[PATCH 26/48] drm: omapdrm: dss: Pass DSS pointer to dss_get_*_clk_source()

Sebastian Reichel sre at kernel.org
Mon Oct 16 09:08:17 UTC 2017


Hi,

On Fri, Oct 13, 2017 at 05:59:22PM +0300, Laurent Pinchart wrote:
> This removes the need to access the global DSS private data in those
> functions (both for the current accesses and the future ones that will
> be introduced when allocating the DSS device dynamically).
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> ---

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

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/dispc.c | 11 +++++++----
>  drivers/gpu/drm/omapdrm/dss/dsi.c   |  8 +++++---
>  drivers/gpu/drm/omapdrm/dss/dss.c   | 18 ++++++++++--------
>  drivers/gpu/drm/omapdrm/dss/dss.h   |  8 +++++---
>  4 files changed, 27 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c
> index 1afd2802e807..723828f97196 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dispc.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
> @@ -167,6 +167,7 @@ struct dispc_features {
>  static struct {
>  	struct platform_device *pdev;
>  	void __iomem    *base;
> +	struct dss_device *dss;
>  
>  	struct dss_debugfs_entry *debugfs;
>  
> @@ -3116,7 +3117,7 @@ static unsigned long dispc_fclk_rate(void)
>  	unsigned long r;
>  	enum dss_clk_source src;
>  
> -	src = dss_get_dispc_clk_source();
> +	src = dss_get_dispc_clk_source(dispc.dss);
>  
>  	if (src == DSS_CLK_SRC_FCK) {
>  		r = dss_get_dispc_clk_rate();
> @@ -3143,7 +3144,7 @@ static unsigned long dispc_mgr_lclk_rate(enum omap_channel channel)
>  	if (!dss_mgr_is_lcd(channel))
>  		return dispc_fclk_rate();
>  
> -	src = dss_get_lcd_clk_source(channel);
> +	src = dss_get_lcd_clk_source(dispc.dss, channel);
>  
>  	if (src == DSS_CLK_SRC_FCK) {
>  		r = dss_get_dispc_clk_rate();
> @@ -3223,7 +3224,7 @@ static void dispc_dump_clocks_channel(struct seq_file *s, enum omap_channel chan
>  
>  	seq_printf(s, "- %s -\n", mgr_desc[channel].name);
>  
> -	lcd_clk_src = dss_get_lcd_clk_source(channel);
> +	lcd_clk_src = dss_get_lcd_clk_source(dispc.dss, channel);
>  
>  	seq_printf(s, "%s clk source = %s\n", mgr_desc[channel].name,
>  		dss_get_clk_source_name(lcd_clk_src));
> @@ -3240,7 +3241,7 @@ void dispc_dump_clocks(struct seq_file *s)
>  {
>  	int lcd;
>  	u32 l;
> -	enum dss_clk_source dispc_clk_src = dss_get_dispc_clk_source();
> +	enum dss_clk_source dispc_clk_src = dss_get_dispc_clk_source(dispc.dss);
>  
>  	if (dispc_runtime_get())
>  		return;
> @@ -4542,12 +4543,14 @@ static int dispc_bind(struct device *dev, struct device *master, void *data)
>  {
>  	struct platform_device *pdev = to_platform_device(dev);
>  	const struct soc_device_attribute *soc;
> +	struct dss_device *dss = dss_get_device(master);
>  	u32 rev;
>  	int r = 0;
>  	struct resource *dispc_mem;
>  	struct device_node *np = pdev->dev.of_node;
>  
>  	dispc.pdev = pdev;
> +	dispc.dss = dss;
>  
>  	spin_lock_init(&dispc.control_lock);
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
> index 6d60882dfd10..7fb048023fd0 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dsi.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
> @@ -1292,8 +1292,10 @@ static unsigned long dsi_fclk_rate(struct platform_device *dsidev)
>  {
>  	unsigned long r;
>  	struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
> +	enum dss_clk_source source;
>  
> -	if (dss_get_dsi_clk_source(dsi->module_id) == DSS_CLK_SRC_FCK) {
> +	source = dss_get_dsi_clk_source(dsi->dss, dsi->module_id);
> +	if (source == DSS_CLK_SRC_FCK) {
>  		/* DSI FCLK source is DSS_CLK_FCK */
>  		r = clk_get_rate(dsi->dss_clk);
>  	} else {
> @@ -1512,8 +1514,8 @@ static void dsi_dump_dsidev_clocks(struct platform_device *dsidev,
>  	int dsi_module = dsi->module_id;
>  	struct dss_pll *pll = &dsi->pll;
>  
> -	dispc_clk_src = dss_get_dispc_clk_source();
> -	dsi_clk_src = dss_get_dsi_clk_source(dsi_module);
> +	dispc_clk_src = dss_get_dispc_clk_source(dsi->dss);
> +	dsi_clk_src = dss_get_dsi_clk_source(dsi->dss, dsi_module);
>  
>  	if (dsi_runtime_get(dsidev))
>  		return;
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.c b/drivers/gpu/drm/omapdrm/dss/dss.c
> index bd8f7abf0450..ba7a2bf1ec09 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.c
> @@ -610,25 +610,27 @@ void dss_select_lcd_clk_source(struct dss_device *dss,
>  	dss->lcd_clk_source[idx] = clk_src;
>  }
>  
> -enum dss_clk_source dss_get_dispc_clk_source(void)
> +enum dss_clk_source dss_get_dispc_clk_source(struct dss_device *dss)
>  {
> -	return dss.dispc_clk_source;
> +	return dss->dispc_clk_source;
>  }
>  
> -enum dss_clk_source dss_get_dsi_clk_source(int dsi_module)
> +enum dss_clk_source dss_get_dsi_clk_source(struct dss_device *dss,
> +					   int dsi_module)
>  {
> -	return dss.dsi_clk_source[dsi_module];
> +	return dss->dsi_clk_source[dsi_module];
>  }
>  
> -enum dss_clk_source dss_get_lcd_clk_source(enum omap_channel channel)
> +enum dss_clk_source dss_get_lcd_clk_source(struct dss_device *dss,
> +					   enum omap_channel channel)
>  {
> -	if (dss.feat->has_lcd_clk_src) {
> +	if (dss->feat->has_lcd_clk_src) {
>  		int idx = dss_get_channel_index(channel);
> -		return dss.lcd_clk_source[idx];
> +		return dss->lcd_clk_source[idx];
>  	} else {
>  		/* LCD_CLK source is the same as DISPC_FCLK source for
>  		 * OMAP2 and OMAP3 */
> -		return dss.dispc_clk_source;
> +		return dss->dispc_clk_source;
>  	}
>  }
>  
> diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h b/drivers/gpu/drm/omapdrm/dss/dss.h
> index 05fba6b3400b..fdb51063c703 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/dss.h
> @@ -311,9 +311,11 @@ void dss_select_dsi_clk_source(struct dss_device *dss, int dsi_module,
>  void dss_select_lcd_clk_source(struct dss_device *dss,
>  			       enum omap_channel channel,
>  			       enum dss_clk_source clk_src);
> -enum dss_clk_source dss_get_dispc_clk_source(void);
> -enum dss_clk_source dss_get_dsi_clk_source(int dsi_module);
> -enum dss_clk_source dss_get_lcd_clk_source(enum omap_channel channel);
> +enum dss_clk_source dss_get_dispc_clk_source(struct dss_device *dss);
> +enum dss_clk_source dss_get_dsi_clk_source(struct dss_device *dss,
> +					   int dsi_module);
> +enum dss_clk_source dss_get_lcd_clk_source(struct dss_device *dss,
> +					   enum omap_channel channel);
>  
>  void dss_set_venc_output(enum omap_dss_venc_type type);
>  void dss_set_dac_pwrdn_bgz(bool enable);
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20171016/07a311ce/attachment.sig>


More information about the dri-devel mailing list