All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Linus Walleij <linus.walleij@linaro.org>, linux-gpio@vger.kernel.org
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	Russell King <linux@armlinux.org.uk>,
	stable@vger.kernel.org
Subject: Re: [PATCH] gpio: fix locking open drain IRQ lines
Date: Thu, 28 May 2020 14:24:58 +0200	[thread overview]
Message-ID: <79d89e93-4e40-089c-606d-e7787013bc80@xs4all.nl> (raw)
In-Reply-To: <20200527140758.162280-1-linus.walleij@linaro.org>

On 27/05/2020 16:07, Linus Walleij wrote:
> We provided the right semantics on open drain lines being
> by definition output but incidentally the irq set up function
> would only allow IRQs on lines that were "not output".
> 
> Fix the semantics to allow output open drain lines to be used
> for IRQs.
> 
> Reported-by: Hans Verkuil <hverkuil@xs4all.nl>

Tested-by: Hans Verkuil <hverkuil@xs4all.nl>

Whether this is the right/best fix or not, I cannot tell, but it certainly
fixes the cec-gpio driver!

Regards,

	Hans

> Cc: Russell King <linux@armlinux.org.uk>
> Cc: stable@vger.kernel.org
> Fixes: 256efaea1fdc ("gpiolib: fix up emulated open drain outputs")
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/gpio/gpiolib.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index b4b5792fe2ff..edd74ff31cea 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -4220,7 +4220,9 @@ int gpiochip_lock_as_irq(struct gpio_chip *gc, unsigned int offset)
>  		}
>  	}
>  
> -	if (test_bit(FLAG_IS_OUT, &desc->flags)) {
> +	/* To be valid for IRQ the line needs to be input or open drain */
> +	if (test_bit(FLAG_IS_OUT, &desc->flags) &&
> +	    !test_bit(FLAG_OPEN_DRAIN, &desc->flags)) {
>  		chip_err(gc,
>  			 "%s: tried to flag a GPIO set as output for IRQ\n",
>  			 __func__);
> 


  parent reply	other threads:[~2020-05-28 12:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-27 14:07 [PATCH] gpio: fix locking open drain IRQ lines Linus Walleij
2020-05-27 14:18 ` Russell King - ARM Linux admin
2020-05-28 13:46   ` Linus Walleij
2020-05-28 13:58     ` Russell King - ARM Linux admin
2020-05-28 14:20       ` Hans Verkuil
2020-05-28 12:24 ` Hans Verkuil [this message]
2020-05-29 11:06   ` Hans Verkuil
2020-05-29 12:03     ` Linus Walleij

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=79d89e93-4e40-089c-606d-e7787013bc80@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=bgolaszewski@baylibre.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.