mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yannick FERTRE <yannick.fertre@foss.st.com>
To: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>,
	Philippe Cornu <philippe.cornu@foss.st.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>
Cc: <dri-devel@lists.freedesktop.org>,
	<linux-stm32@st-md-mailman.stormreply.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH RESEND v3 2/3] drm/stm: dsi: add pm runtime ops
Date: Fri, 21 Jun 2024 14:50:57 +0200	[thread overview]
Message-ID: <f95e0485-0073-40b1-84ae-535b55d0cd0d@foss.st.com> (raw)
In-Reply-To: <20240129104106.43141-3-raphael.gallais-pou@foss.st.com>

Hi Raphael,

thanks for the patch.

Acked-by: Yannick Fertre <yannick.fertre@foss.st.com>

Tested-by: Yannick Fertre <yannick.fertre@foss.st.com>

BR


Le 29/01/2024 à 11:41, Raphael Gallais-Pou a écrit :
> From: Yannick Fertre <yannick.fertre@foss.st.com>
>
> Update control of clocks and supply thanks to the PM runtime
> mechanism to avoid kernel crash during a system suspend.
>
> Signed-off-by: Yannick Fertre <yannick.fertre@foss.st.com>
> Signed-off-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
> ---
> Changes in v2:
> 	- Changed SET_RUNTIME_PM_OPS to RUNTIME_PM_OPS and removed
> 	__maybe_unused
> ---
>   drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 24 ++++++++++++++++++------
>   1 file changed, 18 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
> index b1aee43d51e9..82fff9e84345 100644
> --- a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
> +++ b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
> @@ -11,6 +11,7 @@
>   #include <linux/mod_devicetable.h>
>   #include <linux/module.h>
>   #include <linux/platform_device.h>
> +#include <linux/pm_runtime.h>
>   #include <linux/regulator/consumer.h>
>   
>   #include <video/mipi_display.h>
> @@ -77,6 +78,7 @@ enum dsi_color {
>   struct dw_mipi_dsi_stm {
>   	void __iomem *base;
>   	struct clk *pllref_clk;
> +	struct clk *pclk;
>   	struct dw_mipi_dsi *dsi;
>   	u32 hw_version;
>   	int lane_min_kbps;
> @@ -443,7 +445,6 @@ static int dw_mipi_dsi_stm_probe(struct platform_device *pdev)
>   {
>   	struct device *dev = &pdev->dev;
>   	struct dw_mipi_dsi_stm *dsi;
> -	struct clk *pclk;
>   	int ret;
>   
>   	dsi = devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL);
> @@ -483,21 +484,21 @@ static int dw_mipi_dsi_stm_probe(struct platform_device *pdev)
>   		goto err_clk_get;
>   	}
>   
> -	pclk = devm_clk_get(dev, "pclk");
> -	if (IS_ERR(pclk)) {
> -		ret = PTR_ERR(pclk);
> +	dsi->pclk = devm_clk_get(dev, "pclk");
> +	if (IS_ERR(dsi->pclk)) {
> +		ret = PTR_ERR(dsi->pclk);
>   		DRM_ERROR("Unable to get peripheral clock: %d\n", ret);
>   		goto err_dsi_probe;
>   	}
>   
> -	ret = clk_prepare_enable(pclk);
> +	ret = clk_prepare_enable(dsi->pclk);
>   	if (ret) {
>   		DRM_ERROR("%s: Failed to enable peripheral clk\n", __func__);
>   		goto err_dsi_probe;
>   	}
>   
>   	dsi->hw_version = dsi_read(dsi, DSI_VERSION) & VERSION;
> -	clk_disable_unprepare(pclk);
> +	clk_disable_unprepare(dsi->pclk);
>   
>   	if (dsi->hw_version != HWVER_130 && dsi->hw_version != HWVER_131) {
>   		ret = -ENODEV;
> @@ -551,6 +552,7 @@ static int dw_mipi_dsi_stm_suspend(struct device *dev)
>   	DRM_DEBUG_DRIVER("\n");
>   
>   	clk_disable_unprepare(dsi->pllref_clk);
> +	clk_disable_unprepare(dsi->pclk);
>   	regulator_disable(dsi->vdd_supply);
>   
>   	return 0;
> @@ -569,8 +571,16 @@ static int dw_mipi_dsi_stm_resume(struct device *dev)
>   		return ret;
>   	}
>   
> +	ret = clk_prepare_enable(dsi->pclk);
> +	if (ret) {
> +		regulator_disable(dsi->vdd_supply);
> +		DRM_ERROR("Failed to enable pclk: %d\n", ret);
> +		return ret;
> +	}
> +
>   	ret = clk_prepare_enable(dsi->pllref_clk);
>   	if (ret) {
> +		clk_disable_unprepare(dsi->pclk);
>   		regulator_disable(dsi->vdd_supply);
>   		DRM_ERROR("Failed to enable pllref_clk: %d\n", ret);
>   		return ret;
> @@ -582,6 +592,8 @@ static int dw_mipi_dsi_stm_resume(struct device *dev)
>   static const struct dev_pm_ops dw_mipi_dsi_stm_pm_ops = {
>   	SYSTEM_SLEEP_PM_OPS(dw_mipi_dsi_stm_suspend,
>   			    dw_mipi_dsi_stm_resume)
> +	RUNTIME_PM_OPS(dw_mipi_dsi_stm_suspend,
> +		       dw_mipi_dsi_stm_resume, NULL)
>   };
>   
>   static struct platform_driver dw_mipi_dsi_stm_driver = {

  reply	other threads:[~2024-06-21 12:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-29 10:41 [PATCH RESEND v3 0/3] Update STM DSI PHY driver Raphael Gallais-Pou
2024-01-29 10:41 ` [PATCH RESEND v3 1/3] drm/stm: dsi: use new SYSTEM_SLEEP_PM_OPS() macro Raphael Gallais-Pou
2024-06-21 12:50   ` Yannick FERTRE
2024-01-29 10:41 ` [PATCH RESEND v3 2/3] drm/stm: dsi: add pm runtime ops Raphael Gallais-Pou
2024-06-21 12:50   ` Yannick FERTRE [this message]
2024-01-29 10:41 ` [PATCH RESEND v3 3/3] drm/stm: dsi: expose DSI PHY internal clock Raphael Gallais-Pou
2024-06-21 12:51   ` Yannick FERTRE
2024-06-28 12:45 ` [PATCH RESEND v3 0/3] Update STM DSI PHY driver Philippe CORNU
2024-07-22  8:38   ` [Linux-stm32] " Yanjun Yang
2024-07-26  7:55     ` Philippe CORNU
2024-07-29 13:28       ` Yanjun Yang
2024-08-01  9:07         ` Raphaël Gallais-Pou
2024-08-09 15:12           ` Yannick FERTRE

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f95e0485-0073-40b1-84ae-535b55d0cd0d@foss.st.com \
    --to=yannick.fertre@foss.st.com \
    --cc=airlied@gmail.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=mripard@kernel.org \
    --cc=philippe.cornu@foss.st.com \
    --cc=raphael.gallais-pou@foss.st.com \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®