[PATCH 6/6] iio: adc: ad7793: add firmware support and drop platform data
From: Nuno Sá
Date: Wed Nov 25 2026 - 05:20:23 EST
The driver refuses to probe without struct ad7793_platform_data, and
there are no in-tree users of it. That means the driver can not be used
at all on a modern system.
Get the configuration from firmware properties instead, following the
new binding, and drop the platform data header:
- The reference is REFIN (REFIN1) if refin-supply is present, REFIN2 if
refin2-supply is present, and the internal 1.17 V reference otherwise.
Parts without an internal reference need refin-supply.
- An external clock on the CLK pin is used if given. A 128 kHz clock
is divided by 2 internally.
- The input buffer stays enabled (as it is at power-up) unless
adi,buffer-disable is set, and unipolar coding is used unless bipolar
is set.
- The bias voltage generator, the burnout currents and the excitation
current sources get their own properties.
While at it, also enable the AVDD and DVDD supplies, add an OF match
table and fold the platform data checks into the property parsing.
Signed-off-by: Nuno Sá <nuno.sa@xxxxxxxxxx>
---
MAINTAINERS | 1 -
drivers/iio/adc/ad7793.c | 315 +++++++++++++++++++++++++++++++----
include/linux/platform_data/ad7793.h | 111 ------------
3 files changed, 278 insertions(+), 149 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index e55236f4accb..fe88746df57e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1739,7 +1739,6 @@ S: Supported
W: https://ez.analog.com/linux-software-drivers
F: Documentation/devicetree/bindings/iio/adc/adi,ad7793.yaml
F: drivers/iio/adc/ad7793.c
-F: include/linux/platform_data/ad7793.h
ANALOG DEVICES INC AD8366 DRIVER
M: Michael Hennerich <Michael.Hennerich@xxxxxxxxxx>
diff --git a/drivers/iio/adc/ad7793.c b/drivers/iio/adc/ad7793.c
index b0f44c144f20..f3e3ca724ec2 100644
--- a/drivers/iio/adc/ad7793.c
+++ b/drivers/iio/adc/ad7793.c
@@ -5,10 +5,13 @@
* Copyright 2011-2012 Analog Devices Inc.
*/
+#include <linux/clk.h>
#include <linux/interrupt.h>
#include <linux/device.h>
#include <linux/kernel.h>
+#include <linux/property.h>
#include <linux/slab.h>
+#include <linux/string.h>
#include <linux/sysfs.h>
#include <linux/spi/spi.h>
#include <linux/regulator/consumer.h>
@@ -16,6 +19,7 @@
#include <linux/sched.h>
#include <linux/delay.h>
#include <linux/module.h>
+#include <linux/units.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
@@ -24,7 +28,6 @@
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>
#include <linux/iio/adc/ad_sigma_delta.h>
-#include <linux/platform_data/ad7793.h>
/* Registers */
#define AD7793_REG_COMM 0 /* Communications Register (WO, 8-bit) */
@@ -140,6 +143,107 @@
#define AD7793_FLAG_HAS_GAIN BIT(4)
#define AD7793_FLAG_HAS_BUFFER BIT(5)
+/**
+ * enum ad7793_clock_source - AD7793 clock source selection
+ * @AD7793_CLK_SRC_INT: Internal 64 kHz clock, not available at the CLK pin.
+ * @AD7793_CLK_SRC_INT_CO: Internal 64 kHz clock, available at the CLK pin.
+ * @AD7793_CLK_SRC_EXT: Use external clock.
+ * @AD7793_CLK_SRC_EXT_DIV2: Use external clock divided by 2.
+ */
+enum ad7793_clock_source {
+ AD7793_CLK_SRC_INT,
+ AD7793_CLK_SRC_INT_CO,
+ AD7793_CLK_SRC_EXT,
+ AD7793_CLK_SRC_EXT_DIV2,
+};
+
+/**
+ * enum ad7793_bias_voltage - AD7793 bias voltage selection
+ * @AD7793_BIAS_VOLTAGE_DISABLED: Bias voltage generator disabled
+ * @AD7793_BIAS_VOLTAGE_AIN1: Bias voltage connected to AIN1(-).
+ * @AD7793_BIAS_VOLTAGE_AIN2: Bias voltage connected to AIN2(-).
+ * @AD7793_BIAS_VOLTAGE_AIN3: Bias voltage connected to AIN3(-).
+ * Only valid for AD7795/AD7796.
+ */
+enum ad7793_bias_voltage {
+ AD7793_BIAS_VOLTAGE_DISABLED,
+ AD7793_BIAS_VOLTAGE_AIN1,
+ AD7793_BIAS_VOLTAGE_AIN2,
+ AD7793_BIAS_VOLTAGE_AIN3,
+};
+
+/**
+ * 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 REFIN1(-). Only valid for AD7795/AD7796.
+ * @AD7793_REFSEL_INTERNAL: Internal 1.17 V reference.
+ */
+enum ad7793_refsel {
+ AD7793_REFSEL_REFIN1 = 0,
+ AD7793_REFSEL_REFIN2 = 1,
+ AD7793_REFSEL_INTERNAL = 2,
+};
+
+/**
+ * enum ad7793_current_source_direction - AD7793 excitation current direction
+ * @AD7793_IEXEC1_IOUT1_IEXEC2_IOUT2: Current source IEXC1 connected to pin
+ * IOUT1, current source IEXC2 connected to pin IOUT2.
+ * @AD7793_IEXEC1_IOUT2_IEXEC2_IOUT1: Current source IEXC2 connected to pin
+ * IOUT1, current source IEXC1 connected to pin IOUT2.
+ * @AD7793_IEXEC1_IEXEC2_IOUT1: Both current sources connected to pin IOUT1.
+ * Only valid when the current sources are set to 10 uA or 210 uA.
+ * @AD7793_IEXEC1_IEXEC2_IOUT2: Both current sources connected to Pin IOUT2.
+ * Only valid when the current ources are set to 10 uA or 210 uA.
+ */
+enum ad7793_current_source_direction {
+ AD7793_IEXEC1_IOUT1_IEXEC2_IOUT2 = 0,
+ AD7793_IEXEC1_IOUT2_IEXEC2_IOUT1 = 1,
+ AD7793_IEXEC1_IEXEC2_IOUT1 = 2,
+ AD7793_IEXEC1_IEXEC2_IOUT2 = 3,
+};
+
+/**
+ * enum ad7793_excitation_current - AD7793 excitation current selection
+ * @AD7793_IX_DISABLED: Excitation current Disabled.
+ * @AD7793_IX_10uA: Enable 10 micro-ampere excitation current.
+ * @AD7793_IX_210uA: Enable 210 micro-ampere excitation current.
+ * @AD7793_IX_1mA: Enable 1 milli-Ampere excitation current.
+ */
+enum ad7793_excitation_current {
+ AD7793_IX_DISABLED = 0,
+ AD7793_IX_10uA = 1,
+ AD7793_IX_210uA = 2,
+ AD7793_IX_1mA = 3,
+};
+
+/**
+ * struct ad7793_config - AD7793 configuration
+ * @clock_src: Clock source selection
+ * @burnout_current: If set to true the 100nA burnout current is enabled.
+ * @boost_enable: Enable boost for the bias voltage generator.
+ * @buffered: If set to true configure the device for buffered input mode.
+ * @unipolar: If set to true sample in unipolar mode, if set to false sample in
+ * bipolar mode.
+ * @refsel: Reference voltage selection
+ * @bias_voltage: Bias voltage selection
+ * @exitation_current: Excitation current selection
+ * @current_source_direction: Excitation current direction selection
+ */
+struct ad7793_config {
+ enum ad7793_clock_source clock_src;
+ bool burnout_current;
+ bool boost_enable;
+ bool buffered;
+ bool unipolar;
+
+ enum ad7793_refsel refsel;
+ enum ad7793_bias_voltage bias_voltage;
+ enum ad7793_excitation_current exitation_current;
+ enum ad7793_current_source_direction current_source_direction;
+};
+
struct ad7793_chip_info {
unsigned int id;
const struct iio_chan_spec *channels;
@@ -223,36 +327,36 @@ static int ad7793_calibrate_all(struct ad7793_state *st)
ARRAY_SIZE(ad7793_calib_arr));
}
-static int ad7793_check_platform_data(struct ad7793_state *st,
- const struct ad7793_platform_data *pdata)
+static int ad7793_check_config(struct ad7793_state *st,
+ const struct ad7793_config *cfg)
{
- if ((pdata->current_source_direction == AD7793_IEXEC1_IEXEC2_IOUT1 ||
- pdata->current_source_direction == AD7793_IEXEC1_IEXEC2_IOUT2) &&
- ((pdata->exitation_current != AD7793_IX_10uA) &&
- (pdata->exitation_current != AD7793_IX_210uA)))
+ if ((cfg->current_source_direction == AD7793_IEXEC1_IEXEC2_IOUT1 ||
+ cfg->current_source_direction == AD7793_IEXEC1_IEXEC2_IOUT2) &&
+ cfg->exitation_current != AD7793_IX_10uA &&
+ cfg->exitation_current != AD7793_IX_210uA)
return -EINVAL;
if (!(st->chip_info->flags & AD7793_FLAG_HAS_CLKSEL) &&
- pdata->clock_src != AD7793_CLK_SRC_INT)
+ cfg->clock_src != AD7793_CLK_SRC_INT)
return -EINVAL;
if (!(st->chip_info->flags & AD7793_FLAG_HAS_REFSEL) &&
- pdata->refsel != AD7793_REFSEL_REFIN1)
+ cfg->refsel != AD7793_REFSEL_REFIN1)
return -EINVAL;
if (!(st->chip_info->flags & AD7793_FLAG_HAS_VBIAS) &&
- pdata->bias_voltage != AD7793_BIAS_VOLTAGE_DISABLED)
+ cfg->bias_voltage != AD7793_BIAS_VOLTAGE_DISABLED)
return -EINVAL;
if (!(st->chip_info->flags & AD7793_HAS_EXITATION_CURRENT) &&
- pdata->exitation_current != AD7793_IX_DISABLED)
+ cfg->exitation_current != AD7793_IX_DISABLED)
return -EINVAL;
return 0;
}
static int ad7793_setup(struct iio_dev *indio_dev,
- const struct ad7793_platform_data *pdata,
+ const struct ad7793_config *cfg,
unsigned int vref_mv)
{
struct ad7793_state *st = iio_priv(indio_dev);
@@ -260,7 +364,7 @@ static int ad7793_setup(struct iio_dev *indio_dev,
unsigned long long scale_uv;
u32 id;
- ret = ad7793_check_platform_data(st, pdata);
+ ret = ad7793_check_config(st, cfg);
if (ret)
return ret;
@@ -292,19 +396,19 @@ static int ad7793_setup(struct iio_dev *indio_dev,
st->conf = 0;
if (st->chip_info->flags & AD7793_FLAG_HAS_CLKSEL)
- st->mode |= AD7793_MODE_CLKSRC(pdata->clock_src);
+ st->mode |= AD7793_MODE_CLKSRC(cfg->clock_src);
if (st->chip_info->flags & AD7793_FLAG_HAS_REFSEL)
- st->conf |= AD7793_CONF_REFSEL(pdata->refsel);
+ st->conf |= AD7793_CONF_REFSEL(cfg->refsel);
if (st->chip_info->flags & AD7793_FLAG_HAS_VBIAS)
- st->conf |= AD7793_CONF_VBIAS(pdata->bias_voltage);
- if (pdata->buffered || !(st->chip_info->flags & AD7793_FLAG_HAS_BUFFER))
+ st->conf |= AD7793_CONF_VBIAS(cfg->bias_voltage);
+ if (cfg->buffered || !(st->chip_info->flags & AD7793_FLAG_HAS_BUFFER))
st->conf |= AD7793_CONF_BUF;
- if (pdata->boost_enable &&
- (st->chip_info->flags & AD7793_FLAG_HAS_VBIAS))
+ if (cfg->boost_enable &&
+ (st->chip_info->flags & AD7793_FLAG_HAS_VBIAS))
st->conf |= AD7793_CONF_BOOST;
- if (pdata->burnout_current)
+ if (cfg->burnout_current)
st->conf |= AD7793_CONF_BO_EN;
- if (pdata->unipolar)
+ if (cfg->unipolar)
st->conf |= AD7793_CONF_UNIPOLAR;
if (!(st->chip_info->flags & AD7793_FLAG_HAS_GAIN))
@@ -320,8 +424,8 @@ static int ad7793_setup(struct iio_dev *indio_dev,
if (st->chip_info->flags & AD7793_HAS_EXITATION_CURRENT) {
ret = ad_sd_write_reg(&st->sd, AD7793_REG_IO, 1,
- pdata->exitation_current |
- (pdata->current_source_direction << 2));
+ cfg->exitation_current |
+ (cfg->current_source_direction << 2));
if (ret)
goto out;
}
@@ -776,16 +880,139 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = {
},
};
+static int ad7793_parse_excitation(struct device *dev,
+ struct ad7793_config *cfg)
+{
+ static const char * const iout_pins[] = { "iout1", "iout2" };
+ u32 pins[] = { 1, 2 };
+ const char *names[2];
+ u32 val;
+ int ret;
+
+ ret = device_property_read_u32(dev, "adi,excitation-current-microamp",
+ &val);
+ /* Excitation pins only matter if the excitation current is enabled */
+ if (ret)
+ return 0;
+
+ switch (val) {
+ case 10:
+ cfg->exitation_current = AD7793_IX_10uA;
+ break;
+ case 210:
+ cfg->exitation_current = AD7793_IX_210uA;
+ break;
+ case 1000:
+ cfg->exitation_current = AD7793_IX_1mA;
+ break;
+ default:
+ return dev_err_probe(dev, -EINVAL,
+ "Invalid excitation current: %u\n", val);
+ }
+
+ if (device_property_present(dev, "adi,excitation-pins")) {
+ ret = device_property_read_string_array(dev,
+ "adi,excitation-pins",
+ names,
+ ARRAY_SIZE(names));
+ if (ret != ARRAY_SIZE(names))
+ return dev_err_probe(dev, ret < 0 ? ret : -EINVAL,
+ "Invalid adi,excitation-pins\n");
+
+ /* IOUT pin number for IEXC1 and IEXC2 */
+ for (unsigned int i = 0; i < ARRAY_SIZE(names); i++) {
+ ret = match_string(iout_pins, ARRAY_SIZE(iout_pins),
+ names[i]);
+ if (ret < 0)
+ return dev_err_probe(dev, ret,
+ "Invalid adi,excitation-pins\n");
+
+ pins[i] = ret + 1;
+ }
+ }
+
+ if (pins[0] == 1 && pins[1] == 2)
+ cfg->current_source_direction = AD7793_IEXEC1_IOUT1_IEXEC2_IOUT2;
+ else if (pins[0] == 2 && pins[1] == 1)
+ cfg->current_source_direction = AD7793_IEXEC1_IOUT2_IEXEC2_IOUT1;
+ else if (pins[0] == 1)
+ cfg->current_source_direction = AD7793_IEXEC1_IEXEC2_IOUT1;
+ else
+ cfg->current_source_direction = AD7793_IEXEC1_IEXEC2_IOUT2;
+
+ return 0;
+}
+
+static int ad7793_parse_fw(struct device *dev, struct ad7793_config *cfg,
+ unsigned int *vref_mv)
+{
+ static const char * const vbias_pins[] = { "ain1", "ain2", "ain3" };
+ static const char * const refin_names[] = { "refin", "refin2" };
+ unsigned long rate;
+ struct clk *clk;
+ int ret;
+
+ cfg->refsel = AD7793_REFSEL_INTERNAL;
+ for (unsigned int i = 0; i < ARRAY_SIZE(refin_names); i++) {
+ ret = devm_regulator_get_enable_read_voltage(dev, refin_names[i]);
+ if (ret < 0 && ret != -ENODEV)
+ return dev_err_probe(dev, ret, "Failed to get %s voltage\n",
+ refin_names[i]);
+ if (ret == -ENODEV)
+ continue;
+
+ cfg->refsel = i;
+ *vref_mv = ret / 1000;
+ break;
+ }
+
+ if (cfg->refsel == AD7793_REFSEL_INTERNAL)
+ *vref_mv = 1170;
+
+ clk = devm_clk_get_optional_enabled(dev, NULL);
+ if (IS_ERR(clk))
+ return dev_err_probe(dev, PTR_ERR(clk), "Failed to get clock\n");
+
+ if (clk) {
+ rate = clk_get_rate(clk);
+ if (rate == 64 * HZ_PER_KHZ)
+ cfg->clock_src = AD7793_CLK_SRC_EXT;
+ else if (rate == 128 * HZ_PER_KHZ)
+ cfg->clock_src = AD7793_CLK_SRC_EXT_DIV2;
+ else
+ return dev_err_probe(dev, -EINVAL,
+ "Invalid clock rate: %lu Hz\n", rate);
+ }
+
+ if (device_property_present(dev, "adi,vbias-pin")) {
+ ret = device_property_match_property_string(dev, "adi,vbias-pin",
+ vbias_pins,
+ ARRAY_SIZE(vbias_pins));
+ if (ret < 0)
+ return dev_err_probe(dev, ret, "Invalid adi,vbias-pin\n");
+
+ cfg->bias_voltage = AD7793_BIAS_VOLTAGE_AIN1 + ret;
+ cfg->boost_enable = device_property_read_bool(dev,
+ "adi,vbias-boost-enable");
+ }
+
+ cfg->burnout_current = device_property_read_bool(dev,
+ "adi,burnout-currents-enable");
+ cfg->buffered = !device_property_read_bool(dev, "adi,buffer-disable");
+ cfg->unipolar = !device_property_read_bool(dev, "bipolar");
+
+ return ad7793_parse_excitation(dev, cfg);
+}
+
static int ad7793_probe(struct spi_device *spi)
{
+ static const char * const supplies[] = { "avdd", "dvdd" };
struct device *dev = &spi->dev;
- const struct ad7793_platform_data *pdata = dev_get_platdata(dev);
+ struct ad7793_config cfg = { };
struct ad7793_state *st;
struct iio_dev *indio_dev;
- int ret, vref_mv = 0;
-
- if (!pdata)
- return dev_err_probe(dev, -ENODEV, "no platform data?\n");
+ unsigned int vref_mv;
+ int ret;
if (!spi->irq)
return dev_err_probe(dev, -ENODEV, "no IRQ?\n");
@@ -798,15 +1025,14 @@ static int ad7793_probe(struct spi_device *spi)
ad_sd_init(&st->sd, indio_dev, spi, &ad7793_sigma_delta_info);
- if (pdata->refsel != AD7793_REFSEL_INTERNAL) {
- ret = devm_regulator_get_enable_read_voltage(dev, "refin");
- if (ret < 0)
- return ret;
+ ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(supplies),
+ supplies);
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to enable supplies\n");
- vref_mv = ret / 1000;
- } else {
- vref_mv = 1170; /* Built-in ref */
- }
+ ret = ad7793_parse_fw(dev, &cfg, &vref_mv);
+ if (ret)
+ return ret;
st->chip_info =
&ad7793_chip_info_tbl[spi_get_device_id(spi)->driver_data];
@@ -821,7 +1047,7 @@ static int ad7793_probe(struct spi_device *spi)
if (ret)
return ret;
- ret = ad7793_setup(indio_dev, pdata, vref_mv);
+ ret = ad7793_setup(indio_dev, &cfg, vref_mv);
if (ret)
return ret;
@@ -842,9 +1068,24 @@ static const struct spi_device_id ad7793_id[] = {
};
MODULE_DEVICE_TABLE(spi, ad7793_id);
+static const struct of_device_id ad7793_of_match[] = {
+ { .compatible = "adi,ad7785", .data = &ad7793_chip_info_tbl[ID_AD7785] },
+ { .compatible = "adi,ad7792", .data = &ad7793_chip_info_tbl[ID_AD7792] },
+ { .compatible = "adi,ad7793", .data = &ad7793_chip_info_tbl[ID_AD7793] },
+ { .compatible = "adi,ad7794", .data = &ad7793_chip_info_tbl[ID_AD7794] },
+ { .compatible = "adi,ad7795", .data = &ad7793_chip_info_tbl[ID_AD7795] },
+ { .compatible = "adi,ad7796", .data = &ad7793_chip_info_tbl[ID_AD7796] },
+ { .compatible = "adi,ad7797", .data = &ad7793_chip_info_tbl[ID_AD7797] },
+ { .compatible = "adi,ad7798", .data = &ad7793_chip_info_tbl[ID_AD7798] },
+ { .compatible = "adi,ad7799", .data = &ad7793_chip_info_tbl[ID_AD7799] },
+ { }
+};
+MODULE_DEVICE_TABLE(of, ad7793_of_match);
+
static struct spi_driver ad7793_driver = {
.driver = {
.name = "ad7793",
+ .of_match_table = ad7793_of_match,
},
.probe = ad7793_probe,
.id_table = ad7793_id,
diff --git a/include/linux/platform_data/ad7793.h b/include/linux/platform_data/ad7793.h
deleted file mode 100644
index 7c697e58f02a..000000000000
--- a/include/linux/platform_data/ad7793.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * AD7792/AD7793 SPI ADC driver
- *
- * Copyright 2011 Analog Devices Inc.
- */
-#ifndef __LINUX_PLATFORM_DATA_AD7793_H__
-#define __LINUX_PLATFORM_DATA_AD7793_H__
-
-/**
- * enum ad7793_clock_source - AD7793 clock source selection
- * @AD7793_CLK_SRC_INT: Internal 64 kHz clock, not available at the CLK pin.
- * @AD7793_CLK_SRC_INT_CO: Internal 64 kHz clock, available at the CLK pin.
- * @AD7793_CLK_SRC_EXT: Use external clock.
- * @AD7793_CLK_SRC_EXT_DIV2: Use external clock divided by 2.
- */
-enum ad7793_clock_source {
- AD7793_CLK_SRC_INT,
- AD7793_CLK_SRC_INT_CO,
- AD7793_CLK_SRC_EXT,
- AD7793_CLK_SRC_EXT_DIV2,
-};
-
-/**
- * enum ad7793_bias_voltage - AD7793 bias voltage selection
- * @AD7793_BIAS_VOLTAGE_DISABLED: Bias voltage generator disabled
- * @AD7793_BIAS_VOLTAGE_AIN1: Bias voltage connected to AIN1(-).
- * @AD7793_BIAS_VOLTAGE_AIN2: Bias voltage connected to AIN2(-).
- * @AD7793_BIAS_VOLTAGE_AIN3: Bias voltage connected to AIN3(-).
- * Only valid for AD7795/AD7796.
- */
-enum ad7793_bias_voltage {
- AD7793_BIAS_VOLTAGE_DISABLED,
- AD7793_BIAS_VOLTAGE_AIN1,
- AD7793_BIAS_VOLTAGE_AIN2,
- AD7793_BIAS_VOLTAGE_AIN3,
-};
-
-/**
- * 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 REFIN1(-). Only valid for AD7795/AD7796.
- * @AD7793_REFSEL_INTERNAL: Internal 1.17 V reference.
- */
-enum ad7793_refsel {
- AD7793_REFSEL_REFIN1 = 0,
- AD7793_REFSEL_REFIN2 = 1,
- AD7793_REFSEL_INTERNAL = 2,
-};
-
-/**
- * enum ad7793_current_source_direction - AD7793 excitation current direction
- * @AD7793_IEXEC1_IOUT1_IEXEC2_IOUT2: Current source IEXC1 connected to pin
- * IOUT1, current source IEXC2 connected to pin IOUT2.
- * @AD7793_IEXEC1_IOUT2_IEXEC2_IOUT1: Current source IEXC2 connected to pin
- * IOUT1, current source IEXC1 connected to pin IOUT2.
- * @AD7793_IEXEC1_IEXEC2_IOUT1: Both current sources connected to pin IOUT1.
- * Only valid when the current sources are set to 10 uA or 210 uA.
- * @AD7793_IEXEC1_IEXEC2_IOUT2: Both current sources connected to Pin IOUT2.
- * Only valid when the current ources are set to 10 uA or 210 uA.
- */
-enum ad7793_current_source_direction {
- AD7793_IEXEC1_IOUT1_IEXEC2_IOUT2 = 0,
- AD7793_IEXEC1_IOUT2_IEXEC2_IOUT1 = 1,
- AD7793_IEXEC1_IEXEC2_IOUT1 = 2,
- AD7793_IEXEC1_IEXEC2_IOUT2 = 3,
-};
-
-/**
- * enum ad7793_excitation_current - AD7793 excitation current selection
- * @AD7793_IX_DISABLED: Excitation current Disabled.
- * @AD7793_IX_10uA: Enable 10 micro-ampere excitation current.
- * @AD7793_IX_210uA: Enable 210 micro-ampere excitation current.
- * @AD7793_IX_1mA: Enable 1 milli-Ampere excitation current.
- */
-enum ad7793_excitation_current {
- AD7793_IX_DISABLED = 0,
- AD7793_IX_10uA = 1,
- AD7793_IX_210uA = 2,
- AD7793_IX_1mA = 3,
-};
-
-/**
- * struct ad7793_platform_data - AD7793 platform data
- * @clock_src: Clock source selection
- * @burnout_current: If set to true the 100nA burnout current is enabled.
- * @boost_enable: Enable boost for the bias voltage generator.
- * @buffered: If set to true configure the device for buffered input mode.
- * @unipolar: If set to true sample in unipolar mode, if set to false sample in
- * bipolar mode.
- * @refsel: Reference voltage selection
- * @bias_voltage: Bias voltage selection
- * @exitation_current: Excitation current selection
- * @current_source_direction: Excitation current direction selection
- */
-struct ad7793_platform_data {
- enum ad7793_clock_source clock_src;
- bool burnout_current;
- bool boost_enable;
- bool buffered;
- bool unipolar;
-
- enum ad7793_refsel refsel;
- enum ad7793_bias_voltage bias_voltage;
- enum ad7793_excitation_current exitation_current;
- enum ad7793_current_source_direction current_source_direction;
-};
-
-#endif /* IIO_ADC_AD7793_H_ */
--
2.56.0