public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Philippe REYNES <philippe.reynes@softathome.com>
To: u-boot@lists.denx.de
Subject: [PATCH v2 2/3] drivers: gpio: keep output value for input on sandbox
Date: Mon, 14 Sep 2020 18:01:30 +0200 (CEST)	[thread overview]
Message-ID: <1304662004.1007012.1600099290038.JavaMail.zimbra@softathome.com> (raw)
In-Reply-To: <20200914105056.174287-3-xypron.glpk@gmx.de>


> For testing purposes keep the output value when switching to input.
> This allows us to manipulate the input value via the gpio command.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

Reviewed-by: Philippe Reynes <philippe.reynes@softathome.com>

> ---
> v2:
> new patch
> ---
> drivers/gpio/sandbox.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpio/sandbox.c b/drivers/gpio/sandbox.c
> index c2f80472b8..eb2600de31 100644
> --- a/drivers/gpio/sandbox.c
> +++ b/drivers/gpio/sandbox.c
> @@ -185,7 +185,15 @@ static int sb_gpio_set_dir_flags(struct udevice *dev,
> unsigned int offset,
> 
> dir_flags = get_gpio_dir_flags(dev, offset);
> 
> - *dir_flags = flags;
> + /*
> + * For testing purposes keep the output value when switching to input.
> + * This allows us to manipulate the input value via the gpio command.
> + */
> + if (flags & GPIOD_IS_IN)
> + *dir_flags = (flags & ~GPIOD_IS_OUT_ACTIVE) |
> + (*dir_flags & GPIOD_IS_OUT_ACTIVE);
> + else
> + *dir_flags = flags;
> 
> return 0;
> }
> --
> 2.28.0

  reply	other threads:[~2020-09-14 16:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-14 10:50 [PATCH v2 0/3] cmd/button: return button status Heinrich Schuchardt
2020-09-14 10:50 ` [PATCH v2 1/3] test: sharpen button label unit test Heinrich Schuchardt
2020-09-14 16:00   ` Philippe REYNES
2020-10-14 17:42   ` Tom Rini
2020-09-14 10:50 ` [PATCH v2 2/3] drivers: gpio: keep output value for input on sandbox Heinrich Schuchardt
2020-09-14 16:01   ` Philippe REYNES [this message]
2020-10-14 17:42   ` Tom Rini
2020-09-14 10:50 ` [PATCH v2 3/3] cmd/button: return button status Heinrich Schuchardt
2020-09-14 16:02   ` Philippe REYNES
2020-10-14 17:42   ` Tom Rini

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=1304662004.1007012.1600099290038.JavaMail.zimbra@softathome.com \
    --to=philippe.reynes@softathome.com \
    --cc=u-boot@lists.denx.de \
    /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