Commit 88910638717dd195cff1dd1ea74772b159632bba

Authored by Linus Torvalds

Merge tag 'staging-3.18-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging/IIO driver fixes from Greg KH:
 "Here are some staging and IIO driver fixes for 3.18-rc7 that resolve a
  number of reported issues, and a new device id for a staging wireless
  driver.

  All of these have been in linux-next"

* tag 'staging-3.18-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
  staging: r8188eu: Add new device ID for DLink GO-USB-N150
  staging: r8188eu: Fix scheduling while atomic error introduced in commit fadbe0cd
  iio: accel: bmc150: set low default thresholds
  iio: accel: bmc150: Fix iio_event_spec direction
  iio: accel: bmc150: Send x, y and z motion separately
  iio: accel: bmc150: Error handling when mode set fails
  iio: gyro: bmg160: Fix iio_event_spec direction
  iio: gyro: bmg160: Send x, y and z motion separately
  iio: gyro: bmg160: Don't let interrupt mode to be open drain
  iio: gyro: bmg160: Error handling when mode set fails
  iio: adc: men_z188_adc: Add terminating entry for men_z188_ids
  iio: accel: kxcjk-1013: Fix kxcjk10013_set_range
  iio: Fix IIO_EVENT_CODE_EXTRACT_DIR bit mask

Showing 9 changed files Side-by-side Diff

drivers/iio/accel/bmc150-accel.c
... ... @@ -44,6 +44,9 @@
44 44  
45 45 #define BMC150_ACCEL_REG_INT_STATUS_2 0x0B
46 46 #define BMC150_ACCEL_ANY_MOTION_MASK 0x07
  47 +#define BMC150_ACCEL_ANY_MOTION_BIT_X BIT(0)
  48 +#define BMC150_ACCEL_ANY_MOTION_BIT_Y BIT(1)
  49 +#define BMC150_ACCEL_ANY_MOTION_BIT_Z BIT(2)
47 50 #define BMC150_ACCEL_ANY_MOTION_BIT_SIGN BIT(3)
48 51  
49 52 #define BMC150_ACCEL_REG_PMU_LPW 0x11
50 53  
... ... @@ -92,9 +95,9 @@
92 95 #define BMC150_ACCEL_SLOPE_THRES_MASK 0xFF
93 96  
94 97 /* Slope duration in terms of number of samples */
95   -#define BMC150_ACCEL_DEF_SLOPE_DURATION 2
  98 +#define BMC150_ACCEL_DEF_SLOPE_DURATION 1
96 99 /* in terms of multiples of g's/LSB, based on range */
97   -#define BMC150_ACCEL_DEF_SLOPE_THRESHOLD 5
  100 +#define BMC150_ACCEL_DEF_SLOPE_THRESHOLD 1
98 101  
99 102 #define BMC150_ACCEL_REG_XOUT_L 0x02
100 103  
... ... @@ -536,6 +539,9 @@
536 539 if (ret < 0) {
537 540 dev_err(&data->client->dev,
538 541 "Failed: bmc150_accel_set_power_state for %d\n", on);
  542 + if (on)
  543 + pm_runtime_put_noidle(&data->client->dev);
  544 +
539 545 return ret;
540 546 }
541 547  
... ... @@ -811,6 +817,7 @@
811 817  
812 818 ret = bmc150_accel_setup_any_motion_interrupt(data, state);
813 819 if (ret < 0) {
  820 + bmc150_accel_set_power_state(data, false);
814 821 mutex_unlock(&data->mutex);
815 822 return ret;
816 823 }
... ... @@ -846,7 +853,7 @@
846 853  
847 854 static const struct iio_event_spec bmc150_accel_event = {
848 855 .type = IIO_EV_TYPE_ROC,
849   - .dir = IIO_EV_DIR_RISING | IIO_EV_DIR_FALLING,
  856 + .dir = IIO_EV_DIR_EITHER,
850 857 .mask_separate = BIT(IIO_EV_INFO_VALUE) |
851 858 BIT(IIO_EV_INFO_ENABLE) |
852 859 BIT(IIO_EV_INFO_PERIOD)
... ... @@ -1054,6 +1061,7 @@
1054 1061 else
1055 1062 ret = bmc150_accel_setup_new_data_interrupt(data, state);
1056 1063 if (ret < 0) {
  1064 + bmc150_accel_set_power_state(data, false);
1057 1065 mutex_unlock(&data->mutex);
1058 1066 return ret;
1059 1067 }
1060 1068  
1061 1069  
1062 1070  
... ... @@ -1092,13 +1100,27 @@
1092 1100 else
1093 1101 dir = IIO_EV_DIR_RISING;
1094 1102  
1095   - if (ret & BMC150_ACCEL_ANY_MOTION_MASK)
  1103 + if (ret & BMC150_ACCEL_ANY_MOTION_BIT_X)
1096 1104 iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ACCEL,
1097 1105 0,
1098   - IIO_MOD_X_OR_Y_OR_Z,
  1106 + IIO_MOD_X,
1099 1107 IIO_EV_TYPE_ROC,
1100   - IIO_EV_DIR_EITHER),
  1108 + dir),
1101 1109 data->timestamp);
  1110 + if (ret & BMC150_ACCEL_ANY_MOTION_BIT_Y)
  1111 + iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ACCEL,
  1112 + 0,
  1113 + IIO_MOD_Y,
  1114 + IIO_EV_TYPE_ROC,
  1115 + dir),
  1116 + data->timestamp);
  1117 + if (ret & BMC150_ACCEL_ANY_MOTION_BIT_Z)
  1118 + iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ACCEL,
  1119 + 0,
  1120 + IIO_MOD_Z,
  1121 + IIO_EV_TYPE_ROC,
  1122 + dir),
  1123 + data->timestamp);
1102 1124 ack_intr_status:
1103 1125 if (!data->dready_trigger_on)
1104 1126 ret = i2c_smbus_write_byte_data(data->client,
1105 1127  
1106 1128  
... ... @@ -1354,10 +1376,14 @@
1354 1376 {
1355 1377 struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
1356 1378 struct bmc150_accel_data *data = iio_priv(indio_dev);
  1379 + int ret;
1357 1380  
1358 1381 dev_dbg(&data->client->dev, __func__);
  1382 + ret = bmc150_accel_set_mode(data, BMC150_ACCEL_SLEEP_MODE_SUSPEND, 0);
  1383 + if (ret < 0)
  1384 + return -EAGAIN;
1359 1385  
1360   - return bmc150_accel_set_mode(data, BMC150_ACCEL_SLEEP_MODE_SUSPEND, 0);
  1386 + return 0;
1361 1387 }
1362 1388  
1363 1389 static int bmc150_accel_runtime_resume(struct device *dev)
drivers/iio/accel/kxcjk-1013.c
... ... @@ -269,6 +269,8 @@
269 269 return ret;
270 270 }
271 271  
  272 + ret &= ~(KXCJK1013_REG_CTRL1_BIT_GSEL0 |
  273 + KXCJK1013_REG_CTRL1_BIT_GSEL1);
272 274 ret |= (KXCJK1013_scale_table[range_index].gsel_0 << 3);
273 275 ret |= (KXCJK1013_scale_table[range_index].gsel_1 << 4);
274 276  
drivers/iio/adc/men_z188_adc.c
... ... @@ -152,6 +152,7 @@
152 152  
153 153 static const struct mcb_device_id men_z188_ids[] = {
154 154 { .device = 0xbc },
  155 + { }
155 156 };
156 157 MODULE_DEVICE_TABLE(mcb, men_z188_ids);
157 158  
drivers/iio/gyro/bmg160.c
... ... @@ -67,6 +67,9 @@
67 67 #define BMG160_REG_INT_EN_0 0x15
68 68 #define BMG160_DATA_ENABLE_INT BIT(7)
69 69  
  70 +#define BMG160_REG_INT_EN_1 0x16
  71 +#define BMG160_INT1_BIT_OD BIT(1)
  72 +
70 73 #define BMG160_REG_XOUT_L 0x02
71 74 #define BMG160_AXIS_TO_REG(axis) (BMG160_REG_XOUT_L + (axis * 2))
72 75  
... ... @@ -82,6 +85,9 @@
82 85  
83 86 #define BMG160_REG_INT_STATUS_2 0x0B
84 87 #define BMG160_ANY_MOTION_MASK 0x07
  88 +#define BMG160_ANY_MOTION_BIT_X BIT(0)
  89 +#define BMG160_ANY_MOTION_BIT_Y BIT(1)
  90 +#define BMG160_ANY_MOTION_BIT_Z BIT(2)
85 91  
86 92 #define BMG160_REG_TEMP 0x08
87 93 #define BMG160_TEMP_CENTER_VAL 23
88 94  
... ... @@ -222,7 +228,20 @@
222 228 data->slope_thres = ret;
223 229  
224 230 /* Set default interrupt mode */
  231 + ret = i2c_smbus_read_byte_data(data->client, BMG160_REG_INT_EN_1);
  232 + if (ret < 0) {
  233 + dev_err(&data->client->dev, "Error reading reg_int_en_1\n");
  234 + return ret;
  235 + }
  236 + ret &= ~BMG160_INT1_BIT_OD;
225 237 ret = i2c_smbus_write_byte_data(data->client,
  238 + BMG160_REG_INT_EN_1, ret);
  239 + if (ret < 0) {
  240 + dev_err(&data->client->dev, "Error writing reg_int_en_1\n");
  241 + return ret;
  242 + }
  243 +
  244 + ret = i2c_smbus_write_byte_data(data->client,
226 245 BMG160_REG_INT_RST_LATCH,
227 246 BMG160_INT_MODE_LATCH_INT |
228 247 BMG160_INT_MODE_LATCH_RESET);
... ... @@ -250,6 +269,9 @@
250 269 if (ret < 0) {
251 270 dev_err(&data->client->dev,
252 271 "Failed: bmg160_set_power_state for %d\n", on);
  272 + if (on)
  273 + pm_runtime_put_noidle(&data->client->dev);
  274 +
253 275 return ret;
254 276 }
255 277 #endif
... ... @@ -705,6 +727,7 @@
705 727  
706 728 ret = bmg160_setup_any_motion_interrupt(data, state);
707 729 if (ret < 0) {
  730 + bmg160_set_power_state(data, false);
708 731 mutex_unlock(&data->mutex);
709 732 return ret;
710 733 }
... ... @@ -743,7 +766,7 @@
743 766  
744 767 static const struct iio_event_spec bmg160_event = {
745 768 .type = IIO_EV_TYPE_ROC,
746   - .dir = IIO_EV_DIR_RISING | IIO_EV_DIR_FALLING,
  769 + .dir = IIO_EV_DIR_EITHER,
747 770 .mask_shared_by_type = BIT(IIO_EV_INFO_VALUE) |
748 771 BIT(IIO_EV_INFO_ENABLE)
749 772 };
... ... @@ -871,6 +894,7 @@
871 894 else
872 895 ret = bmg160_setup_new_data_interrupt(data, state);
873 896 if (ret < 0) {
  897 + bmg160_set_power_state(data, false);
874 898 mutex_unlock(&data->mutex);
875 899 return ret;
876 900 }
877 901  
878 902  
... ... @@ -908,13 +932,27 @@
908 932 else
909 933 dir = IIO_EV_DIR_FALLING;
910 934  
911   - if (ret & BMG160_ANY_MOTION_MASK)
  935 + if (ret & BMG160_ANY_MOTION_BIT_X)
912 936 iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ANGL_VEL,
913 937 0,
914   - IIO_MOD_X_OR_Y_OR_Z,
  938 + IIO_MOD_X,
915 939 IIO_EV_TYPE_ROC,
916 940 dir),
917 941 data->timestamp);
  942 + if (ret & BMG160_ANY_MOTION_BIT_Y)
  943 + iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ANGL_VEL,
  944 + 0,
  945 + IIO_MOD_Y,
  946 + IIO_EV_TYPE_ROC,
  947 + dir),
  948 + data->timestamp);
  949 + if (ret & BMG160_ANY_MOTION_BIT_Z)
  950 + iio_push_event(indio_dev, IIO_MOD_EVENT_CODE(IIO_ANGL_VEL,
  951 + 0,
  952 + IIO_MOD_Z,
  953 + IIO_EV_TYPE_ROC,
  954 + dir),
  955 + data->timestamp);
918 956  
919 957 ack_intr_status:
920 958 if (!data->dready_trigger_on) {
921 959  
... ... @@ -1169,8 +1207,15 @@
1169 1207 {
1170 1208 struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
1171 1209 struct bmg160_data *data = iio_priv(indio_dev);
  1210 + int ret;
1172 1211  
1173   - return bmg160_set_mode(data, BMG160_MODE_SUSPEND);
  1212 + ret = bmg160_set_mode(data, BMG160_MODE_SUSPEND);
  1213 + if (ret < 0) {
  1214 + dev_err(&data->client->dev, "set mode failed\n");
  1215 + return -EAGAIN;
  1216 + }
  1217 +
  1218 + return 0;
1174 1219 }
1175 1220  
1176 1221 static int bmg160_runtime_resume(struct device *dev)
drivers/staging/rtl8188eu/core/rtw_cmd.c
... ... @@ -275,11 +275,11 @@
275 275 if (check_fwstate(pmlmepriv, _FW_LINKED) == true)
276 276 rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SCAN, 1);
277 277  
278   - ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
  278 + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
279 279 if (ph2c == NULL)
280 280 return _FAIL;
281 281  
282   - psurveyPara = kzalloc(sizeof(struct sitesurvey_parm), GFP_KERNEL);
  282 + psurveyPara = kzalloc(sizeof(struct sitesurvey_parm), GFP_ATOMIC);
283 283 if (psurveyPara == NULL) {
284 284 kfree(ph2c);
285 285 return _FAIL;
... ... @@ -405,7 +405,7 @@
405 405 else
406 406 RT_TRACE(_module_rtl871x_cmd_c_, _drv_notice_, ("+Join cmd: SSid =[%s]\n", pmlmepriv->assoc_ssid.Ssid));
407 407  
408   - pcmd = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
  408 + pcmd = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
409 409 if (pcmd == NULL) {
410 410 res = _FAIL;
411 411 RT_TRACE(_module_rtl871x_cmd_c_, _drv_err_, ("rtw_joinbss_cmd: memory allocate for cmd_obj fail!!!\n"));
412 412  
... ... @@ -755,13 +755,13 @@
755 755 u8 res = _SUCCESS;
756 756  
757 757  
758   - ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
  758 + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
759 759 if (ph2c == NULL) {
760 760 res = _FAIL;
761 761 goto exit;
762 762 }
763 763  
764   - pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_KERNEL);
  764 + pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC);
765 765 if (pdrvextra_cmd_parm == NULL) {
766 766 kfree(ph2c);
767 767 res = _FAIL;
768 768  
... ... @@ -967,13 +967,13 @@
967 967 u8 res = _SUCCESS;
968 968  
969 969 if (enqueue) {
970   - ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
  970 + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
971 971 if (ph2c == NULL) {
972 972 res = _FAIL;
973 973 goto exit;
974 974 }
975 975  
976   - pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_KERNEL);
  976 + pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC);
977 977 if (pdrvextra_cmd_parm == NULL) {
978 978 kfree(ph2c);
979 979 res = _FAIL;
980 980  
... ... @@ -1010,13 +1010,13 @@
1010 1010  
1011 1011 u8 res = _SUCCESS;
1012 1012  
1013   - ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
  1013 + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
1014 1014 if (ph2c == NULL) {
1015 1015 res = _FAIL;
1016 1016 goto exit;
1017 1017 }
1018 1018  
1019   - pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_KERNEL);
  1019 + pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC);
1020 1020 if (pdrvextra_cmd_parm == NULL) {
1021 1021 kfree(ph2c);
1022 1022 res = _FAIL;
1023 1023  
... ... @@ -1088,13 +1088,13 @@
1088 1088  
1089 1089 u8 res = _SUCCESS;
1090 1090  
1091   - ppscmd = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
  1091 + ppscmd = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
1092 1092 if (ppscmd == NULL) {
1093 1093 res = _FAIL;
1094 1094 goto exit;
1095 1095 }
1096 1096  
1097   - pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_KERNEL);
  1097 + pdrvextra_cmd_parm = kzalloc(sizeof(struct drvextra_cmd_parm), GFP_ATOMIC);
1098 1098 if (pdrvextra_cmd_parm == NULL) {
1099 1099 kfree(ppscmd);
1100 1100 res = _FAIL;
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
... ... @@ -4241,12 +4241,12 @@
4241 4241 pcmdpriv = &padapter->cmdpriv;
4242 4242  
4243 4243  
4244   - pcmd_obj = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
  4244 + pcmd_obj = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
4245 4245 if (pcmd_obj == NULL)
4246 4246 return;
4247 4247  
4248 4248 cmdsz = (sizeof(struct survey_event) + sizeof(struct C2HEvent_Header));
4249   - pevtcmd = kzalloc(cmdsz, GFP_KERNEL);
  4249 + pevtcmd = kzalloc(cmdsz, GFP_ATOMIC);
4250 4250 if (pevtcmd == NULL) {
4251 4251 kfree(pcmd_obj);
4252 4252 return;
4253 4253  
... ... @@ -4339,12 +4339,12 @@
4339 4339 struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
4340 4340 struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
4341 4341  
4342   - pcmd_obj = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
  4342 + pcmd_obj = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
4343 4343 if (pcmd_obj == NULL)
4344 4344 return;
4345 4345  
4346 4346 cmdsz = (sizeof(struct joinbss_event) + sizeof(struct C2HEvent_Header));
4347   - pevtcmd = kzalloc(cmdsz, GFP_KERNEL);
  4347 + pevtcmd = kzalloc(cmdsz, GFP_ATOMIC);
4348 4348 if (pevtcmd == NULL) {
4349 4349 kfree(pcmd_obj);
4350 4350 return;
4351 4351  
... ... @@ -4854,11 +4854,11 @@
4854 4854 pmlmeext->scan_abort = false;/* reset */
4855 4855 }
4856 4856  
4857   - ph2c = kzalloc(sizeof(struct cmd_obj), GFP_KERNEL);
  4857 + ph2c = kzalloc(sizeof(struct cmd_obj), GFP_ATOMIC);
4858 4858 if (ph2c == NULL)
4859 4859 goto exit_survey_timer_hdl;
4860 4860  
4861   - psurveyPara = kzalloc(sizeof(struct sitesurvey_parm), GFP_KERNEL);
  4861 + psurveyPara = kzalloc(sizeof(struct sitesurvey_parm), GFP_ATOMIC);
4862 4862 if (psurveyPara == NULL) {
4863 4863 kfree(ph2c);
4864 4864 goto exit_survey_timer_hdl;
drivers/staging/rtl8188eu/core/rtw_wlan_util.c
... ... @@ -935,7 +935,7 @@
935 935 return true;
936 936 }
937 937  
938   - bssid = kzalloc(sizeof(struct wlan_bssid_ex), GFP_KERNEL);
  938 + bssid = kzalloc(sizeof(struct wlan_bssid_ex), GFP_ATOMIC);
939 939  
940 940 subtype = GetFrameSubType(pframe) >> 4;
941 941  
drivers/staging/rtl8188eu/os_dep/usb_intf.c
... ... @@ -47,6 +47,7 @@
47 47 {USB_DEVICE(0x07b8, 0x8179)}, /* Abocom - Abocom */
48 48 {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */
49 49 {USB_DEVICE(0x2001, 0x3310)}, /* Dlink DWA-123 REV D1 */
  50 + {USB_DEVICE(0x2001, 0x3311)}, /* DLink GO-USB-N150 REV B1 */
50 51 {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */
51 52 {} /* Terminating entry */
52 53 };
include/linux/iio/events.h
... ... @@ -72,7 +72,7 @@
72 72  
73 73 #define IIO_EVENT_CODE_EXTRACT_TYPE(mask) ((mask >> 56) & 0xFF)
74 74  
75   -#define IIO_EVENT_CODE_EXTRACT_DIR(mask) ((mask >> 48) & 0xCF)
  75 +#define IIO_EVENT_CODE_EXTRACT_DIR(mask) ((mask >> 48) & 0x7F)
76 76  
77 77 #define IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(mask) ((mask >> 32) & 0xFF)
78 78