* [PATCH v2 0/2] pwm: rcar: Add suspend/resume support and cleanup for runtime_pm
@ 2018-03-13 8:18 Yoshihiro Shimoda
2018-03-13 8:18 ` [PATCH v2 1/2] pwm: rcar: Use PM Runtime to control module clock Yoshihiro Shimoda
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Yoshihiro Shimoda @ 2018-03-13 8:18 UTC (permalink / raw)
To: thierry.reding; +Cc: linux-pwm, linux-renesas-soc, Yoshihiro Shimoda
This patch set improves power management for Renesas PWM driver.
Changes from v1:
- Add Reviewed-by Geert-san in patch 1 (Thanks!).
- Check a condition in suspend/resume if requested or not in patch 2.
Hien Dang (1):
pwm: rcar: Use PM Runtime to control module clock
Yoshihiro Shimoda (1):
pwm: rcar: add suspend/resume support
drivers/pwm/pwm-rcar.c | 50 ++++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 44 insertions(+), 6 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 1/2] pwm: rcar: Use PM Runtime to control module clock
2018-03-13 8:18 [PATCH v2 0/2] pwm: rcar: Add suspend/resume support and cleanup for runtime_pm Yoshihiro Shimoda
@ 2018-03-13 8:18 ` Yoshihiro Shimoda
2018-03-13 8:18 ` [PATCH v2 2/2] pwm: rcar: add suspend/resume support Yoshihiro Shimoda
2018-03-27 23:27 ` [PATCH v2 0/2] pwm: rcar: Add suspend/resume support and cleanup for runtime_pm Thierry Reding
2 siblings, 0 replies; 4+ messages in thread
From: Yoshihiro Shimoda @ 2018-03-13 8:18 UTC (permalink / raw)
To: thierry.reding; +Cc: linux-pwm, linux-renesas-soc, Hien Dang, Yoshihiro Shimoda
From: Hien Dang <hien.dang.eb@renesas.com>
Runtime PM API (pm_runtime_get_sync/pm_runtime_put) should be used
to control module clock instead of clk_prepare_enable and
clk_disable_unprepare.
Signed-off-by: Hien Dang <hien.dang.eb@renesas.com>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
drivers/pwm/pwm-rcar.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/pwm/pwm-rcar.c b/drivers/pwm/pwm-rcar.c
index 1c85ecc..b942010 100644
--- a/drivers/pwm/pwm-rcar.c
+++ b/drivers/pwm/pwm-rcar.c
@@ -134,16 +134,12 @@ static int rcar_pwm_set_counter(struct rcar_pwm_chip *rp, int div, int duty_ns,
static int rcar_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm)
{
- struct rcar_pwm_chip *rp = to_rcar_pwm_chip(chip);
-
- return clk_prepare_enable(rp->clk);
+ return pm_runtime_get_sync(chip->dev);
}
static void rcar_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm)
{
- struct rcar_pwm_chip *rp = to_rcar_pwm_chip(chip);
-
- clk_disable_unprepare(rp->clk);
+ pm_runtime_put(chip->dev);
}
static int rcar_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 2/2] pwm: rcar: add suspend/resume support
2018-03-13 8:18 [PATCH v2 0/2] pwm: rcar: Add suspend/resume support and cleanup for runtime_pm Yoshihiro Shimoda
2018-03-13 8:18 ` [PATCH v2 1/2] pwm: rcar: Use PM Runtime to control module clock Yoshihiro Shimoda
@ 2018-03-13 8:18 ` Yoshihiro Shimoda
2018-03-27 23:27 ` [PATCH v2 0/2] pwm: rcar: Add suspend/resume support and cleanup for runtime_pm Thierry Reding
2 siblings, 0 replies; 4+ messages in thread
From: Yoshihiro Shimoda @ 2018-03-13 8:18 UTC (permalink / raw)
To: thierry.reding; +Cc: linux-pwm, linux-renesas-soc, Yoshihiro Shimoda
This patch adds suspend/resume support for Renesas PWM driver.
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
drivers/pwm/pwm-rcar.c | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/drivers/pwm/pwm-rcar.c b/drivers/pwm/pwm-rcar.c
index b942010..34069ae 100644
--- a/drivers/pwm/pwm-rcar.c
+++ b/drivers/pwm/pwm-rcar.c
@@ -254,11 +254,53 @@ static int rcar_pwm_remove(struct platform_device *pdev)
};
MODULE_DEVICE_TABLE(of, rcar_pwm_of_table);
+#ifdef CONFIG_PM_SLEEP
+static struct pwm_device *rcar_pwm_dev_to_pwm_dev(struct device *dev)
+{
+ struct platform_device *pdev = to_platform_device(dev);
+ struct rcar_pwm_chip *rcar_pwm = platform_get_drvdata(pdev);
+ struct pwm_chip *chip = &rcar_pwm->chip;
+
+ return &chip->pwms[0];
+}
+
+static int rcar_pwm_suspend(struct device *dev)
+{
+ struct pwm_device *pwm = rcar_pwm_dev_to_pwm_dev(dev);
+
+ if (!test_bit(PWMF_REQUESTED, &pwm->flags))
+ return 0;
+
+ pm_runtime_put(dev);
+
+ return 0;
+}
+
+static int rcar_pwm_resume(struct device *dev)
+{
+ struct pwm_device *pwm = rcar_pwm_dev_to_pwm_dev(dev);
+
+ if (!test_bit(PWMF_REQUESTED, &pwm->flags))
+ return 0;
+
+ pm_runtime_get_sync(dev);
+
+ rcar_pwm_config(pwm->chip, pwm, pwm->state.duty_cycle,
+ pwm->state.period);
+ if (pwm_is_enabled(pwm))
+ rcar_pwm_enable(pwm->chip, pwm);
+
+ return 0;
+}
+#endif /* CONFIG_PM_SLEEP */
+static SIMPLE_DEV_PM_OPS(rcar_pwm_pm_ops, rcar_pwm_suspend, rcar_pwm_resume);
+
static struct platform_driver rcar_pwm_driver = {
.probe = rcar_pwm_probe,
.remove = rcar_pwm_remove,
.driver = {
.name = "pwm-rcar",
+ .pm = &rcar_pwm_pm_ops,
.of_match_table = of_match_ptr(rcar_pwm_of_table),
}
};
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 0/2] pwm: rcar: Add suspend/resume support and cleanup for runtime_pm
2018-03-13 8:18 [PATCH v2 0/2] pwm: rcar: Add suspend/resume support and cleanup for runtime_pm Yoshihiro Shimoda
2018-03-13 8:18 ` [PATCH v2 1/2] pwm: rcar: Use PM Runtime to control module clock Yoshihiro Shimoda
2018-03-13 8:18 ` [PATCH v2 2/2] pwm: rcar: add suspend/resume support Yoshihiro Shimoda
@ 2018-03-27 23:27 ` Thierry Reding
2 siblings, 0 replies; 4+ messages in thread
From: Thierry Reding @ 2018-03-27 23:27 UTC (permalink / raw)
To: Yoshihiro Shimoda; +Cc: linux-pwm, linux-renesas-soc
[-- Attachment #1: Type: text/plain, Size: 609 bytes --]
On Tue, Mar 13, 2018 at 05:18:16PM +0900, Yoshihiro Shimoda wrote:
> This patch set improves power management for Renesas PWM driver.
>
> Changes from v1:
> - Add Reviewed-by Geert-san in patch 1 (Thanks!).
> - Check a condition in suspend/resume if requested or not in patch 2.
>
> Hien Dang (1):
> pwm: rcar: Use PM Runtime to control module clock
>
> Yoshihiro Shimoda (1):
> pwm: rcar: add suspend/resume support
>
> drivers/pwm/pwm-rcar.c | 50 ++++++++++++++++++++++++++++++++++++++++++++------
> 1 file changed, 44 insertions(+), 6 deletions(-)
Applied, thanks.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-03-27 23:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-13 8:18 [PATCH v2 0/2] pwm: rcar: Add suspend/resume support and cleanup for runtime_pm Yoshihiro Shimoda
2018-03-13 8:18 ` [PATCH v2 1/2] pwm: rcar: Use PM Runtime to control module clock Yoshihiro Shimoda
2018-03-13 8:18 ` [PATCH v2 2/2] pwm: rcar: add suspend/resume support Yoshihiro Shimoda
2018-03-27 23:27 ` [PATCH v2 0/2] pwm: rcar: Add suspend/resume support and cleanup for runtime_pm Thierry Reding
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.