summaryrefslogtreecommitdiffstats
path: root/drivers/iio/adc/ti-adc128s052.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-11-22 09:39:45 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-11-22 09:39:45 +0100
commit7c0bc65c84035cd2d7561ba47d7bad1cae62c4c3 (patch)
treedc3d2be87e28788beae297afecfa83a4846397b8 /drivers/iio/adc/ti-adc128s052.c
parent0e2c8fb54d7ae0c3e816dc8b1eedbeb345e9cdad (diff)
parent00426e99789357dbff7e719a092ce36a3ce49d94 (diff)
downloadlinux-stable-7c0bc65c84035cd2d7561ba47d7bad1cae62c4c3.tar.gz
linux-stable-7c0bc65c84035cd2d7561ba47d7bad1cae62c4c3.tar.bz2
linux-stable-7c0bc65c84035cd2d7561ba47d7bad1cae62c4c3.zip
Merge tag 'iio-for-4.21a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-testing
Jonathan writes: First set of new device support, features and cleanups for IIO in the 4.21 cycle Along with the headline feature of 5 new drivers, we have the substantial addition of auxilliary sensor support on the lsm6sdx parts for ST. There has also been a good set of staging cleanup in this period with more underway. An ever increasing number of devices supported with just a new ID which is a good sign that at least some manufacturers are continuing to stabilise their interfaces. New device support, * ad7124 - New driver supporting Analog Devices' ad7124-4 and ad7124-8 parts with the inevitable DT binding. * ad7949 - New driver supporting Analog Devices' ad7949, AD7682 and AD7689 ADCs. * rm3100 - New driver supporting PNIs RM3100 magnometer with bindings and vendor prefix. * ti-dac7311 - New driver supporting DAC7311, DAC6311 and DAC5311 TI DACs, with DT bindings. * vcnl5035 - New driver supporting the light sensor part of the VCNL4035, with DT bindings Features, * bindings - Add a generic ADC channel binding as we keep reinventing this wheel. * adc128s052 - Add IDs for additional pin compatible parts. - Add APCI ID seen on E3940 UP squared boards. * ad_sigma_delta - Allow for custom data register overiding default. * kxcjk1013 - Add KIOX0009 ACPI ID as seen on the Acer One 10. * lsm6dsx - Rework leading to... - External sensor support using the built in I2C master. - Initial support for a slave lis2mdl magnetometer. * meson-saradc - Add temperature sensor support and bindings. * st_magn - New ID for lsm9dsl_magn with bindings - New ID for lis3de accelerometer * tpl0102 - Add supprot for IIO_AVAIL_RANGE to report the range available from this device to userspace and in kernel users. Cleanups and minor fixes * tools - Allow outside specification of CFLAGS * ad2s90 - Handle and spi_read error. - Handle spi_setup failure - Drop a pointless assignment. - Prevent a potentail race by moving device registration to after all other setup. - Add missing scale attribute. - Add a sanity check on channel type before trying to read it. * ad2s1210 - Move to modern gpio descriptors. - Drop a gpioin flag which made no sense as far as we can tell. - Add dt table (bindings doc to follow when this is ready for moving out of staging). * ad5933 - Drop camel-case naming of ext_clk_hz. - White space fixes. * ad7150 - Local variable to shorten overly long line. - Alignment and line break fixes. * ad7280a - Handle an error path that was previously ignored. - Use crc8.h to build the crc table replacing custom code. - Avoid unecessary cast. - Power down the device if an error happens in probe - Use devm routines to simplify probe and remove. * ad7606 - Alignment fixes. * ad7780 - This worked as long as by coincidence an uninitialized value was 0. Lets not rely on that. - Ensure gain update is only used with the ad778x chips that actually support it. - Tidy up pattern mask generation. - Read regulator when scale is requested (which should be infrequent) as it might have changed from initialization. * ad7816 - Move to modern gpio descriptors - Don't use a busy_pin for ad7818 as there isn't one. - Ensure RD/WR and CONVST pins are outputs (previously they were brought up as inputs which doesn't seem to make any sense) - DT id table. * adc128s052 - SPDX * adt7316 - Alignment fix. - Fix data reading. When using I2C the driver never actually used the value read. This has been broken a very long time hence no rush to fix it now + the driver is undergoing a lot of cleanup. - Sanity check that the i2c read didn't fail to actually read anything. * dpot-dac - Mark a switch full through with slightly different text so that gcc doesn't warn on it. * gyro-adc - Fix a wrong file in the MAINTAINERS entry and add binding doc to the listed files. * ina2xx - Add some early returns to clarify error paths in switch. * lsm6dsx - MAINTAINERS entry. * max11100 - SPDX * max9611 - SPDX * mcp4131 - use of_device_get_match_data in preference to spi_get_device_id approach. * rcar-adc - SPDX * sc27xx - Add ADC conversion timeout support to avoid possible fault. * ssp_sensors - Don't free managed resources manually. * st-magn - Add a comment to avoid future confusion over when to use -magn postfix (on multi chip in package parts) - Add BDU register for LIS3MDL where it seems to have been missed. * st-sensors - Minor spelling, grammar etc fixes. * tpl0102 - Use a pointer rather than an index of an array to improve conciseness. * tag 'iio-for-4.21a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (80 commits) Staging: iio: adt7316: Add an extra check for 'ret' equals to 0 Staging: iio: adt7316: Fix i2c data reading, set the data field dt-bindings: iio: adc: Add docs for ad7124 iio: adc: Add ad7124 support dt-bindings: iio: adc: Add common ADCs properties to a separate file iio: ad_sigma_delta: Allow to provide custom data register address staging: iio: ad7816: Add device tree table. iio: imu: st_lsm6dsx: add entry in MAINTAINERS file iio: potentiometer: mcp4131: use of_device_get_match_data() staging: iio: adc: ad7280a: use devm_* APIs staging: iio: adc: ad7280a: power down the device on error in probe dt-bindings: iio: imu: st_lsm6dsx: add support to i2c pullup resistors iio: imu: st_lsm6dsx: add hw FIFO support to i2c controller iio: imu: st_lsm6dsx: add st_lsm6dsx_push_tagged_data routine iio: imu: st_lsm6dsx: add i2c embedded controller support iio: imu: st_lsm6dsx: introduce st_lsm6dsx_sensor_set_enable routine iio: imu: st_lsm6dsx: introduce ST_LSM6DSX_ID_EXT sensor ids iio: imu: st_lsm6dsx: remove static from st_lsm6dsx_set_watermark iio: imu: st_lsm6dsx: reload trimming parameter at bootstrap iio: imu: st_lsm6dsx: introduce locked read/write utility routines ...
Diffstat (limited to 'drivers/iio/adc/ti-adc128s052.c')
-rw-r--r--drivers/iio/adc/ti-adc128s052.c37
1 files changed, 29 insertions, 8 deletions
diff --git a/drivers/iio/adc/ti-adc128s052.c b/drivers/iio/adc/ti-adc128s052.c
index 7cf39b3e2416..1e5a936b5b6a 100644
--- a/drivers/iio/adc/ti-adc128s052.c
+++ b/drivers/iio/adc/ti-adc128s052.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2014 Angelo Compagnucci <angelo.compagnucci@gmail.com>
*
@@ -6,16 +7,14 @@
* http://www.ti.com/lit/ds/symlink/adc128s052.pdf
* http://www.ti.com/lit/ds/symlink/adc122s021.pdf
* http://www.ti.com/lit/ds/symlink/adc124s021.pdf
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
*/
+#include <linux/acpi.h>
#include <linux/err.h>
#include <linux/spi/spi.h>
#include <linux/module.h>
#include <linux/iio/iio.h>
+#include <linux/property.h>
#include <linux/regulator/consumer.h>
struct adc128_configuration {
@@ -135,10 +134,15 @@ static const struct iio_info adc128_info = {
static int adc128_probe(struct spi_device *spi)
{
struct iio_dev *indio_dev;
+ unsigned int config;
struct adc128 *adc;
- int config = spi_get_device_id(spi)->driver_data;
int ret;
+ if (dev_fwnode(&spi->dev))
+ config = (unsigned long) device_get_match_data(&spi->dev);
+ else
+ config = spi_get_device_id(spi)->driver_data;
+
indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*adc));
if (!indio_dev)
return -ENOMEM;
@@ -186,23 +190,40 @@ static int adc128_remove(struct spi_device *spi)
static const struct of_device_id adc128_of_match[] = {
{ .compatible = "ti,adc128s052", },
{ .compatible = "ti,adc122s021", },
+ { .compatible = "ti,adc122s051", },
+ { .compatible = "ti,adc122s101", },
{ .compatible = "ti,adc124s021", },
+ { .compatible = "ti,adc124s051", },
+ { .compatible = "ti,adc124s101", },
{ /* sentinel */ },
};
MODULE_DEVICE_TABLE(of, adc128_of_match);
static const struct spi_device_id adc128_id[] = {
- { "adc128s052", 0}, /* index into adc128_config */
- { "adc122s021", 1},
- { "adc124s021", 2},
+ { "adc128s052", 0 }, /* index into adc128_config */
+ { "adc122s021", 1 },
+ { "adc122s051", 1 },
+ { "adc122s101", 1 },
+ { "adc124s021", 2 },
+ { "adc124s051", 2 },
+ { "adc124s101", 2 },
{ }
};
MODULE_DEVICE_TABLE(spi, adc128_id);
+#ifdef CONFIG_ACPI
+static const struct acpi_device_id adc128_acpi_match[] = {
+ { "AANT1280", 2 }, /* ADC124S021 compatible ACPI ID */
+ { }
+};
+MODULE_DEVICE_TABLE(acpi, adc128_acpi_match);
+#endif
+
static struct spi_driver adc128_driver = {
.driver = {
.name = "adc128s052",
.of_match_table = of_match_ptr(adc128_of_match),
+ .acpi_match_table = ACPI_PTR(adc128_acpi_match),
},
.probe = adc128_probe,
.remove = adc128_remove,