Message ID | 1532726613-6483-8-git-send-email-arun.parameswaran@broadcom.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Add clock config and pm support to bcm iProc mdio mux | expand |
On Fri, Jul 27, 2018 at 02:23:33PM -0700, Arun Parameswaran wrote: > Add support for suspend and resume to the Broadcom iProc mdio > mux driver. > > Signed-off-by: Arun Parameswaran <arun.parameswaran@broadcom.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Andrew
On 07/27/2018 02:23 PM, Arun Parameswaran wrote: > Add support for suspend and resume to the Broadcom iProc mdio > mux driver. > > Signed-off-by: Arun Parameswaran <arun.parameswaran@broadcom.com> > --- > drivers/net/phy/mdio-mux-bcm-iproc.c | 28 ++++++++++++++++++++++++++++ > 1 file changed, 28 insertions(+) > > diff --git a/drivers/net/phy/mdio-mux-bcm-iproc.c b/drivers/net/phy/mdio-mux-bcm-iproc.c > index 51d1003..d89dce0 100644 > --- a/drivers/net/phy/mdio-mux-bcm-iproc.c > +++ b/drivers/net/phy/mdio-mux-bcm-iproc.c > @@ -290,6 +290,33 @@ static int mdio_mux_iproc_remove(struct platform_device *pdev) > return 0; > } > > +#ifdef CONFIG_PM_SLEEP > +static int mdio_mux_iproc_suspend(struct device *dev) > +{ > + struct iproc_mdiomux_desc *md = dev_get_drvdata(dev); > + > + if (md->core_clk) > + clk_disable_unprepare(md->core_clk); Since you are assigning md->core_clk to NULL in case clk_get() returned an error, checking for md->core_clk is not necessary since the Linux common clock framework perform that NULL check already.
Hi Florian, On 18-07-30 03:53 PM, Florian Fainelli wrote: > On 07/27/2018 02:23 PM, Arun Parameswaran wrote: >> Add support for suspend and resume to the Broadcom iProc mdio >> mux driver. >> >> Signed-off-by: Arun Parameswaran <arun.parameswaran@broadcom.com> >> --- >> drivers/net/phy/mdio-mux-bcm-iproc.c | 28 ++++++++++++++++++++++++++++ >> 1 file changed, 28 insertions(+) >> >> diff --git a/drivers/net/phy/mdio-mux-bcm-iproc.c b/drivers/net/phy/mdio-mux-bcm-iproc.c >> index 51d1003..d89dce0 100644 >> --- a/drivers/net/phy/mdio-mux-bcm-iproc.c >> +++ b/drivers/net/phy/mdio-mux-bcm-iproc.c >> @@ -290,6 +290,33 @@ static int mdio_mux_iproc_remove(struct platform_device *pdev) >> return 0; >> } >> >> +#ifdef CONFIG_PM_SLEEP >> +static int mdio_mux_iproc_suspend(struct device *dev) >> +{ >> + struct iproc_mdiomux_desc *md = dev_get_drvdata(dev); >> + >> + if (md->core_clk) >> + clk_disable_unprepare(md->core_clk); > > Since you are assigning md->core_clk to NULL in case clk_get() returned > an error, checking for md->core_clk is not necessary since the Linux > common clock framework perform that NULL check already. > Will remove the check. I am working on Andrew's comments (which will add one more patch to the series). I will send the whole patchset again, with reviewed-by tags (From Florian and Andrew on the ones that apply). Thanks Arun
diff --git a/drivers/net/phy/mdio-mux-bcm-iproc.c b/drivers/net/phy/mdio-mux-bcm-iproc.c index 51d1003..d89dce0 100644 --- a/drivers/net/phy/mdio-mux-bcm-iproc.c +++ b/drivers/net/phy/mdio-mux-bcm-iproc.c @@ -290,6 +290,33 @@ static int mdio_mux_iproc_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM_SLEEP +static int mdio_mux_iproc_suspend(struct device *dev) +{ + struct iproc_mdiomux_desc *md = dev_get_drvdata(dev); + + if (md->core_clk) + clk_disable_unprepare(md->core_clk); + + return 0; +} + +static int mdio_mux_iproc_resume(struct device *dev) +{ + struct iproc_mdiomux_desc *md = dev_get_drvdata(dev); + + if (md->core_clk) + clk_prepare_enable(md->core_clk); + + mdio_mux_iproc_config(md); + + return 0; +} +#endif + +static SIMPLE_DEV_PM_OPS(mdio_mux_iproc_pm_ops, + mdio_mux_iproc_suspend, mdio_mux_iproc_resume); + static const struct of_device_id mdio_mux_iproc_match[] = { { .compatible = "brcm,mdio-mux-iproc", @@ -302,6 +329,7 @@ static int mdio_mux_iproc_remove(struct platform_device *pdev) .driver = { .name = "mdio-mux-iproc", .of_match_table = mdio_mux_iproc_match, + .pm = &mdio_mux_iproc_pm_ops, }, .probe = mdio_mux_iproc_probe, .remove = mdio_mux_iproc_remove,
Add support for suspend and resume to the Broadcom iProc mdio mux driver. Signed-off-by: Arun Parameswaran <arun.parameswaran@broadcom.com> --- drivers/net/phy/mdio-mux-bcm-iproc.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)