summaryrefslogtreecommitdiff
path: root/drivers/iio/adc/ti-adc081c.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-06-29 15:35:01 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-06-29 15:35:01 -0700
commit3c9a6793bde1feb368cd6ef113c08a40a37f7517 (patch)
tree3c50e466061b31fe836faf023e3f194eea6196f6 /drivers/iio/adc/ti-adc081c.c
parent9989b59961a8ad55d92df4588b556f0c6c838ec7 (diff)
parent67626cc1a0f7bd6700b6f2f547244382247f5bb3 (diff)
Merge tag 'iio-for-4.8b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes: Second round of new iio device support, features and cleanups in the 4.8 cycle Firstly some contact detail updates: * NXP took over freescale. Update the mma8452 header to reflect this. * Martin Kepplinger email address change in mma8452 header. * Adriana Reus has changed email address. Update .mailmap. * Matt Ranostay has changed email address. Update .mailmap. New Device Support * max1363 - add the missing i2c_device_ids for a couple of parts so they can actually be used. * ms5867 - add device ids for ms5805 and ms5837 parts. New Features * ad5755 - DT support. This one was a bit controversial and under review for a long time. Still no one could come up with a better solution. * stx104 - add gpio support * ti-adc081c - Add ACPI device ID matching. Core changes * Refuse to register triggers with duplicate names. There is no way to distinguish between them so this makes no sense. A few drivers do not generate unique names for each instance of the device present. We can't fix this without changing ABI so leave them and wait for someone to actually take the rare step of two identical accelerometers on the same board. * buffer-dma - use ARRAY_SIZE in a few appropriate locations. Tools * Fix the fact that the --trigger-num option in generic_buffer didn't allow 0 which is perfectly valid in the ABI. Cleanups * as3935 - improve error reporting. - remove redundant zeroing of a field in iio_priv. * gp2ap020a00f - use the iio_device_claim_*_mode helpers rather than open coding locking around mode changes. * isl29125 - use the iio_device_claim_*_mode helpers rather than open coding locking. * lidar - use the iio_device_claim_*_mode helpers rather than open coding locking. * mma8452 - more detail in devices supported description in comments (addresses and similar) * sca3000 - add a missing error check. * tcs3414 - use the iio_device_claim_*_mode helpers rather than open coding locking. * tcs3472 - use the iio_device_claim_*_mode helpers rather than open coding locking.
Diffstat (limited to 'drivers/iio/adc/ti-adc081c.c')
-rw-r--r--drivers/iio/adc/ti-adc081c.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/drivers/iio/adc/ti-adc081c.c b/drivers/iio/adc/ti-adc081c.c
index 9fd032d9f402..f8807adc08c4 100644
--- a/drivers/iio/adc/ti-adc081c.c
+++ b/drivers/iio/adc/ti-adc081c.c
@@ -22,6 +22,7 @@
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/of.h>
+#include <linux/acpi.h>
#include <linux/iio/iio.h>
#include <linux/iio/buffer.h>
@@ -149,12 +150,24 @@ static int adc081c_probe(struct i2c_client *client,
{
struct iio_dev *iio;
struct adc081c *adc;
- struct adcxx1c_model *model = &adcxx1c_models[id->driver_data];
+ struct adcxx1c_model *model;
int err;
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA))
return -EOPNOTSUPP;
+ if (ACPI_COMPANION(&client->dev)) {
+ const struct acpi_device_id *ad_id;
+
+ ad_id = acpi_match_device(client->dev.driver->acpi_match_table,
+ &client->dev);
+ if (!ad_id)
+ return -ENODEV;
+ model = &adcxx1c_models[ad_id->driver_data];
+ } else {
+ model = &adcxx1c_models[id->driver_data];
+ }
+
iio = devm_iio_device_alloc(&client->dev, sizeof(*adc));
if (!iio)
return -ENOMEM;
@@ -231,10 +244,21 @@ static const struct of_device_id adc081c_of_match[] = {
MODULE_DEVICE_TABLE(of, adc081c_of_match);
#endif
+#ifdef CONFIG_ACPI
+static const struct acpi_device_id adc081c_acpi_match[] = {
+ { "ADC081C", ADC081C },
+ { "ADC101C", ADC101C },
+ { "ADC121C", ADC121C },
+ { }
+};
+MODULE_DEVICE_TABLE(acpi, adc081c_acpi_match);
+#endif
+
static struct i2c_driver adc081c_driver = {
.driver = {
.name = "adc081c",
.of_match_table = of_match_ptr(adc081c_of_match),
+ .acpi_match_table = ACPI_PTR(adc081c_acpi_match),
},
.probe = adc081c_probe,
.remove = adc081c_remove,