* [PATCH v5 0/2] phy: fsl-imx8-mipi-dphy: Hook into runtime pm @ 2021-04-09 11:40 ` Guido Günther 0 siblings, 0 replies; 12+ messages in thread From: Guido Günther @ 2021-04-09 11:40 UTC (permalink / raw) To: Kishon Vijay Abraham I, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team, Robert Chiras, Sam Ravnborg, linux-kernel, linux-arm-kernel, Liu Ying This allows us to shut down the mipi power domain on the imx8. The alternative would be to drop the dphy from the mipi power domain in the SOCs device tree and only have the DSI host controller visible there but since the PD is mostly about the PHY that would defeat it's purpose. This allows to shut off the power domain when blanking the LCD panel: pm_genpd_summary before: domain status slaves /device runtime status ---------------------------------------------------------------------- mipi on /devices/platform/soc@0/soc@0:bus@30800000/30a00300.dphy unsupported /devices/platform/soc@0/soc@0:bus@30800000/30a00000.mipi_dsi suspended after: mipi off-0 /devices/platform/soc@0/soc@0:bus@30800000/30a00300.dphy suspended /devices/platform/soc@0/soc@0:bus@30800000/30a00000.mipi_dsi suspended Changes from v1: - Tweak commit message slightly Changes from v2: - As per review comment by Lucas Stach https://lore.kernel.org/linux-arm-kernel/ee22b072e0abe07559a3e6a63ccf6ece064a46cb.camel@pengutronix.de/ Check for pm_runtime_get_sync failure Changes from v3: - As per review comment by Liu Ying https://lore.kernel.org/linux-arm-kernel/424af315b677934fe6a91cee5a0a7aee058245a9.camel@nxp.com/ https://lore.kernel.org/linux-arm-kernel/a98f7531b9d0293d3c89174446f742d4199cb27c.camel@nxp.com/ - Use phy layers runtime pm - simplify mixel_dphy_remove Chanes from v4: - As per review comment by Liu Ying https://lore.kernel.org/linux-arm-kernel/daef1299e43f0372a95c149b979441f8083f4b15.camel@nxp.com/ - Disable after probe errors - core: increment device usage count on .configure as well Guido Günther (2): phy: core: Use runtime pm during configure too phy: fsl-imx8-mipi-dphy: Hook into runtime pm drivers/phy/freescale/phy-fsl-imx8-mipi-dphy.c | 13 +++++++++++++ drivers/phy/phy-core.c | 6 ++++++ 2 files changed, 19 insertions(+) -- 2.30.1 ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v5 0/2] phy: fsl-imx8-mipi-dphy: Hook into runtime pm @ 2021-04-09 11:40 ` Guido Günther 0 siblings, 0 replies; 12+ messages in thread From: Guido Günther @ 2021-04-09 11:40 UTC (permalink / raw) To: Kishon Vijay Abraham I, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team, Robert Chiras, Sam Ravnborg, linux-kernel, linux-arm-kernel, Liu Ying This allows us to shut down the mipi power domain on the imx8. The alternative would be to drop the dphy from the mipi power domain in the SOCs device tree and only have the DSI host controller visible there but since the PD is mostly about the PHY that would defeat it's purpose. This allows to shut off the power domain when blanking the LCD panel: pm_genpd_summary before: domain status slaves /device runtime status ---------------------------------------------------------------------- mipi on /devices/platform/soc@0/soc@0:bus@30800000/30a00300.dphy unsupported /devices/platform/soc@0/soc@0:bus@30800000/30a00000.mipi_dsi suspended after: mipi off-0 /devices/platform/soc@0/soc@0:bus@30800000/30a00300.dphy suspended /devices/platform/soc@0/soc@0:bus@30800000/30a00000.mipi_dsi suspended Changes from v1: - Tweak commit message slightly Changes from v2: - As per review comment by Lucas Stach https://lore.kernel.org/linux-arm-kernel/ee22b072e0abe07559a3e6a63ccf6ece064a46cb.camel@pengutronix.de/ Check for pm_runtime_get_sync failure Changes from v3: - As per review comment by Liu Ying https://lore.kernel.org/linux-arm-kernel/424af315b677934fe6a91cee5a0a7aee058245a9.camel@nxp.com/ https://lore.kernel.org/linux-arm-kernel/a98f7531b9d0293d3c89174446f742d4199cb27c.camel@nxp.com/ - Use phy layers runtime pm - simplify mixel_dphy_remove Chanes from v4: - As per review comment by Liu Ying https://lore.kernel.org/linux-arm-kernel/daef1299e43f0372a95c149b979441f8083f4b15.camel@nxp.com/ - Disable after probe errors - core: increment device usage count on .configure as well Guido Günther (2): phy: core: Use runtime pm during configure too phy: fsl-imx8-mipi-dphy: Hook into runtime pm drivers/phy/freescale/phy-fsl-imx8-mipi-dphy.c | 13 +++++++++++++ drivers/phy/phy-core.c | 6 ++++++ 2 files changed, 19 insertions(+) -- 2.30.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v5 1/2] phy: core: Use runtime pm during configure too 2021-04-09 11:40 ` Guido Günther @ 2021-04-09 11:40 ` Guido Günther -1 siblings, 0 replies; 12+ messages in thread From: Guido Günther @ 2021-04-09 11:40 UTC (permalink / raw) To: Kishon Vijay Abraham I, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team, Robert Chiras, Sam Ravnborg, linux-kernel, linux-arm-kernel, Liu Ying The phy's configure phase usually needs register access so taking the device out of pm_runtime suspend looks useful. There's currently two in tree drivers using runtime pm and .configure (qualcomm/phy-qcom-qmp.c, rockchip/phy-rockchip-inno-dsidphy.c) but both don't use the phy layers 'transparent' runtime phy_pm_runtime handling but manage it manually so this will for now only affect the phy-fsl-imx8-mipi-dphy driver. Signed-off-by: Guido Günther <agx@sigxcpu.org> --- drivers/phy/phy-core.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index ccb575b13777..256a964d52d3 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -470,10 +470,16 @@ int phy_configure(struct phy *phy, union phy_configure_opts *opts) if (!phy->ops->configure) return -EOPNOTSUPP; + ret = phy_pm_runtime_get_sync(phy); + if (ret < 0 && ret != -ENOTSUPP) + return ret; + ret = 0; /* Override possible ret == -ENOTSUPP */ + mutex_lock(&phy->mutex); ret = phy->ops->configure(phy, opts); mutex_unlock(&phy->mutex); + phy_pm_runtime_put(phy); return ret; } EXPORT_SYMBOL_GPL(phy_configure); -- 2.30.1 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v5 1/2] phy: core: Use runtime pm during configure too @ 2021-04-09 11:40 ` Guido Günther 0 siblings, 0 replies; 12+ messages in thread From: Guido Günther @ 2021-04-09 11:40 UTC (permalink / raw) To: Kishon Vijay Abraham I, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team, Robert Chiras, Sam Ravnborg, linux-kernel, linux-arm-kernel, Liu Ying The phy's configure phase usually needs register access so taking the device out of pm_runtime suspend looks useful. There's currently two in tree drivers using runtime pm and .configure (qualcomm/phy-qcom-qmp.c, rockchip/phy-rockchip-inno-dsidphy.c) but both don't use the phy layers 'transparent' runtime phy_pm_runtime handling but manage it manually so this will for now only affect the phy-fsl-imx8-mipi-dphy driver. Signed-off-by: Guido Günther <agx@sigxcpu.org> --- drivers/phy/phy-core.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index ccb575b13777..256a964d52d3 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -470,10 +470,16 @@ int phy_configure(struct phy *phy, union phy_configure_opts *opts) if (!phy->ops->configure) return -EOPNOTSUPP; + ret = phy_pm_runtime_get_sync(phy); + if (ret < 0 && ret != -ENOTSUPP) + return ret; + ret = 0; /* Override possible ret == -ENOTSUPP */ + mutex_lock(&phy->mutex); ret = phy->ops->configure(phy, opts); mutex_unlock(&phy->mutex); + phy_pm_runtime_put(phy); return ret; } EXPORT_SYMBOL_GPL(phy_configure); -- 2.30.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v5 1/2] phy: core: Use runtime pm during configure too 2021-04-09 11:40 ` Guido Günther @ 2021-04-12 8:40 ` Liu Ying -1 siblings, 0 replies; 12+ messages in thread From: Liu Ying @ 2021-04-12 8:40 UTC (permalink / raw) To: Guido Günther, Kishon Vijay Abraham I, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team, Robert Chiras, Sam Ravnborg, linux-kernel, linux-arm-kernel Hi Guido, On Fri, 2021-04-09 at 13:40 +0200, Guido Günther wrote: > The phy's configure phase usually needs register access so taking the > device out of pm_runtime suspend looks useful. > > There's currently two in tree drivers using runtime pm and .configure > (qualcomm/phy-qcom-qmp.c, rockchip/phy-rockchip-inno-dsidphy.c) but both > don't use the phy layers 'transparent' runtime phy_pm_runtime handling > but manage it manually so this will for now only affect the > phy-fsl-imx8-mipi-dphy driver. IIUC, the qualcomm one's runtime PM is managed by the phy core when users enable it using power/control in sysfs(see comment just before pm_runtime_forbid() in that driver). I'm assuming it's affected and it would be good to test it. I'm not pretty sure if the rockchip one is affected or not, because I'm assuming the power/control nodes of phy->dev and phy->parent.dev in sysfs are both 'auto' after the driver probes. > > Signed-off-by: Guido Günther <agx@sigxcpu.org> > --- > drivers/phy/phy-core.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c > index ccb575b13777..256a964d52d3 100644 > --- a/drivers/phy/phy-core.c > +++ b/drivers/phy/phy-core.c > @@ -470,10 +470,16 @@ int phy_configure(struct phy *phy, union phy_configure_opts *opts) > if (!phy->ops->configure) > return -EOPNOTSUPP; > > + ret = phy_pm_runtime_get_sync(phy); > + if (ret < 0 && ret != -ENOTSUPP) > + return ret; > + ret = 0; /* Override possible ret == -ENOTSUPP */ This override is not needed, because 'ret' will be the return value of phy->ops->configure() right below. Regards, Liu Ying > + > mutex_lock(&phy->mutex); > ret = phy->ops->configure(phy, opts); > mutex_unlock(&phy->mutex); > > + phy_pm_runtime_put(phy); > return ret; > } > EXPORT_SYMBOL_GPL(phy_configure); ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v5 1/2] phy: core: Use runtime pm during configure too @ 2021-04-12 8:40 ` Liu Ying 0 siblings, 0 replies; 12+ messages in thread From: Liu Ying @ 2021-04-12 8:40 UTC (permalink / raw) To: Guido Günther, Kishon Vijay Abraham I, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team, Robert Chiras, Sam Ravnborg, linux-kernel, linux-arm-kernel Hi Guido, On Fri, 2021-04-09 at 13:40 +0200, Guido Günther wrote: > The phy's configure phase usually needs register access so taking the > device out of pm_runtime suspend looks useful. > > There's currently two in tree drivers using runtime pm and .configure > (qualcomm/phy-qcom-qmp.c, rockchip/phy-rockchip-inno-dsidphy.c) but both > don't use the phy layers 'transparent' runtime phy_pm_runtime handling > but manage it manually so this will for now only affect the > phy-fsl-imx8-mipi-dphy driver. IIUC, the qualcomm one's runtime PM is managed by the phy core when users enable it using power/control in sysfs(see comment just before pm_runtime_forbid() in that driver). I'm assuming it's affected and it would be good to test it. I'm not pretty sure if the rockchip one is affected or not, because I'm assuming the power/control nodes of phy->dev and phy->parent.dev in sysfs are both 'auto' after the driver probes. > > Signed-off-by: Guido Günther <agx@sigxcpu.org> > --- > drivers/phy/phy-core.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c > index ccb575b13777..256a964d52d3 100644 > --- a/drivers/phy/phy-core.c > +++ b/drivers/phy/phy-core.c > @@ -470,10 +470,16 @@ int phy_configure(struct phy *phy, union phy_configure_opts *opts) > if (!phy->ops->configure) > return -EOPNOTSUPP; > > + ret = phy_pm_runtime_get_sync(phy); > + if (ret < 0 && ret != -ENOTSUPP) > + return ret; > + ret = 0; /* Override possible ret == -ENOTSUPP */ This override is not needed, because 'ret' will be the return value of phy->ops->configure() right below. Regards, Liu Ying > + > mutex_lock(&phy->mutex); > ret = phy->ops->configure(phy, opts); > mutex_unlock(&phy->mutex); > > + phy_pm_runtime_put(phy); > return ret; > } > EXPORT_SYMBOL_GPL(phy_configure); _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v5 1/2] phy: core: Use runtime pm during configure too 2021-04-12 8:40 ` Liu Ying @ 2021-04-12 9:41 ` Guido Günther -1 siblings, 0 replies; 12+ messages in thread From: Guido Günther @ 2021-04-12 9:41 UTC (permalink / raw) To: Liu Ying Cc: Kishon Vijay Abraham I, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team, Robert Chiras, Sam Ravnborg, linux-kernel, linux-arm-kernel, Dmitry Baryshkov, Heiko Stuebner Hi, On Mon, Apr 12, 2021 at 04:40:56PM +0800, Liu Ying wrote: > Hi Guido, > > On Fri, 2021-04-09 at 13:40 +0200, Guido Günther wrote: > > The phy's configure phase usually needs register access so taking the > > device out of pm_runtime suspend looks useful. > > > > There's currently two in tree drivers using runtime pm and .configure > > (qualcomm/phy-qcom-qmp.c, rockchip/phy-rockchip-inno-dsidphy.c) but both > > don't use the phy layers 'transparent' runtime phy_pm_runtime handling > > but manage it manually so this will for now only affect the > > phy-fsl-imx8-mipi-dphy driver. > > IIUC, the qualcomm one's runtime PM is managed by the phy core when > users enable it using power/control in sysfs(see comment just before > pm_runtime_forbid() in that driver). > I'm assuming it's affected and it would be good to test it. Ah, right. I'll reword the commit message but i don't have any means to test it. > I'm not pretty sure if the rockchip one is affected or not, because I'm > assuming the power/control nodes of phy->dev and phy->parent.dev in > sysfs are both 'auto' after the driver probes. Testing if adding runtime pm for .configure to phy_core breaks anything here would be great too. I've added Dmitry and Heiko to cc: since they were active in those drivers lately and i sure don't want to break these. > > > > Signed-off-by: Guido Günther <agx@sigxcpu.org> > > --- > > drivers/phy/phy-core.c | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c > > index ccb575b13777..256a964d52d3 100644 > > --- a/drivers/phy/phy-core.c > > +++ b/drivers/phy/phy-core.c > > @@ -470,10 +470,16 @@ int phy_configure(struct phy *phy, union phy_configure_opts *opts) > > if (!phy->ops->configure) > > return -EOPNOTSUPP; > > > > + ret = phy_pm_runtime_get_sync(phy); > > + if (ret < 0 && ret != -ENOTSUPP) > > + return ret; > > + ret = 0; /* Override possible ret == -ENOTSUPP */ > > This override is not needed, because 'ret' will be the return value of > phy->ops->configure() right below. I thought being explicit is better here but i'll drop that for the next rev. Thanks! -- Guido > > Regards, > Liu Ying > > > + > > mutex_lock(&phy->mutex); > > ret = phy->ops->configure(phy, opts); > > mutex_unlock(&phy->mutex); > > > > + phy_pm_runtime_put(phy); > > return ret; > > } > > EXPORT_SYMBOL_GPL(phy_configure); > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v5 1/2] phy: core: Use runtime pm during configure too @ 2021-04-12 9:41 ` Guido Günther 0 siblings, 0 replies; 12+ messages in thread From: Guido Günther @ 2021-04-12 9:41 UTC (permalink / raw) To: Liu Ying Cc: Kishon Vijay Abraham I, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team, Robert Chiras, Sam Ravnborg, linux-kernel, linux-arm-kernel, Dmitry Baryshkov, Heiko Stuebner Hi, On Mon, Apr 12, 2021 at 04:40:56PM +0800, Liu Ying wrote: > Hi Guido, > > On Fri, 2021-04-09 at 13:40 +0200, Guido Günther wrote: > > The phy's configure phase usually needs register access so taking the > > device out of pm_runtime suspend looks useful. > > > > There's currently two in tree drivers using runtime pm and .configure > > (qualcomm/phy-qcom-qmp.c, rockchip/phy-rockchip-inno-dsidphy.c) but both > > don't use the phy layers 'transparent' runtime phy_pm_runtime handling > > but manage it manually so this will for now only affect the > > phy-fsl-imx8-mipi-dphy driver. > > IIUC, the qualcomm one's runtime PM is managed by the phy core when > users enable it using power/control in sysfs(see comment just before > pm_runtime_forbid() in that driver). > I'm assuming it's affected and it would be good to test it. Ah, right. I'll reword the commit message but i don't have any means to test it. > I'm not pretty sure if the rockchip one is affected or not, because I'm > assuming the power/control nodes of phy->dev and phy->parent.dev in > sysfs are both 'auto' after the driver probes. Testing if adding runtime pm for .configure to phy_core breaks anything here would be great too. I've added Dmitry and Heiko to cc: since they were active in those drivers lately and i sure don't want to break these. > > > > Signed-off-by: Guido Günther <agx@sigxcpu.org> > > --- > > drivers/phy/phy-core.c | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c > > index ccb575b13777..256a964d52d3 100644 > > --- a/drivers/phy/phy-core.c > > +++ b/drivers/phy/phy-core.c > > @@ -470,10 +470,16 @@ int phy_configure(struct phy *phy, union phy_configure_opts *opts) > > if (!phy->ops->configure) > > return -EOPNOTSUPP; > > > > + ret = phy_pm_runtime_get_sync(phy); > > + if (ret < 0 && ret != -ENOTSUPP) > > + return ret; > > + ret = 0; /* Override possible ret == -ENOTSUPP */ > > This override is not needed, because 'ret' will be the return value of > phy->ops->configure() right below. I thought being explicit is better here but i'll drop that for the next rev. Thanks! -- Guido > > Regards, > Liu Ying > > > + > > mutex_lock(&phy->mutex); > > ret = phy->ops->configure(phy, opts); > > mutex_unlock(&phy->mutex); > > > > + phy_pm_runtime_put(phy); > > return ret; > > } > > EXPORT_SYMBOL_GPL(phy_configure); > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v5 2/2] phy: fsl-imx8-mipi-dphy: Hook into runtime pm 2021-04-09 11:40 ` Guido Günther @ 2021-04-09 11:40 ` Guido Günther -1 siblings, 0 replies; 12+ messages in thread From: Guido Günther @ 2021-04-09 11:40 UTC (permalink / raw) To: Kishon Vijay Abraham I, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team, Robert Chiras, Sam Ravnborg, linux-kernel, linux-arm-kernel, Liu Ying This allows us to shut down the mipi power domain on the imx8. The alternative would be to drop the dphy from the mipi power domain in the SOCs device tree and only have the DSI host controller visible there but since the PD is mostly about the PHY that would defeat it's purpose. This allows to shut off the power domain when blanking the LCD panel: pm_genpd_summary before: domain status slaves /device runtime status ---------------------------------------------------------------------- mipi on /devices/platform/soc@0/soc@0:bus@30800000/30a00300.dphy unsupported /devices/platform/soc@0/soc@0:bus@30800000/30a00000.mipi_dsi suspended after: mipi off-0 /devices/platform/soc@0/soc@0:bus@30800000/30a00300.dphy suspended /devices/platform/soc@0/soc@0:bus@30800000/30a00000.mipi_dsi suspended Signed-off-by: Guido Günther <agx@sigxcpu.org> --- drivers/phy/freescale/phy-fsl-imx8-mipi-dphy.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/phy/freescale/phy-fsl-imx8-mipi-dphy.c b/drivers/phy/freescale/phy-fsl-imx8-mipi-dphy.c index a95572b397ca..f89a0c458499 100644 --- a/drivers/phy/freescale/phy-fsl-imx8-mipi-dphy.c +++ b/drivers/phy/freescale/phy-fsl-imx8-mipi-dphy.c @@ -14,6 +14,7 @@ #include <linux/of_platform.h> #include <linux/phy/phy.h> #include <linux/platform_device.h> +#include <linux/pm_runtime.h> #include <linux/regmap.h> /* DPHY registers */ @@ -469,20 +470,32 @@ static int mixel_dphy_probe(struct platform_device *pdev) dev_set_drvdata(dev, priv); + pm_runtime_enable(dev); + phy = devm_phy_create(dev, np, &mixel_dphy_phy_ops); if (IS_ERR(phy)) { + pm_runtime_disable(&pdev->dev); dev_err(dev, "Failed to create phy %ld\n", PTR_ERR(phy)); return PTR_ERR(phy); } phy_set_drvdata(phy, priv); phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); + if (IS_ERR(phy_provider)) + pm_runtime_disable(&pdev->dev); return PTR_ERR_OR_ZERO(phy_provider); } +static int mixel_dphy_remove(struct platform_device *pdev) +{ + pm_runtime_disable(&pdev->dev); + return 0; +} + static struct platform_driver mixel_dphy_driver = { .probe = mixel_dphy_probe, + .remove = mixel_dphy_remove, .driver = { .name = "mixel-mipi-dphy", .of_match_table = mixel_dphy_of_match, -- 2.30.1 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v5 2/2] phy: fsl-imx8-mipi-dphy: Hook into runtime pm @ 2021-04-09 11:40 ` Guido Günther 0 siblings, 0 replies; 12+ messages in thread From: Guido Günther @ 2021-04-09 11:40 UTC (permalink / raw) To: Kishon Vijay Abraham I, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team, Robert Chiras, Sam Ravnborg, linux-kernel, linux-arm-kernel, Liu Ying This allows us to shut down the mipi power domain on the imx8. The alternative would be to drop the dphy from the mipi power domain in the SOCs device tree and only have the DSI host controller visible there but since the PD is mostly about the PHY that would defeat it's purpose. This allows to shut off the power domain when blanking the LCD panel: pm_genpd_summary before: domain status slaves /device runtime status ---------------------------------------------------------------------- mipi on /devices/platform/soc@0/soc@0:bus@30800000/30a00300.dphy unsupported /devices/platform/soc@0/soc@0:bus@30800000/30a00000.mipi_dsi suspended after: mipi off-0 /devices/platform/soc@0/soc@0:bus@30800000/30a00300.dphy suspended /devices/platform/soc@0/soc@0:bus@30800000/30a00000.mipi_dsi suspended Signed-off-by: Guido Günther <agx@sigxcpu.org> --- drivers/phy/freescale/phy-fsl-imx8-mipi-dphy.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/phy/freescale/phy-fsl-imx8-mipi-dphy.c b/drivers/phy/freescale/phy-fsl-imx8-mipi-dphy.c index a95572b397ca..f89a0c458499 100644 --- a/drivers/phy/freescale/phy-fsl-imx8-mipi-dphy.c +++ b/drivers/phy/freescale/phy-fsl-imx8-mipi-dphy.c @@ -14,6 +14,7 @@ #include <linux/of_platform.h> #include <linux/phy/phy.h> #include <linux/platform_device.h> +#include <linux/pm_runtime.h> #include <linux/regmap.h> /* DPHY registers */ @@ -469,20 +470,32 @@ static int mixel_dphy_probe(struct platform_device *pdev) dev_set_drvdata(dev, priv); + pm_runtime_enable(dev); + phy = devm_phy_create(dev, np, &mixel_dphy_phy_ops); if (IS_ERR(phy)) { + pm_runtime_disable(&pdev->dev); dev_err(dev, "Failed to create phy %ld\n", PTR_ERR(phy)); return PTR_ERR(phy); } phy_set_drvdata(phy, priv); phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); + if (IS_ERR(phy_provider)) + pm_runtime_disable(&pdev->dev); return PTR_ERR_OR_ZERO(phy_provider); } +static int mixel_dphy_remove(struct platform_device *pdev) +{ + pm_runtime_disable(&pdev->dev); + return 0; +} + static struct platform_driver mixel_dphy_driver = { .probe = mixel_dphy_probe, + .remove = mixel_dphy_remove, .driver = { .name = "mixel-mipi-dphy", .of_match_table = mixel_dphy_of_match, -- 2.30.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v5 2/2] phy: fsl-imx8-mipi-dphy: Hook into runtime pm 2021-04-09 11:40 ` Guido Günther @ 2021-04-12 9:11 ` Liu Ying -1 siblings, 0 replies; 12+ messages in thread From: Liu Ying @ 2021-04-12 9:11 UTC (permalink / raw) To: Guido Günther, Kishon Vijay Abraham I, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team, Robert Chiras, Sam Ravnborg, linux-kernel, linux-arm-kernel Hi Guido, On Fri, 2021-04-09 at 13:40 +0200, Guido Günther wrote: > This allows us to shut down the mipi power domain on the imx8. The > alternative would be to drop the dphy from the mipi power domain in the > SOCs device tree and only have the DSI host controller visible there but > since the PD is mostly about the PHY that would defeat it's purpose. > > This allows to shut off the power domain when blanking the LCD panel: > > pm_genpd_summary before: > > domain status slaves > /device runtime status > ---------------------------------------------------------------------- > mipi on > /devices/platform/soc@0/soc@0:bus@30800000/30a00300.dphy unsupported > /devices/platform/soc@0/soc@0:bus@30800000/30a00000.mipi_dsi suspended > > after: > > mipi off-0 > /devices/platform/soc@0/soc@0:bus@30800000/30a00300.dphy suspended > /devices/platform/soc@0/soc@0:bus@30800000/30a00000.mipi_dsi suspended > > Signed-off-by: Guido Günther <agx@sigxcpu.org> > --- > drivers/phy/freescale/phy-fsl-imx8-mipi-dphy.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/drivers/phy/freescale/phy-fsl-imx8-mipi-dphy.c b/drivers/phy/freescale/phy-fsl-imx8-mipi-dphy.c > index a95572b397ca..f89a0c458499 100644 > --- a/drivers/phy/freescale/phy-fsl-imx8-mipi-dphy.c > +++ b/drivers/phy/freescale/phy-fsl-imx8-mipi-dphy.c > @@ -14,6 +14,7 @@ > #include <linux/of_platform.h> > #include <linux/phy/phy.h> > #include <linux/platform_device.h> > +#include <linux/pm_runtime.h> > #include <linux/regmap.h> > > /* DPHY registers */ > @@ -469,20 +470,32 @@ static int mixel_dphy_probe(struct platform_device *pdev) > > dev_set_drvdata(dev, priv); > > + pm_runtime_enable(dev); > + > phy = devm_phy_create(dev, np, &mixel_dphy_phy_ops); > if (IS_ERR(phy)) { > + pm_runtime_disable(&pdev->dev); It's fine to just use 'dev'. > dev_err(dev, "Failed to create phy %ld\n", PTR_ERR(phy)); > return PTR_ERR(phy); > } > phy_set_drvdata(phy, priv); > > phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); > + if (IS_ERR(phy_provider)) > + pm_runtime_disable(&pdev->dev); Ditto. With the above two addressed: Reviewed-by: Liu Ying <victor.liu@nxp.com> > > return PTR_ERR_OR_ZERO(phy_provider); > } > > +static int mixel_dphy_remove(struct platform_device *pdev) > +{ > + pm_runtime_disable(&pdev->dev); > + return 0; > +} > + > static struct platform_driver mixel_dphy_driver = { > .probe = mixel_dphy_probe, > + .remove = mixel_dphy_remove, > .driver = { > .name = "mixel-mipi-dphy", > .of_match_table = mixel_dphy_of_match, ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v5 2/2] phy: fsl-imx8-mipi-dphy: Hook into runtime pm @ 2021-04-12 9:11 ` Liu Ying 0 siblings, 0 replies; 12+ messages in thread From: Liu Ying @ 2021-04-12 9:11 UTC (permalink / raw) To: Guido Günther, Kishon Vijay Abraham I, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team, Robert Chiras, Sam Ravnborg, linux-kernel, linux-arm-kernel Hi Guido, On Fri, 2021-04-09 at 13:40 +0200, Guido Günther wrote: > This allows us to shut down the mipi power domain on the imx8. The > alternative would be to drop the dphy from the mipi power domain in the > SOCs device tree and only have the DSI host controller visible there but > since the PD is mostly about the PHY that would defeat it's purpose. > > This allows to shut off the power domain when blanking the LCD panel: > > pm_genpd_summary before: > > domain status slaves > /device runtime status > ---------------------------------------------------------------------- > mipi on > /devices/platform/soc@0/soc@0:bus@30800000/30a00300.dphy unsupported > /devices/platform/soc@0/soc@0:bus@30800000/30a00000.mipi_dsi suspended > > after: > > mipi off-0 > /devices/platform/soc@0/soc@0:bus@30800000/30a00300.dphy suspended > /devices/platform/soc@0/soc@0:bus@30800000/30a00000.mipi_dsi suspended > > Signed-off-by: Guido Günther <agx@sigxcpu.org> > --- > drivers/phy/freescale/phy-fsl-imx8-mipi-dphy.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/drivers/phy/freescale/phy-fsl-imx8-mipi-dphy.c b/drivers/phy/freescale/phy-fsl-imx8-mipi-dphy.c > index a95572b397ca..f89a0c458499 100644 > --- a/drivers/phy/freescale/phy-fsl-imx8-mipi-dphy.c > +++ b/drivers/phy/freescale/phy-fsl-imx8-mipi-dphy.c > @@ -14,6 +14,7 @@ > #include <linux/of_platform.h> > #include <linux/phy/phy.h> > #include <linux/platform_device.h> > +#include <linux/pm_runtime.h> > #include <linux/regmap.h> > > /* DPHY registers */ > @@ -469,20 +470,32 @@ static int mixel_dphy_probe(struct platform_device *pdev) > > dev_set_drvdata(dev, priv); > > + pm_runtime_enable(dev); > + > phy = devm_phy_create(dev, np, &mixel_dphy_phy_ops); > if (IS_ERR(phy)) { > + pm_runtime_disable(&pdev->dev); It's fine to just use 'dev'. > dev_err(dev, "Failed to create phy %ld\n", PTR_ERR(phy)); > return PTR_ERR(phy); > } > phy_set_drvdata(phy, priv); > > phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); > + if (IS_ERR(phy_provider)) > + pm_runtime_disable(&pdev->dev); Ditto. With the above two addressed: Reviewed-by: Liu Ying <victor.liu@nxp.com> > > return PTR_ERR_OR_ZERO(phy_provider); > } > > +static int mixel_dphy_remove(struct platform_device *pdev) > +{ > + pm_runtime_disable(&pdev->dev); > + return 0; > +} > + > static struct platform_driver mixel_dphy_driver = { > .probe = mixel_dphy_probe, > + .remove = mixel_dphy_remove, > .driver = { > .name = "mixel-mipi-dphy", > .of_match_table = mixel_dphy_of_match, _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2021-04-12 9:52 UTC | newest] Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-04-09 11:40 [PATCH v5 0/2] phy: fsl-imx8-mipi-dphy: Hook into runtime pm Guido Günther 2021-04-09 11:40 ` Guido Günther 2021-04-09 11:40 ` [PATCH v5 1/2] phy: core: Use runtime pm during configure too Guido Günther 2021-04-09 11:40 ` Guido Günther 2021-04-12 8:40 ` Liu Ying 2021-04-12 8:40 ` Liu Ying 2021-04-12 9:41 ` Guido Günther 2021-04-12 9:41 ` Guido Günther 2021-04-09 11:40 ` [PATCH v5 2/2] phy: fsl-imx8-mipi-dphy: Hook into runtime pm Guido Günther 2021-04-09 11:40 ` Guido Günther 2021-04-12 9:11 ` Liu Ying 2021-04-12 9:11 ` Liu Ying
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.