stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Sai Kumar Cholleti <skmr537@gmail.com>
Cc: bgolaszewski@baylibre.com, linux-gpio@vger.kernel.org,
	mmcclain@noprivs.com, stable@vger.kernel.org
Subject: Re: [PATCH v3] gpio: exar: set value when external pull-up or pull-down is present
Date: Tue, 12 Nov 2024 17:30:38 +0200	[thread overview]
Message-ID: <ZzN0nn6WFw2J8HTF@smile.fi.intel.com> (raw)
In-Reply-To: <ZyouKu8_vfFs20CB@smile.fi.intel.com>

On Tue, Nov 05, 2024 at 04:39:38PM +0200, Andy Shevchenko wrote:
> On Tue, Nov 05, 2024 at 12:45:23PM +0530, Sai Kumar Cholleti wrote:
> > Setting GPIO direction = high, sometimes results in GPIO value = 0.
> > 
> > If a GPIO is pulled high, the following construction results in the
> > value being 0 when the desired value is 1:
> > 
> > $ echo "high" > /sys/class/gpio/gpio336/direction
> > $ cat /sys/class/gpio/gpio336/value
> > 0
> > 
> > Before the GPIO direction is changed from an input to an output,
> > exar_set_value() is called with value = 1, but since the GPIO is an
> > input when exar_set_value() is called, _regmap_update_bits() reads a 1
> > due to an external pull-up.  regmap_set_bits() sets force_write =
> > false, so the value (1) is not written.  When the direction is then
> > changed, the GPIO becomes an output with the value of 0 (the hardware
> > default).
> > 
> > regmap_write_bits() sets force_write = true, so the value is always
> > written by exar_set_value() and an external pull-up doesn't affect the
> > outcome of setting direction = high.
> > 
> > 
> > The same can happen when a GPIO is pulled low, but the scenario is a
> > little more complicated.
> > 
> > $ echo high > /sys/class/gpio/gpio351/direction
> > $ cat /sys/class/gpio/gpio351/value
> > 1
> > 
> > $ echo in > /sys/class/gpio/gpio351/direction
> > $ cat /sys/class/gpio/gpio351/value
> > 0
> > 
> > $ echo low > /sys/class/gpio/gpio351/direction
> > $ cat /sys/class/gpio/gpio351/value
> > 1
> 
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Does this need to be applied, Bart?
Seems it is missed in your branches...

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2024-11-12 15:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <ZyjLSmtwyPiD9-r5@black.fi.intel.com>
2024-11-04 15:47 ` [PATCH v2] gpio: exar: set value when external pull-up or pull-down is present Sai Kumar Cholleti
2024-11-04 18:56   ` Andy Shevchenko
2024-11-05  7:15     ` [PATCH v3] " Sai Kumar Cholleti
2024-11-05 14:39       ` Andy Shevchenko
2024-11-12 15:30         ` Andy Shevchenko [this message]
2024-11-18 11:00           ` Bartosz Golaszewski
2024-11-18 12:34             ` Andy Shevchenko
2024-11-19 13:50               ` sai kumar
2024-11-21  8:10       ` Bartosz Golaszewski

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=ZzN0nn6WFw2J8HTF@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=linux-gpio@vger.kernel.org \
    --cc=mmcclain@noprivs.com \
    --cc=skmr537@gmail.com \
    --cc=stable@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;
as well as URLs for NNTP newsgroup(s).