From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Florian Fainelli <florian.fainelli@broadcom.com>
Cc: linux-pwm@vger.kernel.org, Angus Clark <angus.clark@broadcom.com>,
Thierry Reding <thierry.reding@gmail.com>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@broadcom.com>,
Ray Jui <rjui@broadcom.com>,
Scott Branden <sbranden@broadcom.com>,
"moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE"
<linux-rpi-kernel@lists.infradead.org>,
"moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE"
<linux-arm-kernel@lists.infradead.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] pwm: bcm2835: Add support for suspend/resume
Date: Tue, 10 Oct 2023 09:19:08 +0200 [thread overview]
Message-ID: <20231010071908.azpqdx3eff442fxh@pengutronix.de> (raw)
In-Reply-To: <20231009204226.3224521-1-florian.fainelli@broadcom.com>
[-- Attachment #1: Type: text/plain, Size: 2067 bytes --]
On Mon, Oct 09, 2023 at 01:42:26PM -0700, Florian Fainelli wrote:
> Similar to other drivers, we need to make sure that the clock is
> disabled during suspend and re-enabled during resume.
>
> Reported-by: Angus Clark <angus.clark@broadcom.com>
> Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
> ---
> Changes in v2:
>
> - use DEFINE_SIMPLE_DEV_PM_OPS as suggested by Uwe
>
> drivers/pwm/pwm-bcm2835.c | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/drivers/pwm/pwm-bcm2835.c b/drivers/pwm/pwm-bcm2835.c
> index bdfc2a5ec0d6..938f993ae746 100644
> --- a/drivers/pwm/pwm-bcm2835.c
> +++ b/drivers/pwm/pwm-bcm2835.c
> @@ -182,6 +182,25 @@ static void bcm2835_pwm_remove(struct platform_device *pdev)
> clk_disable_unprepare(pc->clk);
> }
>
> +static int __maybe_unused bcm2835_pwm_suspend(struct device *dev)
> +{
> + struct bcm2835_pwm *pc = dev_get_drvdata(dev);
> +
> + clk_disable_unprepare(pc->clk);
> +
> + return 0;
> +}
> +
> +static int __maybe_unused bcm2835_pwm_resume(struct device *dev)
With DEFINE_SIMPLE_DEV_PM_OPS you don't need the __maybe_unused (which
is one of the upsides of DEFINE_SIMPLE_DEV_PM_OPS compared to
SIMPLE_DEV_PM_OPS)
> +{
> + struct bcm2835_pwm *pc = dev_get_drvdata(dev);
> +
> + return clk_prepare_enable(pc->clk);
> +}
> +
> +static DEFINE_SIMPLE_DEV_PM_OPS(bcm2835_pwm_pm_ops, bcm2835_pwm_suspend,
> + bcm2835_pwm_resume);
> +
> static const struct of_device_id bcm2835_pwm_of_match[] = {
> { .compatible = "brcm,bcm2835-pwm", },
> { /* sentinel */ }
> @@ -192,6 +211,7 @@ static struct platform_driver bcm2835_pwm_driver = {
> .driver = {
> .name = "bcm2835-pwm",
> .of_match_table = bcm2835_pwm_of_match,
> + .pm = &bcm2835_pwm_pm_ops,
I think
+ .pm = pm_ptr(&bcm2835_pwm_pm_ops),
is the right thing here.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
prev parent reply other threads:[~2023-10-10 7:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-09 20:42 [PATCH v2] pwm: bcm2835: Add support for suspend/resume Florian Fainelli
2023-10-10 7:19 ` Uwe Kleine-König [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=20231010071908.azpqdx3eff442fxh@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--cc=angus.clark@broadcom.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=florian.fainelli@broadcom.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=rjui@broadcom.com \
--cc=sbranden@broadcom.com \
--cc=thierry.reding@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