Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Janani Sunil" <janani.sunil@analog.com>
Cc: conor+dt@kernel.org, robh@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 5/6] gpio: ad7768: Add AD7768 GPIO auxiliary driver
Date: Thu, 09 Jul 2026 09:38:02 +0000	[thread overview]
Message-ID: <20260709093803.2BE5B1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260709-ad7768-driver-v1-5-44e1194fd96a@analog.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Configuring GPIO direction to output before setting the intended output value causes a transient hardware glitch.
--

--- Patch [5]: [PATCH 5/6] gpio: ad7768: Add AD7768 GPIO auxiliary driver ---
commit 0fd38c3af385be1ae0dc21601c951d0e8f32ade5
Author: Janani Sunil <janani.sunil@analog.com>

gpio: ad7768: Add AD7768 GPIO auxiliary driver

This commit adds an auxiliary bus driver to expose 5 general-purpose I/O
pins on the AD7768/AD7768-4 ADC as a GPIO controller. The driver handles pin
direction and value configuration by sharing a regmap with the parent IIO
device.

> diff --git a/drivers/gpio/gpio-ad7768.c b/drivers/gpio/gpio-ad7768.c
> new file mode 100644
> index 0000000000000..c2f01b1abd7c9
> --- /dev/null
> +++ b/drivers/gpio/gpio-ad7768.c

[ ... ]

> +static int ad7768_gpio_direction_output(struct gpio_chip *chip,
> +					unsigned int offset, int value)
> +{
> +	struct ad7768_gpio_state *st = gpiochip_get_data(chip);
> +	int ret;
> +
> +	PM_RUNTIME_ACQUIRE_IF_ENABLED_AUTOSUSPEND(st->parent, pm);
> +	ret = PM_RUNTIME_ACQUIRE_ERR(&pm);
> +	if (ret)
> +		return ret;
> +
> +	guard(mutex)(&st->lock);
> +
> +	ret = regmap_update_bits(st->regmap, AD7768_REG_GPIO_CONTROL,
> +				 BIT(offset), AD7768_GPIO_OUTPUT(offset));
> +	if (ret)
> +		return ret;
> +
> +	return regmap_update_bits(st->regmap, AD7768_REG_GPIO_WRITE,
> +				  BIT(offset), value << offset);

[Severity: Medium]
Will this sequence cause a transient hardware glitch on the GPIO pin?

By configuring the pin direction to output in AD7768_REG_GPIO_CONTROL before
setting the intended output value in AD7768_REG_GPIO_WRITE, the hardware
could briefly drive the line with whatever stale value is currently held in
the write register.

Would it be safer to write the intended value to AD7768_REG_GPIO_WRITE first,
and only then switch the pin direction to output?

> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260709-ad7768-driver-v1-0-44e1194fd96a@analog.com?part=5

  reply	other threads:[~2026-07-09  9:38 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-09  8:50 [PATCH 0/6] iio: adc: Add AD7768/AD7768-4 ADC driver support Janani Sunil
2026-07-09  8:50 ` [PATCH 1/6] dt-bindings: iio: adc: Add AD7768 Janani Sunil
2026-07-09  8:59   ` sashiko-bot
2026-07-09 15:43   ` David Lechner
2026-07-10  0:33     ` Jonathan Cameron
2026-07-11 14:40       ` David Lechner
2026-07-10  1:39   ` Jonathan Cameron
2026-07-09  8:50 ` [PATCH 2/6] iio: backend: Add support for CRC Janani Sunil
2026-07-09  9:03   ` sashiko-bot
2026-07-10  0:36   ` Jonathan Cameron
2026-07-09  8:50 ` [PATCH 3/6] iio: adc: adi-axi-adc: " Janani Sunil
2026-07-09  9:14   ` sashiko-bot
2026-07-09 15:54   ` David Lechner
2026-07-10  0:39   ` Jonathan Cameron
2026-07-10  0:46   ` Jonathan Cameron
2026-07-09  8:50 ` [PATCH 4/6] iio: adc: Add AD7768 IIO Driver support Janani Sunil
2026-07-09  9:27   ` sashiko-bot
2026-07-10  2:10   ` Jonathan Cameron
2026-07-10  7:41   ` Uwe Kleine-König
2026-07-09  8:50 ` [PATCH 5/6] gpio: ad7768: Add AD7768 GPIO auxiliary driver Janani Sunil
2026-07-09  9:38   ` sashiko-bot [this message]
2026-07-09 11:05   ` Andy Shevchenko
2026-07-10  2:14   ` Jonathan Cameron
2026-07-10 20:06   ` Linus Walleij
2026-07-09  8:50 ` [PATCH 6/6] Documentation: iio: Add AD7768 Documentation Janani Sunil
2026-07-09  9:41   ` sashiko-bot
2026-07-10  2:16   ` 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=20260709093803.2BE5B1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=janani.sunil@analog.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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