Skip to content

Commit ef994fd

Browse files
committed
Merge tag 'iio-for-3.10a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes: First set of IIO new drivers and cleanup for the 3.10 cycle. New stuff 1) Add OF support for specifying mappings between iio devices and their in kernel consumers. 2) Driver for AD7923 (extra functionality and support for ad7904, ad7914 and ad7924 added later in series) 3) Driver for Exynos adc (dt suppor for phy added later in series). 4) Make iio_push_event save IRQ context - necessary if it is to be used within an interrupt handler. Users of this functionality to follow. 5) For iio use the device tree node name to provide the hwmon name attribute if available. Removal and moves out of staging 1) Drop the adt7410 driver from IIO now that there is a hmwon driver with equivalent support. This device is very much targeted at hardware monitoring so hwmon is a more appropriate host for the driver. 2) Move iio_hwmon driver to drivers/hwmon. Cleanups 1) Minor cleanup in ST common library. 2) Large set of patches to break the info_mask element which previously used odd and even bits to specify if a channel attribute was either shared across similar channels or specific to only one. Now we have two bitmaps, one for those parameters that are specific to this channel and one for those shared by all channels with the same type as this one. This has no effect on the userspace abi. It simplifies the core code and provides more space for new channel parameters. It has been on the todo list for a long time! Conflicts: drivers/iio/dac/ad5064.c
2 parents 25eeb66 + 51b53dc commit ef994fd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+1715
-1710
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
Samsung Exynos Analog to Digital Converter bindings
2+
3+
This devicetree binding are for the new adc driver written fori
4+
Exynos4 and upward SoCs from Samsung.
5+
6+
New driver handles the following
7+
1. Supports ADC IF found on EXYNOS4412/EXYNOS5250
8+
and future SoCs from Samsung
9+
2. Add ADC driver under iio/adc framework
10+
3. Also adds the Documentation for device tree bindings
11+
12+
Required properties:
13+
- compatible: Must be "samsung,exynos-adc-v1"
14+
for exynos4412/5250 controllers.
15+
Must be "samsung,exynos-adc-v2" for
16+
future controllers.
17+
- reg: Contains ADC register address range (base address and
18+
length) and the address of the phy enable register.
19+
- interrupts: Contains the interrupt information for the timer. The
20+
format is being dependent on which interrupt controller
21+
the Samsung device uses.
22+
- #io-channel-cells = <1>; As ADC has multiple outputs
23+
24+
Note: child nodes can be added for auto probing from device tree.
25+
26+
Example: adding device info in dtsi file
27+
28+
adc: adc@12D10000 {
29+
compatible = "samsung,exynos-adc-v1";
30+
reg = <0x12D10000 0x100>, <0x10040718 0x4>;
31+
interrupts = <0 106 0>;
32+
#io-channel-cells = <1>;
33+
io-channel-ranges;
34+
};
35+
36+
37+
Example: Adding child nodes in dts file
38+
39+
adc@12D10000 {
40+
41+
/* NTC thermistor is a hwmon device */
42+
ncp15wb473@0 {
43+
compatible = "ntc,ncp15wb473";
44+
pullup-uV = <1800000>;
45+
pullup-ohm = <47000>;
46+
pulldown-ohm = <0>;
47+
io-channels = <&adc 4>;
48+
};
49+
};
50+
51+
Note: Does not apply to ADC driver under arch/arm/plat-samsung/
52+
Note: The child node can be added under the adc node or seperately.
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
This binding is derived from clock bindings, and based on suggestions
2+
from Lars-Peter Clausen [1].
3+
4+
Sources of IIO channels can be represented by any node in the device
5+
tree. Those nodes are designated as IIO providers. IIO consumer
6+
nodes use a phandle and IIO specifier pair to connect IIO provider
7+
outputs to IIO inputs. Similar to the gpio specifiers, an IIO
8+
specifier is an array of one or more cells identifying the IIO
9+
output on a device. The length of an IIO specifier is defined by the
10+
value of a #io-channel-cells property in the IIO provider node.
11+
12+
[1] http://marc.info/?l=linux-iio&m=135902119507483&w=2
13+
14+
==IIO providers==
15+
16+
Required properties:
17+
#io-channel-cells: Number of cells in an IIO specifier; Typically 0 for nodes
18+
with a single IIO output and 1 for nodes with multiple
19+
IIO outputs.
20+
21+
Example for a simple configuration with no trigger:
22+
23+
adc: voltage-sensor@35 {
24+
compatible = "maxim,max1139";
25+
reg = <0x35>;
26+
#io-channel-cells = <1>;
27+
};
28+
29+
Example for a configuration with trigger:
30+
31+
adc@35 {
32+
compatible = "some-vendor,some-adc";
33+
reg = <0x35>;
34+
35+
adc1: iio-device@0 {
36+
#io-channel-cells = <1>;
37+
/* other properties */
38+
};
39+
adc2: iio-device@1 {
40+
#io-channel-cells = <1>;
41+
/* other properties */
42+
};
43+
};
44+
45+
==IIO consumers==
46+
47+
Required properties:
48+
io-channels: List of phandle and IIO specifier pairs, one pair
49+
for each IIO input to the device. Note: if the
50+
IIO provider specifies '0' for #io-channel-cells,
51+
then only the phandle portion of the pair will appear.
52+
53+
Optional properties:
54+
io-channel-names:
55+
List of IIO input name strings sorted in the same
56+
order as the io-channels property. Consumers drivers
57+
will use io-channel-names to match IIO input names
58+
with IIO specifiers.
59+
io-channel-ranges:
60+
Empty property indicating that child nodes can inherit named
61+
IIO channels from this node. Useful for bus nodes to provide
62+
and IIO channel to their children.
63+
64+
For example:
65+
66+
device {
67+
io-channels = <&adc 1>, <&ref 0>;
68+
io-channel-names = "vcc", "vdd";
69+
};
70+
71+
This represents a device with two IIO inputs, named "vcc" and "vdd".
72+
The vcc channel is connected to output 1 of the &adc device, and the
73+
vdd channel is connected to output 0 of the &ref device.
74+
75+
==Example==
76+
77+
adc: max1139@35 {
78+
compatible = "maxim,max1139";
79+
reg = <0x35>;
80+
#io-channel-cells = <1>;
81+
};
82+
83+
...
84+
85+
iio_hwmon {
86+
compatible = "iio-hwmon";
87+
io-channels = <&adc 0>, <&adc 1>, <&adc 2>,
88+
<&adc 3>, <&adc 4>, <&adc 5>,
89+
<&adc 6>, <&adc 7>, <&adc 8>,
90+
<&adc 9>;
91+
};
92+
93+
some_consumer {
94+
compatible = "some-consumer";
95+
io-channels = <&adc 10>, <&adc 11>;
96+
io-channel-names = "adc1", "adc2";
97+
};

drivers/hwmon/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,15 @@ config SENSORS_IBMPEX
499499
This driver can also be built as a module. If so, the module
500500
will be called ibmpex.
501501

502+
config SENSORS_IIO_HWMON
503+
tristate "Hwmon driver that uses channels specified via iio maps"
504+
depends on IIO
505+
help
506+
This is a platform driver that in combination with a suitable
507+
map allows IIO devices to provide basic hwmon functionality
508+
for those channels specified in the map. This map can be provided
509+
either via platform data or the device tree bindings.
510+
502511
config SENSORS_IT87
503512
tristate "ITE IT87xx and compatibles"
504513
depends on !PPC

drivers/hwmon/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ obj-$(CONFIG_SENSORS_ULTRA45) += ultra45_env.o
6565
obj-$(CONFIG_SENSORS_I5K_AMB) += i5k_amb.o
6666
obj-$(CONFIG_SENSORS_IBMAEM) += ibmaem.o
6767
obj-$(CONFIG_SENSORS_IBMPEX) += ibmpex.o
68+
obj-$(CONFIG_SENSORS_IIO_HWMON) += iio_hwmon.o
6869
obj-$(CONFIG_SENSORS_INA209) += ina209.o
6970
obj-$(CONFIG_SENSORS_INA2XX) += ina2xx.o
7071
obj-$(CONFIG_SENSORS_IT87) += it87.o

drivers/staging/iio/iio_hwmon.c renamed to drivers/hwmon/iio_hwmon.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/err.h>
1414
#include <linux/platform_device.h>
1515
#include <linux/hwmon.h>
16+
#include <linux/of.h>
1617
#include <linux/hwmon-sysfs.h>
1718
#include <linux/iio/consumer.h>
1819
#include <linux/iio/types.h>
@@ -58,7 +59,12 @@ static ssize_t iio_hwmon_read_val(struct device *dev,
5859
static ssize_t show_name(struct device *dev, struct device_attribute *attr,
5960
char *buf)
6061
{
61-
return sprintf(buf, "iio_hwmon\n");
62+
const char *name = "iio_hwmon";
63+
64+
if (dev->of_node && dev->of_node->name)
65+
name = dev->of_node->name;
66+
67+
return sprintf(buf, "%s\n", name);
6268
}
6369

6470
static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);

drivers/iio/accel/hid-sensor-accel-3d.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,28 +60,28 @@ static const struct iio_chan_spec accel_3d_channels[] = {
6060
.type = IIO_ACCEL,
6161
.modified = 1,
6262
.channel2 = IIO_MOD_X,
63-
.info_mask = IIO_CHAN_INFO_OFFSET_SHARED_BIT |
64-
IIO_CHAN_INFO_SCALE_SHARED_BIT |
65-
IIO_CHAN_INFO_SAMP_FREQ_SHARED_BIT |
66-
IIO_CHAN_INFO_HYSTERESIS_SHARED_BIT,
63+
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) |
64+
BIT(IIO_CHAN_INFO_SCALE) |
65+
BIT(IIO_CHAN_INFO_SAMP_FREQ) |
66+
BIT(IIO_CHAN_INFO_HYSTERESIS),
6767
.scan_index = CHANNEL_SCAN_INDEX_X,
6868
}, {
6969
.type = IIO_ACCEL,
7070
.modified = 1,
7171
.channel2 = IIO_MOD_Y,
72-
.info_mask = IIO_CHAN_INFO_OFFSET_SHARED_BIT |
73-
IIO_CHAN_INFO_SCALE_SHARED_BIT |
74-
IIO_CHAN_INFO_SAMP_FREQ_SHARED_BIT |
75-
IIO_CHAN_INFO_HYSTERESIS_SHARED_BIT,
72+
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) |
73+
BIT(IIO_CHAN_INFO_SCALE) |
74+
BIT(IIO_CHAN_INFO_SAMP_FREQ) |
75+
BIT(IIO_CHAN_INFO_HYSTERESIS),
7676
.scan_index = CHANNEL_SCAN_INDEX_Y,
7777
}, {
7878
.type = IIO_ACCEL,
7979
.modified = 1,
8080
.channel2 = IIO_MOD_Z,
81-
.info_mask = IIO_CHAN_INFO_OFFSET_SHARED_BIT |
82-
IIO_CHAN_INFO_SCALE_SHARED_BIT |
83-
IIO_CHAN_INFO_SAMP_FREQ_SHARED_BIT |
84-
IIO_CHAN_INFO_HYSTERESIS_SHARED_BIT,
81+
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_OFFSET) |
82+
BIT(IIO_CHAN_INFO_SCALE) |
83+
BIT(IIO_CHAN_INFO_SAMP_FREQ) |
84+
BIT(IIO_CHAN_INFO_HYSTERESIS),
8585
.scan_index = CHANNEL_SCAN_INDEX_Z,
8686
}
8787
};

drivers/iio/accel/kxsd9.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,16 +177,16 @@ static int kxsd9_read_raw(struct iio_dev *indio_dev,
177177
.type = IIO_ACCEL, \
178178
.modified = 1, \
179179
.channel2 = IIO_MOD_##axis, \
180-
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \
181-
IIO_CHAN_INFO_SCALE_SHARED_BIT, \
180+
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
181+
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
182182
.address = KXSD9_REG_##axis, \
183183
}
184184

185185
static const struct iio_chan_spec kxsd9_channels[] = {
186186
KXSD9_ACCEL_CHAN(X), KXSD9_ACCEL_CHAN(Y), KXSD9_ACCEL_CHAN(Z),
187187
{
188188
.type = IIO_VOLTAGE,
189-
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT,
189+
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
190190
.indexed = 1,
191191
.address = KXSD9_REG_AUX,
192192
}

drivers/iio/adc/Kconfig

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,18 @@ config AD7298
3030
To compile this driver as a module, choose M here: the
3131
module will be called ad7298.
3232

33+
config AD7923
34+
tristate "Analog Devices AD7923 and similar ADCs driver"
35+
depends on SPI
36+
select IIO_BUFFER
37+
select IIO_TRIGGERED_BUFFER
38+
help
39+
Say yes here to build support for Analog Devices
40+
AD7904, AD7914, AD7923, AD7924 4 Channel ADCs.
41+
42+
To compile this driver as a module, choose M here: the
43+
module will be called ad7923.
44+
3345
config AD7791
3446
tristate "Analog Devices AD7791 ADC driver"
3547
depends on SPI
@@ -91,6 +103,14 @@ config AT91_ADC
91103
help
92104
Say yes here to build support for Atmel AT91 ADC.
93105

106+
config EXYNOS_ADC
107+
bool "Exynos ADC driver support"
108+
depends on OF
109+
help
110+
Core support for the ADC block found in the Samsung EXYNOS series
111+
of SoCs for drivers such as the touchscreen and hwmon to use to share
112+
this resource.
113+
94114
config LP8788_ADC
95115
bool "LP8788 ADC driver"
96116
depends on MFD_LP8788

drivers/iio/adc/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
obj-$(CONFIG_AD_SIGMA_DELTA) += ad_sigma_delta.o
66
obj-$(CONFIG_AD7266) += ad7266.o
77
obj-$(CONFIG_AD7298) += ad7298.o
8+
obj-$(CONFIG_AD7923) += ad7923.o
89
obj-$(CONFIG_AD7476) += ad7476.o
910
obj-$(CONFIG_AD7791) += ad7791.o
1011
obj-$(CONFIG_AD7793) += ad7793.o
1112
obj-$(CONFIG_AD7887) += ad7887.o
1213
obj-$(CONFIG_AT91_ADC) += at91_adc.o
14+
obj-$(CONFIG_EXYNOS_ADC) += exynos_adc.o
1315
obj-$(CONFIG_LP8788_ADC) += lp8788_adc.o
1416
obj-$(CONFIG_MAX1363) += max1363.o
1517
obj-$(CONFIG_TI_ADC081C) += ti-adc081c.o

drivers/iio/adc/ad7266.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,9 @@ static int ad7266_read_raw(struct iio_dev *indio_dev,
201201
.indexed = 1, \
202202
.channel = (_chan), \
203203
.address = (_chan), \
204-
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT \
205-
| IIO_CHAN_INFO_SCALE_SHARED_BIT \
206-
| IIO_CHAN_INFO_OFFSET_SHARED_BIT, \
204+
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
205+
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) \
206+
| BIT(IIO_CHAN_INFO_OFFSET), \
207207
.scan_index = (_chan), \
208208
.scan_type = { \
209209
.sign = (_sign), \
@@ -249,9 +249,9 @@ static AD7266_DECLARE_SINGLE_ENDED_CHANNELS_FIXED(s, 's');
249249
.channel = (_chan) * 2, \
250250
.channel2 = (_chan) * 2 + 1, \
251251
.address = (_chan), \
252-
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT \
253-
| IIO_CHAN_INFO_SCALE_SHARED_BIT \
254-
| IIO_CHAN_INFO_OFFSET_SHARED_BIT, \
252+
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
253+
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) \
254+
| BIT(IIO_CHAN_INFO_OFFSET), \
255255
.scan_index = (_chan), \
256256
.scan_type = { \
257257
.sign = _sign, \

drivers/iio/adc/ad7298.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ struct ad7298_state {
6363
.type = IIO_VOLTAGE, \
6464
.indexed = 1, \
6565
.channel = index, \
66-
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \
67-
IIO_CHAN_INFO_SCALE_SHARED_BIT, \
66+
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
67+
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
6868
.address = index, \
6969
.scan_index = index, \
7070
.scan_type = { \
@@ -80,9 +80,9 @@ static const struct iio_chan_spec ad7298_channels[] = {
8080
.type = IIO_TEMP,
8181
.indexed = 1,
8282
.channel = 0,
83-
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
84-
IIO_CHAN_INFO_SCALE_SEPARATE_BIT |
85-
IIO_CHAN_INFO_OFFSET_SEPARATE_BIT,
83+
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
84+
BIT(IIO_CHAN_INFO_SCALE) |
85+
BIT(IIO_CHAN_INFO_OFFSET),
8686
.address = AD7298_CH_TEMP,
8787
.scan_index = -1,
8888
.scan_type = {

drivers/iio/adc/ad7476.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,12 @@ static int ad7476_read_raw(struct iio_dev *indio_dev,
140140
return -EINVAL;
141141
}
142142

143-
#define _AD7476_CHAN(bits, _shift, _info_mask) \
143+
#define _AD7476_CHAN(bits, _shift, _info_mask_sep) \
144144
{ \
145145
.type = IIO_VOLTAGE, \
146146
.indexed = 1, \
147-
.info_mask = _info_mask | \
148-
IIO_CHAN_INFO_SCALE_SHARED_BIT, \
147+
.info_mask_separate = _info_mask_sep, \
148+
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
149149
.scan_type = { \
150150
.sign = 'u', \
151151
.realbits = (bits), \
@@ -156,9 +156,9 @@ static int ad7476_read_raw(struct iio_dev *indio_dev,
156156
}
157157

158158
#define AD7476_CHAN(bits) _AD7476_CHAN((bits), 13 - (bits), \
159-
IIO_CHAN_INFO_RAW_SEPARATE_BIT)
159+
BIT(IIO_CHAN_INFO_RAW))
160160
#define AD7940_CHAN(bits) _AD7476_CHAN((bits), 15 - (bits), \
161-
IIO_CHAN_INFO_RAW_SEPARATE_BIT)
161+
BIT(IIO_CHAN_INFO_RAW))
162162
#define AD7091R_CHAN(bits) _AD7476_CHAN((bits), 16 - (bits), 0)
163163

164164
static const struct ad7476_chip_info ad7476_chip_info_tbl[] = {

0 commit comments

Comments
 (0)