@@ -18,8 +18,6 @@
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
-#include "ad7746.h"
-
/*
* AD7746 Register Definition
*/
@@ -676,11 +674,10 @@ static const struct iio_info ad7746_info = {
static int ad7746_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
- struct ad7746_platform_data *pdata = client->dev.platform_data;
struct device_node *np = client->dev.of_node;
struct ad7746_chip_info *chip;
struct iio_dev *indio_dev;
- unsigned int exca_en, excb_en;
+ unsigned int exca_en, excb_en, exclvl;
unsigned char regval = 0;
int ret = 0;
@@ -721,12 +718,11 @@ static int ad7746_probe(struct i2c_client *client,
regval |= AD7746_EXCSETUP_NEXCB;
}
- if (pdata) {
- regval |= AD7746_EXCSETUP_EXCLVL(pdata->exclvl);
- } else {
- dev_warn(&client->dev, "No platform data? using default\n");
- regval = AD7746_EXCSETUP_EXCLVL(3);
- }
+ ret = of_property_read_u32(np, "adi,excitation-voltage-level", &exclvl);
+ if (!ret)
+ regval |= AD7746_EXCSETUP_EXCLVL(exclvl);
+ else
+ regval |= AD7746_EXCSETUP_EXCLVL(3);
ret = i2c_smbus_write_byte_data(chip->client,
AD7746_REG_EXC_SETUP, regval);
deleted file mode 100644
@@ -1,24 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * AD7746 capacitive sensor driver supporting AD7745, AD7746 and AD7747
- *
- * Copyright 2011 Analog Devices Inc.
- */
-
-#ifndef IIO_CDC_AD7746_H_
-#define IIO_CDC_AD7746_H_
-
-/*
- * TODO: struct ad7746_platform_data needs to go into include/linux/iio
- */
-
-#define AD7466_EXCLVL_0 0 /* +-VDD/8 */
-#define AD7466_EXCLVL_1 1 /* +-VDD/4 */
-#define AD7466_EXCLVL_2 2 /* +-VDD * 3/8 */
-#define AD7466_EXCLVL_3 3 /* +-VDD/2 */
-
-struct ad7746_platform_data {
- unsigned char exclvl; /*Excitation Voltage Level */
-};
-
-#endif /* IIO_CDC_AD7746_H_ */
Set device excitation level using properties from device tree binding instead of using platform_data. As this replaces the last instance where the platform_data struct was used, remove ad7746.h header file since it's no longer needed. Signed-off-by: Lucas Stankus <lucas.p.stankus@gmail.com> --- drivers/staging/iio/cdc/ad7746.c | 16 ++++++---------- drivers/staging/iio/cdc/ad7746.h | 24 ------------------------ 2 files changed, 6 insertions(+), 34 deletions(-) delete mode 100644 drivers/staging/iio/cdc/ad7746.h