linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: grygorii.strashko@ti.com (Grygorii Strashko)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/2] gpio: zynq: Implement irq_pm_(get|put)
Date: Mon, 9 Nov 2015 17:00:04 +0200	[thread overview]
Message-ID: <5640B4F4.6080008@ti.com> (raw)
In-Reply-To: <1446668160-17522-3-git-send-email-soren.brinkmann@xilinx.com>

Hi Soren,

On 11/04/2015 10:16 PM, Soren Brinkmann wrote:
> The driver uses runtime PM to leverage low power techniques. For
> use-cases using GPIO as interrupt the device needs to be in an
> appropriate state.
> 
> Reported-by: John Linn <linnj@xilinx.com>
> Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>

I've one question here. As I know, there is one code path when 
GPIO HW can be accessed before request_irq() during OF boot:

irq_create_of_mapping()
- irq_create_fwspec_mapping()
  - irq_set_irq_type()

How do you handle this situation? :(

> ---
> v2:
>   - declare callbacks static
> ---
>   drivers/gpio/gpio-zynq.c | 20 ++++++++++++++++++++
>   1 file changed, 20 insertions(+)
> 
> diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c
> index 8abeacac5885..98197f778694 100644
> --- a/drivers/gpio/gpio-zynq.c
> +++ b/drivers/gpio/gpio-zynq.c
> @@ -471,6 +471,22 @@ static int zynq_gpio_set_wake(struct irq_data *data, unsigned int on)
>   	return 0;
>   }
>   
> +static int zynq_gpio_irq_pm_get(struct irq_data *data)
> +{
> +	struct zynq_gpio *gpio = irq_data_get_irq_chip_data(data);
> +	struct device *dev = gpio->chip.dev;
> +
> +	return pm_runtime_get_sync(dev);
> +}
> +
> +static void zynq_gpio_irq_pm_put(struct irq_data *data)
> +{
> +	struct zynq_gpio *gpio = irq_data_get_irq_chip_data(data);
> +	struct device *dev = gpio->chip.dev;
> +
> +	pm_runtime_put(dev);
> +}
> +
>   /* irq chip descriptor */
>   static struct irq_chip zynq_gpio_level_irqchip = {
>   	.name		= DRIVER_NAME,
> @@ -480,6 +496,8 @@ static struct irq_chip zynq_gpio_level_irqchip = {
>   	.irq_unmask	= zynq_gpio_irq_unmask,
>   	.irq_set_type	= zynq_gpio_set_irq_type,
>   	.irq_set_wake	= zynq_gpio_set_wake,
> +	.irq_pm_get	= zynq_gpio_irq_pm_get,
> +	.irq_pm_put	= zynq_gpio_irq_pm_put,
>   	.flags		= IRQCHIP_EOI_THREADED | IRQCHIP_EOI_IF_HANDLED |
>   			  IRQCHIP_MASK_ON_SUSPEND,
>   };
> @@ -492,6 +510,8 @@ static struct irq_chip zynq_gpio_edge_irqchip = {
>   	.irq_unmask	= zynq_gpio_irq_unmask,
>   	.irq_set_type	= zynq_gpio_set_irq_type,
>   	.irq_set_wake	= zynq_gpio_set_wake,
> +	.irq_pm_get	= zynq_gpio_irq_pm_get,
> +	.irq_pm_put	= zynq_gpio_irq_pm_put,
>   	.flags		= IRQCHIP_MASK_ON_SUSPEND,
>   };
>   
> 


-- 
regards,
-grygorii

      reply	other threads:[~2015-11-09 15:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-04 20:15 [PATCH v2 0/2] Power management callbacks for irqchips Soren Brinkmann
2015-11-04 20:15 ` [PATCH v2 1/2] genirq: Add irq_pm_(get|put) callbacks to the irqchip Soren Brinkmann
2015-11-04 20:16 ` [PATCH v2 2/2] gpio: zynq: Implement irq_pm_(get|put) Soren Brinkmann
2015-11-09 15:00   ` Grygorii Strashko [this message]

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=5640B4F4.6080008@ti.com \
    --to=grygorii.strashko@ti.com \
    --cc=linux-arm-kernel@lists.infradead.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).