From: "Nuno Sá" <noname.nuno@gmail.com>
To: Cosmin Tanislav <demonsingur@gmail.com>
Cc: Cosmin Tanislav <cosmin.tanislav@analog.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Michael Hennerich <Michael.Hennerich@analog.com>,
Jonathan Cameron <jic23@kernel.org>,
Andy Shevchenko <andy.shevchenko@gmail.com>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] iio: adc: ad4130: only set GPIO_CTRL if pin is unused
Date: Thu, 08 Feb 2024 09:16:39 +0100 [thread overview]
Message-ID: <4eb13d801cd227e8682f10804025f5b6da2dfafc.camel@gmail.com> (raw)
In-Reply-To: <20240207132007.253768-2-demonsingur@gmail.com>
On Wed, 2024-02-07 at 15:20 +0200, Cosmin Tanislav wrote:
> Currently, GPIO_CTRL bits are set even if the pins are used for
> measurements.
>
> GPIO_CTRL bits should only be set if the pin is not used for
> other functionality.
>
> Fix this by only setting the GPIO_CTRL bits if the pin has no
> other function.
>
> Fixes: 62094060cf3a ("iio: adc: ad4130: add AD4130 driver")
> Signed-off-by: Cosmin Tanislav <demonsingur@gmail.com>
> ---
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
> drivers/iio/adc/ad4130.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/iio/adc/ad4130.c b/drivers/iio/adc/ad4130.c
> index c7df499f9775..febb64e67955 100644
> --- a/drivers/iio/adc/ad4130.c
> +++ b/drivers/iio/adc/ad4130.c
> @@ -1864,10 +1864,14 @@ static int ad4130_setup(struct iio_dev *indio_dev)
> return ret;
>
> /*
> - * Configure all GPIOs for output. If configured, the interrupt
> function
> - * of P2 takes priority over the GPIO out function.
> + * Configure unused GPIOs for output. If configured, the interrupt
> + * function of P2 takes priority over the GPIO out function.
> */
> - val = AD4130_IO_CONTROL_GPIO_CTRL_MASK;
> + val = 0;
> + for (i = 0; i < AD4130_MAX_GPIOS; i++)
> + if (st->pins_fn[i + AD4130_AIN2_P1] == AD4130_PIN_FN_NONE)
> + val |= FIELD_PREP(AD4130_IO_CONTROL_GPIO_CTRL_MASK,
> BIT(i));
> +
> val |= FIELD_PREP(AD4130_IO_CONTROL_INT_PIN_SEL_MASK, st-
> >int_pin_sel);
>
> ret = regmap_write(st->regmap, AD4130_IO_CONTROL_REG, val);
next prev parent reply other threads:[~2024-02-08 8:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-07 13:20 [PATCH 1/2] iio: adc: ad4130: zero-initialize clock init data Cosmin Tanislav
2024-02-07 13:20 ` [PATCH 2/2] iio: adc: ad4130: only set GPIO_CTRL if pin is unused Cosmin Tanislav
2024-02-08 8:16 ` Nuno Sá [this message]
2024-02-08 8:15 ` [PATCH 1/2] iio: adc: ad4130: zero-initialize clock init data Nuno Sá
2024-02-10 16:53 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4eb13d801cd227e8682f10804025f5b6da2dfafc.camel@gmail.com \
--to=noname.nuno@gmail.com \
--cc=Michael.Hennerich@analog.com \
--cc=andy.shevchenko@gmail.com \
--cc=cosmin.tanislav@analog.com \
--cc=demonsingur@gmail.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox