Re: [PATCH 08/20] Replace clk_enable/disable APIs with HWMOD APIs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Guruswamy Senthilvadivu <svadivu@xxxxxx> writes:

> From: Senthilvadivu Guruswamy <svadivu@xxxxxx>
>
> when DSS ICK, FCK are requested, dss HWMOD APIs are used for enable
> and disable. The remaining clocks (dss opt clks in HWMOD database)
> continue to use clk APIs, since HWMOD APIs are not fully available
> for the dss opt clocks without the usage of clk framework.

The clocks that are managed by omap_device/omap_hwmod should be
controlled by using the runtime PM API, not by using pdata function
pointers.

Since the runtime PM core implements use-counting, you can probably get
rid of the use_count management too.

Kevin

> Signed-off-by: Senthilvadivu Guruswamy <svadivu@xxxxxx>
> ---
>  drivers/video/omap2/dss/dss.c |   28 ++++++++++++++++++++--------
>  1 files changed, 20 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
> index 15d0399..098ff96 100644
> --- a/drivers/video/omap2/dss/dss.c
> +++ b/drivers/video/omap2/dss/dss.c
> @@ -61,6 +61,7 @@ struct dss_reg {
>  
>  static struct {
>  	struct platform_device *pdev;
> +	struct omap_display_platform_data *pdata;
>  
>  	void __iomem    *base;
>  	int		ctx_id;
> @@ -310,14 +311,26 @@ static unsigned count_clk_bits(enum dss_clock clks)
>  	return num_clks;
>  }
>  
> +static inline void enable_clocks(bool enable)
> + {
> +	static int use_count;
> +
> +	use_count += enable ? 1 : -1;
> +	if (use_count < 0)
> +		use_count = 0;
> +
> +	if (enable && use_count == 1)
> +		dss.pdata->device_enable(dss.pdev);
> +	else if (!enable && use_count == 0)
> +		dss.pdata->device_idle(dss.pdev);
> +}
> +
>  static void dss_clk_enable_no_ctx(enum dss_clock clks)
>  {
>  	unsigned num_clks = count_clk_bits(clks);
>  
> -	if (clks & DSS_CLK_ICK)
> -		clk_enable(dss.dss_ick);
> -	if (clks & DSS_CLK_FCK1)
> -		clk_enable(dss.dss1_fck);
> +	if ((clks & DSS_CLK_ICK) || (clks & DSS_CLK_FCK1))
> +		enable_clocks(1);
>  	if (clks & DSS_CLK_FCK2)
>  		clk_enable(dss.dss2_fck);
>  	if (clks & DSS_CLK_54M)
> @@ -342,10 +355,8 @@ static void dss_clk_disable_no_ctx(enum dss_clock clks)
>  {
>  	unsigned num_clks = count_clk_bits(clks);
>  
> -	if (clks & DSS_CLK_ICK)
> -		clk_disable(dss.dss_ick);
> -	if (clks & DSS_CLK_FCK1)
> -		clk_disable(dss.dss1_fck);
> +	if ((clks & DSS_CLK_ICK) || (clks & DSS_CLK_FCK1))
> +		enable_clocks(0);
>  	if (clks & DSS_CLK_FCK2)
>  		clk_disable(dss.dss2_fck);
>  	if (clks & DSS_CLK_54M)
> @@ -447,6 +458,7 @@ static int omap_dsshw_probe(struct platform_device *pdev)
>  	int r;
>  
>  	dss.pdev = pdev;
> +	dss.pdata = dss.pdev->dev.platform_data;
>  
>  	r = dss_get_clocks();
>  	if (r)
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux