]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iio: adc: adi-axi-adc: split axi_adc_chan_status()
authorNuno Sa <nuno.sa@analog.com>
Fri, 2 Aug 2024 14:27:03 +0000 (16:27 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 3 Aug 2024 13:36:45 +0000 (14:36 +0100)
Add a new axi_adc_read_chan_status() helper so we get the raw register
value out of it.

This is in preparation of a future change where we really want to look
into dedicated bits of the register.

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://patch.msgid.link/20240802-dev-iio-backend-add-debugfs-v2-5-4cb62852f0d0@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/adi-axi-adc.c

index f4cdfcca865d55a9f278315aa5b310a00787be5d..442a87024e1a647a75bbeb5c01a450d2f6013416 100644 (file)
@@ -208,12 +208,10 @@ static int axi_adc_test_pattern_set(struct iio_backend *back,
        }
 }
 
-static int axi_adc_chan_status(struct iio_backend *back, unsigned int chan,
-                              bool *error)
+static int axi_adc_read_chan_status(struct adi_axi_adc_state *st, unsigned int chan,
+                                   unsigned int *status)
 {
-       struct adi_axi_adc_state *st = iio_backend_get_priv(back);
        int ret;
-       u32 val;
 
        guard(mutex)(&st->lock);
        /* reset test bits by setting them */
@@ -225,7 +223,18 @@ static int axi_adc_chan_status(struct iio_backend *back, unsigned int chan,
        /* let's give enough time to validate or erroring the incoming pattern */
        fsleep(1000);
 
-       ret = regmap_read(st->regmap, ADI_AXI_ADC_REG_CHAN_STATUS(chan), &val);
+       return regmap_read(st->regmap, ADI_AXI_ADC_REG_CHAN_STATUS(chan),
+                          status);
+}
+
+static int axi_adc_chan_status(struct iio_backend *back, unsigned int chan,
+                              bool *error)
+{
+       struct adi_axi_adc_state *st = iio_backend_get_priv(back);
+       u32 val;
+       int ret;
+
+       ret = axi_adc_read_chan_status(st, chan, &val);
        if (ret)
                return ret;