Skip to content

Commit 552edf8

Browse files
committed
Merge tag 'iio-for-4.9b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes: Second set of iio new device support, features and cleanups for the 4.9 cycle. New device support * ad8801 dac - new driver supporting ad8801 and ad8803 DACs. * adc12138 - new driver supporting TI adc12130/adc12132 and adc12138 ADCs. * ltc2485 adc - new driver * mxc6255 - add support for the mxc6225 part name and fixup the ID check so it works. * vz89x VOC sensor - add support for the vz89te part which drops the voc_short channel and adds CRCs compared to other supported parts. New features * core - immutable triggers. These effectively grant exclusive control over a trigger. The typical usecase is a device representing an analog part (perhaps a MUX) that needs to control the sampling of a downstream ADC. - resource managed trigger registration and triggered_buffer_init. - iio_push_event now protected against case of the event interface registration not having yet occured. Only matters if an interrupt can occur during this window - might happen on shared interrupt lines. - helper to let a driver query if the trigger it is using is provided by itself (using the convention of both device and trigger having the same parent). * tools - iio-utils. Used channel modifier scaling in preference to generic scaling when both exist. * at91-adc - Add support for touchscreen switches closure time needed by some newer parts. * stx104 - support the ADC channels on this ADC/DAC board. As these are the primary feature of the board also move the driver to the iio/adc directory. * sx9500 - device tree bindings. Cleanups / Fixes * ad5755 - fix an off-by-one on devnr limit check (introduced earlier this cycle) * ad7266 - drop NULL check on devm_regulator_get_optional as it can't return NULL. * ak8974 - avoid an unused functional warning due to rework in PM core code. - remove .owner field setting as done by i2c_core. * ina2xx - clear out a left over debug field from chip global data. * hid-sensors - avoid an unused functional warning due to rework in PM core code. * maxim-thermocouple - fix non static symbol warnings. * ms5611 - fetch and enable regulators unconditionally when they aren't optional. * sca3000 - whitespace cleanup. * st_sensors - fetch and enable regulators unconditionally rather than having them supported as optional regulators (missunderstanding on my part amongst others a while back) - followup to previous patch fixes error checking on the regulators. - mark symbols static where possible. - use the 'is it my trigger' help function. This prevents the odd case of another device triggering from the st-sensors trigger whilst the st-sensors trigger is itself not using it but rather using say an hrtimer. * ti-ads1015 - add missing of_node_put. * vz89x - rework to all support of new devices. - prevent reading of a corrupted buffer. - fixup a return value of 0/1 in a bool returning function. Address updates - Vlad Dogaru email address change.
2 parents d2f3e10 + 1696566 commit 552edf8

38 files changed

Lines changed: 1610 additions & 140 deletions

‎.mailmap‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
159159
Viresh Kumar <vireshk@kernel.org> <viresh.kumar@st.com>
160160
Viresh Kumar <vireshk@kernel.org> <viresh.linux@gmail.com>
161161
Viresh Kumar <vireshk@kernel.org> <viresh.kumar2@arm.com>
162+
Vlad Dogaru <ddvlad@gmail.com> <vlad.dogaru@intel.com>
162163
Vladimir Davydov <vdavydov.dev@gmail.com> <vdavydov@virtuozzo.com>
163164
Vladimir Davydov <vdavydov.dev@gmail.com> <vdavydov@parallels.com>
164165
Takashi YOSHII <takashi.yoshii.zj@renesas.com>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
* Texas Instruments' ADC12130/ADC12132/ADC12138
2+
3+
Required properties:
4+
- compatible: Should be one of
5+
* "ti,adc12130"
6+
* "ti,adc12132"
7+
* "ti,adc12138"
8+
- reg: SPI chip select number for the device
9+
- interrupts: Should contain interrupt for EOC (end of conversion)
10+
- clocks: phandle to conversion clock input
11+
- spi-max-frequency: Definision as per
12+
Documentation/devicetree/bindings/spi/spi-bus.txt
13+
- vref-p-supply: The regulator supply for positive analog voltage reference
14+
15+
Optional properties:
16+
- vref-n-supply: The regulator supply for negative analog voltage reference
17+
(Note that this must not go below GND or exceed vref-p)
18+
If not specified, this is assumed to be analog ground.
19+
- ti,acquisition-time: The number of conversion clock periods for the S/H's
20+
acquisition time. Should be one of 6, 10, 18, 34. If not specified,
21+
default value of 10 is used.
22+
For high source impedances, this value can be increased to 18 or 34.
23+
For less ADC accuracy and/or slower CCLK frequencies this value may be
24+
decreased to 6. See section 6.0 INPUT SOURCE RESISTANCE in the
25+
datasheet for details.
26+
27+
Example:
28+
adc@0 {
29+
compatible = "ti,adc12138";
30+
reg = <0>;
31+
interrupts = <28 IRQ_TYPE_EDGE_RISING>;
32+
interrupt-parent = <&gpio1>;
33+
clocks = <&cclk>;
34+
vref-p-supply = <&ldo4_reg>;
35+
spi-max-frequency = <5000000>;
36+
ti,acquisition-time = <6>;
37+
};
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Semtech's SX9500 capacitive proximity button device driver
2+
3+
Required properties:
4+
- compatible: must be "semtech,sx9500"
5+
- reg: i2c address where to find the device
6+
- interrupt-parent : should be the phandle for the interrupt controller
7+
- interrupts : the sole interrupt generated by the device
8+
9+
Refer to interrupt-controller/interrupts.txt for generic
10+
interrupt client node bindings.
11+
12+
Optional properties:
13+
- reset-gpios: Reference to the GPIO connected to the device's active
14+
low reset pin.
15+
16+
Example:
17+
18+
sx9500@28 {
19+
compatible = "semtech,sx9500";
20+
reg = <0x28>;
21+
interrupt-parent = <&gpio2>;
22+
interrupts = <16 IRQ_TYPE_LEVEL_LOW>;
23+
reset-gpios = <&gpio2 10 GPIO_ACTIVE_LOW>;
24+
};

‎Documentation/driver-model/devres.txt‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,12 @@ IIO
266266
devm_iio_device_unregister()
267267
devm_iio_kfifo_allocate()
268268
devm_iio_kfifo_free()
269+
devm_iio_triggered_buffer_setup()
270+
devm_iio_triggered_buffer_cleanup()
269271
devm_iio_trigger_alloc()
270272
devm_iio_trigger_free()
273+
devm_iio_trigger_register()
274+
devm_iio_trigger_unregister()
271275
devm_iio_channel_get()
272276
devm_iio_channel_release()
273277
devm_iio_channel_get_all()

‎MAINTAINERS‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -810,11 +810,11 @@ L: alsa-devel@alsa-project.org (moderated for non-subscribers)
810810
S: Maintained
811811
F: sound/aoa/
812812

813-
APEX EMBEDDED SYSTEMS STX104 DAC DRIVER
813+
APEX EMBEDDED SYSTEMS STX104 IIO DRIVER
814814
M: William Breathitt Gray <vilhelm.gray@gmail.com>
815815
L: linux-iio@vger.kernel.org
816816
S: Maintained
817-
F: drivers/iio/dac/stx104.c
817+
F: drivers/iio/adc/stx104.c
818818

819819
APM DRIVER
820820
M: Jiri Kosina <jikos@kernel.org>

‎drivers/iio/accel/mxc6255.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ static int mxc6255_probe(struct i2c_client *client,
154154
return ret;
155155
}
156156

157-
if (chip_id != MXC6255_CHIP_ID) {
157+
if ((chip_id & 0x1f) != MXC6255_CHIP_ID) {
158158
dev_err(&client->dev, "Invalid chip id %x\n", chip_id);
159159
return -ENODEV;
160160
}
@@ -171,12 +171,14 @@ static int mxc6255_probe(struct i2c_client *client,
171171
}
172172

173173
static const struct acpi_device_id mxc6255_acpi_match[] = {
174+
{"MXC6225", 0},
174175
{"MXC6255", 0},
175176
{ }
176177
};
177178
MODULE_DEVICE_TABLE(acpi, mxc6255_acpi_match);
178179

179180
static const struct i2c_device_id mxc6255_id[] = {
181+
{"mxc6225", 0},
180182
{"mxc6255", 0},
181183
{ }
182184
};

‎drivers/iio/adc/Kconfig‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,15 @@ config LPC18XX_ADC
264264
To compile this driver as a module, choose M here: the module will be
265265
called lpc18xx_adc.
266266

267+
config LTC2485
268+
tristate "Linear Technology LTC2485 ADC driver"
269+
depends on I2C
270+
help
271+
Say yes here to build support for Linear Technology LTC2485 ADC.
272+
273+
To compile this driver as a module, choose M here: the module will be
274+
called ltc2485.
275+
267276
config MAX1027
268277
tristate "Maxim max1027 ADC driver"
269278
depends on SPI
@@ -410,6 +419,21 @@ config ROCKCHIP_SARADC
410419
To compile this driver as a module, choose M here: the
411420
module will be called rockchip_saradc.
412421

422+
config STX104
423+
tristate "Apex Embedded Systems STX104 driver"
424+
depends on X86 && ISA_BUS_API
425+
select GPIOLIB
426+
help
427+
Say yes here to build support for the Apex Embedded Systems STX104
428+
integrated analog PC/104 card.
429+
430+
This driver supports the 16 channels of single-ended (8 channels of
431+
differential) analog inputs, 2 channels of analog output, 4 digital
432+
inputs, and 4 digital outputs provided by the STX104.
433+
434+
The base port addresses for the devices may be configured via the base
435+
array module parameter.
436+
413437
config TI_ADC081C
414438
tristate "Texas Instruments ADC081C/ADC101C/ADC121C family"
415439
depends on I2C
@@ -430,6 +454,18 @@ config TI_ADC0832
430454
This driver can also be built as a module. If so, the module will be
431455
called ti-adc0832.
432456

457+
config TI_ADC12138
458+
tristate "Texas Instruments ADC12130/ADC12132/ADC12138"
459+
depends on SPI
460+
select IIO_BUFFER
461+
select IIO_TRIGGERED_BUFFER
462+
help
463+
If you say yes here you get support for Texas Instruments ADC12130,
464+
ADC12132 and ADC12138 chips.
465+
466+
This driver can also be built as a module. If so, the module will be
467+
called ti-adc12138.
468+
433469
config TI_ADC128S052
434470
tristate "Texas Instruments ADC128S052/ADC122S021/ADC124S021"
435471
depends on SPI

‎drivers/iio/adc/Makefile‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ obj-$(CONFIG_IMX7D_ADC) += imx7d_adc.o
2727
obj-$(CONFIG_INA2XX_ADC) += ina2xx-adc.o
2828
obj-$(CONFIG_LP8788_ADC) += lp8788_adc.o
2929
obj-$(CONFIG_LPC18XX_ADC) += lpc18xx_adc.o
30+
obj-$(CONFIG_LTC2485) += ltc2485.o
3031
obj-$(CONFIG_MAX1027) += max1027.o
3132
obj-$(CONFIG_MAX1363) += max1363.o
3233
obj-$(CONFIG_MCP320X) += mcp320x.o
@@ -39,8 +40,10 @@ obj-$(CONFIG_PALMAS_GPADC) += palmas_gpadc.o
3940
obj-$(CONFIG_QCOM_SPMI_IADC) += qcom-spmi-iadc.o
4041
obj-$(CONFIG_QCOM_SPMI_VADC) += qcom-spmi-vadc.o
4142
obj-$(CONFIG_ROCKCHIP_SARADC) += rockchip_saradc.o
43+
obj-$(CONFIG_STX104) += stx104.o
4244
obj-$(CONFIG_TI_ADC081C) += ti-adc081c.o
4345
obj-$(CONFIG_TI_ADC0832) += ti-adc0832.o
46+
obj-$(CONFIG_TI_ADC12138) += ti-adc12138.o
4447
obj-$(CONFIG_TI_ADC128S052) += ti-adc128s052.o
4548
obj-$(CONFIG_TI_ADC161S626) += ti-adc161s626.o
4649
obj-$(CONFIG_TI_ADS1015) += ti-ads1015.o

‎drivers/iio/adc/ad7266.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ static int ad7266_probe(struct spi_device *spi)
481481
if (!st->fixed_addr)
482482
gpio_free_array(st->gpios, ARRAY_SIZE(st->gpios));
483483
error_disable_reg:
484-
if (!IS_ERR_OR_NULL(st->reg))
484+
if (!IS_ERR(st->reg))
485485
regulator_disable(st->reg);
486486

487487
return ret;
@@ -496,7 +496,7 @@ static int ad7266_remove(struct spi_device *spi)
496496
iio_triggered_buffer_cleanup(indio_dev);
497497
if (!st->fixed_addr)
498498
gpio_free_array(st->gpios, ARRAY_SIZE(st->gpios));
499-
if (!IS_ERR_OR_NULL(st->reg))
499+
if (!IS_ERR(st->reg))
500500
regulator_disable(st->reg);
501501

502502
return 0;

‎drivers/iio/adc/at91_adc.c‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
#define AT91_ADC_TSMR_TSAV (3 << 4) /* Averages samples */
114114
#define AT91_ADC_TSMR_TSAV_(x) ((x) << 4)
115115
#define AT91_ADC_TSMR_SCTIM (0x0f << 16) /* Switch closure time */
116+
#define AT91_ADC_TSMR_SCTIM_(x) ((x) << 16)
116117
#define AT91_ADC_TSMR_PENDBC (0x0f << 28) /* Pen Debounce time */
117118
#define AT91_ADC_TSMR_PENDBC_(x) ((x) << 28)
118119
#define AT91_ADC_TSMR_NOTSDMA (1 << 22) /* No Touchscreen DMA */
@@ -150,6 +151,7 @@
150151
#define MAX_RLPOS_BITS 10
151152
#define TOUCH_SAMPLE_PERIOD_US_RL 10000 /* 10ms, the SoC can't keep up with 2ms */
152153
#define TOUCH_SHTIM 0xa
154+
#define TOUCH_SCTIM_US 10 /* 10us for the Touchscreen Switches Closure Time */
153155

154156
/**
155157
* struct at91_adc_reg_desc - Various informations relative to registers
@@ -1001,7 +1003,9 @@ static void atmel_ts_close(struct input_dev *dev)
10011003

10021004
static int at91_ts_hw_init(struct at91_adc_state *st, u32 adc_clk_khz)
10031005
{
1006+
struct iio_dev *idev = iio_priv_to_dev(st);
10041007
u32 reg = 0;
1008+
u32 tssctim = 0;
10051009
int i = 0;
10061010

10071011
/* a Pen Detect Debounce Time is necessary for the ADC Touch to avoid
@@ -1034,11 +1038,20 @@ static int at91_ts_hw_init(struct at91_adc_state *st, u32 adc_clk_khz)
10341038
return 0;
10351039
}
10361040

1041+
/* Touchscreen Switches Closure time needed for allowing the value to
1042+
* stabilize.
1043+
* Switch Closure Time = (TSSCTIM * 4) ADCClock periods
1044+
*/
1045+
tssctim = DIV_ROUND_UP(TOUCH_SCTIM_US * adc_clk_khz / 1000, 4);
1046+
dev_dbg(&idev->dev, "adc_clk at: %d KHz, tssctim at: %d\n",
1047+
adc_clk_khz, tssctim);
1048+
10371049
if (st->touchscreen_type == ATMEL_ADC_TOUCHSCREEN_4WIRE)
10381050
reg = AT91_ADC_TSMR_TSMODE_4WIRE_PRESS;
10391051
else
10401052
reg = AT91_ADC_TSMR_TSMODE_5WIRE;
10411053

1054+
reg |= AT91_ADC_TSMR_SCTIM_(tssctim) & AT91_ADC_TSMR_SCTIM;
10421055
reg |= AT91_ADC_TSMR_TSAV_(st->caps->ts_filter_average)
10431056
& AT91_ADC_TSMR_TSAV;
10441057
reg |= AT91_ADC_TSMR_PENDBC_(st->ts_pendbc) & AT91_ADC_TSMR_PENDBC;

0 commit comments

Comments
 (0)