[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <6ZXLWQ.5R931M3PVWBF2@crapouillou.net>
Date: Wed, 21 Jul 2021 19:28:18 +0100
From: Paul Cercueil <paul@...pouillou.net>
To: citral23 <cbranchereau@...il.com>
Cc: jic23@...nel.org, lars@...afoo.de, linux-mips@...r.kernel.org,
linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
robh+dt@...nel.org, devicetree@...r.kernel.org, linux@...ck-us.net,
contact@...ur-rojek.eu
Subject: Re: [PATCH 5/6] iio/adc: ingenic: modify
Hi Christophe,
Le mer., juil. 21 2021 at 12:53:16 +0200, citral23
<cbranchereau@...il.com> a écrit :
> The current code does not allow to set MD to 0 to sample AUX0, fix it
> for the JZ4760(B).
Well, then this should be merged with patch 3, because that means
JZ4760 support does not work without it.
Also, concise commit messages are good, but "modify" is a bit too
concise ;)
Cheers,
-Paul
> Signed-off-by: citral23 <cbranchereau@...il.com>
> ---
> drivers/iio/adc/ingenic-adc.c | 20 ++++++++++++++++----
> 1 file changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/iio/adc/ingenic-adc.c
> b/drivers/iio/adc/ingenic-adc.c
> index 618150475421..1edaae439a32 100644
> --- a/drivers/iio/adc/ingenic-adc.c
> +++ b/drivers/iio/adc/ingenic-adc.c
> @@ -632,7 +632,7 @@ static int ingenic_adc_read_chan_info_raw(struct
> iio_dev *iio_dev,
> struct iio_chan_spec const *chan,
> int *val)
> {
> - int bit, ret, engine = (chan->channel == INGENIC_ADC_BATTERY);
> + int cmd, ret, engine = (chan->channel == INGENIC_ADC_BATTERY);
> struct ingenic_adc *adc = iio_priv(iio_dev);
>
> ret = clk_enable(adc->clk);
> @@ -642,11 +642,22 @@ static int
> ingenic_adc_read_chan_info_raw(struct iio_dev *iio_dev,
> return ret;
> }
>
> - /* We cannot sample AUX/AUX2 in parallel. */
> + /* We cannot sample the aux channels in parallel. */
> mutex_lock(&adc->aux_lock);
> if (adc->soc_data->has_aux_md && engine == 0) {
> - bit = BIT(chan->channel == INGENIC_ADC_AUX2);
> - ingenic_adc_set_config(adc, JZ_ADC_REG_CFG_AUX_MD, bit);
> + switch (chan->channel) {
> + case INGENIC_ADC_AUX0:
> + cmd = 0;
> + break;
> + case INGENIC_ADC_AUX:
> + cmd = 1;
> + break;
> + case INGENIC_ADC_AUX2:
> + cmd = 2;
> + break;
> + }
> +
> + ingenic_adc_set_config(adc, JZ_ADC_REG_CFG_AUX_MD, cmd);
> }
>
> ret = ingenic_adc_capture(adc, engine);
> @@ -654,6 +665,7 @@ static int ingenic_adc_read_chan_info_raw(struct
> iio_dev *iio_dev,
> goto out;
>
> switch (chan->channel) {
> + case INGENIC_ADC_AUX0:
> case INGENIC_ADC_AUX:
> case INGENIC_ADC_AUX2:
> *val = readw(adc->base + JZ_ADC_REG_ADSDAT);
> --
> 2.30.2
>
Powered by blists - more mailing lists