Patchwork [23/48] drm: omapdrm: dss: Pass PLL pointer to dss_ctrl_pll_enable()

login
register
mail settings
Submitter Laurent Pinchart
Date Oct. 13, 2017, 2:59 p.m.
Message ID <20171013145944.26557-24-laurent.pinchart@ideasonboard.com>
Download mbox | patch
Permalink /patch/10005015/
State New
Headers show

Comments

Laurent Pinchart - Oct. 13, 2017, 2:59 p.m.
This will allow accessing the PLL data to get the DSS device pointer,
removing the need to access the global DSS private data.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/gpu/drm/omapdrm/dss/dss.c       | 13 +++++++------
 drivers/gpu/drm/omapdrm/dss/dss.h       |  2 +-
 drivers/gpu/drm/omapdrm/dss/hdmi_pll.c  |  4 ++--
 drivers/gpu/drm/omapdrm/dss/video-pll.c |  6 +++---
 4 files changed, 13 insertions(+), 12 deletions(-)
Sebastian Reichel - Oct. 16, 2017, 8:42 a.m.
Hi,

On Fri, Oct 13, 2017 at 05:59:19PM +0300, Laurent Pinchart wrote:
> This will allow accessing the PLL data to get the DSS device pointer,
> removing the need to access the global DSS private data.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---

Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/dss.c       | 13 +++++++------
>  drivers/gpu/drm/omapdrm/dss/dss.h       |  2 +-
>  drivers/gpu/drm/omapdrm/dss/hdmi_pll.c  |  4 ++--
>  drivers/gpu/drm/omapdrm/dss/video-pll.c |  6 +++---
>  4 files changed, 13 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c
> index a83277ebe1ef..7179d02e7451 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.c
> @@ -191,17 +191,17 @@ static void dss_restore_context(void)
>  #undef SR
>  #undef RR
>  
> -void dss_ctrl_pll_enable(enum dss_pll_id pll_id, bool enable)
> +void dss_ctrl_pll_enable(struct dss_pll *pll, bool enable)
>  {
>  	unsigned int shift;
>  	unsigned int val;
>  
> -	if (!dss.syscon_pll_ctrl)
> +	if (!pll->dss->syscon_pll_ctrl)
>  		return;
>  
>  	val = !enable;
>  
> -	switch (pll_id) {
> +	switch (pll->id) {
>  	case DSS_PLL_VIDEO1:
>  		shift = 0;
>  		break;
> @@ -212,12 +212,13 @@ void dss_ctrl_pll_enable(enum dss_pll_id pll_id, bool enable)
>  		shift = 2;
>  		break;
>  	default:
> -		DSSERR("illegal DSS PLL ID %d\n", pll_id);
> +		DSSERR("illegal DSS PLL ID %d\n", pll->id);
>  		return;
>  	}
>  
> -	regmap_update_bits(dss.syscon_pll_ctrl, dss.syscon_pll_ctrl_offset,
> -		1 << shift, val << shift);
> +	regmap_update_bits(pll->dss->syscon_pll_ctrl,
> +			   pll->dss->syscon_pll_ctrl_offset,
> +			   1 << shift, val << shift);
>  }
>  
>  static int dss_ctrl_pll_set_control_mux(enum dss_clk_source clk_src,
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h b/drivers/gpu/drm/omapdrm/dss/dss.h
> index 009b7ef200cd..0b8facf258cf 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.h
> @@ -298,7 +298,7 @@ struct dss_pll *dss_video_pll_init(struct dss_device *dss,
>  				   struct regulator *regulator);
>  void dss_video_pll_uninit(struct dss_pll *pll);
>  
> -void dss_ctrl_pll_enable(enum dss_pll_id pll_id, bool enable);
> +void dss_ctrl_pll_enable(struct dss_pll *pll, bool enable);
>  
>  void dss_sdi_init(int datapairs);
>  int dss_sdi_enable(void);
> diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c b/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c
> index 9915354b66c9..4da32c261c30 100644
> --- a/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c
> +++ b/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c
> @@ -48,7 +48,7 @@ static int hdmi_pll_enable(struct dss_pll *dsspll)
>  	r = pm_runtime_get_sync(&pll->pdev->dev);
>  	WARN_ON(r < 0);
>  
> -	dss_ctrl_pll_enable(DSS_PLL_HDMI, true);
> +	dss_ctrl_pll_enable(dsspll, true);
>  
>  	r = hdmi_wp_set_pll_pwr(wp, HDMI_PLLPWRCMD_BOTHON_ALLCLKS);
>  	if (r)
> @@ -65,7 +65,7 @@ static void hdmi_pll_disable(struct dss_pll *dsspll)
>  
>  	hdmi_wp_set_pll_pwr(wp, HDMI_PLLPWRCMD_ALLOFF);
>  
> -	dss_ctrl_pll_enable(DSS_PLL_HDMI, false);
> +	dss_ctrl_pll_enable(dsspll, false);
>  
>  	r = pm_runtime_put_sync(&pll->pdev->dev);
>  	WARN_ON(r < 0 && r != -ENOSYS);
> diff --git a/drivers/gpu/drm/omapdrm/dss/video-pll.c b/drivers/gpu/drm/omapdrm/dss/video-pll.c
> index 7ef30f61c52b..989a5ee4433a 100644
> --- a/drivers/gpu/drm/omapdrm/dss/video-pll.c
> +++ b/drivers/gpu/drm/omapdrm/dss/video-pll.c
> @@ -66,7 +66,7 @@ static int dss_video_pll_enable(struct dss_pll *pll)
>  	if (r)
>  		return r;
>  
> -	dss_ctrl_pll_enable(pll->id, true);
> +	dss_ctrl_pll_enable(pll, true);
>  
>  	dss_dpll_enable_scp_clk(vpll);
>  
> @@ -80,7 +80,7 @@ static int dss_video_pll_enable(struct dss_pll *pll)
>  
>  err_reset:
>  	dss_dpll_disable_scp_clk(vpll);
> -	dss_ctrl_pll_enable(pll->id, false);
> +	dss_ctrl_pll_enable(pll, false);
>  	dss_runtime_put(pll->dss);
>  
>  	return r;
> @@ -94,7 +94,7 @@ static void dss_video_pll_disable(struct dss_pll *pll)
>  
>  	dss_dpll_disable_scp_clk(vpll);
>  
> -	dss_ctrl_pll_enable(pll->id, false);
> +	dss_ctrl_pll_enable(pll, false);
>  
>  	dss_runtime_put(pll->dss);
>  }
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

Patch

diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c
index a83277ebe1ef..7179d02e7451 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.c
+++ b/drivers/gpu/drm/omapdrm/dss/dss.c
@@ -191,17 +191,17 @@  static void dss_restore_context(void)
 #undef SR
 #undef RR
 
-void dss_ctrl_pll_enable(enum dss_pll_id pll_id, bool enable)
+void dss_ctrl_pll_enable(struct dss_pll *pll, bool enable)
 {
 	unsigned int shift;
 	unsigned int val;
 
-	if (!dss.syscon_pll_ctrl)
+	if (!pll->dss->syscon_pll_ctrl)
 		return;
 
 	val = !enable;
 
-	switch (pll_id) {
+	switch (pll->id) {
 	case DSS_PLL_VIDEO1:
 		shift = 0;
 		break;
@@ -212,12 +212,13 @@  void dss_ctrl_pll_enable(enum dss_pll_id pll_id, bool enable)
 		shift = 2;
 		break;
 	default:
-		DSSERR("illegal DSS PLL ID %d\n", pll_id);
+		DSSERR("illegal DSS PLL ID %d\n", pll->id);
 		return;
 	}
 
-	regmap_update_bits(dss.syscon_pll_ctrl, dss.syscon_pll_ctrl_offset,
-		1 << shift, val << shift);
+	regmap_update_bits(pll->dss->syscon_pll_ctrl,
+			   pll->dss->syscon_pll_ctrl_offset,
+			   1 << shift, val << shift);
 }
 
 static int dss_ctrl_pll_set_control_mux(enum dss_clk_source clk_src,
diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h b/drivers/gpu/drm/omapdrm/dss/dss.h
index 009b7ef200cd..0b8facf258cf 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss.h
+++ b/drivers/gpu/drm/omapdrm/dss/dss.h
@@ -298,7 +298,7 @@  struct dss_pll *dss_video_pll_init(struct dss_device *dss,
 				   struct regulator *regulator);
 void dss_video_pll_uninit(struct dss_pll *pll);
 
-void dss_ctrl_pll_enable(enum dss_pll_id pll_id, bool enable);
+void dss_ctrl_pll_enable(struct dss_pll *pll, bool enable);
 
 void dss_sdi_init(int datapairs);
 int dss_sdi_enable(void);
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c b/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c
index 9915354b66c9..4da32c261c30 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi_pll.c
@@ -48,7 +48,7 @@  static int hdmi_pll_enable(struct dss_pll *dsspll)
 	r = pm_runtime_get_sync(&pll->pdev->dev);
 	WARN_ON(r < 0);
 
-	dss_ctrl_pll_enable(DSS_PLL_HDMI, true);
+	dss_ctrl_pll_enable(dsspll, true);
 
 	r = hdmi_wp_set_pll_pwr(wp, HDMI_PLLPWRCMD_BOTHON_ALLCLKS);
 	if (r)
@@ -65,7 +65,7 @@  static void hdmi_pll_disable(struct dss_pll *dsspll)
 
 	hdmi_wp_set_pll_pwr(wp, HDMI_PLLPWRCMD_ALLOFF);
 
-	dss_ctrl_pll_enable(DSS_PLL_HDMI, false);
+	dss_ctrl_pll_enable(dsspll, false);
 
 	r = pm_runtime_put_sync(&pll->pdev->dev);
 	WARN_ON(r < 0 && r != -ENOSYS);
diff --git a/drivers/gpu/drm/omapdrm/dss/video-pll.c b/drivers/gpu/drm/omapdrm/dss/video-pll.c
index 7ef30f61c52b..989a5ee4433a 100644
--- a/drivers/gpu/drm/omapdrm/dss/video-pll.c
+++ b/drivers/gpu/drm/omapdrm/dss/video-pll.c
@@ -66,7 +66,7 @@  static int dss_video_pll_enable(struct dss_pll *pll)
 	if (r)
 		return r;
 
-	dss_ctrl_pll_enable(pll->id, true);
+	dss_ctrl_pll_enable(pll, true);
 
 	dss_dpll_enable_scp_clk(vpll);
 
@@ -80,7 +80,7 @@  static int dss_video_pll_enable(struct dss_pll *pll)
 
 err_reset:
 	dss_dpll_disable_scp_clk(vpll);
-	dss_ctrl_pll_enable(pll->id, false);
+	dss_ctrl_pll_enable(pll, false);
 	dss_runtime_put(pll->dss);
 
 	return r;
@@ -94,7 +94,7 @@  static void dss_video_pll_disable(struct dss_pll *pll)
 
 	dss_dpll_disable_scp_clk(vpll);
 
-	dss_ctrl_pll_enable(pll->id, false);
+	dss_ctrl_pll_enable(pll, false);
 
 	dss_runtime_put(pll->dss);
 }