All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
To: Jeffy Chen <jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>,
	John Keeping <john-HooS5bfzL4hWk0Htik3J/w@public.gmane.org>
Cc: linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Linus Walleij
	<linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Brian Norris
	<briannorris-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
	Douglas Anderson
	<dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Tomasz Figa <tfiga-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH] pinctrl: rockchip: add irq_enable & irq_disable ops
Date: Wed, 15 Mar 2017 18:46:38 +0100	[thread overview]
Message-ID: <2305921.lIYBC71m00@phil> (raw)
In-Reply-To: <1488434212-6567-1-git-send-email-jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>

Am Donnerstag, 2. März 2017, 13:56:52 CET schrieb Jeffy Chen:
> Currently we are trying to enable/disable the clk of irq's gpio bank when
> unmask/mask irq. But the kernel's "lazy disable approach" will skip masking
> irq when the irq chip doesn't support irq_disable ops.
> 
> So we may hit this case:
> 	irq_enable-> enable clk
> 	irq_disable-> noop
> 	irq_enable-> enable clk again
> 	irq_disable-> noop
> 
> Signed-off-by: Jeffy Chen <jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>

While I'm not that versed in irqchip details, reading through some other 
irqchips makes this look correct handling, so also makes sense in the context 
of the pinctrl irqs here

Reviewed-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>

> ---
> 
>  drivers/pinctrl/pinctrl-rockchip.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-rockchip.c
> b/drivers/pinctrl/pinctrl-rockchip.c index 7813599..a9a7dfa 100644
> --- a/drivers/pinctrl/pinctrl-rockchip.c
> +++ b/drivers/pinctrl/pinctrl-rockchip.c
> @@ -2061,7 +2061,7 @@ static void rockchip_irq_resume(struct irq_data *d)
>  	clk_disable(bank->clk);
>  }
> 
> -static void rockchip_irq_gc_mask_clr_bit(struct irq_data *d)
> +static void rockchip_irq_enable(struct irq_data *d)
>  {
>  	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
>  	struct rockchip_pin_bank *bank = gc->private;
> @@ -2070,7 +2070,7 @@ static void rockchip_irq_gc_mask_clr_bit(struct
> irq_data *d) irq_gc_mask_clr_bit(d);
>  }
> 
> -static void rockchip_irq_gc_mask_set_bit(struct irq_data *d)
> +static void rockchip_irq_disable(struct irq_data *d)
>  {
>  	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
>  	struct rockchip_pin_bank *bank = gc->private;
> @@ -2137,9 +2137,10 @@ static int rockchip_interrupts_register(struct
> platform_device *pdev, gc->chip_types[0].regs.mask = GPIO_INTMASK;
>  		gc->chip_types[0].regs.ack = GPIO_PORTS_EOI;
>  		gc->chip_types[0].chip.irq_ack = irq_gc_ack_set_bit;
> -		gc->chip_types[0].chip.irq_mask = rockchip_irq_gc_mask_set_bit;
> -		gc->chip_types[0].chip.irq_unmask =
> -						  rockchip_irq_gc_mask_clr_bit;
> +		gc->chip_types[0].chip.irq_mask = irq_gc_mask_set_bit;
> +		gc->chip_types[0].chip.irq_unmask = irq_gc_mask_clr_bit;
> +		gc->chip_types[0].chip.irq_enable = rockchip_irq_enable;
> +		gc->chip_types[0].chip.irq_disable = rockchip_irq_disable;
>  		gc->chip_types[0].chip.irq_set_wake = irq_gc_set_wake;
>  		gc->chip_types[0].chip.irq_suspend = rockchip_irq_suspend;
>  		gc->chip_types[0].chip.irq_resume = rockchip_irq_resume;

WARNING: multiple messages have this Message-ID (diff)
From: Heiko Stuebner <heiko@sntech.de>
To: Jeffy Chen <jeffy.chen@rock-chips.com>, John Keeping <john@metanate.com>
Cc: linux-gpio@vger.kernel.org,
	Brian Norris <briannorris@chromium.org>,
	Douglas Anderson <dianders@chromium.org>,
	Tomasz Figa <tfiga@google.com>,
	linux-rockchip@lists.infradead.org,
	Linus Walleij <linus.walleij@linaro.org>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] pinctrl: rockchip: add irq_enable & irq_disable ops
Date: Wed, 15 Mar 2017 18:46:38 +0100	[thread overview]
Message-ID: <2305921.lIYBC71m00@phil> (raw)
In-Reply-To: <1488434212-6567-1-git-send-email-jeffy.chen@rock-chips.com>

Am Donnerstag, 2. März 2017, 13:56:52 CET schrieb Jeffy Chen:
> Currently we are trying to enable/disable the clk of irq's gpio bank when
> unmask/mask irq. But the kernel's "lazy disable approach" will skip masking
> irq when the irq chip doesn't support irq_disable ops.
> 
> So we may hit this case:
> 	irq_enable-> enable clk
> 	irq_disable-> noop
> 	irq_enable-> enable clk again
> 	irq_disable-> noop
> 
> Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>

While I'm not that versed in irqchip details, reading through some other 
irqchips makes this look correct handling, so also makes sense in the context 
of the pinctrl irqs here

Reviewed-by: Heiko Stuebner <heiko@sntech.de>

> ---
> 
>  drivers/pinctrl/pinctrl-rockchip.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-rockchip.c
> b/drivers/pinctrl/pinctrl-rockchip.c index 7813599..a9a7dfa 100644
> --- a/drivers/pinctrl/pinctrl-rockchip.c
> +++ b/drivers/pinctrl/pinctrl-rockchip.c
> @@ -2061,7 +2061,7 @@ static void rockchip_irq_resume(struct irq_data *d)
>  	clk_disable(bank->clk);
>  }
> 
> -static void rockchip_irq_gc_mask_clr_bit(struct irq_data *d)
> +static void rockchip_irq_enable(struct irq_data *d)
>  {
>  	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
>  	struct rockchip_pin_bank *bank = gc->private;
> @@ -2070,7 +2070,7 @@ static void rockchip_irq_gc_mask_clr_bit(struct
> irq_data *d) irq_gc_mask_clr_bit(d);
>  }
> 
> -static void rockchip_irq_gc_mask_set_bit(struct irq_data *d)
> +static void rockchip_irq_disable(struct irq_data *d)
>  {
>  	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
>  	struct rockchip_pin_bank *bank = gc->private;
> @@ -2137,9 +2137,10 @@ static int rockchip_interrupts_register(struct
> platform_device *pdev, gc->chip_types[0].regs.mask = GPIO_INTMASK;
>  		gc->chip_types[0].regs.ack = GPIO_PORTS_EOI;
>  		gc->chip_types[0].chip.irq_ack = irq_gc_ack_set_bit;
> -		gc->chip_types[0].chip.irq_mask = rockchip_irq_gc_mask_set_bit;
> -		gc->chip_types[0].chip.irq_unmask =
> -						  rockchip_irq_gc_mask_clr_bit;
> +		gc->chip_types[0].chip.irq_mask = irq_gc_mask_set_bit;
> +		gc->chip_types[0].chip.irq_unmask = irq_gc_mask_clr_bit;
> +		gc->chip_types[0].chip.irq_enable = rockchip_irq_enable;
> +		gc->chip_types[0].chip.irq_disable = rockchip_irq_disable;
>  		gc->chip_types[0].chip.irq_set_wake = irq_gc_set_wake;
>  		gc->chip_types[0].chip.irq_suspend = rockchip_irq_suspend;
>  		gc->chip_types[0].chip.irq_resume = rockchip_irq_resume;

WARNING: multiple messages have this Message-ID (diff)
From: heiko@sntech.de (Heiko Stuebner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] pinctrl: rockchip: add irq_enable & irq_disable ops
Date: Wed, 15 Mar 2017 18:46:38 +0100	[thread overview]
Message-ID: <2305921.lIYBC71m00@phil> (raw)
In-Reply-To: <1488434212-6567-1-git-send-email-jeffy.chen@rock-chips.com>

Am Donnerstag, 2. M?rz 2017, 13:56:52 CET schrieb Jeffy Chen:
> Currently we are trying to enable/disable the clk of irq's gpio bank when
> unmask/mask irq. But the kernel's "lazy disable approach" will skip masking
> irq when the irq chip doesn't support irq_disable ops.
> 
> So we may hit this case:
> 	irq_enable-> enable clk
> 	irq_disable-> noop
> 	irq_enable-> enable clk again
> 	irq_disable-> noop
> 
> Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>

While I'm not that versed in irqchip details, reading through some other 
irqchips makes this look correct handling, so also makes sense in the context 
of the pinctrl irqs here

Reviewed-by: Heiko Stuebner <heiko@sntech.de>

> ---
> 
>  drivers/pinctrl/pinctrl-rockchip.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-rockchip.c
> b/drivers/pinctrl/pinctrl-rockchip.c index 7813599..a9a7dfa 100644
> --- a/drivers/pinctrl/pinctrl-rockchip.c
> +++ b/drivers/pinctrl/pinctrl-rockchip.c
> @@ -2061,7 +2061,7 @@ static void rockchip_irq_resume(struct irq_data *d)
>  	clk_disable(bank->clk);
>  }
> 
> -static void rockchip_irq_gc_mask_clr_bit(struct irq_data *d)
> +static void rockchip_irq_enable(struct irq_data *d)
>  {
>  	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
>  	struct rockchip_pin_bank *bank = gc->private;
> @@ -2070,7 +2070,7 @@ static void rockchip_irq_gc_mask_clr_bit(struct
> irq_data *d) irq_gc_mask_clr_bit(d);
>  }
> 
> -static void rockchip_irq_gc_mask_set_bit(struct irq_data *d)
> +static void rockchip_irq_disable(struct irq_data *d)
>  {
>  	struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
>  	struct rockchip_pin_bank *bank = gc->private;
> @@ -2137,9 +2137,10 @@ static int rockchip_interrupts_register(struct
> platform_device *pdev, gc->chip_types[0].regs.mask = GPIO_INTMASK;
>  		gc->chip_types[0].regs.ack = GPIO_PORTS_EOI;
>  		gc->chip_types[0].chip.irq_ack = irq_gc_ack_set_bit;
> -		gc->chip_types[0].chip.irq_mask = rockchip_irq_gc_mask_set_bit;
> -		gc->chip_types[0].chip.irq_unmask =
> -						  rockchip_irq_gc_mask_clr_bit;
> +		gc->chip_types[0].chip.irq_mask = irq_gc_mask_set_bit;
> +		gc->chip_types[0].chip.irq_unmask = irq_gc_mask_clr_bit;
> +		gc->chip_types[0].chip.irq_enable = rockchip_irq_enable;
> +		gc->chip_types[0].chip.irq_disable = rockchip_irq_disable;
>  		gc->chip_types[0].chip.irq_set_wake = irq_gc_set_wake;
>  		gc->chip_types[0].chip.irq_suspend = rockchip_irq_suspend;
>  		gc->chip_types[0].chip.irq_resume = rockchip_irq_resume;

  parent reply	other threads:[~2017-03-15 17:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-02  5:56 [PATCH] pinctrl: rockchip: add irq_enable & irq_disable ops Jeffy Chen
2017-03-02  5:56 ` Jeffy Chen
2017-03-14 15:03 ` Linus Walleij
2017-03-14 15:03   ` Linus Walleij
2017-03-14 15:03   ` Linus Walleij
2017-03-14 15:06   ` Heiko Stübner
2017-03-14 15:06     ` Heiko Stübner
2017-03-14 15:06     ` Heiko Stübner
     [not found] ` <1488434212-6567-1-git-send-email-jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2017-03-15 17:46   ` Heiko Stuebner [this message]
2017-03-15 17:46     ` Heiko Stuebner
2017-03-15 17:46     ` Heiko Stuebner
2017-03-23  9:05 ` Linus Walleij
2017-03-23  9:05   ` Linus Walleij
2017-03-23  9:05   ` 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=2305921.lIYBC71m00@phil \
    --to=heiko-4mtyjxux2i+zqb+pc5nmwq@public.gmane.org \
    --cc=briannorris-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
    --cc=john-HooS5bfzL4hWk0Htik3J/w@public.gmane.org \
    --cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=tfiga-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.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.