diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-06-18 12:05:28 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-06-18 12:05:28 -0400 |
commit | a50094a4813443a7ca605f86019061905ba697c4 (patch) | |
tree | b851efe79d5314c001e5437d07bdd49ef04fd6e8 | |
parent | 607117a1533d8ef41b34aa170363ae4415b3d524 (diff) | |
parent | bc8201e3e1885614a5cd3a5f70a79d08f99152fd (diff) |
Merge tag 'staging-4.7-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull IIO and staging fixes from Greg KH:
"Here are a number of IIO and staging bugfixes for 4.7-rc4.
Nothing huge, the normal amount of iio driver fixes, and some small
staging driver bugfixes for some reported problems (2 are reverts of
patches that went into 4.7-rc1). All have been in linux-next with no
reported issues"
* tag 'staging-4.7-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (24 commits)
Revert "Staging: rtl8188eu: rtw_efuse: Use sizeof type *pointer instead of sizeof type."
Revert "Staging: drivers: rtl8188eu: use sizeof(*ptr) instead of sizeof(struct)"
staging: lustre: lnet: Don't access NULL NI on failure path
iio: hudmidity: hdc100x: fix incorrect shifting and scaling
iio: light apds9960: Add the missing dev.parent
iio: Fix error handling in iio_trigger_attach_poll_func
iio: st_sensors: Disable DRDY at init time
iio: st_sensors: Init trigger before irq request
iio: st_sensors: switch to a threaded interrupt
iio: light: bh1780: assign a static name
iio: bh1780: dereference the client properly
iio: humidity: hdc100x: fix IIO_TEMP channel reporting
iio:st_pressure: fix sampling gains (bring inline with ABI)
iio: proximity: as3935: fix buffer stack trashing
iio: proximity: as3935: remove triggered buffer processing
iio: proximity: as3935: correct IIO_CHAN_INFO_RAW output
max44000: Remove scale from proximity
iio: humidity: am2315: Remove a stray unlock
iio: humidity: hdc100x: correct humidity integration time mask
iio: pressure: bmp280: fix error message for wrong chip id
...
26 files changed, 237 insertions, 105 deletions
diff --git a/Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935 b/Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935 index 6708c5e264aa..33e96f740639 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935 +++ b/Documentation/ABI/testing/sysfs-bus-iio-proximity-as3935 | |||
@@ -1,4 +1,4 @@ | |||
1 | What /sys/bus/iio/devices/iio:deviceX/in_proximity_raw | 1 | What /sys/bus/iio/devices/iio:deviceX/in_proximity_input |
2 | Date: March 2014 | 2 | Date: March 2014 |
3 | KernelVersion: 3.15 | 3 | KernelVersion: 3.15 |
4 | Contact: Matt Ranostay <mranostay@gmail.com> | 4 | Contact: Matt Ranostay <mranostay@gmail.com> |
diff --git a/drivers/iio/accel/st_accel_buffer.c b/drivers/iio/accel/st_accel_buffer.c index a1e642ee13d6..7fddc137e91e 100644 --- a/drivers/iio/accel/st_accel_buffer.c +++ b/drivers/iio/accel/st_accel_buffer.c | |||
@@ -91,7 +91,7 @@ static const struct iio_buffer_setup_ops st_accel_buffer_setup_ops = { | |||
91 | 91 | ||
92 | int st_accel_allocate_ring(struct iio_dev *indio_dev) | 92 | int st_accel_allocate_ring(struct iio_dev *indio_dev) |
93 | { | 93 | { |
94 | return iio_triggered_buffer_setup(indio_dev, &iio_pollfunc_store_time, | 94 | return iio_triggered_buffer_setup(indio_dev, NULL, |
95 | &st_sensors_trigger_handler, &st_accel_buffer_setup_ops); | 95 | &st_sensors_trigger_handler, &st_accel_buffer_setup_ops); |
96 | } | 96 | } |
97 | 97 | ||
diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c index dc73f2d85e6d..4d95bfc4786c 100644 --- a/drivers/iio/accel/st_accel_core.c +++ b/drivers/iio/accel/st_accel_core.c | |||
@@ -741,6 +741,7 @@ static const struct iio_info accel_info = { | |||
741 | static const struct iio_trigger_ops st_accel_trigger_ops = { | 741 | static const struct iio_trigger_ops st_accel_trigger_ops = { |
742 | .owner = THIS_MODULE, | 742 | .owner = THIS_MODULE, |
743 | .set_trigger_state = ST_ACCEL_TRIGGER_SET_STATE, | 743 | .set_trigger_state = ST_ACCEL_TRIGGER_SET_STATE, |
744 | .validate_device = st_sensors_validate_device, | ||
744 | }; | 745 | }; |
745 | #define ST_ACCEL_TRIGGER_OPS (&st_accel_trigger_ops) | 746 | #define ST_ACCEL_TRIGGER_OPS (&st_accel_trigger_ops) |
746 | #else | 747 | #else |
diff --git a/drivers/iio/common/st_sensors/st_sensors_buffer.c b/drivers/iio/common/st_sensors/st_sensors_buffer.c index c55898543a47..f1693dbebb8a 100644 --- a/drivers/iio/common/st_sensors/st_sensors_buffer.c +++ b/drivers/iio/common/st_sensors/st_sensors_buffer.c | |||
@@ -57,31 +57,20 @@ irqreturn_t st_sensors_trigger_handler(int irq, void *p) | |||
57 | struct iio_poll_func *pf = p; | 57 | struct iio_poll_func *pf = p; |
58 | struct iio_dev *indio_dev = pf->indio_dev; | 58 | struct iio_dev *indio_dev = pf->indio_dev; |
59 | struct st_sensor_data *sdata = iio_priv(indio_dev); | 59 | struct st_sensor_data *sdata = iio_priv(indio_dev); |
60 | s64 timestamp; | ||
60 | 61 | ||
61 | /* If we have a status register, check if this IRQ came from us */ | 62 | /* If we do timetamping here, do it before reading the values */ |
62 | if (sdata->sensor_settings->drdy_irq.addr_stat_drdy) { | 63 | if (sdata->hw_irq_trigger) |
63 | u8 status; | 64 | timestamp = sdata->hw_timestamp; |
64 | 65 | else | |
65 | len = sdata->tf->read_byte(&sdata->tb, sdata->dev, | 66 | timestamp = iio_get_time_ns(); |
66 | sdata->sensor_settings->drdy_irq.addr_stat_drdy, | ||
67 | &status); | ||
68 | if (len < 0) | ||
69 | dev_err(sdata->dev, "could not read channel status\n"); | ||
70 | |||
71 | /* | ||
72 | * If this was not caused by any channels on this sensor, | ||
73 | * return IRQ_NONE | ||
74 | */ | ||
75 | if (!(status & (u8)indio_dev->active_scan_mask[0])) | ||
76 | return IRQ_NONE; | ||
77 | } | ||
78 | 67 | ||
79 | len = st_sensors_get_buffer_element(indio_dev, sdata->buffer_data); | 68 | len = st_sensors_get_buffer_element(indio_dev, sdata->buffer_data); |
80 | if (len < 0) | 69 | if (len < 0) |
81 | goto st_sensors_get_buffer_element_error; | 70 | goto st_sensors_get_buffer_element_error; |
82 | 71 | ||
83 | iio_push_to_buffers_with_timestamp(indio_dev, sdata->buffer_data, | 72 | iio_push_to_buffers_with_timestamp(indio_dev, sdata->buffer_data, |
84 | pf->timestamp); | 73 | timestamp); |
85 | 74 | ||
86 | st_sensors_get_buffer_element_error: | 75 | st_sensors_get_buffer_element_error: |
87 | iio_trigger_notify_done(indio_dev->trig); | 76 | iio_trigger_notify_done(indio_dev->trig); |
diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c index dffe00692169..9e59c90f6a8d 100644 --- a/drivers/iio/common/st_sensors/st_sensors_core.c +++ b/drivers/iio/common/st_sensors/st_sensors_core.c | |||
@@ -363,6 +363,11 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev, | |||
363 | if (err < 0) | 363 | if (err < 0) |
364 | return err; | 364 | return err; |
365 | 365 | ||
366 | /* Disable DRDY, this might be still be enabled after reboot. */ | ||
367 | err = st_sensors_set_dataready_irq(indio_dev, false); | ||
368 | if (err < 0) | ||
369 | return err; | ||
370 | |||
366 | if (sdata->current_fullscale) { | 371 | if (sdata->current_fullscale) { |
367 | err = st_sensors_set_fullscale(indio_dev, | 372 | err = st_sensors_set_fullscale(indio_dev, |
368 | sdata->current_fullscale->num); | 373 | sdata->current_fullscale->num); |
@@ -424,6 +429,9 @@ int st_sensors_set_dataready_irq(struct iio_dev *indio_dev, bool enable) | |||
424 | else | 429 | else |
425 | drdy_mask = sdata->sensor_settings->drdy_irq.mask_int2; | 430 | drdy_mask = sdata->sensor_settings->drdy_irq.mask_int2; |
426 | 431 | ||
432 | /* Flag to the poll function that the hardware trigger is in use */ | ||
433 | sdata->hw_irq_trigger = enable; | ||
434 | |||
427 | /* Enable/Disable the interrupt generator for data ready. */ | 435 | /* Enable/Disable the interrupt generator for data ready. */ |
428 | err = st_sensors_write_data_with_mask(indio_dev, | 436 | err = st_sensors_write_data_with_mask(indio_dev, |
429 | sdata->sensor_settings->drdy_irq.addr, | 437 | sdata->sensor_settings->drdy_irq.addr, |
diff --git a/drivers/iio/common/st_sensors/st_sensors_trigger.c b/drivers/iio/common/st_sensors/st_sensors_trigger.c index da72279fcf99..296e4ff19ae8 100644 --- a/drivers/iio/common/st_sensors/st_sensors_trigger.c +++ b/drivers/iio/common/st_sensors/st_sensors_trigger.c | |||
@@ -17,6 +17,73 @@ | |||
17 | #include <linux/iio/common/st_sensors.h> | 17 | #include <linux/iio/common/st_sensors.h> |
18 | #include "st_sensors_core.h" | 18 | #include "st_sensors_core.h" |
19 | 19 | ||
20 | /** | ||
21 | * st_sensors_irq_handler() - top half of the IRQ-based triggers | ||
22 | * @irq: irq number | ||
23 | * @p: private handler data | ||
24 | */ | ||
25 | irqreturn_t st_sensors_irq_handler(int irq, void *p) | ||
26 | { | ||
27 | struct iio_trigger *trig = p; | ||
28 | struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig); | ||
29 | struct st_sensor_data *sdata = iio_priv(indio_dev); | ||
30 | |||
31 | /* Get the time stamp as close in time as possible */ | ||
32 | sdata->hw_timestamp = iio_get_time_ns(); | ||
33 | return IRQ_WAKE_THREAD; | ||
34 | } | ||
35 | |||
36 | /** | ||
37 | * st_sensors_irq_thread() - bottom half of the IRQ-based triggers | ||
38 | * @irq: irq number | ||
39 | * @p: private handler data | ||
40 | */ | ||
41 | irqreturn_t st_sensors_irq_thread(int irq, void *p) | ||
42 | { | ||
43 | struct iio_trigger *trig = p; | ||
44 | struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig); | ||
45 | struct st_sensor_data *sdata = iio_priv(indio_dev); | ||
46 | int ret; | ||
47 | |||
48 | /* | ||
49 | * If this trigger is backed by a hardware interrupt and we have a | ||
50 | * status register, check if this IRQ came from us | ||
51 | */ | ||
52 | if (sdata->sensor_settings->drdy_irq.addr_stat_drdy) { | ||
53 | u8 status; | ||
54 | |||
55 | ret = sdata->tf->read_byte(&sdata->tb, sdata->dev, | ||
56 | sdata->sensor_settings->drdy_irq.addr_stat_drdy, | ||
57 | &status); | ||
58 | if (ret < 0) { | ||
59 | dev_err(sdata->dev, "could not read channel status\n"); | ||
60 | goto out_poll; | ||
61 | } | ||
62 | /* | ||
63 | * the lower bits of .active_scan_mask[0] is directly mapped | ||
64 | * to the channels on the sensor: either bit 0 for | ||
65 | * one-dimensional sensors, or e.g. x,y,z for accelerometers, | ||
66 | * gyroscopes or magnetometers. No sensor use more than 3 | ||
67 | * channels, so cut the other status bits here. | ||
68 | */ | ||
69 | status &= 0x07; | ||
70 | |||
71 | /* | ||
72 | * If this was not caused by any channels on this sensor, | ||
73 | * return IRQ_NONE | ||
74 | */ | ||
75 | if (!indio_dev->active_scan_mask) | ||
76 | return IRQ_NONE; | ||
77 | if (!(status & (u8)indio_dev->active_scan_mask[0])) | ||
78 | return IRQ_NONE; | ||
79 | } | ||
80 | |||
81 | out_poll: | ||
82 | /* It's our IRQ: proceed to handle the register polling */ | ||
83 | iio_trigger_poll_chained(p); | ||
84 | return IRQ_HANDLED; | ||
85 | } | ||
86 | |||
20 | int st_sensors_allocate_trigger(struct iio_dev *indio_dev, | 87 | int st_sensors_allocate_trigger(struct iio_dev *indio_dev, |
21 | const struct iio_trigger_ops *trigger_ops) | 88 | const struct iio_trigger_ops *trigger_ops) |
22 | { | 89 | { |
@@ -30,6 +97,10 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev, | |||
30 | return -ENOMEM; | 97 | return -ENOMEM; |
31 | } | 98 | } |
32 | 99 | ||
100 | iio_trigger_set_drvdata(sdata->trig, indio_dev); | ||
101 | sdata->trig->ops = trigger_ops; | ||
102 | sdata->trig->dev.parent = sdata->dev; | ||
103 | |||
33 | irq = sdata->get_irq_data_ready(indio_dev); | 104 | irq = sdata->get_irq_data_ready(indio_dev); |
34 | irq_trig = irqd_get_trigger_type(irq_get_irq_data(irq)); | 105 | irq_trig = irqd_get_trigger_type(irq_get_irq_data(irq)); |
35 | /* | 106 | /* |
@@ -77,9 +148,12 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev, | |||
77 | sdata->sensor_settings->drdy_irq.addr_stat_drdy) | 148 | sdata->sensor_settings->drdy_irq.addr_stat_drdy) |
78 | irq_trig |= IRQF_SHARED; | 149 | irq_trig |= IRQF_SHARED; |
79 | 150 | ||
80 | err = request_threaded_irq(irq, | 151 | /* Let's create an interrupt thread masking the hard IRQ here */ |
81 | iio_trigger_generic_data_rdy_poll, | 152 | irq_trig |= IRQF_ONESHOT; |
82 | NULL, | 153 | |
154 | err = request_threaded_irq(sdata->get_irq_data_ready(indio_dev), | ||
155 | st_sensors_irq_handler, | ||
156 | st_sensors_irq_thread, | ||
83 | irq_trig, | 157 | irq_trig, |
84 | sdata->trig->name, | 158 | sdata->trig->name, |
85 | sdata->trig); | 159 | sdata->trig); |
@@ -88,10 +162,6 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev, | |||
88 | goto iio_trigger_free; | 162 | goto iio_trigger_free; |
89 | } | 163 | } |
90 | 164 | ||
91 | iio_trigger_set_drvdata(sdata->trig, indio_dev); | ||
92 | sdata->trig->ops = trigger_ops; | ||
93 | sdata->trig->dev.parent = sdata->dev; | ||
94 | |||
95 | err = iio_trigger_register(sdata->trig); | 165 | err = iio_trigger_register(sdata->trig); |
96 | if (err < 0) { | 166 | if (err < 0) { |
97 | dev_err(&indio_dev->dev, "failed to register iio trigger.\n"); | 167 | dev_err(&indio_dev->dev, "failed to register iio trigger.\n"); |
@@ -119,6 +189,18 @@ void st_sensors_deallocate_trigger(struct iio_dev *indio_dev) | |||
119 | } | 189 | } |
120 | EXPORT_SYMBOL(st_sensors_deallocate_trigger); | 190 | EXPORT_SYMBOL(st_sensors_deallocate_trigger); |
121 | 191 | ||
192 | int st_sensors_validate_device(struct iio_trigger *trig, | ||
193 | struct iio_dev *indio_dev) | ||
194 | { | ||
195 | struct iio_dev *indio = iio_trigger_get_drvdata(trig); | ||
196 | |||
197 | if (indio != indio_dev) | ||
198 | return -EINVAL; | ||
199 | |||
200 | return 0; | ||
201 | } | ||
202 | EXPORT_SYMBOL(st_sensors_validate_device); | ||
203 | |||
122 | MODULE_AUTHOR("Denis Ciocca <denis.ciocca@st.com>"); | 204 | MODULE_AUTHOR("Denis Ciocca <denis.ciocca@st.com>"); |
123 | MODULE_DESCRIPTION("STMicroelectronics ST-sensors trigger"); | 205 | MODULE_DESCRIPTION("STMicroelectronics ST-sensors trigger"); |
124 | MODULE_LICENSE("GPL v2"); | 206 | MODULE_LICENSE("GPL v2"); |
diff --git a/drivers/iio/dac/ad5592r-base.c b/drivers/iio/dac/ad5592r-base.c index 948f600e7059..69bde5909854 100644 --- a/drivers/iio/dac/ad5592r-base.c +++ b/drivers/iio/dac/ad5592r-base.c | |||
@@ -525,7 +525,7 @@ static int ad5592r_alloc_channels(struct ad5592r_state *st) | |||
525 | 525 | ||
526 | device_for_each_child_node(st->dev, child) { | 526 | device_for_each_child_node(st->dev, child) { |
527 | ret = fwnode_property_read_u32(child, "reg", ®); | 527 | ret = fwnode_property_read_u32(child, "reg", ®); |
528 | if (ret || reg > ARRAY_SIZE(st->channel_modes)) | 528 | if (ret || reg >= ARRAY_SIZE(st->channel_modes)) |
529 | continue; | 529 | continue; |
530 | 530 | ||
531 | ret = fwnode_property_read_u32(child, "adi,mode", &tmp); | 531 | ret = fwnode_property_read_u32(child, "adi,mode", &tmp); |
diff --git a/drivers/iio/gyro/st_gyro_buffer.c b/drivers/iio/gyro/st_gyro_buffer.c index d67b17b6a7aa..a5377044e42f 100644 --- a/drivers/iio/gyro/st_gyro_buffer.c +++ b/drivers/iio/gyro/st_gyro_buffer.c | |||
@@ -91,7 +91,7 @@ static const struct iio_buffer_setup_ops st_gyro_buffer_setup_ops = { | |||
91 | 91 | ||
92 | int st_gyro_allocate_ring(struct iio_dev *indio_dev) | 92 | int st_gyro_allocate_ring(struct iio_dev *indio_dev) |
93 | { | 93 | { |
94 | return iio_triggered_buffer_setup(indio_dev, &iio_pollfunc_store_time, | 94 | return iio_triggered_buffer_setup(indio_dev, NULL, |
95 | &st_sensors_trigger_handler, &st_gyro_buffer_setup_ops); | 95 | &st_sensors_trigger_handler, &st_gyro_buffer_setup_ops); |
96 | } | 96 | } |
97 | 97 | ||
diff --git a/drivers/iio/gyro/st_gyro_core.c b/drivers/iio/gyro/st_gyro_core.c index 52a3c87c375c..a8012955a1f6 100644 --- a/drivers/iio/gyro/st_gyro_core.c +++ b/drivers/iio/gyro/st_gyro_core.c | |||
@@ -409,6 +409,7 @@ static const struct iio_info gyro_info = { | |||
409 | static const struct iio_trigger_ops st_gyro_trigger_ops = { | 409 | static const struct iio_trigger_ops st_gyro_trigger_ops = { |
410 | .owner = THIS_MODULE, | 410 | .owner = THIS_MODULE, |
411 | .set_trigger_state = ST_GYRO_TRIGGER_SET_STATE, | 411 | .set_trigger_state = ST_GYRO_TRIGGER_SET_STATE, |
412 | .validate_device = st_sensors_validate_device, | ||
412 | }; | 413 | }; |
413 | #define ST_GYRO_TRIGGER_OPS (&st_gyro_trigger_ops) | 414 | #define ST_GYRO_TRIGGER_OPS (&st_gyro_trigger_ops) |
414 | #else | 415 | #else |
diff --git a/drivers/iio/humidity/am2315.c b/drivers/iio/humidity/am2315.c index 3be6d209a159..11535911a5c6 100644 --- a/drivers/iio/humidity/am2315.c +++ b/drivers/iio/humidity/am2315.c | |||
@@ -165,10 +165,8 @@ static irqreturn_t am2315_trigger_handler(int irq, void *p) | |||
165 | struct am2315_sensor_data sensor_data; | 165 | struct am2315_sensor_data sensor_data; |
166 | 166 | ||
167 | ret = am2315_read_data(data, &sensor_data); | 167 | ret = am2315_read_data(data, &sensor_data); |
168 | if (ret < 0) { | 168 | if (ret < 0) |
169 | mutex_unlock(&data->lock); | ||
170 | goto err; | 169 | goto err; |
171 | } | ||
172 | 170 | ||
173 | mutex_lock(&data->lock); | 171 | mutex_lock(&data->lock); |
174 | if (*(indio_dev->active_scan_mask) == AM2315_ALL_CHANNEL_MASK) { | 172 | if (*(indio_dev->active_scan_mask) == AM2315_ALL_CHANNEL_MASK) { |
diff --git a/drivers/iio/humidity/hdc100x.c b/drivers/iio/humidity/hdc100x.c index fa4767613173..a03832a5fc95 100644 --- a/drivers/iio/humidity/hdc100x.c +++ b/drivers/iio/humidity/hdc100x.c | |||
@@ -55,7 +55,7 @@ static const struct { | |||
55 | }, | 55 | }, |
56 | { /* IIO_HUMIDITYRELATIVE channel */ | 56 | { /* IIO_HUMIDITYRELATIVE channel */ |
57 | .shift = 8, | 57 | .shift = 8, |
58 | .mask = 2, | 58 | .mask = 3, |
59 | }, | 59 | }, |
60 | }; | 60 | }; |
61 | 61 | ||
@@ -164,14 +164,14 @@ static int hdc100x_get_measurement(struct hdc100x_data *data, | |||
164 | dev_err(&client->dev, "cannot read high byte measurement"); | 164 | dev_err(&client->dev, "cannot read high byte measurement"); |
165 | return ret; | 165 | return ret; |
166 | } | 166 | } |
167 | val = ret << 6; | 167 | val = ret << 8; |
168 | 168 | ||
169 | ret = i2c_smbus_read_byte(client); | 169 | ret = i2c_smbus_read_byte(client); |
170 | if (ret < 0) { | 170 | if (ret < 0) { |
171 | dev_err(&client->dev, "cannot read low byte measurement"); | 171 | dev_err(&client->dev, "cannot read low byte measurement"); |
172 | return ret; | 172 | return ret; |
173 | } | 173 | } |
174 | val |= ret >> 2; | 174 | val |= ret; |
175 | 175 | ||
176 | return val; | 176 | return val; |
177 | } | 177 | } |
@@ -211,18 +211,18 @@ static int hdc100x_read_raw(struct iio_dev *indio_dev, | |||
211 | return IIO_VAL_INT_PLUS_MICRO; | 211 | return IIO_VAL_INT_PLUS_MICRO; |
212 | case IIO_CHAN_INFO_SCALE: | 212 | case IIO_CHAN_INFO_SCALE: |
213 | if (chan->type == IIO_TEMP) { | 213 | if (chan->type == IIO_TEMP) { |
214 | *val = 165; | 214 | *val = 165000; |
215 | *val2 = 65536 >> 2; | 215 | *val2 = 65536; |
216 | return IIO_VAL_FRACTIONAL; | 216 | return IIO_VAL_FRACTIONAL; |
217 | } else { | 217 | } else { |
218 | *val = 0; | 218 | *val = 100; |
219 | *val2 = 10000; | 219 | *val2 = 65536; |
220 | return IIO_VAL_INT_PLUS_MICRO; | 220 | return IIO_VAL_FRACTIONAL; |
221 | } | 221 | } |
222 | break; | 222 | break; |
223 | case IIO_CHAN_INFO_OFFSET: | 223 | case IIO_CHAN_INFO_OFFSET: |
224 | *val = -3971; | 224 | *val = -15887; |
225 | *val2 = 879096; | 225 | *val2 = 515151; |
226 | return IIO_VAL_INT_PLUS_MICRO; | 226 | return IIO_VAL_INT_PLUS_MICRO; |
227 | default: | 227 | default: |
228 | return -EINVAL; | 228 | return -EINVAL; |
diff --git a/drivers/iio/imu/bmi160/bmi160_core.c b/drivers/iio/imu/bmi160/bmi160_core.c index 0bf92b06d7d8..b8a290ec984e 100644 --- a/drivers/iio/imu/bmi160/bmi160_core.c +++ b/drivers/iio/imu/bmi160/bmi160_core.c | |||
@@ -209,11 +209,11 @@ static const struct bmi160_scale_item bmi160_scale_table[] = { | |||
209 | }; | 209 | }; |
210 | 210 | ||
211 | static const struct bmi160_odr bmi160_accel_odr[] = { | 211 | static const struct bmi160_odr bmi160_accel_odr[] = { |
212 | {0x01, 0, 78125}, | 212 | {0x01, 0, 781250}, |
213 | {0x02, 1, 5625}, | 213 | {0x02, 1, 562500}, |
214 | {0x03, 3, 125}, | 214 | {0x03, 3, 125000}, |
215 | {0x04, 6, 25}, | 215 | {0x04, 6, 250000}, |
216 | {0x05, 12, 5}, | 216 | {0x05, 12, 500000}, |
217 | {0x06, 25, 0}, | 217 | {0x06, 25, 0}, |
218 | {0x07, 50, 0}, | 218 | {0x07, 50, 0}, |
219 | {0x08, 100, 0}, | 219 | {0x08, 100, 0}, |
@@ -229,7 +229,7 @@ static const struct bmi160_odr bmi160_gyro_odr[] = { | |||
229 | {0x08, 100, 0}, | 229 | {0x08, 100, 0}, |
230 | {0x09, 200, 0}, | 230 | {0x09, 200, 0}, |
231 | {0x0A, 400, 0}, | 231 | {0x0A, 400, 0}, |
232 | {0x0B, 8000, 0}, | 232 | {0x0B, 800, 0}, |
233 | {0x0C, 1600, 0}, | 233 | {0x0C, 1600, 0}, |
234 | {0x0D, 3200, 0}, | 234 | {0x0D, 3200, 0}, |
235 | }; | 235 | }; |
@@ -364,8 +364,8 @@ int bmi160_set_odr(struct bmi160_data *data, enum bmi160_sensor_type t, | |||
364 | 364 | ||
365 | return regmap_update_bits(data->regmap, | 365 | return regmap_update_bits(data->regmap, |
366 | bmi160_regs[t].config, | 366 | bmi160_regs[t].config, |
367 | bmi160_odr_table[t].tbl[i].bits, | 367 | bmi160_regs[t].config_odr_mask, |
368 | bmi160_regs[t].config_odr_mask); | 368 | bmi160_odr_table[t].tbl[i].bits); |
369 | } | 369 | } |
370 | 370 | ||
371 | static int bmi160_get_odr(struct bmi160_data *data, enum bmi160_sensor_type t, | 371 | static int bmi160_get_odr(struct bmi160_data *data, enum bmi160_sensor_type t, |
diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c index ae2806aafb72..0c52dfe64977 100644 --- a/drivers/iio/industrialio-trigger.c +++ b/drivers/iio/industrialio-trigger.c | |||
@@ -210,22 +210,35 @@ static int iio_trigger_attach_poll_func(struct iio_trigger *trig, | |||
210 | 210 | ||
211 | /* Prevent the module from being removed whilst attached to a trigger */ | 211 | /* Prevent the module from being removed whilst attached to a trigger */ |
212 | __module_get(pf->indio_dev->info->driver_module); | 212 | __module_get(pf->indio_dev->info->driver_module); |
213 | |||
214 | /* Get irq number */ | ||
213 | pf->irq = iio_trigger_get_irq(trig); | 215 | pf->irq = iio_trigger_get_irq(trig); |
216 | if (pf->irq < 0) | ||
217 | goto out_put_module; | ||
218 | |||
219 | /* Request irq */ | ||
214 | ret = request_threaded_irq(pf->irq, pf->h, pf->thread, | 220 | ret = request_threaded_irq(pf->irq, pf->h, pf->thread, |
215 | pf->type, pf->name, | 221 | pf->type, pf->name, |
216 | pf); | 222 | pf); |
217 | if (ret < 0) { | 223 | if (ret < 0) |
218 | module_put(pf->indio_dev->info->driver_module); | 224 | goto out_put_irq; |
219 | return ret; | ||
220 | } | ||
221 | 225 | ||
226 | /* Enable trigger in driver */ | ||
222 | if (trig->ops && trig->ops->set_trigger_state && notinuse) { | 227 | if (trig->ops && trig->ops->set_trigger_state && notinuse) { |
223 | ret = trig->ops->set_trigger_state(trig, true); | 228 | ret = trig->ops->set_trigger_state(trig, true); |
224 | if (ret < 0) | 229 | if (ret < 0) |
225 | module_put(pf->indio_dev->info->driver_module); | 230 | goto out_free_irq; |
226 | } | 231 | } |
227 | 232 | ||
228 | return ret; | 233 | return ret; |
234 | |||
235 | out_free_irq: | ||
236 | free_irq(pf->irq, pf); | ||
237 | out_put_irq: | ||
238 | iio_trigger_put_irq(trig, pf->irq); | ||
239 | out_put_module: | ||
240 | module_put(pf->indio_dev->info->driver_module); | ||
241 | return ret; | ||
229 | } | 242 | } |
230 | 243 | ||
231 | static int iio_trigger_detach_poll_func(struct iio_trigger *trig, | 244 | static int iio_trigger_detach_poll_func(struct iio_trigger *trig, |
diff --git a/drivers/iio/light/apds9960.c b/drivers/iio/light/apds9960.c index b4dbb3912977..651d57b8abbf 100644 --- a/drivers/iio/light/apds9960.c +++ b/drivers/iio/light/apds9960.c | |||
@@ -1011,6 +1011,7 @@ static int apds9960_probe(struct i2c_client *client, | |||
1011 | 1011 | ||
1012 | iio_device_attach_buffer(indio_dev, buffer); | 1012 | iio_device_attach_buffer(indio_dev, buffer); |
1013 | 1013 | ||
1014 | indio_dev->dev.parent = &client->dev; | ||
1014 | indio_dev->info = &apds9960_info; | 1015 | indio_dev->info = &apds9960_info; |
1015 | indio_dev->name = APDS9960_DRV_NAME; | 1016 | indio_dev->name = APDS9960_DRV_NAME; |
1016 | indio_dev->channels = apds9960_channels; | 1017 | indio_dev->channels = apds9960_channels; |
diff --git a/drivers/iio/light/bh1780.c b/drivers/iio/light/bh1780.c index 72b364e4aa72..b54dcba05a82 100644 --- a/drivers/iio/light/bh1780.c +++ b/drivers/iio/light/bh1780.c | |||
@@ -84,7 +84,7 @@ static int bh1780_debugfs_reg_access(struct iio_dev *indio_dev, | |||
84 | int ret; | 84 | int ret; |
85 | 85 | ||
86 | if (!readval) | 86 | if (!readval) |
87 | bh1780_write(bh1780, (u8)reg, (u8)writeval); | 87 | return bh1780_write(bh1780, (u8)reg, (u8)writeval); |
88 | 88 | ||
89 | ret = bh1780_read(bh1780, (u8)reg); | 89 | ret = bh1780_read(bh1780, (u8)reg); |
90 | if (ret < 0) | 90 | if (ret < 0) |
@@ -187,7 +187,7 @@ static int bh1780_probe(struct i2c_client *client, | |||
187 | 187 | ||
188 | indio_dev->dev.parent = &client->dev; | 188 | indio_dev->dev.parent = &client->dev; |
189 | indio_dev->info = &bh1780_info; | 189 | indio_dev->info = &bh1780_info; |
190 | indio_dev->name = id->name; | 190 | indio_dev->name = "bh1780"; |
191 | indio_dev->channels = bh1780_channels; | 191 | indio_dev->channels = bh1780_channels; |
192 | indio_dev->num_channels = ARRAY_SIZE(bh1780_channels); | 192 | indio_dev->num_channels = ARRAY_SIZE(bh1780_channels); |
193 | indio_dev->modes = INDIO_DIRECT_MODE; | 193 | indio_dev->modes = INDIO_DIRECT_MODE; |
@@ -226,7 +226,8 @@ static int bh1780_remove(struct i2c_client *client) | |||
226 | static int bh1780_runtime_suspend(struct device *dev) | 226 | static int bh1780_runtime_suspend(struct device *dev) |
227 | { | 227 | { |
228 | struct i2c_client *client = to_i2c_client(dev); | 228 | struct i2c_client *client = to_i2c_client(dev); |
229 | struct bh1780_data *bh1780 = i2c_get_clientdata(client); | 229 | struct iio_dev *indio_dev = i2c_get_clientdata(client); |
230 | struct bh1780_data *bh1780 = iio_priv(indio_dev); | ||
230 | int ret; | 231 | int ret; |
231 | 232 | ||
232 | ret = bh1780_write(bh1780, BH1780_REG_CONTROL, BH1780_POFF); | 233 | ret = bh1780_write(bh1780, BH1780_REG_CONTROL, BH1780_POFF); |
@@ -241,7 +242,8 @@ static int bh1780_runtime_suspend(struct device *dev) | |||
241 | static int bh1780_runtime_resume(struct device *dev) | 242 | static int bh1780_runtime_resume(struct device *dev) |
242 | { | 243 | { |
243 | struct i2c_client *client = to_i2c_client(dev); | 244 | struct i2c_client *client = to_i2c_client(dev); |
244 | struct bh1780_data *bh1780 = i2c_get_clientdata(client); | 245 | struct iio_dev *indio_dev = i2c_get_clientdata(client); |
246 | struct bh1780_data *bh1780 = iio_priv(indio_dev); | ||
245 | int ret; | 247 | int ret; |
246 | 248 | ||
247 | ret = bh1780_write(bh1780, BH1780_REG_CONTROL, BH1780_PON); | 249 | ret = bh1780_write(bh1780, BH1780_REG_CONTROL, BH1780_PON); |
diff --git a/drivers/iio/light/max44000.c b/drivers/iio/light/max44000.c index e01e58a9bd14..f17cb2ea18f5 100644 --- a/drivers/iio/light/max44000.c +++ b/drivers/iio/light/max44000.c | |||
@@ -147,7 +147,6 @@ static const struct iio_chan_spec max44000_channels[] = { | |||
147 | { | 147 | { |
148 | .type = IIO_PROXIMITY, | 148 | .type = IIO_PROXIMITY, |
149 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), | 149 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), |
150 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), | ||
151 | .scan_index = MAX44000_SCAN_INDEX_PRX, | 150 | .scan_index = MAX44000_SCAN_INDEX_PRX, |
152 | .scan_type = { | 151 | .scan_type = { |
153 | .sign = 'u', | 152 | .sign = 'u', |
diff --git a/drivers/iio/magnetometer/st_magn_buffer.c b/drivers/iio/magnetometer/st_magn_buffer.c index ecd3bd0a9769..0a9e8fadfa9d 100644 --- a/drivers/iio/magnetometer/st_magn_buffer.c +++ b/drivers/iio/magnetometer/st_magn_buffer.c | |||
@@ -82,7 +82,7 @@ static const struct iio_buffer_setup_ops st_magn_buffer_setup_ops = { | |||
82 | 82 | ||
83 | int st_magn_allocate_ring(struct iio_dev *indio_dev) | 83 | int st_magn_allocate_ring(struct iio_dev *indio_dev) |
84 | { | 84 | { |
85 | return iio_triggered_buffer_setup(indio_dev, &iio_pollfunc_store_time, | 85 | return iio_triggered_buffer_setup(indio_dev, NULL, |
86 | &st_sensors_trigger_handler, &st_magn_buffer_setup_ops); | 86 | &st_sensors_trigger_handler, &st_magn_buffer_setup_ops); |
87 | } | 87 | } |
88 | 88 | ||
diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c index 62036d2a9956..8250fc322c56 100644 --- a/drivers/iio/magnetometer/st_magn_core.c +++ b/drivers/iio/magnetometer/st_magn_core.c | |||
@@ -572,6 +572,7 @@ static const struct iio_info magn_info = { | |||
572 | static const struct iio_trigger_ops st_magn_trigger_ops = { | 572 | static const struct iio_trigger_ops st_magn_trigger_ops = { |
573 | .owner = THIS_MODULE, | 573 | .owner = THIS_MODULE, |
574 | .set_trigger_state = ST_MAGN_TRIGGER_SET_STATE, | 574 | .set_trigger_state = ST_MAGN_TRIGGER_SET_STATE, |
575 | .validate_device = st_sensors_validate_device, | ||
575 | }; | 576 | }; |
576 | #define ST_MAGN_TRIGGER_OPS (&st_magn_trigger_ops) | 577 | #define ST_MAGN_TRIGGER_OPS (&st_magn_trigger_ops) |
577 | #else | 578 | #else |
diff --git a/drivers/iio/pressure/bmp280.c b/drivers/iio/pressure/bmp280.c index 2f1498e12bb2..724452d61846 100644 --- a/drivers/iio/pressure/bmp280.c +++ b/drivers/iio/pressure/bmp280.c | |||
@@ -879,8 +879,8 @@ static int bmp280_probe(struct i2c_client *client, | |||
879 | if (ret < 0) | 879 | if (ret < 0) |
880 | return ret; | 880 | return ret; |
881 | if (chip_id != id->driver_data) { | 881 | if (chip_id != id->driver_data) { |
882 | dev_err(&client->dev, "bad chip id. expected %x got %x\n", | 882 | dev_err(&client->dev, "bad chip id. expected %lx got %x\n", |
883 | BMP280_CHIP_ID, chip_id); | 883 | id->driver_data, chip_id); |
884 | return -EINVAL; | 884 | return -EINVAL; |
885 | } | 885 | } |
886 | 886 | ||
diff --git a/drivers/iio/pressure/st_pressure_buffer.c b/drivers/iio/pressure/st_pressure_buffer.c index 2ff53f222352..99468d0a64e7 100644 --- a/drivers/iio/pressure/st_pressure_buffer.c +++ b/drivers/iio/pressure/st_pressure_buffer.c | |||
@@ -82,7 +82,7 @@ static const struct iio_buffer_setup_ops st_press_buffer_setup_ops = { | |||
82 | 82 | ||
83 | int st_press_allocate_ring(struct iio_dev *indio_dev) | 83 | int st_press_allocate_ring(struct iio_dev *indio_dev) |
84 | { | 84 | { |
85 | return iio_triggered_buffer_setup(indio_dev, &iio_pollfunc_store_time, | 85 | return iio_triggered_buffer_setup(indio_dev, NULL, |
86 | &st_sensors_trigger_handler, &st_press_buffer_setup_ops); | 86 | &st_sensors_trigger_handler, &st_press_buffer_setup_ops); |
87 | } | 87 | } |
88 | 88 | ||
diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c index 9e9b72a8f18f..92a118c3c4ac 100644 --- a/drivers/iio/pressure/st_pressure_core.c +++ b/drivers/iio/pressure/st_pressure_core.c | |||
@@ -28,15 +28,21 @@ | |||
28 | #include <linux/iio/common/st_sensors.h> | 28 | #include <linux/iio/common/st_sensors.h> |
29 | #include "st_pressure.h" | 29 | #include "st_pressure.h" |
30 | 30 | ||
31 | #define MCELSIUS_PER_CELSIUS 1000 | ||
32 | |||
33 | /* Default pressure sensitivity */ | ||
31 | #define ST_PRESS_LSB_PER_MBAR 4096UL | 34 | #define ST_PRESS_LSB_PER_MBAR 4096UL |
32 | #define ST_PRESS_KPASCAL_NANO_SCALE (100000000UL / \ | 35 | #define ST_PRESS_KPASCAL_NANO_SCALE (100000000UL / \ |
33 | ST_PRESS_LSB_PER_MBAR) | 36 | ST_PRESS_LSB_PER_MBAR) |
37 | |||
38 | /* Default temperature sensitivity */ | ||
34 | #define ST_PRESS_LSB_PER_CELSIUS 480UL | 39 | #define ST_PRESS_LSB_PER_CELSIUS 480UL |
35 | #define ST_PRESS_CELSIUS_NANO_SCALE (1000000000UL / \ | 40 | #define ST_PRESS_MILLI_CELSIUS_OFFSET 42500UL |
36 | ST_PRESS_LSB_PER_CELSIUS) | 41 | |
37 | #define ST_PRESS_NUMBER_DATA_CHANNELS 1 | 42 | #define ST_PRESS_NUMBER_DATA_CHANNELS 1 |
38 | 43 | ||
39 | /* FULLSCALE */ | 44 | /* FULLSCALE */ |
45 | #define ST_PRESS_FS_AVL_1100MB 1100 | ||
40 | #define ST_PRESS_FS_AVL_1260MB 1260 | 46 | #define ST_PRESS_FS_AVL_1260MB 1260 |
41 | 47 | ||
42 | #define ST_PRESS_1_OUT_XL_ADDR 0x28 | 48 | #define ST_PRESS_1_OUT_XL_ADDR 0x28 |
@@ -54,9 +60,6 @@ | |||
54 | #define ST_PRESS_LPS331AP_PW_MASK 0x80 | 60 | #define ST_PRESS_LPS331AP_PW_MASK 0x80 |
55 | #define ST_PRESS_LPS331AP_FS_ADDR 0x23 | 61 | #define ST_PRESS_LPS331AP_FS_ADDR 0x23 |
56 | #define ST_PRESS_LPS331AP_FS_MASK 0x30 | 62 | #define ST_PRESS_LPS331AP_FS_MASK 0x30 |
57 | #define ST_PRESS_LPS331AP_FS_AVL_1260_VAL 0x00 | ||
58 | #define ST_PRESS_LPS331AP_FS_AVL_1260_GAIN ST_PRESS_KPASCAL_NANO_SCALE | ||
59 | #define ST_PRESS_LPS331AP_FS_AVL_TEMP_GAIN ST_PRESS_CELSIUS_NANO_SCALE | ||
60 | #define ST_PRESS_LPS331AP_BDU_ADDR 0x20 | 63 | #define ST_PRESS_LPS331AP_BDU_ADDR 0x20 |
61 | #define ST_PRESS_LPS331AP_BDU_MASK 0x04 | 64 | #define ST_PRESS_LPS331AP_BDU_MASK 0x04 |
62 | #define ST_PRESS_LPS331AP_DRDY_IRQ_ADDR 0x22 | 65 | #define ST_PRESS_LPS331AP_DRDY_IRQ_ADDR 0x22 |
@@ -67,9 +70,14 @@ | |||
67 | #define ST_PRESS_LPS331AP_OD_IRQ_ADDR 0x22 | 70 | #define ST_PRESS_LPS331AP_OD_IRQ_ADDR 0x22 |
68 | #define ST_PRESS_LPS331AP_OD_IRQ_MASK 0x40 | 71 | #define ST_PRESS_LPS331AP_OD_IRQ_MASK 0x40 |
69 | #define ST_PRESS_LPS331AP_MULTIREAD_BIT true | 72 | #define ST_PRESS_LPS331AP_MULTIREAD_BIT true |
70 | #define ST_PRESS_LPS331AP_TEMP_OFFSET 42500 | ||
71 | 73 | ||
72 | /* CUSTOM VALUES FOR LPS001WP SENSOR */ | 74 | /* CUSTOM VALUES FOR LPS001WP SENSOR */ |
75 | |||
76 | /* LPS001WP pressure resolution */ | ||
77 | #define ST_PRESS_LPS001WP_LSB_PER_MBAR 16UL | ||
78 | /* LPS001WP temperature resolution */ | ||
79 | #define ST_PRESS_LPS001WP_LSB_PER_CELSIUS 64UL | ||
80 | |||
73 | #define ST_PRESS_LPS001WP_WAI_EXP 0xba | 81 | #define ST_PRESS_LPS001WP_WAI_EXP 0xba |
74 | #define ST_PRESS_LPS001WP_ODR_ADDR 0x20 | 82 | #define ST_PRESS_LPS001WP_ODR_ADDR 0x20 |
75 | #define ST_PRESS_LPS001WP_ODR_MASK 0x30 | 83 | #define ST_PRESS_LPS001WP_ODR_MASK 0x30 |
@@ -78,6 +86,8 @@ | |||
78 | #define ST_PRESS_LPS001WP_ODR_AVL_13HZ_VAL 0x03 | 86 | #define ST_PRESS_LPS001WP_ODR_AVL_13HZ_VAL 0x03 |
79 | #define ST_PRESS_LPS001WP_PW_ADDR 0x20 | 87 | #define ST_PRESS_LPS001WP_PW_ADDR 0x20 |
80 | #define ST_PRESS_LPS001WP_PW_MASK 0x40 | 88 | #define ST_PRESS_LPS001WP_PW_MASK 0x40 |
89 | #define ST_PRESS_LPS001WP_FS_AVL_PRESS_GAIN \ | ||
90 | (100000000UL / ST_PRESS_LPS001WP_LSB_PER_MBAR) | ||
81 | #define ST_PRESS_LPS001WP_BDU_ADDR 0x20 | 91 | #define ST_PRESS_LPS001WP_BDU_ADDR 0x20 |
82 | #define ST_PRESS_LPS001WP_BDU_MASK 0x04 | 92 | #define ST_PRESS_LPS001WP_BDU_MASK 0x04 |
83 | #define ST_PRESS_LPS001WP_MULTIREAD_BIT true | 93 | #define ST_PRESS_LPS001WP_MULTIREAD_BIT true |
@@ -94,11 +104,6 @@ | |||
94 | #define ST_PRESS_LPS25H_ODR_AVL_25HZ_VAL 0x04 | 104 | #define ST_PRESS_LPS25H_ODR_AVL_25HZ_VAL 0x04 |
95 | #define ST_PRESS_LPS25H_PW_ADDR 0x20 | 105 | #define ST_PRESS_LPS25H_PW_ADDR 0x20 |
96 | #define ST_PRESS_LPS25H_PW_MASK 0x80 | 106 | #define ST_PRESS_LPS25H_PW_MASK 0x80 |
97 | #define ST_PRESS_LPS25H_FS_ADDR 0x00 | ||
98 | #define ST_PRESS_LPS25H_FS_MASK 0x00 | ||
99 | #define ST_PRESS_LPS25H_FS_AVL_1260_VAL 0x00 | ||
100 | #define ST_PRESS_LPS25H_FS_AVL_1260_GAIN ST_PRESS_KPASCAL_NANO_SCALE | ||
101 | #define ST_PRESS_LPS25H_FS_AVL_TEMP_GAIN ST_PRESS_CELSIUS_NANO_SCALE | ||
102 | #define ST_PRESS_LPS25H_BDU_ADDR 0x20 | 107 | #define ST_PRESS_LPS25H_BDU_ADDR 0x20 |
103 | #define ST_PRESS_LPS25H_BDU_MASK 0x04 | 108 | #define ST_PRESS_LPS25H_BDU_MASK 0x04 |
104 | #define ST_PRESS_LPS25H_DRDY_IRQ_ADDR 0x23 | 109 | #define ST_PRESS_LPS25H_DRDY_IRQ_ADDR 0x23 |
@@ -109,7 +114,6 @@ | |||
109 | #define ST_PRESS_LPS25H_OD_IRQ_ADDR 0x22 | 114 | #define ST_PRESS_LPS25H_OD_IRQ_ADDR 0x22 |
110 | #define ST_PRESS_LPS25H_OD_IRQ_MASK 0x40 | 115 | #define ST_PRESS_LPS25H_OD_IRQ_MASK 0x40 |
111 | #define ST_PRESS_LPS25H_MULTIREAD_BIT true | 116 | #define ST_PRESS_LPS25H_MULTIREAD_BIT true |
112 | #define ST_PRESS_LPS25H_TEMP_OFFSET 42500 | ||
113 | #define ST_PRESS_LPS25H_OUT_XL_ADDR 0x28 | 117 | #define ST_PRESS_LPS25H_OUT_XL_ADDR 0x28 |
114 | #define ST_TEMP_LPS25H_OUT_L_ADDR 0x2b | 118 | #define ST_TEMP_LPS25H_OUT_L_ADDR 0x2b |
115 | 119 | ||
@@ -161,7 +165,9 @@ static const struct iio_chan_spec st_press_lps001wp_channels[] = { | |||
161 | .storagebits = 16, | 165 | .storagebits = 16, |
162 | .endianness = IIO_LE, | 166 | .endianness = IIO_LE, |
163 | }, | 167 | }, |
164 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), | 168 | .info_mask_separate = |
169 | BIT(IIO_CHAN_INFO_RAW) | | ||
170 | BIT(IIO_CHAN_INFO_SCALE), | ||
165 | .modified = 0, | 171 | .modified = 0, |
166 | }, | 172 | }, |
167 | { | 173 | { |
@@ -177,7 +183,7 @@ static const struct iio_chan_spec st_press_lps001wp_channels[] = { | |||
177 | }, | 183 | }, |
178 | .info_mask_separate = | 184 | .info_mask_separate = |
179 | BIT(IIO_CHAN_INFO_RAW) | | 185 | BIT(IIO_CHAN_INFO_RAW) | |
180 | BIT(IIO_CHAN_INFO_OFFSET), | 186 | BIT(IIO_CHAN_INFO_SCALE), |
181 | .modified = 0, | 187 | .modified = 0, |
182 | }, | 188 | }, |
183 | IIO_CHAN_SOFT_TIMESTAMP(1) | 189 | IIO_CHAN_SOFT_TIMESTAMP(1) |
@@ -212,11 +218,14 @@ static const struct st_sensor_settings st_press_sensors_settings[] = { | |||
212 | .addr = ST_PRESS_LPS331AP_FS_ADDR, | 218 | .addr = ST_PRESS_LPS331AP_FS_ADDR, |
213 | .mask = ST_PRESS_LPS331AP_FS_MASK, | 219 | .mask = ST_PRESS_LPS331AP_FS_MASK, |
214 | .fs_avl = { | 220 | .fs_avl = { |
221 | /* | ||
222 | * Pressure and temperature sensitivity values | ||
223 | * as defined in table 3 of LPS331AP datasheet. | ||
224 | */ | ||
215 | [0] = { | 225 | [0] = { |
216 | .num = ST_PRESS_FS_AVL_1260MB, | 226 | .num = ST_PRESS_FS_AVL_1260MB, |
217 | .value = ST_PRESS_LPS331AP_FS_AVL_1260_VAL, | 227 | .gain = ST_PRESS_KPASCAL_NANO_SCALE, |
218 | .gain = ST_PRESS_LPS331AP_FS_AVL_1260_GAIN, | 228 | .gain2 = ST_PRESS_LSB_PER_CELSIUS, |
219 | .gain2 = ST_PRESS_LPS331AP_FS_AVL_TEMP_GAIN, | ||
220 | }, | 229 | }, |
221 | }, | 230 | }, |
222 | }, | 231 | }, |
@@ -261,7 +270,17 @@ static const struct st_sensor_settings st_press_sensors_settings[] = { | |||
261 | .value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE, | 270 | .value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE, |
262 | }, | 271 | }, |
263 | .fs = { | 272 | .fs = { |
264 | .addr = 0, | 273 | .fs_avl = { |
274 | /* | ||
275 | * Pressure and temperature resolution values | ||
276 | * as defined in table 3 of LPS001WP datasheet. | ||
277 | */ | ||
278 | [0] = { | ||
279 | .num = ST_PRESS_FS_AVL_1100MB, | ||
280 | .gain = ST_PRESS_LPS001WP_FS_AVL_PRESS_GAIN, | ||
281 | .gain2 = ST_PRESS_LPS001WP_LSB_PER_CELSIUS, | ||
282 | }, | ||
283 | }, | ||
265 | }, | 284 | }, |
266 | .bdu = { | 285 | .bdu = { |
267 | .addr = ST_PRESS_LPS001WP_BDU_ADDR, | 286 | .addr = ST_PRESS_LPS001WP_BDU_ADDR, |
@@ -298,14 +317,15 @@ static const struct st_sensor_settings st_press_sensors_settings[] = { | |||
298 | .value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE, | 317 | .value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE, |
299 | }, | 318 | }, |
300 | .fs = { | 319 | .fs = { |
301 | .addr = ST_PRESS_LPS25H_FS_ADDR, | ||
302 | .mask = ST_PRESS_LPS25H_FS_MASK, | ||
303 | .fs_avl = { | 320 | .fs_avl = { |
321 | /* | ||
322 | * Pressure and temperature sensitivity values | ||
323 | * as defined in table 3 of LPS25H datasheet. | ||
324 | */ | ||
304 | [0] = { | 325 | [0] = { |
305 | .num = ST_PRESS_FS_AVL_1260MB, | 326 | .num = ST_PRESS_FS_AVL_1260MB, |
306 | .value = ST_PRESS_LPS25H_FS_AVL_1260_VAL, | 327 | .gain = ST_PRESS_KPASCAL_NANO_SCALE, |
307 | .gain = ST_PRESS_LPS25H_FS_AVL_1260_GAIN, | 328 | .gain2 = ST_PRESS_LSB_PER_CELSIUS, |
308 | .gain2 = ST_PRESS_LPS25H_FS_AVL_TEMP_GAIN, | ||
309 | }, | 329 | }, |
310 | }, | 330 | }, |
311 | }, | 331 | }, |
@@ -364,26 +384,26 @@ static int st_press_read_raw(struct iio_dev *indio_dev, | |||
364 | 384 | ||
365 | return IIO_VAL_INT; | 385 | return IIO_VAL_INT; |
366 | case IIO_CHAN_INFO_SCALE: | 386 | case IIO_CHAN_INFO_SCALE: |
367 | *val = 0; | ||
368 | |||
369 | switch (ch->type) { | 387 | switch (ch->type) { |
370 | case IIO_PRESSURE: | 388 | case IIO_PRESSURE: |
389 | *val = 0; | ||
371 | *val2 = press_data->current_fullscale->gain; | 390 | *val2 = press_data->current_fullscale->gain; |
372 | break; | 391 | return IIO_VAL_INT_PLUS_NANO; |
373 | case IIO_TEMP: | 392 | case IIO_TEMP: |
393 | *val = MCELSIUS_PER_CELSIUS; | ||
374 | *val2 = press_data->current_fullscale->gain2; | 394 | *val2 = press_data->current_fullscale->gain2; |
375 | break; | 395 | return IIO_VAL_FRACTIONAL; |
376 | default: | 396 | default: |
377 | err = -EINVAL; | 397 | err = -EINVAL; |
378 | goto read_error; | 398 | goto read_error; |
379 | } | 399 | } |
380 | 400 | ||
381 | return IIO_VAL_INT_PLUS_NANO; | ||
382 | case IIO_CHAN_INFO_OFFSET: | 401 | case IIO_CHAN_INFO_OFFSET: |
383 | switch (ch->type) { | 402 | switch (ch->type) { |
384 | case IIO_TEMP: | 403 | case IIO_TEMP: |
385 | *val = 425; | 404 | *val = ST_PRESS_MILLI_CELSIUS_OFFSET * |
386 | *val2 = 10; | 405 | press_data->current_fullscale->gain2; |
406 | *val2 = MCELSIUS_PER_CELSIUS; | ||
387 | break; | 407 | break; |
388 | default: | 408 | default: |
389 | err = -EINVAL; | 409 | err = -EINVAL; |
@@ -425,6 +445,7 @@ static const struct iio_info press_info = { | |||
425 | static const struct iio_trigger_ops st_press_trigger_ops = { | 445 | static const struct iio_trigger_ops st_press_trigger_ops = { |
426 | .owner = THIS_MODULE, | 446 | .owner = THIS_MODULE, |
427 | .set_trigger_state = ST_PRESS_TRIGGER_SET_STATE, | 447 | .set_trigger_state = ST_PRESS_TRIGGER_SET_STATE, |
448 | .validate_device = st_sensors_validate_device, | ||
428 | }; | 449 | }; |
429 | #define ST_PRESS_TRIGGER_OPS (&st_press_trigger_ops) | 450 | #define ST_PRESS_TRIGGER_OPS (&st_press_trigger_ops) |
430 | #else | 451 | #else |
diff --git a/drivers/iio/proximity/as3935.c b/drivers/iio/proximity/as3935.c index f4d29d5dbd5f..e2f926cdcad2 100644 --- a/drivers/iio/proximity/as3935.c +++ b/drivers/iio/proximity/as3935.c | |||
@@ -64,6 +64,7 @@ struct as3935_state { | |||
64 | struct delayed_work work; | 64 | struct delayed_work work; |
65 | 65 | ||
66 | u32 tune_cap; | 66 | u32 tune_cap; |
67 | u8 buffer[16]; /* 8-bit data + 56-bit padding + 64-bit timestamp */ | ||
67 | u8 buf[2] ____cacheline_aligned; | 68 | u8 buf[2] ____cacheline_aligned; |
68 | }; | 69 | }; |
69 | 70 | ||
@@ -72,7 +73,8 @@ static const struct iio_chan_spec as3935_channels[] = { | |||
72 | .type = IIO_PROXIMITY, | 73 | .type = IIO_PROXIMITY, |
73 | .info_mask_separate = | 74 | .info_mask_separate = |
74 | BIT(IIO_CHAN_INFO_RAW) | | 75 | BIT(IIO_CHAN_INFO_RAW) | |
75 | BIT(IIO_CHAN_INFO_PROCESSED), | 76 | BIT(IIO_CHAN_INFO_PROCESSED) | |
77 | BIT(IIO_CHAN_INFO_SCALE), | ||
76 | .scan_index = 0, | 78 | .scan_index = 0, |
77 | .scan_type = { | 79 | .scan_type = { |
78 | .sign = 'u', | 80 | .sign = 'u', |
@@ -181,7 +183,12 @@ static int as3935_read_raw(struct iio_dev *indio_dev, | |||
181 | /* storm out of range */ | 183 | /* storm out of range */ |
182 | if (*val == AS3935_DATA_MASK) | 184 | if (*val == AS3935_DATA_MASK) |
183 | return -EINVAL; | 185 | return -EINVAL; |
184 | *val *= 1000; | 186 | |
187 | if (m == IIO_CHAN_INFO_PROCESSED) | ||
188 | *val *= 1000; | ||
189 | break; | ||
190 | case IIO_CHAN_INFO_SCALE: | ||
191 | *val = 1000; | ||
185 | break; | 192 | break; |
186 | default: | 193 | default: |
187 | return -EINVAL; | 194 | return -EINVAL; |
@@ -206,10 +213,10 @@ static irqreturn_t as3935_trigger_handler(int irq, void *private) | |||
206 | ret = as3935_read(st, AS3935_DATA, &val); | 213 | ret = as3935_read(st, AS3935_DATA, &val); |
207 | if (ret) | 214 | if (ret) |
208 | goto err_read; | 215 | goto err_read; |
209 | val &= AS3935_DATA_MASK; | ||
210 | val *= 1000; | ||
211 | 216 | ||
212 | iio_push_to_buffers_with_timestamp(indio_dev, &val, pf->timestamp); | 217 | st->buffer[0] = val & AS3935_DATA_MASK; |
218 | iio_push_to_buffers_with_timestamp(indio_dev, &st->buffer, | ||
219 | pf->timestamp); | ||
213 | err_read: | 220 | err_read: |
214 | iio_trigger_notify_done(indio_dev->trig); | 221 | iio_trigger_notify_done(indio_dev->trig); |
215 | 222 | ||
diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c index bbfee53cfcf5..845e49a52430 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | |||
@@ -2521,12 +2521,13 @@ kiblnd_passive_connect(struct rdma_cm_id *cmid, void *priv, int priv_nob) | |||
2521 | return 0; | 2521 | return 0; |
2522 | 2522 | ||
2523 | failed: | 2523 | failed: |
2524 | if (ni) | 2524 | if (ni) { |
2525 | lnet_ni_decref(ni); | 2525 | lnet_ni_decref(ni); |
2526 | rej.ibr_cp.ibcp_queue_depth = kiblnd_msg_queue_size(version, ni); | ||
2527 | rej.ibr_cp.ibcp_max_frags = kiblnd_rdma_frags(version, ni); | ||
2528 | } | ||
2526 | 2529 | ||
2527 | rej.ibr_version = version; | 2530 | rej.ibr_version = version; |
2528 | rej.ibr_cp.ibcp_queue_depth = kiblnd_msg_queue_size(version, ni); | ||
2529 | rej.ibr_cp.ibcp_max_frags = kiblnd_rdma_frags(version, ni); | ||
2530 | kiblnd_reject(cmid, &rej); | 2531 | kiblnd_reject(cmid, &rej); |
2531 | 2532 | ||
2532 | return -ECONNREFUSED; | 2533 | return -ECONNREFUSED; |
diff --git a/drivers/staging/rtl8188eu/core/rtw_efuse.c b/drivers/staging/rtl8188eu/core/rtw_efuse.c index c17870cddb5b..fbce1f7e68ca 100644 --- a/drivers/staging/rtl8188eu/core/rtw_efuse.c +++ b/drivers/staging/rtl8188eu/core/rtw_efuse.c | |||
@@ -102,7 +102,7 @@ efuse_phymap_to_logical(u8 *phymap, u16 _offset, u16 _size_byte, u8 *pbuf) | |||
102 | if (!efuseTbl) | 102 | if (!efuseTbl) |
103 | return; | 103 | return; |
104 | 104 | ||
105 | eFuseWord = (u16 **)rtw_malloc2d(EFUSE_MAX_SECTION_88E, EFUSE_MAX_WORD_UNIT, sizeof(*eFuseWord)); | 105 | eFuseWord = (u16 **)rtw_malloc2d(EFUSE_MAX_SECTION_88E, EFUSE_MAX_WORD_UNIT, sizeof(u16)); |
106 | if (!eFuseWord) { | 106 | if (!eFuseWord) { |
107 | DBG_88E("%s: alloc eFuseWord fail!\n", __func__); | 107 | DBG_88E("%s: alloc eFuseWord fail!\n", __func__); |
108 | goto eFuseWord_failed; | 108 | goto eFuseWord_failed; |
diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c b/drivers/staging/rtl8188eu/hal/usb_halinit.c index 87ea3b844951..363f3a34ddce 100644 --- a/drivers/staging/rtl8188eu/hal/usb_halinit.c +++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c | |||
@@ -2072,7 +2072,8 @@ void rtl8188eu_set_hal_ops(struct adapter *adapt) | |||
2072 | { | 2072 | { |
2073 | struct hal_ops *halfunc = &adapt->HalFunc; | 2073 | struct hal_ops *halfunc = &adapt->HalFunc; |
2074 | 2074 | ||
2075 | adapt->HalData = kzalloc(sizeof(*adapt->HalData), GFP_KERNEL); | 2075 | |
2076 | adapt->HalData = kzalloc(sizeof(struct hal_data_8188e), GFP_KERNEL); | ||
2076 | if (!adapt->HalData) | 2077 | if (!adapt->HalData) |
2077 | DBG_88E("cant not alloc memory for HAL DATA\n"); | 2078 | DBG_88E("cant not alloc memory for HAL DATA\n"); |
2078 | 2079 | ||
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h index d029ffac0d69..99403b19092f 100644 --- a/include/linux/iio/common/st_sensors.h +++ b/include/linux/iio/common/st_sensors.h | |||
@@ -223,6 +223,8 @@ struct st_sensor_settings { | |||
223 | * @get_irq_data_ready: Function to get the IRQ used for data ready signal. | 223 | * @get_irq_data_ready: Function to get the IRQ used for data ready signal. |
224 | * @tf: Transfer function structure used by I/O operations. | 224 | * @tf: Transfer function structure used by I/O operations. |
225 | * @tb: Transfer buffers and mutex used by I/O operations. | 225 | * @tb: Transfer buffers and mutex used by I/O operations. |
226 | * @hw_irq_trigger: if we're using the hardware interrupt on the sensor. | ||
227 | * @hw_timestamp: Latest timestamp from the interrupt handler, when in use. | ||
226 | */ | 228 | */ |
227 | struct st_sensor_data { | 229 | struct st_sensor_data { |
228 | struct device *dev; | 230 | struct device *dev; |
@@ -247,6 +249,9 @@ struct st_sensor_data { | |||
247 | 249 | ||
248 | const struct st_sensor_transfer_function *tf; | 250 | const struct st_sensor_transfer_function *tf; |
249 | struct st_sensor_transfer_buffer tb; | 251 | struct st_sensor_transfer_buffer tb; |
252 | |||
253 | bool hw_irq_trigger; | ||
254 | s64 hw_timestamp; | ||
250 | }; | 255 | }; |
251 | 256 | ||
252 | #ifdef CONFIG_IIO_BUFFER | 257 | #ifdef CONFIG_IIO_BUFFER |
@@ -260,7 +265,8 @@ int st_sensors_allocate_trigger(struct iio_dev *indio_dev, | |||
260 | const struct iio_trigger_ops *trigger_ops); | 265 | const struct iio_trigger_ops *trigger_ops); |
261 | 266 | ||
262 | void st_sensors_deallocate_trigger(struct iio_dev *indio_dev); | 267 | void st_sensors_deallocate_trigger(struct iio_dev *indio_dev); |
263 | 268 | int st_sensors_validate_device(struct iio_trigger *trig, | |
269 | struct iio_dev *indio_dev); | ||
264 | #else | 270 | #else |
265 | static inline int st_sensors_allocate_trigger(struct iio_dev *indio_dev, | 271 | static inline int st_sensors_allocate_trigger(struct iio_dev *indio_dev, |
266 | const struct iio_trigger_ops *trigger_ops) | 272 | const struct iio_trigger_ops *trigger_ops) |
@@ -271,6 +277,7 @@ static inline void st_sensors_deallocate_trigger(struct iio_dev *indio_dev) | |||
271 | { | 277 | { |
272 | return; | 278 | return; |
273 | } | 279 | } |
280 | #define st_sensors_validate_device NULL | ||
274 | #endif | 281 | #endif |
275 | 282 | ||
276 | int st_sensors_init_sensor(struct iio_dev *indio_dev, | 283 | int st_sensors_init_sensor(struct iio_dev *indio_dev, |