Hi,
v5.4.y commit 31b169a8bed7 ("drm/msm/dsi: Use pm_runtime_resume_and_get to prevent refcnt leaks"), which is commit 3d07a411b4fa upstream, broke display on Dragonboard 845c(sdm845). Cherry-picking commit 6ab502bc1cf3 ("drm/msm/dsi: Enable runtime PM") from the original patch series https://patchwork.freedesktop.org/series/119583/ and it's dependent runtime PM helper routines as suggested by Dmitry https://lore.kernel.org/stable/CAA8EJpo7q9qZbgXHWe7SuQFh0EWW0ZxGL5xYX4nckoFG... fixes that display regression on DB845c.
Dmitry Baryshkov (1): PM: runtime: add devm_pm_runtime_enable helper
Douglas Anderson (1): PM: runtime: Have devm_pm_runtime_enable() handle pm_runtime_dont_use_autosuspend()
Konrad Dybcio (1): drm/msm/dsi: Enable runtime PM
drivers/base/power/runtime.c | 22 ++++++++++++++++++++++ drivers/gpu/drm/msm/dsi/phy/dsi_phy.c | 4 ++++ include/linux/pm_runtime.h | 9 +++++++++ 3 files changed, 35 insertions(+)
From: Dmitry Baryshkov dmitry.baryshkov@linaro.org
[ Upstream commit b3636a3a2c51715736d3ec45f635ed03191962ce ]
A typical code pattern for pm_runtime_enable() call is to call it in the _probe function and to call pm_runtime_disable() both from _probe error path and from _remove function. For some drivers the whole remove function would consist of the call to pm_remove_disable().
Add helper function to replace this bolierplate piece of code. Calling devm_pm_runtime_enable() removes the need for calling pm_runtime_disable() both in the probe()'s error path and in the remove() function.
Signed-off-by: Dmitry Baryshkov dmitry.baryshkov@linaro.org Link: https://lore.kernel.org/r/20210731195034.979084-2-dmitry.baryshkov@linaro.or... Acked-by: Rafael J. Wysocki rafael@kernel.org Signed-off-by: Stephen Boyd sboyd@kernel.org Stable-dep-of: 3d07a411b4fa ("drm/msm/dsi: Use pm_runtime_resume_and_get to prevent refcnt leaks") Signed-off-by: Amit Pundir amit.pundir@linaro.org --- drivers/base/power/runtime.c | 17 +++++++++++++++++ include/linux/pm_runtime.h | 4 ++++ 2 files changed, 21 insertions(+)
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index 626f22c01f2f..f31609f3e7fa 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c @@ -1475,6 +1475,23 @@ void pm_runtime_enable(struct device *dev) } EXPORT_SYMBOL_GPL(pm_runtime_enable);
+static void pm_runtime_disable_action(void *data) +{ + pm_runtime_disable(data); +} + +/** + * devm_pm_runtime_enable - devres-enabled version of pm_runtime_enable. + * @dev: Device to handle. + */ +int devm_pm_runtime_enable(struct device *dev) +{ + pm_runtime_enable(dev); + + return devm_add_action_or_reset(dev, pm_runtime_disable_action, dev); +} +EXPORT_SYMBOL_GPL(devm_pm_runtime_enable); + /** * pm_runtime_forbid - Block runtime PM of a device. * @dev: Device to handle. diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h index c7c754884cdc..eda6619a6358 100644 --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h @@ -60,6 +60,8 @@ extern void pm_runtime_put_suppliers(struct device *dev); extern void pm_runtime_new_link(struct device *dev); extern void pm_runtime_drop_link(struct device_link *link);
+extern int devm_pm_runtime_enable(struct device *dev); + static inline void pm_suspend_ignore_children(struct device *dev, bool enable) { dev->power.ignore_children = enable; @@ -156,6 +158,8 @@ static inline void __pm_runtime_disable(struct device *dev, bool c) {} static inline void pm_runtime_allow(struct device *dev) {} static inline void pm_runtime_forbid(struct device *dev) {}
+static inline int devm_pm_runtime_enable(struct device *dev) { return 0; } + static inline void pm_suspend_ignore_children(struct device *dev, bool enable) {} static inline void pm_runtime_get_noresume(struct device *dev) {} static inline void pm_runtime_put_noidle(struct device *dev) {}
From: Douglas Anderson dianders@chromium.org
[ Upstream commit b4060db9251f919506e4d672737c6b8ab9a84701 ]
The PM Runtime docs say:
Drivers in ->remove() callback should undo the runtime PM changes done in ->probe(). Usually this means calling pm_runtime_disable(), pm_runtime_dont_use_autosuspend() etc.
From grepping code, it's clear that many people aren't aware of the need to call pm_runtime_dont_use_autosuspend().
When brainstorming solutions, one idea that came up was to leverage the new-ish devm_pm_runtime_enable() function. The idea here is that:
* When the devm action is called we know that the driver is being removed. It's the perfect time to undo the use_autosuspend.
* The code of pm_runtime_dont_use_autosuspend() already handles the case of being called when autosuspend wasn't enabled.
Suggested-by: Laurent Pinchart laurent.pinchart@ideasonboard.com Signed-off-by: Douglas Anderson dianders@chromium.org Reviewed-by: Ulf Hansson ulf.hansson@linaro.org Signed-off-by: Rafael J. Wysocki rafael.j.wysocki@intel.com Stable-dep-of: 3d07a411b4fa ("drm/msm/dsi: Use pm_runtime_resume_and_get to prevent refcnt leaks") Signed-off-by: Amit Pundir amit.pundir@linaro.org --- drivers/base/power/runtime.c | 5 +++++ include/linux/pm_runtime.h | 5 +++++ 2 files changed, 10 insertions(+)
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index f31609f3e7fa..a10121b05aaf 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c @@ -1477,11 +1477,16 @@ EXPORT_SYMBOL_GPL(pm_runtime_enable);
static void pm_runtime_disable_action(void *data) { + pm_runtime_dont_use_autosuspend(data); pm_runtime_disable(data); }
/** * devm_pm_runtime_enable - devres-enabled version of pm_runtime_enable. + * + * NOTE: this will also handle calling pm_runtime_dont_use_autosuspend() for + * you at driver exit time if needed. + * * @dev: Device to handle. */ int devm_pm_runtime_enable(struct device *dev) diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h index eda6619a6358..ea0dd2c81e7f 100644 --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h @@ -296,6 +296,11 @@ static inline void pm_runtime_disable(struct device *dev) __pm_runtime_disable(dev, true); }
+/** + * NOTE: It's important to undo this with pm_runtime_dont_use_autosuspend() + * at driver exit time unless your driver initially enabled pm_runtime + * with devm_pm_runtime_enable() (which handles it for you). + */ static inline void pm_runtime_use_autosuspend(struct device *dev) { __pm_runtime_use_autosuspend(dev, true);
From: Konrad Dybcio konrad.dybcio@linaro.org
[ Upstream commit 6ab502bc1cf3147ea1d8540d04b83a7a4cb6d1f1 ]
Some devices power the DSI PHY/PLL through a power rail that we model as a GENPD. Enable runtime PM to make it suspendable.
Signed-off-by: Konrad Dybcio konrad.dybcio@linaro.org Reviewed-by: Dmitry Baryshkov dmitry.baryshkov@linaro.org Patchwork: https://patchwork.freedesktop.org/patch/543352/ Link: https://lore.kernel.org/r/20230620-topic-dsiphy_rpm-v2-2-a11a751f34f0@linaro... Signed-off-by: Dmitry Baryshkov dmitry.baryshkov@linaro.org Stable-dep-of: 3d07a411b4fa ("drm/msm/dsi: Use pm_runtime_resume_and_get to prevent refcnt leaks") Signed-off-by: Amit Pundir amit.pundir@linaro.org --- drivers/gpu/drm/msm/dsi/phy/dsi_phy.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c index 1582386fe162..925262ea6f14 100644 --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c @@ -606,6 +606,10 @@ static int dsi_phy_driver_probe(struct platform_device *pdev) goto fail; }
+ ret = devm_pm_runtime_enable(&pdev->dev); + if (ret) + return ret; + /* PLL init will call into clk_register which requires * register access, so we need to enable power and ahb clock. */
On Mon, Jan 29, 2024 at 04:08:59PM +0530, Amit Pundir wrote:
Hi,
v5.4.y commit 31b169a8bed7 ("drm/msm/dsi: Use pm_runtime_resume_and_get to prevent refcnt leaks"), which is commit 3d07a411b4fa upstream, broke display on Dragonboard 845c(sdm845). Cherry-picking commit 6ab502bc1cf3 ("drm/msm/dsi: Enable runtime PM") from the original patch series https://patchwork.freedesktop.org/series/119583/ and it's dependent runtime PM helper routines as suggested by Dmitry https://lore.kernel.org/stable/CAA8EJpo7q9qZbgXHWe7SuQFh0EWW0ZxGL5xYX4nckoFG... fixes that display regression on DB845c.
We need fixes for all of the newer stable trees too, you can't fix an issue in an old tree and then if you upgraded, you would run into that issue again.
So please, resend this series as a set of series for all active lts kernels, and we will be glad to queue them up.
thanks,
greg k-h
On Mon, 29 Jan 2024 at 21:51, Greg KH gregkh@linuxfoundation.org wrote:
On Mon, Jan 29, 2024 at 04:08:59PM +0530, Amit Pundir wrote:
Hi,
v5.4.y commit 31b169a8bed7 ("drm/msm/dsi: Use pm_runtime_resume_and_get to prevent refcnt leaks"), which is commit 3d07a411b4fa upstream, broke display on Dragonboard 845c(sdm845). Cherry-picking commit 6ab502bc1cf3 ("drm/msm/dsi: Enable runtime PM") from the original patch series https://patchwork.freedesktop.org/series/119583/ and it's dependent runtime PM helper routines as suggested by Dmitry https://lore.kernel.org/stable/CAA8EJpo7q9qZbgXHWe7SuQFh0EWW0ZxGL5xYX4nckoFG... fixes that display regression on DB845c.
We need fixes for all of the newer stable trees too, you can't fix an issue in an old tree and then if you upgraded, you would run into that issue again.
So please, resend this series as a set of series for all active lts kernels, and we will be glad to queue them up.
Ack. I'll send the patch series for all the active LTS kernels tomorrow after build/boot testing them locally. Meanwhile please consider this patch series for v5.4.y anyway.
Regards, Amit Pundir
thanks,
greg k-h
On Mon, Jan 29, 2024 at 10:59:53PM +0530, Amit Pundir wrote:
On Mon, 29 Jan 2024 at 21:51, Greg KH gregkh@linuxfoundation.org wrote:
On Mon, Jan 29, 2024 at 04:08:59PM +0530, Amit Pundir wrote:
Hi,
v5.4.y commit 31b169a8bed7 ("drm/msm/dsi: Use pm_runtime_resume_and_get to prevent refcnt leaks"), which is commit 3d07a411b4fa upstream, broke display on Dragonboard 845c(sdm845). Cherry-picking commit 6ab502bc1cf3 ("drm/msm/dsi: Enable runtime PM") from the original patch series https://patchwork.freedesktop.org/series/119583/ and it's dependent runtime PM helper routines as suggested by Dmitry https://lore.kernel.org/stable/CAA8EJpo7q9qZbgXHWe7SuQFh0EWW0ZxGL5xYX4nckoFG... fixes that display regression on DB845c.
We need fixes for all of the newer stable trees too, you can't fix an issue in an old tree and then if you upgraded, you would run into that issue again.
So please, resend this series as a set of series for all active lts kernels, and we will be glad to queue them up.
Ack. I'll send the patch series for all the active LTS kernels tomorrow after build/boot testing them locally. Meanwhile please consider this patch series for v5.4.y anyway.
Nope, I have to wait until the newer changes show up, for obvious reasonse.
thanks,
greg k-h
On Mon, 29 Jan 2024 at 22:59, Amit Pundir amit.pundir@linaro.org wrote:
On Mon, 29 Jan 2024 at 21:51, Greg KH gregkh@linuxfoundation.org wrote:
On Mon, Jan 29, 2024 at 04:08:59PM +0530, Amit Pundir wrote:
Hi,
v5.4.y commit 31b169a8bed7 ("drm/msm/dsi: Use pm_runtime_resume_and_get to prevent refcnt leaks"), which is commit 3d07a411b4fa upstream, broke display on Dragonboard 845c(sdm845). Cherry-picking commit 6ab502bc1cf3 ("drm/msm/dsi: Enable runtime PM") from the original patch series https://patchwork.freedesktop.org/series/119583/ and it's dependent runtime PM helper routines as suggested by Dmitry https://lore.kernel.org/stable/CAA8EJpo7q9qZbgXHWe7SuQFh0EWW0ZxGL5xYX4nckoFG... fixes that display regression on DB845c.
We need fixes for all of the newer stable trees too, you can't fix an issue in an old tree and then if you upgraded, you would run into that issue again.
So please, resend this series as a set of series for all active lts kernels, and we will be glad to queue them up.
Ack. I'll send the patch series for all the active LTS kernels tomorrow after build/boot testing them locally. Meanwhile please consider this patch series for v5.4.y anyway.
Smoke tested and sent relevant fixes for other active LTS kernel versions as well.
v5.10.y https://lore.kernel.org/stable/20240130124630.3867218-1-amit.pundir@linaro.o...
v5.15.y https://lore.kernel.org/stable/20240130125847.3915432-1-amit.pundir@linaro.o...
and v6.1.y+ https://lore.kernel.org/stable/20240130134647.58630-1-amit.pundir@linaro.org...
Regards, Amit Pundir
thanks,
greg k-h
On Tue, Jan 30, 2024 at 07:22:28PM +0530, Amit Pundir wrote:
On Mon, 29 Jan 2024 at 22:59, Amit Pundir amit.pundir@linaro.org wrote:
On Mon, 29 Jan 2024 at 21:51, Greg KH gregkh@linuxfoundation.org wrote:
On Mon, Jan 29, 2024 at 04:08:59PM +0530, Amit Pundir wrote:
Hi,
v5.4.y commit 31b169a8bed7 ("drm/msm/dsi: Use pm_runtime_resume_and_get to prevent refcnt leaks"), which is commit 3d07a411b4fa upstream, broke display on Dragonboard 845c(sdm845). Cherry-picking commit 6ab502bc1cf3 ("drm/msm/dsi: Enable runtime PM") from the original patch series https://patchwork.freedesktop.org/series/119583/ and it's dependent runtime PM helper routines as suggested by Dmitry https://lore.kernel.org/stable/CAA8EJpo7q9qZbgXHWe7SuQFh0EWW0ZxGL5xYX4nckoFG... fixes that display regression on DB845c.
We need fixes for all of the newer stable trees too, you can't fix an issue in an old tree and then if you upgraded, you would run into that issue again.
So please, resend this series as a set of series for all active lts kernels, and we will be glad to queue them up.
Ack. I'll send the patch series for all the active LTS kernels tomorrow after build/boot testing them locally. Meanwhile please consider this patch series for v5.4.y anyway.
Smoke tested and sent relevant fixes for other active LTS kernel versions as well.
v5.10.y https://lore.kernel.org/stable/20240130124630.3867218-1-amit.pundir@linaro.o...
v5.15.y https://lore.kernel.org/stable/20240130125847.3915432-1-amit.pundir@linaro.o...
and v6.1.y+ https://lore.kernel.org/stable/20240130134647.58630-1-amit.pundir@linaro.org...
Sorry for the long delay, been busy :(
All now queued up.
greg k-h
linux-stable-mirror@lists.linaro.org