lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231009204226.3224521-1-florian.fainelli@broadcom.com>
Date:   Mon,  9 Oct 2023 13:42:26 -0700
From:   Florian Fainelli <florian.fainelli@...adcom.com>
To:     linux-pwm@...r.kernel.org
Cc:     Florian Fainelli <florian.fainelli@...adcom.com>,
        Angus Clark <angus.clark@...adcom.com>,
        Thierry Reding <thierry.reding@...il.com>,
        Uwe Kleine-König 
        <u.kleine-koenig@...gutronix.de>,
        Broadcom internal kernel review list 
        <bcm-kernel-feedback-list@...adcom.com>,
        Ray Jui <rjui@...adcom.com>,
        Scott Branden <sbranden@...adcom.com>,
        linux-rpi-kernel@...ts.infradead.org (moderated list:BROADCOM
        BCM2711/BCM2835 ARM ARCHITECTURE),
        linux-arm-kernel@...ts.infradead.org (moderated list:BROADCOM
        BCM2711/BCM2835 ARM ARCHITECTURE),
        linux-kernel@...r.kernel.org (open list)
Subject: [PATCH v2] pwm: bcm2835: Add support for suspend/resume

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@...adcom.com>
Signed-off-by: Florian Fainelli <florian.fainelli@...adcom.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)
+{
+	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,
 	},
 	.probe = bcm2835_pwm_probe,
 	.remove_new = bcm2835_pwm_remove,
-- 
2.34.1


Download attachment "smime.p7s" of type "application/pkcs7-signature" (4221 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ