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. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAABCAAGBQJVpA2CAAoJEFSFNJnE9BaIJGEP/2uXFSqOZhmJ9sGqICSgKj4W OUjDtpXpKWxLC3Fypzvzg5u00R1t2likfvhXP2RsF5+/mqPb8NS6qzdcKMPCyxEl 5tvsmYHm9yxN8o3ZZqtgYaR4mYt5tH4dFZ9qHpbFeNAXGjTRrYhGbgmLnND0v7cA 5L1ABLls8ntoJ1aZZDsofwnmnUgclW5yqQZZ+huNkwaOpUQLke9tEL18cv+bsVgS zw7j/t3oJVdcUB9OTB7T/sW9J0+W7XnXogATHksHdHh2cd5N7wh/EZ1bet69QUrI PD2q2+0MUwyBMWDPveyWfm7XbS66lYxIRCmWZp+69Q1c/V91srhSPfh0kPcvHSQ1 Uzpba6oSFPlFyDAtXWhaSEBzjXaHwKBIQvIVYOKiE6JdrbsnSg4GHAcF8TMhGtwT SDDgfb+cxOm6Vb4ws0+i15HMEiXpeK8AiJfHmLvau3OnA69/xzxHqqSg/oCO6/ES IzoAMqIVEk3L5gu88qgnmWzmyWp1pyTf1u+Kr+gAXNdSF/b3wgVkGn2X9hNRQ4g/ XEFAD1PzarBnv1ce/HfWi+9/aUwv08nXHxBe4Yx3bfle2RUQKmFSbksVkCwu+ha3 E4jPs5Cf9MrHO4gbuFaZX2+bFYlMdbcEWVRcP/3CHUuxeixGwemOsak1L+J5h6+e 2xVEkGeywVdmDOsan1B8 =mBqw -----END PGP SIGNATURE----- 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.
This commit is contained in:
Коммит
a732cd437b
|
@ -1234,10 +1234,8 @@ Description:
|
|||
object is near the sensor, usually be observing
|
||||
reflectivity of infrared or ultrasound emitted.
|
||||
Often these sensors are unit less and as such conversion
|
||||
to SI units is not possible. Where it is, the units should
|
||||
be meters. If such a conversion is not possible, the reported
|
||||
values should behave in the same way as a distance, i.e. lower
|
||||
values indicate something is closer to the sensor.
|
||||
to SI units is not possible. Higher proximity measurements
|
||||
indicate closer objects, and vice versa.
|
||||
|
||||
What: /sys/.../iio:deviceX/in_illuminance_input
|
||||
What: /sys/.../iio:deviceX/in_illuminance_raw
|
||||
|
|
|
@ -1464,7 +1464,7 @@ static void bmc150_accel_unregister_triggers(struct bmc150_accel_data *data,
|
|||
{
|
||||
int i;
|
||||
|
||||
for (i = from; i >= 0; i++) {
|
||||
for (i = from; i >= 0; i--) {
|
||||
if (data->triggers[i].indio_trig) {
|
||||
iio_trigger_unregister(data->triggers[i].indio_trig);
|
||||
data->triggers[i].indio_trig = NULL;
|
||||
|
|
|
@ -153,8 +153,7 @@ config DA9150_GPADC
|
|||
|
||||
config CC10001_ADC
|
||||
tristate "Cosmic Circuits 10001 ADC driver"
|
||||
depends on HAVE_CLK || REGULATOR
|
||||
depends on HAS_IOMEM
|
||||
depends on HAS_IOMEM && HAVE_CLK && REGULATOR
|
||||
select IIO_BUFFER
|
||||
select IIO_TRIGGERED_BUFFER
|
||||
help
|
||||
|
|
|
@ -182,7 +182,7 @@ struct at91_adc_caps {
|
|||
u8 ts_pen_detect_sensitivity;
|
||||
|
||||
/* startup time calculate function */
|
||||
u32 (*calc_startup_ticks)(u8 startup_time, u32 adc_clk_khz);
|
||||
u32 (*calc_startup_ticks)(u32 startup_time, u32 adc_clk_khz);
|
||||
|
||||
u8 num_channels;
|
||||
struct at91_adc_reg_desc registers;
|
||||
|
@ -201,7 +201,7 @@ struct at91_adc_state {
|
|||
u8 num_channels;
|
||||
void __iomem *reg_base;
|
||||
struct at91_adc_reg_desc *registers;
|
||||
u8 startup_time;
|
||||
u32 startup_time;
|
||||
u8 sample_hold_time;
|
||||
bool sleep_mode;
|
||||
struct iio_trigger **trig;
|
||||
|
@ -779,7 +779,7 @@ ret:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static u32 calc_startup_ticks_9260(u8 startup_time, u32 adc_clk_khz)
|
||||
static u32 calc_startup_ticks_9260(u32 startup_time, u32 adc_clk_khz)
|
||||
{
|
||||
/*
|
||||
* 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)
|
|||
return round_up((startup_time * adc_clk_khz / 1000) - 1, 8) / 8;
|
||||
}
|
||||
|
||||
static u32 calc_startup_ticks_9x5(u8 startup_time, u32 adc_clk_khz)
|
||||
static u32 calc_startup_ticks_9x5(u32 startup_time, u32 adc_clk_khz)
|
||||
{
|
||||
/*
|
||||
* For sama5d3x and at91sam9x5, the formula changes to:
|
||||
|
|
|
@ -349,3 +349,7 @@ static struct platform_driver rockchip_saradc_driver = {
|
|||
};
|
||||
|
||||
module_platform_driver(rockchip_saradc_driver);
|
||||
|
||||
MODULE_AUTHOR("Heiko Stuebner <heiko@sntech.de>");
|
||||
MODULE_DESCRIPTION("Rockchip SARADC driver");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
|
|
|
@ -833,7 +833,8 @@ static int twl4030_madc_probe(struct platform_device *pdev)
|
|||
irq = platform_get_irq(pdev, 0);
|
||||
ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
|
||||
twl4030_madc_threaded_irq_handler,
|
||||
IRQF_TRIGGER_RISING, "twl4030_madc", madc);
|
||||
IRQF_TRIGGER_RISING | IRQF_ONESHOT,
|
||||
"twl4030_madc", madc);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "could not request irq\n");
|
||||
goto err_i2c;
|
||||
|
|
|
@ -36,6 +36,8 @@ static int _hid_sensor_power_state(struct hid_sensor_common *st, bool state)
|
|||
s32 poll_value = 0;
|
||||
|
||||
if (state) {
|
||||
if (!atomic_read(&st->user_requested_state))
|
||||
return 0;
|
||||
if (sensor_hub_device_open(st->hsdev))
|
||||
return -EIO;
|
||||
|
||||
|
@ -52,8 +54,12 @@ static int _hid_sensor_power_state(struct hid_sensor_common *st, bool state)
|
|||
|
||||
poll_value = hid_sensor_read_poll_value(st);
|
||||
} else {
|
||||
if (!atomic_dec_and_test(&st->data_ready))
|
||||
int val;
|
||||
|
||||
val = atomic_dec_if_positive(&st->data_ready);
|
||||
if (val < 0)
|
||||
return 0;
|
||||
|
||||
sensor_hub_device_close(st->hsdev);
|
||||
state_val = hid_sensor_get_usage_index(st->hsdev,
|
||||
st->power_state.report_id,
|
||||
|
@ -92,9 +98,11 @@ EXPORT_SYMBOL(hid_sensor_power_state);
|
|||
|
||||
int hid_sensor_power_state(struct hid_sensor_common *st, bool state)
|
||||
{
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
int ret;
|
||||
|
||||
atomic_set(&st->user_requested_state, state);
|
||||
if (state)
|
||||
ret = pm_runtime_get_sync(&st->pdev->dev);
|
||||
else {
|
||||
|
@ -109,6 +117,7 @@ int hid_sensor_power_state(struct hid_sensor_common *st, bool state)
|
|||
|
||||
return 0;
|
||||
#else
|
||||
atomic_set(&st->user_requested_state, state);
|
||||
return _hid_sensor_power_state(st, state);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "ad5624r.h"
|
||||
|
||||
static int ad5624r_spi_write(struct spi_device *spi,
|
||||
u8 cmd, u8 addr, u16 val, u8 len)
|
||||
u8 cmd, u8 addr, u16 val, u8 shift)
|
||||
{
|
||||
u32 data;
|
||||
u8 msg[3];
|
||||
|
@ -35,7 +35,7 @@ static int ad5624r_spi_write(struct spi_device *spi,
|
|||
* 14-, 12-bit input code followed by 0, 2, or 4 don't care bits,
|
||||
* for the AD5664R, AD5644R, and AD5624R, respectively.
|
||||
*/
|
||||
data = (0 << 22) | (cmd << 19) | (addr << 16) | (val << (16 - len));
|
||||
data = (0 << 22) | (cmd << 19) | (addr << 16) | (val << shift);
|
||||
msg[0] = data >> 16;
|
||||
msg[1] = data >> 8;
|
||||
msg[2] = data;
|
||||
|
|
|
@ -431,6 +431,23 @@ static int inv_mpu6050_write_gyro_scale(struct inv_mpu6050_state *st, int val)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int inv_write_raw_get_fmt(struct iio_dev *indio_dev,
|
||||
struct iio_chan_spec const *chan, long mask)
|
||||
{
|
||||
switch (mask) {
|
||||
case IIO_CHAN_INFO_SCALE:
|
||||
switch (chan->type) {
|
||||
case IIO_ANGL_VEL:
|
||||
return IIO_VAL_INT_PLUS_NANO;
|
||||
default:
|
||||
return IIO_VAL_INT_PLUS_MICRO;
|
||||
}
|
||||
default:
|
||||
return IIO_VAL_INT_PLUS_MICRO;
|
||||
}
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
static int inv_mpu6050_write_accel_scale(struct inv_mpu6050_state *st, int val)
|
||||
{
|
||||
int result, i;
|
||||
|
@ -696,6 +713,7 @@ static const struct iio_info mpu_info = {
|
|||
.driver_module = THIS_MODULE,
|
||||
.read_raw = &inv_mpu6050_read_raw,
|
||||
.write_raw = &inv_mpu6050_write_raw,
|
||||
.write_raw_get_fmt = &inv_write_raw_get_fmt,
|
||||
.attrs = &inv_attribute_group,
|
||||
.validate_trigger = inv_mpu6050_validate_trigger,
|
||||
};
|
||||
|
|
|
@ -123,7 +123,7 @@ static int cm3323_set_it_bits(struct cm3323_data *data, int val, int val2)
|
|||
for (i = 0; i < ARRAY_SIZE(cm3323_int_time); i++) {
|
||||
if (val == cm3323_int_time[i].val &&
|
||||
val2 == cm3323_int_time[i].val2) {
|
||||
reg_conf = data->reg_conf;
|
||||
reg_conf = data->reg_conf & ~CM3323_CONF_IT_MASK;
|
||||
reg_conf |= i << CM3323_CONF_IT_SHIFT;
|
||||
|
||||
ret = i2c_smbus_write_word_data(data->client,
|
||||
|
|
|
@ -185,7 +185,7 @@ static int tcs3414_write_raw(struct iio_dev *indio_dev,
|
|||
if (val != 0)
|
||||
return -EINVAL;
|
||||
for (i = 0; i < ARRAY_SIZE(tcs3414_times); i++) {
|
||||
if (val == tcs3414_times[i] * 1000) {
|
||||
if (val2 == tcs3414_times[i] * 1000) {
|
||||
data->timing &= ~TCS3414_INTEG_MASK;
|
||||
data->timing |= i;
|
||||
return i2c_smbus_write_byte_data(
|
||||
|
|
|
@ -281,7 +281,7 @@ static int sx9500_read_prox_data(struct sx9500_data *data,
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
*val = 32767 - (s16)be16_to_cpu(regval);
|
||||
*val = be16_to_cpu(regval);
|
||||
|
||||
return IIO_VAL_INT;
|
||||
}
|
||||
|
|
|
@ -230,6 +230,7 @@ struct hid_sensor_common {
|
|||
struct platform_device *pdev;
|
||||
unsigned usage_id;
|
||||
atomic_t data_ready;
|
||||
atomic_t user_requested_state;
|
||||
struct iio_trigger *trigger;
|
||||
struct hid_sensor_hub_attribute_info poll;
|
||||
struct hid_sensor_hub_attribute_info report_state;
|
||||
|
|
Загрузка…
Ссылка в новой задаче