History

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

Jonathan writes: First round of IIO fixes for the 4.8 cycle. This is somewhat of a bumper set due to my unavailabilty earlier in the month. The only slightly unusual ones are the dts updates for the rockchip adc reset. The fix in the driver only makes sense with these and the rockchip maintainer is happy with them going through IIO to reach mainline. Core stuff * Fix an issue with a blocking op when !TASK_RUNNING. This been there a while and snuck in with seemingly minor additions to some core code paths. * Tools - generic_buffer failed to initialize the channel array pointer thus in the case of no channels blows up trying to free a random memory address. * sw-trigger: - Fix config group initialization when configfs is built as a module. Drivers * ad5933 - Fix an incorrect overwrite of an error value. * ad799x - A missed assignment of the update_scan_mode callback means buffered mode doesn't work on the ad7991, ad7995 or ad7999. * ads1015 - wrong pointer returned from i2c_get_clientdata (missmatch of assumptions) * am2315 - Timestamps are reported, but never actually acquired from anywhere (so always 0) - missing buffer selects in Kconfig * am335x adc - Protect fifo1 from concurrent access. - Increase timeout waiting for ADC to be long enough in all cases. * as3935 - Timestamps are reported, but never actually acquired from anywhere (so always 0) * at91 - Fix reading of channel 3. * atlas-ph-sensor - Typo means that the scale of electrical conductivity readings is way off. * bma220 - Timestamps are reported, but never actually acquired from anywhere (so always 0) - Missing buffer selects in Kconfig * bmp280 - pass the write pointer to PTR_ERR (i.e. the one that was just checked with IS_ERR). - suspend /resume crash due to wrong assumption about what dev_get_drvdata would return. * hdc100x - It superficially appeared that smbus_read_byte commands would allow reading of the outputs in two goes. In reality it doesn't work, but instead returns the same for the upper and lower bytes (nice catch from Alison!) * kxsd9 - Fix raw read return value to ensure it actually reports the value rather than a blank string. * max44000 - Missing buffer selects in Kconfig * rockchip_saradc - Add use of reset controller to enforce a clean state of the ADC. Some bootloaders can leave it in an 'intersting' state and effectively frozen without this. A couple of associated dts updates. * stk8ba50 - Missing buffer selects in Kconfig * stx104 - Fix a possible race due to use of devm_iio_device_register when there was other stuff in the remove function.

Greg Kroah-Hartman committed 10 years ago

Commit eafe5cf2 parents c0678b2 3d4267a27 files · +141 −57Browse files

Unified · Split

27 files
  1. Documentation/devicetree/bindings/iio/adc/rockchip-saradc.txt +7 −0
  2. arch/arm/boot/dts/rk3066a.dtsi +2 −0
  3. arch/arm/boot/dts/rk3288.dtsi +2 −0
  4. arch/arm/boot/dts/rk3xxx.dtsi +2 −0
  5. arch/arm64/boot/dts/rockchip/rk3368.dtsi +2 −0
  6. drivers/iio/accel/Kconfig +4 −1
  7. drivers/iio/accel/bma220_spi.c +1 −1
  8. drivers/iio/accel/kxsd9.c +1 −0
  9. drivers/iio/adc/Kconfig +1 −0
  10. drivers/iio/adc/ad799x.c +1 −0
  11. drivers/iio/adc/at91_adc.c +2 −2
  12. drivers/iio/adc/rockchip_saradc.c +30 −0
  13. drivers/iio/adc/ti-ads1015.c +2 −1
  14. drivers/iio/adc/ti_am335x_adc.c +12 −4
  15. drivers/iio/chemical/atlas-ph-sensor.c +1 −1
  16. drivers/iio/dac/stx104.c +29 −9
  17. drivers/iio/humidity/Kconfig +2 −0
  18. drivers/iio/humidity/am2315.c +1 −1
  19. drivers/iio/humidity/hdc100x.c +7 −20
  20. drivers/iio/industrialio-buffer.c +17 −6
  21. drivers/iio/light/Kconfig +2 −0
  22. drivers/iio/pressure/bmp280-core.c +5 −3
  23. drivers/iio/proximity/as3935.c +1 −1
  24. drivers/staging/iio/impedance-analyzer/ad5933.c +1 −1
  25. include/linux/iio/sw_trigger.h +1 −1
  26. include/linux/mfd/ti_am335x_tscadc.h +4 −4
  27. tools/iio/iio_generic_buffer.c +1 −1
Documentation/devicetree/bindings/iio/adc/rockchip-saradc.txt+7−0
@@ -16,6 +16,11 @@ Required properties: · 15 unmodified lines
1616 - vref-supply: The regulator supply ADC reference voltage.
1717 - #io-channel-cells: Should be 1, see ../iio-bindings.txt
1818
19+Optional properties:
20+- resets: Must contain an entry for each entry in reset-names if need support
21+ this option. See ../reset/reset.txt for details.
22+- reset-names: Must include the name "saradc-apb".
23+
1924 Example:
2025 saradc: saradc@2006c000 {
2126 compatible = "rockchip,saradc";
@@ -23,6 +28,8 @@ Example: · 1 unmodified line
2328 interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>;
2429 clocks = <&cru SCLK_SARADC>, <&cru PCLK_SARADC>;
2530 clock-names = "saradc", "apb_pclk";
31+ resets = <&cru SRST_SARADC>;
32+ reset-names = "saradc-apb";
2633 #io-channel-cells = <1>;
2734 vref-supply = <&vcc18>;
2835 };
arch/arm/boot/dts/rk3066a.dtsi+2−0
@@ -197,6 +197,8 @@ · 196 unmodified lines
197197 clock-names = "saradc", "apb_pclk";
198198 interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>;
199199 #io-channel-cells = <1>;
200+ resets = <&cru SRST_SARADC>;
201+ reset-names = "saradc-apb";
200202 status = "disabled";
201203 };
202204
arch/arm/boot/dts/rk3288.dtsi+2−0
@@ -279,6 +279,8 @@ · 278 unmodified lines
279279 #io-channel-cells = <1>;
280280 clocks = <&cru SCLK_SARADC>, <&cru PCLK_SARADC>;
281281 clock-names = "saradc", "apb_pclk";
282+ resets = <&cru SRST_SARADC>;
283+ reset-names = "saradc-apb";
282284 status = "disabled";
283285 };
284286
arch/arm/boot/dts/rk3xxx.dtsi+2−0
@@ -399,6 +399,8 @@ · 398 unmodified lines
399399 #io-channel-cells = <1>;
400400 clocks = <&cru SCLK_SARADC>, <&cru PCLK_SARADC>;
401401 clock-names = "saradc", "apb_pclk";
402+ resets = <&cru SRST_SARADC>;
403+ reset-names = "saradc-apb";
402404 status = "disabled";
403405 };
404406
arch/arm64/boot/dts/rockchip/rk3368.dtsi+2−0
@@ -270,6 +270,8 @@ · 269 unmodified lines
270270 #io-channel-cells = <1>;
271271 clocks = <&cru SCLK_SARADC>, <&cru PCLK_SARADC>;
272272 clock-names = "saradc", "apb_pclk";
273+ resets = <&cru SRST_SARADC>;
274+ reset-names = "saradc-apb";
273275 status = "disabled";
274276 };
275277
drivers/iio/accel/Kconfig+4−1
@@ -20,6 +20,8 @@ config BMA180 · 19 unmodified lines
2020 config BMA220
2121 tristate "Bosch BMA220 3-Axis Accelerometer Driver"
2222 depends on SPI
23+ select IIO_BUFFER
24+ select IIO_TRIGGERED_BUFFER
2325 help
2426 Say yes here to add support for the Bosch BMA220 triaxial
2527 acceleration sensor.
@@ -234,7 +236,8 @@ config STK8312 · 208 unmodified lines
234236 config STK8BA50
235237 tristate "Sensortek STK8BA50 3-Axis Accelerometer Driver"
236238 depends on I2C
237− depends on IIO_TRIGGER
239+ select IIO_BUFFER
240+ select IIO_TRIGGERED_BUFFER
238241 help
239242 Say yes here to get support for the Sensortek STK8BA50 3-axis
240243 accelerometer.
drivers/iio/accel/bma220_spi.c+1−1
@@ -253,7 +253,7 @@ static int bma220_probe(struct spi_device *spi) · 252 unmodified lines
253253 if (ret < 0)
254254 return ret;
255255
256− ret = iio_triggered_buffer_setup(indio_dev, NULL,
256+ ret = iio_triggered_buffer_setup(indio_dev, iio_pollfunc_store_time,
257257 bma220_trigger_handler, NULL);
258258 if (ret < 0) {
259259 dev_err(&spi->dev, "iio triggered buffer setup failed\n");
drivers/iio/accel/kxsd9.c+1−0
@@ -160,6 +160,7 @@ static int kxsd9_read_raw(struct iio_dev *indio_dev, · 159 unmodified lines
160160 if (ret < 0)
161161 goto error_ret;
162162 *val = ret;
163+ ret = IIO_VAL_INT;
163164 break;
164165 case IIO_CHAN_INFO_SCALE:
165166 ret = spi_w8r8(st->us, KXSD9_READ(KXSD9_REG_CTRL_C));
drivers/iio/adc/Kconfig+1−0
@@ -389,6 +389,7 @@ config QCOM_SPMI_VADC · 388 unmodified lines
389389 config ROCKCHIP_SARADC
390390 tristate "Rockchip SARADC driver"
391391 depends on ARCH_ROCKCHIP || (ARM && COMPILE_TEST)
392+ depends on RESET_CONTROLLER
392393 help
393394 Say yes here to build support for the SARADC found in SoCs from
394395 Rockchip.
drivers/iio/adc/ad799x.c+1−0
@@ -527,6 +527,7 @@ static struct attribute_group ad799x_event_attrs_group = { · 526 unmodified lines
527527 static const struct iio_info ad7991_info = {
528528 .read_raw = &ad799x_read_raw,
529529 .driver_module = THIS_MODULE,
530+ .update_scan_mode = ad799x_update_scan_mode,
530531 };
531532
532533 static const struct iio_info ad7993_4_7_8_noirq_info = {
drivers/iio/adc/at91_adc.c+2−2
@@ -381,8 +381,8 @@ static irqreturn_t at91_adc_rl_interrupt(int irq, void *private) · 380 unmodified lines
381381 st->ts_bufferedmeasure = false;
382382 input_report_key(st->ts_input, BTN_TOUCH, 0);
383383 input_sync(st->ts_input);
384− } else if (status & AT91_ADC_EOC(3)) {
385− /* Conversion finished */
384+ } else if (status & AT91_ADC_EOC(3) && st->ts_input) {
385+ /* Conversion finished and we've a touchscreen */
386386 if (st->ts_bufferedmeasure) {
387387 /*
388388 * Last measurement is always discarded, since it can
drivers/iio/adc/rockchip_saradc.c+30−0
@@ -21,6 +21,8 @@ · 20 unmodified lines
2121 #include <linux/of_device.h>
2222 #include <linux/clk.h>
2323 #include <linux/completion.h>
24+#include <linux/delay.h>
25+#include <linux/reset.h>
2426 #include <linux/regulator/consumer.h>
2527 #include <linux/iio/iio.h>
2628
@@ -53,6 +55,7 @@ struct rockchip_saradc { · 26 unmodified lines
5355 struct clk *clk;
5456 struct completion completion;
5557 struct regulator *vref;
58+ struct reset_control *reset;
5659 const struct rockchip_saradc_data *data;
5760 u16 last_val;
5861 };
@@ -190,6 +193,16 @@ static const struct of_device_id rockchip_saradc_match[] = { · 131 unmodified lines
190193 };
191194 MODULE_DEVICE_TABLE(of, rockchip_saradc_match);
192195
196+/**
197+ * Reset SARADC Controller.
198+ */
199+static void rockchip_saradc_reset_controller(struct reset_control *reset)
200+{
201+ reset_control_assert(reset);
202+ usleep_range(10, 20);
203+ reset_control_deassert(reset);
204+}
205+
193206 static int rockchip_saradc_probe(struct platform_device *pdev)
194207 {
195208 struct rockchip_saradc *info = NULL;
@@ -218,6 +231,20 @@ static int rockchip_saradc_probe(struct platform_device *pdev) · 22 unmodified lines
218231 if (IS_ERR(info->regs))
219232 return PTR_ERR(info->regs);
220233
234+ /*
235+ * The reset should be an optional property, as it should work
236+ * with old devicetrees as well
237+ */
238+ info->reset = devm_reset_control_get(&pdev->dev, "saradc-apb");
239+ if (IS_ERR(info->reset)) {
240+ ret = PTR_ERR(info->reset);
241+ if (ret != -ENOENT)
242+ return ret;
243+
244+ dev_dbg(&pdev->dev, "no reset control found\n");
245+ info->reset = NULL;
246+ }
247+
221248 init_completion(&info->completion);
222249
223250 irq = platform_get_irq(pdev, 0);
@@ -252,6 +279,9 @@ static int rockchip_saradc_probe(struct platform_device *pdev) · 28 unmodified lines
252279 return PTR_ERR(info->vref);
253280 }
254281
282+ if (info->reset)
283+ rockchip_saradc_reset_controller(info->reset);
284+
255285 /*
256286 * Use a default value for the converter clock.
257287 * This may become user-configurable in the future.
drivers/iio/adc/ti-ads1015.c+2−1
@@ -489,7 +489,8 @@ static struct iio_info ads1115_info = { · 488 unmodified lines
489489 #ifdef CONFIG_OF
490490 static int ads1015_get_channels_config_of(struct i2c_client *client)
491491 {
492− struct ads1015_data *data = i2c_get_clientdata(client);
492+ struct iio_dev *indio_dev = i2c_get_clientdata(client);
493+ struct ads1015_data *data = iio_priv(indio_dev);
493494 struct device_node *node;
494495
495496 if (!client->dev.of_node ||
drivers/iio/adc/ti_am335x_adc.c+12−4
@@ -32,6 +32,7 @@ · 31 unmodified lines
3232
3333 struct tiadc_device {
3434 struct ti_tscadc_dev *mfd_tscadc;
35+ struct mutex fifo1_lock; /* to protect fifo access */
3536 int channels;
3637 u8 channel_line[8];
3738 u8 channel_step[8];
@@ -359,6 +360,7 @@ static int tiadc_read_raw(struct iio_dev *indio_dev, · 321 unmodified lines
359360 int *val, int *val2, long mask)
360361 {
361362 struct tiadc_device *adc_dev = iio_priv(indio_dev);
363+ int ret = IIO_VAL_INT;
362364 int i, map_val;
363365 unsigned int fifo1count, read, stepid;
364366 bool found = false;
@@ -372,13 +374,14 @@ static int tiadc_read_raw(struct iio_dev *indio_dev, · 7 unmodified lines
372374 if (!step_en)
373375 return -EINVAL;
374376
377+ mutex_lock(&adc_dev->fifo1_lock);
375378 fifo1count = tiadc_readl(adc_dev, REG_FIFO1CNT);
376379 while (fifo1count--)
377380 tiadc_readl(adc_dev, REG_FIFO1);
378381
379382 am335x_tsc_se_set_once(adc_dev->mfd_tscadc, step_en);
380383
381− timeout = jiffies + usecs_to_jiffies
384+ timeout = jiffies + msecs_to_jiffies
382385 (IDLE_TIMEOUT * adc_dev->channels);
383386 /* Wait for Fifo threshold interrupt */
384387 while (1) {
@@ -388,7 +391,8 @@ static int tiadc_read_raw(struct iio_dev *indio_dev, · 3 unmodified lines
388391
389392 if (time_after(jiffies, timeout)) {
390393 am335x_tsc_se_adc_done(adc_dev->mfd_tscadc);
391− return -EAGAIN;
394+ ret = -EAGAIN;
395+ goto err_unlock;
392396 }
393397 }
394398 map_val = adc_dev->channel_step[chan->scan_index];
@@ -414,8 +418,11 @@ static int tiadc_read_raw(struct iio_dev *indio_dev, · 19 unmodified lines
414418 am335x_tsc_se_adc_done(adc_dev->mfd_tscadc);
415419
416420 if (found == false)
417− return -EBUSY;
418− return IIO_VAL_INT;
421+ ret = -EBUSY;
422+
423+err_unlock:
424+ mutex_unlock(&adc_dev->fifo1_lock);
425+ return ret;
419426 }
420427
421428 static const struct iio_info tiadc_info = {
@@ -483,6 +490,7 @@ static int tiadc_probe(struct platform_device *pdev) · 61 unmodified lines
483490
484491 tiadc_step_config(indio_dev);
485492 tiadc_writel(adc_dev, REG_FIFO1THR, FIFO1_THRESHOLD);
493+ mutex_init(&adc_dev->fifo1_lock);
486494
487495 err = tiadc_channel_init(indio_dev, adc_dev->channels);
488496 if (err < 0)
drivers/iio/chemical/atlas-ph-sensor.c+1−1
@@ -434,7 +434,7 @@ static int atlas_read_raw(struct iio_dev *indio_dev, · 433 unmodified lines
434434 break;
435435 case IIO_ELECTRICALCONDUCTIVITY:
436436 *val = 1; /* 0.00001 */
437− *val = 100000;
437+ *val2 = 100000;
438438 break;
439439 case IIO_CONCENTRATION:
440440 *val = 0; /* 0.000000001 */
drivers/iio/dac/stx104.c+29−9
@@ -65,6 +65,16 @@ struct stx104_gpio { · 64 unmodified lines
6565 unsigned int out_state;
6666 };
6767
68+/**
69+ * struct stx104_dev - STX104 device private data structure
70+ * @indio_dev: IIO device
71+ * @chip: instance of the gpio_chip
72+ */
73+struct stx104_dev {
74+ struct iio_dev *indio_dev;
75+ struct gpio_chip *chip;
76+};
77+
6878 static int stx104_read_raw(struct iio_dev *indio_dev,
6979 struct iio_chan_spec const *chan, int *val, int *val2, long mask)
7080 {
@@ -107,6 +117,7 @@ static const struct iio_chan_spec stx104_channels[STX104_NUM_CHAN] = { · 36 unmodified lines
107117 static int stx104_gpio_get_direction(struct gpio_chip *chip,
108118 unsigned int offset)
109119 {
120+ /* GPIO 0-3 are input only, while the rest are output only */
110121 if (offset < 4)
111122 return 1;
112123
@@ -169,6 +180,7 @@ static int stx104_probe(struct device *dev, unsigned int id) · 56 unmodified lines
169180 struct iio_dev *indio_dev;
170181 struct stx104_iio *priv;
171182 struct stx104_gpio *stx104gpio;
183+ struct stx104_dev *stx104dev;
172184 int err;
173185
174186 indio_dev = devm_iio_device_alloc(dev, sizeof(*priv));
@@ -179,6 +191,10 @@ static int stx104_probe(struct device *dev, unsigned int id) · 4 unmodified lines
179191 if (!stx104gpio)
180192 return -ENOMEM;
181193
194+ stx104dev = devm_kzalloc(dev, sizeof(*stx104dev), GFP_KERNEL);
195+ if (!stx104dev)
196+ return -ENOMEM;
197+
182198 if (!devm_request_region(dev, base[id], STX104_EXTENT,
183199 dev_name(dev))) {
184200 dev_err(dev, "Unable to lock port addresses (0x%X-0x%X)\n",
@@ -199,12 +215,6 @@ static int stx104_probe(struct device *dev, unsigned int id) · 14 unmodified lines
199215 outw(0, base[id] + 4);
200216 outw(0, base[id] + 6);
201217
202− err = devm_iio_device_register(dev, indio_dev);
203− if (err) {
204− dev_err(dev, "IIO device registering failed (%d)\n", err);
205− return err;
206− }
207−
208218 stx104gpio->chip.label = dev_name(dev);
209219 stx104gpio->chip.parent = dev;
210220 stx104gpio->chip.owner = THIS_MODULE;
@@ -220,7 +230,9 @@ static int stx104_probe(struct device *dev, unsigned int id) · 9 unmodified lines
220230
221231 spin_lock_init(&stx104gpio->lock);
222232
223− dev_set_drvdata(dev, stx104gpio);
233+ stx104dev->indio_dev = indio_dev;
234+ stx104dev->chip = &stx104gpio->chip;
235+ dev_set_drvdata(dev, stx104dev);
224236
225237 err = gpiochip_add_data(&stx104gpio->chip, stx104gpio);
226238 if (err) {
@@ -228,14 +240,22 @@ static int stx104_probe(struct device *dev, unsigned int id) · 1 unmodified line
228240 return err;
229241 }
230242
243+ err = iio_device_register(indio_dev);
244+ if (err) {
245+ dev_err(dev, "IIO device registering failed (%d)\n", err);
246+ gpiochip_remove(&stx104gpio->chip);
247+ return err;
248+ }
249+
231250 return 0;
232251 }
233252
234253 static int stx104_remove(struct device *dev, unsigned int id)
235254 {
236− struct stx104_gpio *const stx104gpio = dev_get_drvdata(dev);
255+ struct stx104_dev *const stx104dev = dev_get_drvdata(dev);
237256
238− gpiochip_remove(&stx104gpio->chip);
257+ iio_device_unregister(stx104dev->indio_dev);
258+ gpiochip_remove(stx104dev->chip);
239259
240260 return 0;
241261 }
drivers/iio/humidity/Kconfig+2−0
@@ -6,6 +6,8 @@ menu "Humidity sensors" · 5 unmodified lines
66 config AM2315
77 tristate "Aosong AM2315 relative humidity and temperature sensor"
88 depends on I2C
9+ select IIO_BUFFER
10+ select IIO_TRIGGERED_BUFFER
911 help
1012 If you say yes here you get support for the Aosong AM2315
1113 relative humidity and ambient temperature sensor.
drivers/iio/humidity/am2315.c+1−1
@@ -244,7 +244,7 @@ static int am2315_probe(struct i2c_client *client, · 243 unmodified lines
244244 indio_dev->channels = am2315_channels;
245245 indio_dev->num_channels = ARRAY_SIZE(am2315_channels);
246246
247− ret = iio_triggered_buffer_setup(indio_dev, NULL,
247+ ret = iio_triggered_buffer_setup(indio_dev, iio_pollfunc_store_time,
248248 am2315_trigger_handler, NULL);
249249 if (ret < 0) {
250250 dev_err(&client->dev, "iio triggered buffer setup failed\n");
drivers/iio/humidity/hdc100x.c+7−20
@@ -142,7 +142,7 @@ static int hdc100x_get_measurement(struct hdc100x_data *data, · 141 unmodified lines
142142 struct i2c_client *client = data->client;
143143 int delay = data->adc_int_us[chan->address];
144144 int ret;
145− int val;
145+ __be16 val;
146146
147147 /* start measurement */
148148 ret = i2c_smbus_write_byte(client, chan->address);
@@ -154,26 +154,13 @@ static int hdc100x_get_measurement(struct hdc100x_data *data, · 5 unmodified lines
154154 /* wait for integration time to pass */
155155 usleep_range(delay, delay + 1000);
156156
157− /*
158− * i2c_smbus_read_word_data cannot() be used here due to the command
159− * value not being understood and causes NAKs preventing any reading
160− * from being accessed.
161− */
162− ret = i2c_smbus_read_byte(client);
157+ /* read measurement */
158+ ret = i2c_master_recv(data->client, (char *)&val, sizeof(val));
163159 if (ret < 0) {
164− dev_err(&client->dev, "cannot read high byte measurement");
160+ dev_err(&client->dev, "cannot read sensor data\n");
165161 return ret;
166162 }
167− val = ret << 8;
168−
169− ret = i2c_smbus_read_byte(client);
170− if (ret < 0) {
171− dev_err(&client->dev, "cannot read low byte measurement");
172− return ret;
173− }
174− val |= ret;
175−
176− return val;
163+ return be16_to_cpu(val);
177164 }
178165
179166 static int hdc100x_get_heater_status(struct hdc100x_data *data)
@@ -272,8 +259,8 @@ static int hdc100x_probe(struct i2c_client *client, · 92 unmodified lines
272259 struct iio_dev *indio_dev;
273260 struct hdc100x_data *data;
274261
275− if (!i2c_check_functionality(client->adapter,
276− I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_BYTE))
262+ if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA |
263+ I2C_FUNC_SMBUS_BYTE | I2C_FUNC_I2C))
277264 return -EOPNOTSUPP;
278265
279266 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
drivers/iio/industrialio-buffer.c+17−6
@@ -107,6 +107,7 @@ ssize_t iio_buffer_read_first_n_outer(struct file *filp, char __user *buf, · 106 unmodified lines
107107 {
108108 struct iio_dev *indio_dev = filp->private_data;
109109 struct iio_buffer *rb = indio_dev->buffer;
110+ DEFINE_WAIT_FUNC(wait, woken_wake_function);
110111 size_t datum_size;
111112 size_t to_wait;
112113 int ret;
@@ -131,19 +132,29 @@ ssize_t iio_buffer_read_first_n_outer(struct file *filp, char __user *buf, · 18 unmodified lines
131132 else
132133 to_wait = min_t(size_t, n / datum_size, rb->watermark);
133134
135+ add_wait_queue(&rb->pollq, &wait);
134136 do {
135− ret = wait_event_interruptible(rb->pollq,
136− iio_buffer_ready(indio_dev, rb, to_wait, n / datum_size));
137− if (ret)
138− return ret;
137+ if (!indio_dev->info) {
138+ ret = -ENODEV;
139+ break;
140+ }
139141
140− if (!indio_dev->info)
141− return -ENODEV;
142+ if (!iio_buffer_ready(indio_dev, rb, to_wait, n / datum_size)) {
143+ if (signal_pending(current)) {
144+ ret = -ERESTARTSYS;
145+ break;
146+ }
147+
148+ wait_woken(&wait, TASK_INTERRUPTIBLE,
149+ MAX_SCHEDULE_TIMEOUT);
150+ continue;
151+ }
142152
143153 ret = rb->access->read_first_n(rb, n, buf);
144154 if (ret == 0 && (filp->f_flags & O_NONBLOCK))
145155 ret = -EAGAIN;
146156 } while (ret == 0);
157+ remove_wait_queue(&rb->pollq, &wait);
147158
148159 return ret;
149160 }
drivers/iio/light/Kconfig+2−0
@@ -238,6 +238,8 @@ config MAX44000 · 237 unmodified lines
238238 tristate "MAX44000 Ambient and Infrared Proximity Sensor"
239239 depends on I2C
240240 select REGMAP_I2C
241+ select IIO_BUFFER
242+ select IIO_TRIGGERED_BUFFER
241243 help
242244 Say Y here if you want to build support for Maxim Integrated's
243245 MAX44000 ambient and infrared proximity sensor device.
drivers/iio/pressure/bmp280-core.c+5−3
@@ -970,7 +970,7 @@ int bmp280_common_probe(struct device *dev, · 969 unmodified lines
970970 data->vdda = devm_regulator_get(dev, "vdda");
971971 if (IS_ERR(data->vdda)) {
972972 dev_err(dev, "failed to get VDDA regulator\n");
973− ret = PTR_ERR(data->vddd);
973+ ret = PTR_ERR(data->vdda);
974974 goto out_disable_vddd;
975975 }
976976 ret = regulator_enable(data->vdda);
@@ -1079,7 +1079,8 @@ EXPORT_SYMBOL(bmp280_common_remove); · 102 unmodified lines
10791079 #ifdef CONFIG_PM
10801080 static int bmp280_runtime_suspend(struct device *dev)
10811081 {
1082− struct bmp280_data *data = dev_get_drvdata(dev);
1082+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
1083+ struct bmp280_data *data = iio_priv(indio_dev);
10831084 int ret;
10841085
10851086 ret = regulator_disable(data->vdda);
@@ -1090,7 +1091,8 @@ static int bmp280_runtime_suspend(struct device *dev) · 4 unmodified lines
10901091
10911092 static int bmp280_runtime_resume(struct device *dev)
10921093 {
1093− struct bmp280_data *data = dev_get_drvdata(dev);
1094+ struct iio_dev *indio_dev = dev_get_drvdata(dev);
1095+ struct bmp280_data *data = iio_priv(indio_dev);
10941096 int ret;
10951097
10961098 ret = regulator_enable(data->vddd);
drivers/iio/proximity/as3935.c+1−1
@@ -397,7 +397,7 @@ static int as3935_probe(struct spi_device *spi) · 396 unmodified lines
397397 return ret;
398398 }
399399
400− ret = iio_triggered_buffer_setup(indio_dev, NULL,
400+ ret = iio_triggered_buffer_setup(indio_dev, iio_pollfunc_store_time,
401401 &as3935_trigger_handler, NULL);
402402
403403 if (ret) {
drivers/staging/iio/impedance-analyzer/ad5933.c+1−1
@@ -419,6 +419,7 @@ static ssize_t ad5933_store(struct device *dev, · 418 unmodified lines
419419 mutex_lock(&indio_dev->mlock);
420420 switch ((u32)this_attr->address) {
421421 case AD5933_OUT_RANGE:
422+ ret = -EINVAL;
422423 for (i = 0; i < 4; i++)
423424 if (val == st->range_avail[i]) {
424425 st->ctrl_hb &= ~AD5933_CTRL_RANGE(0x3);
@@ -426,7 +427,6 @@ static ssize_t ad5933_store(struct device *dev, · 1 unmodified line
426427 ret = ad5933_cmd(st, 0);
427428 break;
428429 }
429− ret = -EINVAL;
430430 break;
431431 case AD5933_IN_PGA_GAIN:
432432 if (sysfs_streq(buf, "1")) {
include/linux/iio/sw_trigger.h+1−1
@@ -62,7 +62,7 @@ void iio_swt_group_init_type_name(struct iio_sw_trigger *t, · 61 unmodified lines
6262 const char *name,
6363 struct config_item_type *type)
6464 {
65−#ifdef CONFIG_CONFIGFS_FS
65+#if IS_ENABLED(CONFIG_CONFIGFS_FS)
6666 config_group_init_type_name(&t->group, name, type);
6767 #endif
6868 }
include/linux/mfd/ti_am335x_tscadc.h+4−4
@@ -138,16 +138,16 @@ · 137 unmodified lines
138138 /*
139139 * time in us for processing a single channel, calculated as follows:
140140 *
141− * num cycles = open delay + (sample delay + conv time) * averaging
141+ * max num cycles = open delay + (sample delay + conv time) * averaging
142142 *
143− * num cycles: 152 + (1 + 13) * 16 = 376
143+ * max num cycles: 262143 + (255 + 13) * 16 = 266431
144144 *
145145 * clock frequency: 26MHz / 8 = 3.25MHz
146146 * clock period: 1 / 3.25MHz = 308ns
147147 *
148− * processing time: 376 * 308ns = 116us
148+ * max processing time: 266431 * 308ns = 83ms(approx)
149149 */
150−#define IDLE_TIMEOUT 116 /* microsec */
150+#define IDLE_TIMEOUT 83 /* milliseconds */
151151
152152 #define TSCADC_CELLS 2
153153
tools/iio/iio_generic_buffer.c+1−1
@@ -348,7 +348,7 @@ int main(int argc, char **argv) · 347 unmodified lines
348348 int notrigger = 0;
349349 char *dummy;
350350
351− struct iio_channel_info *channels;
351+ struct iio_channel_info *channels = NULL;
352352
353353 register_cleanup();
354354

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t