[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230623022334.791026-5-gnstark@sberdevices.ru>
Date: Fri, 23 Jun 2023 05:20:12 +0300
From: George Stark <gnstark@...rdevices.ru>
To: <jic23@...nel.org>, <lars@...afoo.de>, <neil.armstrong@...aro.org>,
<khilman@...libre.com>, <jbrunet@...libre.com>,
<martin.blumenstingl@...glemail.com>,
<andriy.shevchenko@...ux.intel.com>, <nuno.sa@...log.com>,
<gnstark@...rdevices.ru>
CC: <linux-iio@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>,
<linux-amlogic@...ts.infradead.org>, <kernel@...rdevices.ru>,
George Stark <GNStark@...rdevices.ru>
Subject: [PATCH v2 4/6] meson saradc: add enum for iio channel array indexes
Add enum for iio channel array indexes.
Signed-off-by: George Stark <GNStark@...rdevices.ru>
---
drivers/iio/adc/meson_saradc.c | 34 +++++++++++++++++++++++-----------
1 file changed, 23 insertions(+), 11 deletions(-)
diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
index ffd4de950a63..7ef006650982 100644
--- a/drivers/iio/adc/meson_saradc.c
+++ b/drivers/iio/adc/meson_saradc.c
@@ -223,16 +223,28 @@ enum meson_sar_adc_chan7_mux_sel {
CHAN7_MUX_CH7_INPUT = 0x7,
};
+enum meson_sar_adc_channel_index {
+ INDEX_CHAN_0,
+ INDEX_CHAN_1,
+ INDEX_CHAN_2,
+ INDEX_CHAN_3,
+ INDEX_CHAN_4,
+ INDEX_CHAN_5,
+ INDEX_CHAN_6,
+ INDEX_CHAN_7,
+ INDEX_CHAN_SOFT_TIMESTAMP,
+};
+
static const struct iio_chan_spec meson_sar_adc_iio_channels[] = {
- MESON_SAR_ADC_CHAN(0),
- MESON_SAR_ADC_CHAN(1),
- MESON_SAR_ADC_CHAN(2),
- MESON_SAR_ADC_CHAN(3),
- MESON_SAR_ADC_CHAN(4),
- MESON_SAR_ADC_CHAN(5),
- MESON_SAR_ADC_CHAN(6),
- MESON_SAR_ADC_CHAN(7),
- IIO_CHAN_SOFT_TIMESTAMP(8),
+ MESON_SAR_ADC_CHAN(INDEX_CHAN_0),
+ MESON_SAR_ADC_CHAN(INDEX_CHAN_1),
+ MESON_SAR_ADC_CHAN(INDEX_CHAN_2),
+ MESON_SAR_ADC_CHAN(INDEX_CHAN_3),
+ MESON_SAR_ADC_CHAN(INDEX_CHAN_4),
+ MESON_SAR_ADC_CHAN(INDEX_CHAN_5),
+ MESON_SAR_ADC_CHAN(INDEX_CHAN_6),
+ MESON_SAR_ADC_CHAN(INDEX_CHAN_7),
+ IIO_CHAN_SOFT_TIMESTAMP(INDEX_CHAN_SOFT_TIMESTAMP),
MESON_SAR_ADC_TEMP_CHAN(), /* must be the last item */
};
@@ -1003,7 +1015,7 @@ static int meson_sar_adc_calib(struct iio_dev *indio_dev)
meson_sar_adc_set_chan7_mux(indio_dev, CHAN7_MUX_VDD_DIV4);
usleep_range(10, 20);
ret = meson_sar_adc_get_sample(indio_dev,
- &indio_dev->channels[7],
+ &indio_dev->channels[INDEX_CHAN_7],
MEAN_AVERAGING, EIGHT_SAMPLES, &value0);
if (ret < 0)
goto out;
@@ -1011,7 +1023,7 @@ static int meson_sar_adc_calib(struct iio_dev *indio_dev)
meson_sar_adc_set_chan7_mux(indio_dev, CHAN7_MUX_VDD_MUL3_DIV4);
usleep_range(10, 20);
ret = meson_sar_adc_get_sample(indio_dev,
- &indio_dev->channels[7],
+ &indio_dev->channels[INDEX_CHAN_7],
MEAN_AVERAGING, EIGHT_SAMPLES, &value1);
if (ret < 0)
goto out;
--
2.38.4
Powered by blists - more mailing lists