Skip to content

Commit db7c17e

Browse files
committed
Merge tag 'iio-for-3.17c' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes: 3rd round of IIO new drivers, cleanups and functionality for the 3.17 cycle. New drivers * isl29125 digital color light sensor driver * TAOS/AMS tcs3414 digital color sensor Staging graduation * ad7291 ADC driver. New functionality * st_sensors - device tree support and bindings * mma8452 - device tree support Cleanups * Drop redundant variables in a number of drivers. * Reorder a structure definition to ealy wiht a warning about static not being at the beginning in the hid-sensors driver. * Switch a few more drivers away from using explicit sampling_frequency attribute to providing this through the core. * Make hid_sensor_get_reporting_interval static as only used within a single file. * Drop a redundant check for negative values in an unsigned variable from ad9832 * Drop some duplicate case labels in the event monitor example code. * Use devm_ioremap_resource to simplify error handling. * Use devm_kzalloc within the blackfin timer driver to simplify error handling and removal. * A number of cleanups of the ad7291 from Hartmut Knaack in response to a patch moving it out of staging. * Core support for the period info element about events. It has been in the abi for a while, but not added until now to the newer handling of information related to events. * Add HAS_IOMEM dependency to mxs_lradc to avoid build issues when testing enabled.
2 parents 01e1162 + 90c5f2d commit db7c17e

47 files changed

Lines changed: 1390 additions & 479 deletions

Some content is hidden

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

‎Documentation/devicetree/bindings/i2c/trivial-devices.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ epson,rx8581 I2C-BUS INTERFACE REAL TIME CLOCK MODULE
5050
fsl,mag3110 MAG3110: Xtrinsic High Accuracy, 3D Magnetometer
5151
fsl,mc13892 MC13892: Power Management Integrated Circuit (PMIC) for i.MX35/51
5252
fsl,mma8450 MMA8450Q: Xtrinsic Low-power, 3-axis Xtrinsic Accelerometer
53+
fsl,mma8452 MMA8452Q: 3-axis 12-bit / 8-bit Digital Accelerometer
5354
fsl,mpr121 MPR121: Proximity Capacitive Touch Sensor Controller
5455
fsl,sgtl5000 SGTL5000: Ultra Low-Power Audio Codec
5556
gmt,g751 G751: Digital Temperature Sensor and Thermal Watchdog with Two-Wire Interface
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
STMicroelectronics MEMS sensors
2+
3+
The STMicroelectronics sensor devices are pretty straight-forward I2C or
4+
SPI devices, all sharing the same device tree descriptions no matter what
5+
type of sensor it is.
6+
7+
Required properties:
8+
- compatible: see the list of valid compatible strings below
9+
- reg: the I2C or SPI address the device will respond to
10+
11+
Optional properties:
12+
- vdd-supply: an optional regulator that needs to be on to provide VDD
13+
power to the sensor.
14+
- vddio-supply: an optional regulator that needs to be on to provide the
15+
VDD IO power to the sensor.
16+
- st,drdy-int-pin: the pin on the package that will be used to signal
17+
"data ready" (valid values: 1 or 2). This property is not configurable
18+
on all sensors.
19+
20+
Sensors may also have applicable pin control settings, those use the
21+
standard bindings from pinctrl/pinctrl-bindings.txt.
22+
23+
Valid compatible strings:
24+
25+
Accelerometers:
26+
- st,lsm303dlh-accel
27+
- st,lsm303dlhc-accel
28+
- st,lis3dh-accel
29+
- st,lsm330d-accel
30+
- st,lsm330dl-accel
31+
- st,lsm330dlc-accel
32+
- st,lis331dlh-accel
33+
- st,lsm303dl-accel
34+
- st,lsm303dlm-accel
35+
- st,lsm330-accel
36+
37+
Gyroscopes:
38+
- st,l3g4200d-gyro
39+
- st,lsm330d-gyro
40+
- st,lsm330dl-gyro
41+
- st,lsm330dlc-gyro
42+
- st,l3gd20-gyro
43+
- st,l3g4is-gyro
44+
- st,lsm330-gyro
45+
46+
Magnetometers:
47+
- st,lsm303dlhc-magn
48+
- st,lsm303dlm-magn
49+
- st,lis3mdl-magn
50+
51+
Pressure sensors:
52+
- st,lps001wp-press
53+
- st,lps25h-press
54+
- st,lps331ap-press

‎drivers/iio/accel/mma8452.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,9 +423,15 @@ static const struct i2c_device_id mma8452_id[] = {
423423
};
424424
MODULE_DEVICE_TABLE(i2c, mma8452_id);
425425

426+
static const struct of_device_id mma8452_dt_ids[] = {
427+
{ .compatible = "fsl,mma8452" },
428+
{ }
429+
};
430+
426431
static struct i2c_driver mma8452_driver = {
427432
.driver = {
428433
.name = "mma8452",
434+
.of_match_table = of_match_ptr(mma8452_dt_ids),
429435
.pm = MMA8452_PM_OPS,
430436
},
431437
.probe = mma8452_probe,

‎drivers/iio/accel/st_accel_core.c‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,9 @@ static int st_accel_read_raw(struct iio_dev *indio_dev,
393393
*val = 0;
394394
*val2 = adata->current_fullscale->gain;
395395
return IIO_VAL_INT_PLUS_MICRO;
396+
case IIO_CHAN_INFO_SAMP_FREQ:
397+
*val = adata->odr;
398+
return IIO_VAL_INT;
396399
default:
397400
return -EINVAL;
398401
}
@@ -410,21 +413,26 @@ static int st_accel_write_raw(struct iio_dev *indio_dev,
410413
case IIO_CHAN_INFO_SCALE:
411414
err = st_sensors_set_fullscale_by_gain(indio_dev, val2);
412415
break;
416+
case IIO_CHAN_INFO_SAMP_FREQ:
417+
if (val2)
418+
return -EINVAL;
419+
mutex_lock(&indio_dev->mlock);
420+
err = st_sensors_set_odr(indio_dev, val);
421+
mutex_unlock(&indio_dev->mlock);
422+
return err;
413423
default:
414424
return -EINVAL;
415425
}
416426

417427
return err;
418428
}
419429

420-
static ST_SENSOR_DEV_ATTR_SAMP_FREQ();
421430
static ST_SENSORS_DEV_ATTR_SAMP_FREQ_AVAIL();
422431
static ST_SENSORS_DEV_ATTR_SCALE_AVAIL(in_accel_scale_available);
423432

424433
static struct attribute *st_accel_attributes[] = {
425434
&iio_dev_attr_sampling_frequency_available.dev_attr.attr,
426435
&iio_dev_attr_in_accel_scale_available.dev_attr.attr,
427-
&iio_dev_attr_sampling_frequency.dev_attr.attr,
428436
NULL,
429437
};
430438

‎drivers/iio/accel/st_accel_i2c.c‎

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,55 @@
1818
#include <linux/iio/common/st_sensors_i2c.h>
1919
#include "st_accel.h"
2020

21+
#ifdef CONFIG_OF
22+
static const struct of_device_id st_accel_of_match[] = {
23+
{
24+
.compatible = "st,lsm303dlh-accel",
25+
.data = LSM303DLH_ACCEL_DEV_NAME,
26+
},
27+
{
28+
.compatible = "st,lsm303dlhc-accel",
29+
.data = LSM303DLHC_ACCEL_DEV_NAME,
30+
},
31+
{
32+
.compatible = "st,lis3dh-accel",
33+
.data = LIS3DH_ACCEL_DEV_NAME,
34+
},
35+
{
36+
.compatible = "st,lsm330d-accel",
37+
.data = LSM330D_ACCEL_DEV_NAME,
38+
},
39+
{
40+
.compatible = "st,lsm330dl-accel",
41+
.data = LSM330DL_ACCEL_DEV_NAME,
42+
},
43+
{
44+
.compatible = "st,lsm330dlc-accel",
45+
.data = LSM330DLC_ACCEL_DEV_NAME,
46+
},
47+
{
48+
.compatible = "st,lis331dlh-accel",
49+
.data = LIS331DLH_ACCEL_DEV_NAME,
50+
},
51+
{
52+
.compatible = "st,lsm303dl-accel",
53+
.data = LSM303DL_ACCEL_DEV_NAME,
54+
},
55+
{
56+
.compatible = "st,lsm303dlm-accel",
57+
.data = LSM303DLM_ACCEL_DEV_NAME,
58+
},
59+
{
60+
.compatible = "st,lsm330-accel",
61+
.data = LSM330_ACCEL_DEV_NAME,
62+
},
63+
{},
64+
};
65+
MODULE_DEVICE_TABLE(of, st_accel_of_match);
66+
#else
67+
#define st_accel_of_match NULL
68+
#endif
69+
2170
static int st_accel_i2c_probe(struct i2c_client *client,
2271
const struct i2c_device_id *id)
2372
{
@@ -31,6 +80,7 @@ static int st_accel_i2c_probe(struct i2c_client *client,
3180

3281
adata = iio_priv(indio_dev);
3382
adata->dev = &client->dev;
83+
st_sensors_of_i2c_probe(client, st_accel_of_match);
3484

3585
st_sensors_i2c_configure(indio_dev, client, adata);
3686

@@ -67,6 +117,7 @@ static struct i2c_driver st_accel_driver = {
67117
.driver = {
68118
.owner = THIS_MODULE,
69119
.name = "st-accel-i2c",
120+
.of_match_table = of_match_ptr(st_accel_of_match),
70121
},
71122
.probe = st_accel_i2c_probe,
72123
.remove = st_accel_i2c_remove,

‎drivers/iio/adc/Kconfig‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ config AD7266
2020
Say yes here to build support for Analog Devices AD7265 and AD7266
2121
ADCs.
2222

23+
config AD7291
24+
tristate "Analog Devices AD7291 ADC driver"
25+
depends on I2C
26+
help
27+
Say yes here to build support for Analog Devices AD7291
28+
8 Channel ADC with temperature sensor.
29+
30+
To compile this driver as a module, choose M here: the
31+
module will be called ad7291.
32+
2333
config AD7298
2434
tristate "Analog Devices AD7298 ADC driver"
2535
depends on SPI

‎drivers/iio/adc/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# When adding new entries keep the list in alphabetical order
66
obj-$(CONFIG_AD_SIGMA_DELTA) += ad_sigma_delta.o
77
obj-$(CONFIG_AD7266) += ad7266.o
8+
obj-$(CONFIG_AD7291) += ad7291.o
89
obj-$(CONFIG_AD7298) += ad7298.o
910
obj-$(CONFIG_AD7923) += ad7923.o
1011
obj-$(CONFIG_AD7476) += ad7476.o

0 commit comments

Comments
 (0)