Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.

+48 -18
+2 -4
Documentation/ABI/testing/sysfs-bus-iio
··· 1234 1234 object is near the sensor, usually be observing 1235 1235 reflectivity of infrared or ultrasound emitted. 1236 1236 Often these sensors are unit less and as such conversion 1237 - to SI units is not possible. Where it is, the units should 1238 - be meters. If such a conversion is not possible, the reported 1239 - values should behave in the same way as a distance, i.e. lower 1240 - values indicate something is closer to the sensor. 1237 + to SI units is not possible. Higher proximity measurements 1238 + indicate closer objects, and vice versa. 1241 1239 1242 1240 What: /sys/.../iio:deviceX/in_illuminance_input 1243 1241 What: /sys/.../iio:deviceX/in_illuminance_raw
+1 -1
drivers/iio/accel/bmc150-accel.c
··· 1464 1464 { 1465 1465 int i; 1466 1466 1467 - for (i = from; i >= 0; i++) { 1467 + for (i = from; i >= 0; i--) { 1468 1468 if (data->triggers[i].indio_trig) { 1469 1469 iio_trigger_unregister(data->triggers[i].indio_trig); 1470 1470 data->triggers[i].indio_trig = NULL;
+1 -2
drivers/iio/adc/Kconfig
··· 153 153 154 154 config CC10001_ADC 155 155 tristate "Cosmic Circuits 10001 ADC driver" 156 - depends on HAVE_CLK || REGULATOR 157 - depends on HAS_IOMEM 156 + depends on HAS_IOMEM && HAVE_CLK && REGULATOR 158 157 select IIO_BUFFER 159 158 select IIO_TRIGGERED_BUFFER 160 159 help
+4 -4
drivers/iio/adc/at91_adc.c
··· 182 182 u8 ts_pen_detect_sensitivity; 183 183 184 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 187 u8 num_channels; 188 188 struct at91_adc_reg_desc registers; ··· 201 201 u8 num_channels; 202 202 void __iomem *reg_base; 203 203 struct at91_adc_reg_desc *registers; 204 - u8 startup_time; 204 + u32 startup_time; 205 205 u8 sample_hold_time; 206 206 bool sleep_mode; 207 207 struct iio_trigger **trig; ··· 779 779 return ret; 780 780 } 781 781 782 - static u32 calc_startup_ticks_9260(u8 startup_time, u32 adc_clk_khz) 782 + static u32 calc_startup_ticks_9260(u32 startup_time, u32 adc_clk_khz) 783 783 { 784 784 /* 785 785 * Number of ticks needed to cover the startup time of the ADC ··· 790 790 return round_up((startup_time * adc_clk_khz / 1000) - 1, 8) / 8; 791 791 } 792 792 793 - static u32 calc_startup_ticks_9x5(u8 startup_time, u32 adc_clk_khz) 793 + static u32 calc_startup_ticks_9x5(u32 startup_time, u32 adc_clk_khz) 794 794 { 795 795 /* 796 796 * For sama5d3x and at91sam9x5, the formula changes to:
+4
drivers/iio/adc/rockchip_saradc.c
··· 349 349 }; 350 350 351 351 module_platform_driver(rockchip_saradc_driver); 352 + 353 + MODULE_AUTHOR("Heiko Stuebner <heiko@sntech.de>"); 354 + MODULE_DESCRIPTION("Rockchip SARADC driver"); 355 + MODULE_LICENSE("GPL v2");
+2 -1
drivers/iio/adc/twl4030-madc.c
··· 833 833 irq = platform_get_irq(pdev, 0); 834 834 ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, 835 835 twl4030_madc_threaded_irq_handler, 836 - IRQF_TRIGGER_RISING, "twl4030_madc", madc); 836 + IRQF_TRIGGER_RISING | IRQF_ONESHOT, 837 + "twl4030_madc", madc); 837 838 if (ret) { 838 839 dev_err(&pdev->dev, "could not request irq\n"); 839 840 goto err_i2c;
+10 -1
drivers/iio/common/hid-sensors/hid-sensor-trigger.c
··· 36 36 s32 poll_value = 0; 37 37 38 38 if (state) { 39 + if (!atomic_read(&st->user_requested_state)) 40 + return 0; 39 41 if (sensor_hub_device_open(st->hsdev)) 40 42 return -EIO; 41 43 ··· 54 52 55 53 poll_value = hid_sensor_read_poll_value(st); 56 54 } else { 57 - if (!atomic_dec_and_test(&st->data_ready)) 55 + int val; 56 + 57 + val = atomic_dec_if_positive(&st->data_ready); 58 + if (val < 0) 58 59 return 0; 60 + 59 61 sensor_hub_device_close(st->hsdev); 60 62 state_val = hid_sensor_get_usage_index(st->hsdev, 61 63 st->power_state.report_id, ··· 98 92 99 93 int hid_sensor_power_state(struct hid_sensor_common *st, bool state) 100 94 { 95 + 101 96 #ifdef CONFIG_PM 102 97 int ret; 103 98 99 + atomic_set(&st->user_requested_state, state); 104 100 if (state) 105 101 ret = pm_runtime_get_sync(&st->pdev->dev); 106 102 else { ··· 117 109 118 110 return 0; 119 111 #else 112 + atomic_set(&st->user_requested_state, state); 120 113 return _hid_sensor_power_state(st, state); 121 114 #endif 122 115 }
+2 -2
drivers/iio/dac/ad5624r_spi.c
··· 22 22 #include "ad5624r.h" 23 23 24 24 static 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 27 u32 data; 28 28 u8 msg[3]; ··· 35 35 * 14-, 12-bit input code followed by 0, 2, or 4 don't care bits, 36 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 39 msg[0] = data >> 16; 40 40 msg[1] = data >> 8; 41 41 msg[2] = data;
+18
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
··· 431 431 return -EINVAL; 432 432 } 433 433 434 + static 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 + } 434 451 static int inv_mpu6050_write_accel_scale(struct inv_mpu6050_state *st, int val) 435 452 { 436 453 int result, i; ··· 713 696 .driver_module = THIS_MODULE, 714 697 .read_raw = &inv_mpu6050_read_raw, 715 698 .write_raw = &inv_mpu6050_write_raw, 699 + .write_raw_get_fmt = &inv_write_raw_get_fmt, 716 700 .attrs = &inv_attribute_group, 717 701 .validate_trigger = inv_mpu6050_validate_trigger, 718 702 };
+1 -1
drivers/iio/light/cm3323.c
··· 123 123 for (i = 0; i < ARRAY_SIZE(cm3323_int_time); i++) { 124 124 if (val == cm3323_int_time[i].val && 125 125 val2 == cm3323_int_time[i].val2) { 126 - reg_conf = data->reg_conf; 126 + reg_conf = data->reg_conf & ~CM3323_CONF_IT_MASK; 127 127 reg_conf |= i << CM3323_CONF_IT_SHIFT; 128 128 129 129 ret = i2c_smbus_write_word_data(data->client,
+1 -1
drivers/iio/light/tcs3414.c
··· 185 185 if (val != 0) 186 186 return -EINVAL; 187 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 189 data->timing &= ~TCS3414_INTEG_MASK; 190 190 data->timing |= i; 191 191 return i2c_smbus_write_byte_data(
+1 -1
drivers/iio/proximity/sx9500.c
··· 281 281 if (ret < 0) 282 282 return ret; 283 283 284 - *val = 32767 - (s16)be16_to_cpu(regval); 284 + *val = be16_to_cpu(regval); 285 285 286 286 return IIO_VAL_INT; 287 287 }
+1
include/linux/hid-sensor-hub.h
··· 230 230 struct platform_device *pdev; 231 231 unsigned usage_id; 232 232 atomic_t data_ready; 233 + atomic_t user_requested_state; 233 234 struct iio_trigger *trigger; 234 235 struct hid_sensor_hub_attribute_info poll; 235 236 struct hid_sensor_hub_attribute_info report_state;