From 781cb90b0529b5bb84c63691fe42a7c26d197aec Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Sat, 18 Jul 2020 17:30:40 -0700 Subject: platform_data: ad7793.h: drop a duplicated word Drop the repeated word "and" in a comment. Signed-off-by: Randy Dunlap Cc: Lars-Peter Clausen Cc: Jonathan Cameron Signed-off-by: Jonathan Cameron --- include/linux/platform_data/ad7793.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/linux/platform_data') diff --git a/include/linux/platform_data/ad7793.h b/include/linux/platform_data/ad7793.h index 576c7f962c4e..7c697e58f02a 100644 --- a/include/linux/platform_data/ad7793.h +++ b/include/linux/platform_data/ad7793.h @@ -40,7 +40,7 @@ enum ad7793_bias_voltage { * enum ad7793_refsel - AD7793 reference voltage selection * @AD7793_REFSEL_REFIN1: External reference applied between REFIN1(+) * and REFIN1(-). - * @AD7793_REFSEL_REFIN2: External reference applied between REFIN2(+) and + * @AD7793_REFSEL_REFIN2: External reference applied between REFIN2(+) * and REFIN1(-). Only valid for AD7795/AD7796. * @AD7793_REFSEL_INTERNAL: Internal 1.17 V reference. */ -- cgit v1.2.3 From 48404cf57852224c052e2e40d4dc50dd398c7a58 Mon Sep 17 00:00:00 2001 From: Michael Auchter Date: Tue, 22 Sep 2020 09:44:20 -0500 Subject: iio: adc: ad7291: convert to device tree There are no in-tree users of the platform data for this driver, so remove it and convert the driver to use device tree instead. Signed-off-by: Michael Auchter Link: https://lore.kernel.org/r/20200922144422.542669-1-michael.auchter@ni.com Signed-off-by: Jonathan Cameron --- drivers/iio/adc/ad7291.c | 35 +++++++++++++++++++++-------------- include/linux/platform_data/ad7291.h | 13 ------------- 2 files changed, 21 insertions(+), 27 deletions(-) delete mode 100644 include/linux/platform_data/ad7291.h (limited to 'include/linux/platform_data') diff --git a/drivers/iio/adc/ad7291.c b/drivers/iio/adc/ad7291.c index 62fde2aad282..2301a0e27f23 100644 --- a/drivers/iio/adc/ad7291.c +++ b/drivers/iio/adc/ad7291.c @@ -20,8 +20,6 @@ #include #include -#include - /* * Simplified handling * @@ -465,7 +463,6 @@ static const struct iio_info ad7291_info = { static int ad7291_probe(struct i2c_client *client, const struct i2c_device_id *id) { - struct ad7291_platform_data *pdata = client->dev.platform_data; struct ad7291_chip_info *chip; struct iio_dev *indio_dev; int ret; @@ -475,16 +472,6 @@ static int ad7291_probe(struct i2c_client *client, return -ENOMEM; chip = iio_priv(indio_dev); - if (pdata && pdata->use_external_ref) { - chip->reg = devm_regulator_get(&client->dev, "vref"); - if (IS_ERR(chip->reg)) - return PTR_ERR(chip->reg); - - ret = regulator_enable(chip->reg); - if (ret) - return ret; - } - mutex_init(&chip->state_lock); /* this is only used for device removal purposes */ i2c_set_clientdata(client, indio_dev); @@ -495,8 +482,21 @@ static int ad7291_probe(struct i2c_client *client, AD7291_T_SENSE_MASK | /* Tsense always enabled */ AD7291_ALERT_POLARITY; /* set irq polarity low level */ - if (pdata && pdata->use_external_ref) + chip->reg = devm_regulator_get_optional(&client->dev, "vref"); + if (IS_ERR(chip->reg)) { + if (PTR_ERR(chip->reg) != -ENODEV) + return PTR_ERR(chip->reg); + + chip->reg = NULL; + } + + if (chip->reg) { + ret = regulator_enable(chip->reg); + if (ret) + return ret; + chip->command |= AD7291_EXT_REF; + } indio_dev->name = id->name; indio_dev->channels = ad7291_channels; @@ -567,9 +567,16 @@ static const struct i2c_device_id ad7291_id[] = { MODULE_DEVICE_TABLE(i2c, ad7291_id); +static const struct of_device_id ad7291_of_match[] = { + { .compatible = "adi,ad7291" }, + {} +}; +MODULE_DEVICE_TABLE(of, ad7291_of_match); + static struct i2c_driver ad7291_driver = { .driver = { .name = KBUILD_MODNAME, + .of_match_table = ad7291_of_match, }, .probe = ad7291_probe, .remove = ad7291_remove, diff --git a/include/linux/platform_data/ad7291.h b/include/linux/platform_data/ad7291.h deleted file mode 100644 index b1fd1530c9a5..000000000000 --- a/include/linux/platform_data/ad7291.h +++ /dev/null @@ -1,13 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __IIO_AD7291_H__ -#define __IIO_AD7291_H__ - -/** - * struct ad7291_platform_data - AD7291 platform data - * @use_external_ref: Whether to use an external or internal reference voltage - */ -struct ad7291_platform_data { - bool use_external_ref; -}; - -#endif -- cgit v1.2.3