linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chunyan Zhang <zhang.lyra@gmail.com>
To: Lee Jones <lee.jones@linaro.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Orson Zhai <orsonzhai@gmail.com>,
	Baolin Wang <baolin.wang7@gmail.com>,
	Chunyan Zhang <chunyan.zhang@unisoc.com>
Subject: Re: [PATCH V2] mfd: sprd: Add wakeup capability for PMIC irq
Date: Thu, 4 Jun 2020 16:16:51 +0800	[thread overview]
Message-ID: <CAAfSe-voe6as4VveyMt2pyJR1jytdzfRCp1z3s9AnS+QzTvPKA@mail.gmail.com> (raw)
In-Reply-To: <20200527062147.680-1-zhang.lyra@gmail.com>

Hi Lee,

On Wed, 27 May 2020 at 14:21, Chunyan Zhang <zhang.lyra@gmail.com> wrote:
>
> From: Baolin Wang <baolin.wang7@gmail.com>
>
> When changing to use suspend-to-idle to save power, the PMIC irq can not
> wakeup the system due to lack of wakeup capability, which will cause
> the sub-irqs (such as power key) of the PMIC can not wake up the system.
> Thus we can add the wakeup capability for PMIC irq to solve this issue,
> as well as removing the IRQF_NO_SUSPEND flag to allow PMIC irq to be
> a wakeup source.
>
> Reported-by: Chunyan Zhang <zhang.lyra@gmail.com>
> Signed-off-by: Baolin Wang <baolin.wang7@gmail.com>
> Tested-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
> ---
> Changes from v1:
> * addressed comments from Lee;
> * added tested-by from Chunyan.
> (This patch is rebased on branch for-mfd-next)

Could you please pick up this patch if there's no more comments :)

Thanks,
Chunyan

> ---
>  drivers/mfd/sprd-sc27xx-spi.c | 28 +++++++++++++++++++++++++++-
>  1 file changed, 27 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mfd/sprd-sc27xx-spi.c b/drivers/mfd/sprd-sc27xx-spi.c
> index 33336cde4724..adb4a1b13332 100644
> --- a/drivers/mfd/sprd-sc27xx-spi.c
> +++ b/drivers/mfd/sprd-sc27xx-spi.c
> @@ -256,7 +256,7 @@ static int sprd_pmic_probe(struct spi_device *spi)
>         }
>
>         ret = devm_regmap_add_irq_chip(&spi->dev, ddata->regmap, ddata->irq,
> -                                      IRQF_ONESHOT | IRQF_NO_SUSPEND, 0,
> +                                      IRQF_ONESHOT, 0,
>                                        &ddata->irq_chip, &ddata->irq_data);
>         if (ret) {
>                 dev_err(&spi->dev, "Failed to add PMIC irq chip %d\n", ret);
> @@ -272,9 +272,34 @@ static int sprd_pmic_probe(struct spi_device *spi)
>                 return ret;
>         }
>
> +       device_init_wakeup(&spi->dev, true);
>         return 0;
>  }
>
> +#ifdef CONFIG_PM_SLEEP
> +static int sprd_pmic_suspend(struct device *dev)
> +{
> +       struct sprd_pmic *ddata = dev_get_drvdata(dev);
> +
> +       if (device_may_wakeup(dev))
> +               enable_irq_wake(ddata->irq);
> +
> +       return 0;
> +}
> +
> +static int sprd_pmic_resume(struct device *dev)
> +{
> +       struct sprd_pmic *ddata = dev_get_drvdata(dev);
> +
> +       if (device_may_wakeup(dev))
> +               disable_irq_wake(ddata->irq);
> +
> +       return 0;
> +}
> +#endif
> +
> +static SIMPLE_DEV_PM_OPS(sprd_pmic_pm_ops, sprd_pmic_suspend, sprd_pmic_resume);
> +
>  static const struct of_device_id sprd_pmic_match[] = {
>         { .compatible = "sprd,sc2731", .data = &sc2731_data },
>         {},
> @@ -285,6 +310,7 @@ static struct spi_driver sprd_pmic_driver = {
>         .driver = {
>                 .name = "sc27xx-pmic",
>                 .of_match_table = sprd_pmic_match,
> +               .pm = &sprd_pmic_pm_ops,
>         },
>         .probe = sprd_pmic_probe,
>  };
> --
> 2.20.1
>

  reply	other threads:[~2020-06-04  8:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-27  6:21 [PATCH V2] mfd: sprd: Add wakeup capability for PMIC irq Chunyan Zhang
2020-06-04  8:16 ` Chunyan Zhang [this message]
2020-06-04 11:16   ` Lee Jones
2020-06-05  1:53     ` Chunyan Zhang
2020-06-05  6:09       ` Lee Jones

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=CAAfSe-voe6as4VveyMt2pyJR1jytdzfRCp1z3s9AnS+QzTvPKA@mail.gmail.com \
    --to=zhang.lyra@gmail.com \
    --cc=baolin.wang7@gmail.com \
    --cc=chunyan.zhang@unisoc.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=orsonzhai@gmail.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).