All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@deeprootsystems.com>
To: Guruswamy Senthilvadivu <svadivu@ti.com>
Cc: linux-omap@vger.kernel.org, tomi.valkeinen@nokia.com, paul@pwsan.com
Subject: Re: [PATCH 08/20] Replace clk_enable/disable APIs with HWMOD APIs
Date: Thu, 26 Aug 2010 16:37:36 -0700	[thread overview]
Message-ID: <87sk21t073.fsf@deeprootsystems.com> (raw)
In-Reply-To: <1282579089-10487-9-git-send-email-svadivu@ti.com> (Guruswamy Senthilvadivu's message of "Mon, 23 Aug 2010 21:27:57 +0530")

Guruswamy Senthilvadivu <svadivu@ti.com> writes:

> From: Senthilvadivu Guruswamy <svadivu@ti.com>
>
> 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@ti.com>
> ---
>  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)

  parent reply	other threads:[~2010-08-26 23:37 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-23 15:57 [RFC PATCH 00/20] HWMOD Adaptation for DSS Guruswamy Senthilvadivu
2010-08-23 15:57 ` [PATCH 01/20] DSS HWMOD database generation for OMAP3 Guruswamy Senthilvadivu
2010-08-23 15:57   ` [PATCH 02/20] Move DSS driver register from board to mach_omap2 Guruswamy Senthilvadivu
2010-08-23 15:57     ` [PATCH 03/20] Build omap_device for each DSS HW IP Guruswamy Senthilvadivu
2010-08-23 15:57       ` [PATCH 04/20] Create platform_driver " Guruswamy Senthilvadivu
2010-08-23 15:57         ` [PATCH 05/20] Move dss platform driver to dss.c Guruswamy Senthilvadivu
2010-08-23 15:57           ` [PATCH 06/20] DSS driver name change in clock database Guruswamy Senthilvadivu
2010-08-23 15:57             ` [PATCH 07/20] Move clock functions from core driver to dss driver Guruswamy Senthilvadivu
2010-08-23 15:57               ` [PATCH 08/20] Replace clk_enable/disable APIs with HWMOD APIs Guruswamy Senthilvadivu
2010-08-23 15:57                 ` [PATCH 09/20] Move dss_init to dsshw_probe Guruswamy Senthilvadivu
2010-08-23 15:57                   ` [PATCH 10/20] Move rfbi init to rfbi probe Guruswamy Senthilvadivu
2010-08-23 15:58                     ` [PATCH 11/20] Move dispc init to dispc probe Guruswamy Senthilvadivu
2010-08-23 15:58                       ` [PATCH 12/20] Move venc init to venc probe Guruswamy Senthilvadivu
2010-08-23 15:58                         ` [PATCH 13/20] Move dsi init to dsi probe Guruswamy Senthilvadivu
2010-08-23 15:58                           ` [PATCH 14/20] Pass platform_device argument to rfbi,dispc Guruswamy Senthilvadivu
2010-08-23 15:58                             ` [PATCH 15/20] Use platform device to get DSS base addr Guruswamy Senthilvadivu
2010-08-23 15:58                               ` [PATCH 16/20] Get DISPC base addr with platform device Guruswamy Senthilvadivu
2010-08-23 15:58                                 ` [PATCH 17/20] Get VENC base addr from " Guruswamy Senthilvadivu
2010-08-23 15:58                                   ` [PATCH 18/20] Get DSI base addr with " Guruswamy Senthilvadivu
2010-08-23 15:58                                     ` [PATCH 19/20] Get RFBI baseaddr " Guruswamy Senthilvadivu
2010-08-23 15:58                                       ` [PATCH 20/20] Get DSS IRQ " Guruswamy Senthilvadivu
2010-08-25 13:13                                 ` [PATCH 16/20] Get DISPC base addr " Tomi Valkeinen
2010-08-31  9:14                                   ` Guruswamy, Senthilvadivu
2010-08-23 21:43                               ` [PATCH 15/20] Use platform device to get DSS base addr Cousson, Benoit
2010-08-31 12:55                                 ` Guruswamy, Senthilvadivu
2010-08-26 23:54                     ` [PATCH 10/20] Move rfbi init to rfbi probe Kevin Hilman
2010-08-27 13:54                     ` Cousson, Benoit
2010-08-31 12:57                       ` Guruswamy, Senthilvadivu
2010-08-31 16:38                         ` Cousson, Benoit
2010-08-26 23:37                 ` Kevin Hilman [this message]
2010-08-25  8:49           ` [PATCH 05/20] Move dss platform driver to dss.c Tomi Valkeinen
2010-08-31  9:13             ` Guruswamy, Senthilvadivu
2010-08-26 23:52         ` [PATCH 04/20] Create platform_driver for each DSS HW IP Kevin Hilman
2010-08-31 13:03           ` Guruswamy, Senthilvadivu
2010-08-31 15:27             ` Kevin Hilman
2010-08-26 23:33       ` [PATCH 03/20] Build omap_device " Kevin Hilman
2010-08-31 13:01         ` Guruswamy, Senthilvadivu
2010-08-31 15:29           ` Kevin Hilman
2010-08-25  8:31     ` [PATCH 02/20] Move DSS driver register from board to mach_omap2 Tomi Valkeinen
2010-08-31  9:14       ` Guruswamy, Senthilvadivu
2010-08-26 23:30   ` [PATCH 01/20] DSS HWMOD database generation for OMAP3 Kevin Hilman
2010-08-31 12:59     ` Guruswamy, Senthilvadivu
2010-08-23 21:40 ` [RFC PATCH 00/20] HWMOD Adaptation for DSS Cousson, Benoit
2010-08-31 12:54   ` Guruswamy, Senthilvadivu
2010-08-26 23:57 ` Kevin Hilman
2010-08-31 13:03   ` Guruswamy, Senthilvadivu

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=87sk21t073.fsf@deeprootsystems.com \
    --to=khilman@deeprootsystems.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=paul@pwsan.com \
    --cc=svadivu@ti.com \
    --cc=tomi.valkeinen@nokia.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.