diff options
author | 2024-08-02 16:27:03 +0200 | |
---|---|---|
committer | 2024-08-03 14:36:45 +0100 | |
commit | 232cca61cf2f964bebbec66504a86b4ce36b6842 (patch) | |
tree | 8161918e3890182a989dbe495c2199fccee9fdb6 | |
parent | iio: adc: adi-axi-adc: support modified prbs23 (diff) | |
download | wireguard-linux-232cca61cf2f964bebbec66504a86b4ce36b6842.tar.xz wireguard-linux-232cca61cf2f964bebbec66504a86b4ce36b6842.zip |
iio: adc: adi-axi-adc: split axi_adc_chan_status()
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>
-rw-r--r-- | drivers/iio/adc/adi-axi-adc.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/iio/adc/adi-axi-adc.c b/drivers/iio/adc/adi-axi-adc.c index f4cdfcca865d..442a87024e1a 100644 --- a/drivers/iio/adc/adi-axi-adc.c +++ b/drivers/iio/adc/adi-axi-adc.c @@ -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; |