History

Merge tag 'iio-fixes-for-4.2a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus

Jonathan writes: First set of IIO fixes for the 4.2 cycle. * Fix a regression in hid sensors suspend time as a result of adding runtime pm. The normal flow of waking up devices in order to go into suspend (given the devices are normally suspended when not reading) to a regression in suspend time on some laptops (reports of an additional 8 seconds). Fix this by checking to see if a user action resulting in the wake up, and make it a null operation if it didn't. Note that for hid sensors, there is nothing useful to be done when moving into a full suspend from a runtime suspend so they might as well be left alone. * rochip_saradc: fix some missing MODULE_* data including the licence so that the driver does not taint the kernel incorrectly and can build as a module. * twl4030 - mark irq as oneshot as it always should have been. * inv-mpu - write formats for attributes not specified, leading to miss interpretation of the gyro scale channel when written. * Proximity ABI clarification. This had snuck through as a mess. Some drivers thought proximity went in one direction, some the other. We went with the most common option, documented it and fixed up the drivers going the other way. Fix for sx9500 included in this set. * ad624r - fix a wrong shift in the output data. * at91_adc - remove a false limit on the value of the STARTUP register applied by too small a type for the device tree parameter. * cm3323 - clear the bits when setting the integration time (otherwise we can only ever set more bits in the relevant field). * bmc150-accel - multiple triggers are registered, but on error were not being unwound in the opposite order leading to removal of triggers that had not yet successfully been registered (count down instead of up when unwinding). * tcs3414 - ensure right part of val / val2 pair read so that the integration time is not always 0. * cc10001_adc - bug in kconfig dependency. Use of OR when AND was intended.

Greg Kroah-Hartman committed 11 years ago

Commit a732cd42 parents cbe4f44 b2b3c3d13 files · +48 −18Browse files

Unified · Split

13 files
  1. Documentation/ABI/testing/sysfs-bus-iio +2 −4
  2. drivers/iio/accel/bmc150-accel.c +1 −1
  3. drivers/iio/adc/Kconfig +1 −2
  4. drivers/iio/adc/at91_adc.c +4 −4
  5. drivers/iio/adc/rockchip_saradc.c +4 −0
  6. drivers/iio/adc/twl4030-madc.c +2 −1
  7. drivers/iio/common/hid-sensors/hid-sensor-trigger.c +10 −1
  8. drivers/iio/dac/ad5624r_spi.c +2 −2
  9. drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +18 −0
  10. drivers/iio/light/cm3323.c +1 −1
  11. drivers/iio/light/tcs3414.c +1 −1
  12. drivers/iio/proximity/sx9500.c +1 −1
  13. include/linux/hid-sensor-hub.h +1 −0
Documentation/ABI/testing/sysfs-bus-iio+2−4
@@ -1234,10 +1234,8 @@ Description: · 1233 unmodified lines
1234 object is near the sensor, usually be observing1234 object is near the sensor, usually be observing
1235 reflectivity of infrared or ultrasound emitted.1235 reflectivity of infrared or ultrasound emitted.
1236 Often these sensors are unit less and as such conversion1236 Often these sensors are unit less and as such conversion
1237 to SI units is not possible. Where it is, the units should1237 to SI units is not possible. Higher proximity measurements
1238 be meters. If such a conversion is not possible, the reported1238 indicate closer objects, and vice versa.
1239 values should behave in the same way as a distance, i.e. lower
1240 values indicate something is closer to the sensor.
1241 1239
1242What: /sys/.../iio:deviceX/in_illuminance_input1240What: /sys/.../iio:deviceX/in_illuminance_input
1243What: /sys/.../iio:deviceX/in_illuminance_raw1241What: /sys/.../iio:deviceX/in_illuminance_raw
drivers/iio/accel/bmc150-accel.c+1−1
@@ -1464,7 +1464,7 @@ static void bmc150_accel_unregister_triggers(struct bmc150_accel_data *data, · 1463 unmodified lines
1464{1464{
1465 int i;1465 int i;
1466 1466
1467 for (i = from; i >= 0; i++) {1467 for (i = from; i >= 0; i--) {
1468 if (data->triggers[i].indio_trig) {1468 if (data->triggers[i].indio_trig) {
1469 iio_trigger_unregister(data->triggers[i].indio_trig);1469 iio_trigger_unregister(data->triggers[i].indio_trig);
1470 data->triggers[i].indio_trig = NULL;1470 data->triggers[i].indio_trig = NULL;
drivers/iio/adc/Kconfig+1−2
@@ -153,8 +153,7 @@ config DA9150_GPADC · 152 unmodified lines
153 153
154config CC10001_ADC154config CC10001_ADC
155 tristate "Cosmic Circuits 10001 ADC driver"155 tristate "Cosmic Circuits 10001 ADC driver"
156 depends on HAVE_CLK || REGULATOR156 depends on HAS_IOMEM && HAVE_CLK && REGULATOR
157 depends on HAS_IOMEM
158 select IIO_BUFFER157 select IIO_BUFFER
159 select IIO_TRIGGERED_BUFFER158 select IIO_TRIGGERED_BUFFER
160 help159 help
drivers/iio/adc/at91_adc.c+4−4
@@ -182,7 +182,7 @@ struct at91_adc_caps { · 181 unmodified lines
182 u8 ts_pen_detect_sensitivity;182 u8 ts_pen_detect_sensitivity;
183 183
184 /* startup time calculate function */184 /* startup time calculate function */
185 u32 (*calc_startup_ticks)(u8 startup_time, u32 adc_clk_khz);185 u32 (*calc_startup_ticks)(u32 startup_time, u32 adc_clk_khz);
186 186
187 u8 num_channels;187 u8 num_channels;
188 struct at91_adc_reg_desc registers;188 struct at91_adc_reg_desc registers;
@@ -201,7 +201,7 @@ struct at91_adc_state { · 12 unmodified lines
201 u8 num_channels;201 u8 num_channels;
202 void __iomem *reg_base;202 void __iomem *reg_base;
203 struct at91_adc_reg_desc *registers;203 struct at91_adc_reg_desc *registers;
204 u8 startup_time;204 u32 startup_time;
205 u8 sample_hold_time;205 u8 sample_hold_time;
206 bool sleep_mode;206 bool sleep_mode;
207 struct iio_trigger **trig;207 struct iio_trigger **trig;
@@ -779,7 +779,7 @@ ret: · 571 unmodified lines
779 return ret;779 return ret;
780}780}
781 781
782static u32 calc_startup_ticks_9260(u8 startup_time, u32 adc_clk_khz)782static u32 calc_startup_ticks_9260(u32 startup_time, u32 adc_clk_khz)
783{783{
784 /*784 /*
785 * Number of ticks needed to cover the startup time of the ADC785 * Number of ticks needed to cover the startup time of the ADC
@@ -790,7 +790,7 @@ static u32 calc_startup_ticks_9260(u8 startup_time, u32 adc_clk_khz) · 4 unmodified lines
790 return round_up((startup_time * adc_clk_khz / 1000) - 1, 8) / 8;790 return round_up((startup_time * adc_clk_khz / 1000) - 1, 8) / 8;
791}791}
792 792
793static u32 calc_startup_ticks_9x5(u8 startup_time, u32 adc_clk_khz)793static u32 calc_startup_ticks_9x5(u32 startup_time, u32 adc_clk_khz)
794{794{
795 /*795 /*
796 * For sama5d3x and at91sam9x5, the formula changes to:796 * For sama5d3x and at91sam9x5, the formula changes to:
drivers/iio/adc/rockchip_saradc.c+4−0
@@ -349,3 +349,7 @@ static struct platform_driver rockchip_saradc_driver = { · 348 unmodified lines
349};349};
350 350
351module_platform_driver(rockchip_saradc_driver);351module_platform_driver(rockchip_saradc_driver);
352
353MODULE_AUTHOR("Heiko Stuebner <heiko@sntech.de>");
354MODULE_DESCRIPTION("Rockchip SARADC driver");
355MODULE_LICENSE("GPL v2");
drivers/iio/adc/twl4030-madc.c+2−1
@@ -833,7 +833,8 @@ static int twl4030_madc_probe(struct platform_device *pdev) · 832 unmodified lines
833 irq = platform_get_irq(pdev, 0);833 irq = platform_get_irq(pdev, 0);
834 ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,834 ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
835 twl4030_madc_threaded_irq_handler,835 twl4030_madc_threaded_irq_handler,
836 IRQF_TRIGGER_RISING, "twl4030_madc", madc);836 IRQF_TRIGGER_RISING | IRQF_ONESHOT,
837 "twl4030_madc", madc);
837 if (ret) {838 if (ret) {
838 dev_err(&pdev->dev, "could not request irq\n");839 dev_err(&pdev->dev, "could not request irq\n");
839 goto err_i2c;840 goto err_i2c;
drivers/iio/common/hid-sensors/hid-sensor-trigger.c+10−1
@@ -36,6 +36,8 @@ static int _hid_sensor_power_state(struct hid_sensor_common *st, bool state) · 35 unmodified lines
36 s32 poll_value = 0;36 s32 poll_value = 0;
37 37
38 if (state) {38 if (state) {
39 if (!atomic_read(&st->user_requested_state))
40 return 0;
39 if (sensor_hub_device_open(st->hsdev))41 if (sensor_hub_device_open(st->hsdev))
40 return -EIO;42 return -EIO;
41 43
@@ -52,8 +54,12 @@ static int _hid_sensor_power_state(struct hid_sensor_common *st, bool state) · 10 unmodified lines
52 54
53 poll_value = hid_sensor_read_poll_value(st);55 poll_value = hid_sensor_read_poll_value(st);
54 } else {56 } else {
55 if (!atomic_dec_and_test(&st->data_ready))57 int val;
58
59 val = atomic_dec_if_positive(&st->data_ready);
60 if (val < 0)
56 return 0;61 return 0;
62
57 sensor_hub_device_close(st->hsdev);63 sensor_hub_device_close(st->hsdev);
58 state_val = hid_sensor_get_usage_index(st->hsdev,64 state_val = hid_sensor_get_usage_index(st->hsdev,
59 st->power_state.report_id,65 st->power_state.report_id,
@@ -92,9 +98,11 @@ EXPORT_SYMBOL(hid_sensor_power_state); · 32 unmodified lines
92 98
93int hid_sensor_power_state(struct hid_sensor_common *st, bool state)99int hid_sensor_power_state(struct hid_sensor_common *st, bool state)
94{100{
101
95#ifdef CONFIG_PM102#ifdef CONFIG_PM
96 int ret;103 int ret;
97 104
105 atomic_set(&st->user_requested_state, state);
98 if (state)106 if (state)
99 ret = pm_runtime_get_sync(&st->pdev->dev);107 ret = pm_runtime_get_sync(&st->pdev->dev);
100 else {108 else {
@@ -109,6 +117,7 @@ int hid_sensor_power_state(struct hid_sensor_common *st, bool state) · 8 unmodified lines
109 117
110 return 0;118 return 0;
111#else119#else
120 atomic_set(&st->user_requested_state, state);
112 return _hid_sensor_power_state(st, state);121 return _hid_sensor_power_state(st, state);
113#endif122#endif
114}123}
drivers/iio/dac/ad5624r_spi.c+2−2
@@ -22,7 +22,7 @@ · 21 unmodified lines
22#include "ad5624r.h"22#include "ad5624r.h"
23 23
24static int ad5624r_spi_write(struct spi_device *spi,24static int ad5624r_spi_write(struct spi_device *spi,
25 u8 cmd, u8 addr, u16 val, u8 len)25 u8 cmd, u8 addr, u16 val, u8 shift)
26{26{
27 u32 data;27 u32 data;
28 u8 msg[3];28 u8 msg[3];
@@ -35,7 +35,7 @@ static int ad5624r_spi_write(struct spi_device *spi, · 6 unmodified lines
35 * 14-, 12-bit input code followed by 0, 2, or 4 don't care bits,35 * 14-, 12-bit input code followed by 0, 2, or 4 don't care bits,
36 * for the AD5664R, AD5644R, and AD5624R, respectively.36 * for the AD5664R, AD5644R, and AD5624R, respectively.
37 */37 */
38 data = (0 << 22) | (cmd << 19) | (addr << 16) | (val << (16 - len));38 data = (0 << 22) | (cmd << 19) | (addr << 16) | (val << shift);
39 msg[0] = data >> 16;39 msg[0] = data >> 16;
40 msg[1] = data >> 8;40 msg[1] = data >> 8;
41 msg[2] = data;41 msg[2] = data;
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c+18−0
@@ -431,6 +431,23 @@ static int inv_mpu6050_write_gyro_scale(struct inv_mpu6050_state *st, int val) · 430 unmodified lines
431 return -EINVAL;431 return -EINVAL;
432}432}
433 433
434static int inv_write_raw_get_fmt(struct iio_dev *indio_dev,
435 struct iio_chan_spec const *chan, long mask)
436{
437 switch (mask) {
438 case IIO_CHAN_INFO_SCALE:
439 switch (chan->type) {
440 case IIO_ANGL_VEL:
441 return IIO_VAL_INT_PLUS_NANO;
442 default:
443 return IIO_VAL_INT_PLUS_MICRO;
444 }
445 default:
446 return IIO_VAL_INT_PLUS_MICRO;
447 }
448
449 return -EINVAL;
450}
434static int inv_mpu6050_write_accel_scale(struct inv_mpu6050_state *st, int val)451static int inv_mpu6050_write_accel_scale(struct inv_mpu6050_state *st, int val)
435{452{
436 int result, i;453 int result, i;
@@ -696,6 +713,7 @@ static const struct iio_info mpu_info = { · 259 unmodified lines
696 .driver_module = THIS_MODULE,713 .driver_module = THIS_MODULE,
697 .read_raw = &inv_mpu6050_read_raw,714 .read_raw = &inv_mpu6050_read_raw,
698 .write_raw = &inv_mpu6050_write_raw,715 .write_raw = &inv_mpu6050_write_raw,
716 .write_raw_get_fmt = &inv_write_raw_get_fmt,
699 .attrs = &inv_attribute_group,717 .attrs = &inv_attribute_group,
700 .validate_trigger = inv_mpu6050_validate_trigger,718 .validate_trigger = inv_mpu6050_validate_trigger,
701};719};
drivers/iio/light/cm3323.c+1−1
@@ -123,7 +123,7 @@ static int cm3323_set_it_bits(struct cm3323_data *data, int val, int val2) · 122 unmodified lines
123 for (i = 0; i < ARRAY_SIZE(cm3323_int_time); i++) {123 for (i = 0; i < ARRAY_SIZE(cm3323_int_time); i++) {
124 if (val == cm3323_int_time[i].val &&124 if (val == cm3323_int_time[i].val &&
125 val2 == cm3323_int_time[i].val2) {125 val2 == cm3323_int_time[i].val2) {
126 reg_conf = data->reg_conf;126 reg_conf = data->reg_conf & ~CM3323_CONF_IT_MASK;
127 reg_conf |= i << CM3323_CONF_IT_SHIFT;127 reg_conf |= i << CM3323_CONF_IT_SHIFT;
128 128
129 ret = i2c_smbus_write_word_data(data->client,129 ret = i2c_smbus_write_word_data(data->client,
drivers/iio/light/tcs3414.c+1−1
@@ -185,7 +185,7 @@ static int tcs3414_write_raw(struct iio_dev *indio_dev, · 184 unmodified lines
185 if (val != 0)185 if (val != 0)
186 return -EINVAL;186 return -EINVAL;
187 for (i = 0; i < ARRAY_SIZE(tcs3414_times); i++) {187 for (i = 0; i < ARRAY_SIZE(tcs3414_times); i++) {
188 if (val == tcs3414_times[i] * 1000) {188 if (val2 == tcs3414_times[i] * 1000) {
189 data->timing &= ~TCS3414_INTEG_MASK;189 data->timing &= ~TCS3414_INTEG_MASK;
190 data->timing |= i;190 data->timing |= i;
191 return i2c_smbus_write_byte_data(191 return i2c_smbus_write_byte_data(
drivers/iio/proximity/sx9500.c+1−1
@@ -281,7 +281,7 @@ static int sx9500_read_prox_data(struct sx9500_data *data, · 280 unmodified lines
281 if (ret < 0)281 if (ret < 0)
282 return ret;282 return ret;
283 283
284 *val = 32767 - (s16)be16_to_cpu(regval);284 *val = be16_to_cpu(regval);
285 285
286 return IIO_VAL_INT;286 return IIO_VAL_INT;
287}287}
include/linux/hid-sensor-hub.h+1−0
@@ -230,6 +230,7 @@ struct hid_sensor_common { · 229 unmodified lines
230 struct platform_device *pdev;230 struct platform_device *pdev;
231 unsigned usage_id;231 unsigned usage_id;
232 atomic_t data_ready;232 atomic_t data_ready;
233 atomic_t user_requested_state;
233 struct iio_trigger *trigger;234 struct iio_trigger *trigger;
234 struct hid_sensor_hub_attribute_info poll;235 struct hid_sensor_hub_attribute_info poll;
235 struct hid_sensor_hub_attribute_info report_state;236 struct hid_sensor_hub_attribute_info report_state;