Message ID | 20241202115140.33492-1-wahrenst@gmx.net (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [V6] mmc: bcm2835: add suspend/resume pm support | expand |
On Mon, 2 Dec 2024 at 12:51, Stefan Wahren <wahrenst@gmx.net> wrote: > > Add a minimalistic suspend/resume PM support. > > Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Applied for next, thanks! Kind regards Uffe > --- > drivers/mmc/host/bcm2835.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > Changes in V6: > - split out of series because there is no dependency > - remove unnecessary complete check > > diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c > index 7847f0c8b465..e5f151d092cd 100644 > --- a/drivers/mmc/host/bcm2835.c > +++ b/drivers/mmc/host/bcm2835.c > @@ -1343,6 +1343,25 @@ static int bcm2835_add_host(struct bcm2835_host *host) > return 0; > } > > +static int bcm2835_suspend(struct device *dev) > +{ > + struct bcm2835_host *host = dev_get_drvdata(dev); > + > + clk_disable_unprepare(host->clk); > + > + return 0; > +} > + > +static int bcm2835_resume(struct device *dev) > +{ > + struct bcm2835_host *host = dev_get_drvdata(dev); > + > + return clk_prepare_enable(host->clk); > +} > + > +static DEFINE_SIMPLE_DEV_PM_OPS(bcm2835_pm_ops, bcm2835_suspend, > + bcm2835_resume); > + > static int bcm2835_probe(struct platform_device *pdev) > { > struct device *dev = &pdev->dev; > @@ -1471,6 +1490,7 @@ static struct platform_driver bcm2835_driver = { > .name = "sdhost-bcm2835", > .probe_type = PROBE_PREFER_ASYNCHRONOUS, > .of_match_table = bcm2835_match, > + .pm = pm_ptr(&bcm2835_pm_ops), > }, > }; > module_platform_driver(bcm2835_driver); > -- > 2.34.1 >
diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c index 7847f0c8b465..e5f151d092cd 100644 --- a/drivers/mmc/host/bcm2835.c +++ b/drivers/mmc/host/bcm2835.c @@ -1343,6 +1343,25 @@ static int bcm2835_add_host(struct bcm2835_host *host) return 0; } +static int bcm2835_suspend(struct device *dev) +{ + struct bcm2835_host *host = dev_get_drvdata(dev); + + clk_disable_unprepare(host->clk); + + return 0; +} + +static int bcm2835_resume(struct device *dev) +{ + struct bcm2835_host *host = dev_get_drvdata(dev); + + return clk_prepare_enable(host->clk); +} + +static DEFINE_SIMPLE_DEV_PM_OPS(bcm2835_pm_ops, bcm2835_suspend, + bcm2835_resume); + static int bcm2835_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -1471,6 +1490,7 @@ static struct platform_driver bcm2835_driver = { .name = "sdhost-bcm2835", .probe_type = PROBE_PREFER_ASYNCHRONOUS, .of_match_table = bcm2835_match, + .pm = pm_ptr(&bcm2835_pm_ops), }, }; module_platform_driver(bcm2835_driver);
Add a minimalistic suspend/resume PM support. Signed-off-by: Stefan Wahren <wahrenst@gmx.net> --- drivers/mmc/host/bcm2835.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) Changes in V6: - split out of series because there is no dependency - remove unnecessary complete check -- 2.34.1