linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-gpio@vger.kernel.org,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>
Subject: Re: [PATCH] pinctrl: intel: Pass irqchip when adding gpiochip
Date: Mon, 7 Oct 2019 11:11:19 +0300	[thread overview]
Message-ID: <20191007081119.GJ32742@smile.fi.intel.com> (raw)
In-Reply-To: <20191006005949.30849-1-linus.walleij@linaro.org>

On Sun, Oct 06, 2019 at 02:59:49AM +0200, Linus Walleij wrote:
> We need to convert all old gpio irqchips to pass the irqchip
> setup along when adding the gpio_chip. For more info see
> drivers/gpio/TODO.
> 
> This is an unchained irqchip so we use the method from
> drivers/gpio/gpio-mt7621.c that also requests its interrupt
> instead if chaining the interrupt handler.

One comment below, after addressing,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> 
> Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> This is based on Andy's patch to dynamically allocate the
> irqchio. Mika maybe you want to queue it with the rest of
> the stuff so you can sync fixes and new development?

My Rb tag Mika may use for fixes stuff in this cycle.

> ---
>  drivers/pinctrl/intel/pinctrl-intel.c | 52 ++++++++++++++++-----------
>  1 file changed, 31 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
> index bc013599a9a3..d63566e57f4c 100644
> --- a/drivers/pinctrl/intel/pinctrl-intel.c
> +++ b/drivers/pinctrl/intel/pinctrl-intel.c
> @@ -1206,6 +1206,37 @@ static int intel_gpio_probe(struct intel_pinctrl *pctrl, int irq)
>  	pctrl->irqchip.irq_set_wake = intel_gpio_irq_wake;
>  	pctrl->irqchip.flags = IRQCHIP_MASK_ON_SUSPEND;
>  
> +	/*
> +	 * We need to request the interrupt here (instead of using a
> +	 * chained handler) because on some platforms several GPIO
> +	 * controllers share the same interrupt line.
> +	 */
> +	ret = devm_request_irq(pctrl->dev, irq, intel_gpio_irq,
> +			       IRQF_SHARED | IRQF_NO_THREAD,
> +			       dev_name(pctrl->dev), pctrl);

> +	if (!ret) {

Why not positive condition?

> +		struct gpio_irq_chip *girq;
> +
> +		girq = &pctrl->chip.irq;
> +		girq->chip = &pctrl->irqchip;
> +		/*
> +		 * This is an unchained interrupt. Compare to
> +		 * drivers/gpio/gpio-mt7621.c that also does this:
> +		 * assign no parents.
> +		 *
> +		 * FIXME: make the gpiolib flag this and handle unchained
> +		 * GPIO interrupts better if need be.
> +		 */
> +		girq->parent_handler = NULL;
> +		girq->num_parents = 0;
> +		girq->parents = NULL;
> +		girq->default_type = IRQ_TYPE_NONE;
> +		girq->handler = handle_bad_irq;
> +	} else {
> +		/* Skip irqchip, register gpiochip anyway */
> +		dev_err(pctrl->dev, "failed to request interrupt\n");
> +	}
> +
>  	ret = devm_gpiochip_add_data(pctrl->dev, &pctrl->chip, pctrl);
>  	if (ret) {
>  		dev_err(pctrl->dev, "failed to register gpiochip\n");
> @@ -1222,27 +1253,6 @@ static int intel_gpio_probe(struct intel_pinctrl *pctrl, int irq)
>  		}
>  	}
>  
> -	/*
> -	 * We need to request the interrupt here (instead of providing chip
> -	 * to the irq directly) because on some platforms several GPIO
> -	 * controllers share the same interrupt line.
> -	 */
> -	ret = devm_request_irq(pctrl->dev, irq, intel_gpio_irq,
> -			       IRQF_SHARED | IRQF_NO_THREAD,
> -			       dev_name(pctrl->dev), pctrl);
> -	if (ret) {
> -		dev_err(pctrl->dev, "failed to request interrupt\n");
> -		return ret;
> -	}
> -
> -	ret = gpiochip_irqchip_add(&pctrl->chip, &pctrl->irqchip, 0,
> -				   handle_bad_irq, IRQ_TYPE_NONE);
> -	if (ret) {
> -		dev_err(pctrl->dev, "failed to add irqchip\n");
> -		return ret;
> -	}
> -
> -	gpiochip_set_chained_irqchip(&pctrl->chip, &pctrl->irqchip, irq, NULL);
>  	return 0;
>  }
>  
> -- 
> 2.21.0
> 

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2019-10-07  8:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-06  0:59 [PATCH] pinctrl: intel: Pass irqchip when adding gpiochip Linus Walleij
2019-10-07  8:11 ` Andy Shevchenko [this message]
2019-10-07 14:22 ` Mika Westerberg
  -- strict thread matches above, loose matches on Subject: below --
2019-12-29  1:30 Linus Walleij
2019-12-30 10:20 ` Mika Westerberg
2020-01-07 10:32   ` Linus Walleij
2020-01-07 13:52     ` Mika Westerberg
2020-01-07 14:48       ` Andy Shevchenko

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=20191007081119.GJ32742@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    /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).