All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@ti.com>
To: Nishanth Menon <nm@ti.com>
Cc: linux-omap <linux-omap@vger.kernel.org>,
	linux-arm <linux-arm-kernel@lists.infradead.org>,
	Tony <tony@atomide.com>, Paul <paul@pwsan.com>,
	Jarkko Nikula <jhnikula@gmail.com>
Subject: Re: [PATCH V3 13/19] OMAP3+: SR: Reuse sr_[start|stop]_vddautocomp functions
Date: Thu, 17 Mar 2011 10:25:30 -0700	[thread overview]
Message-ID: <87r5a57j79.fsf@ti.com> (raw)
In-Reply-To: <1299338962-5602-14-git-send-email-nm@ti.com> (Nishanth Menon's message of "Sat, 5 Mar 2011 20:59:16 +0530")

Nishanth Menon <nm@ti.com> writes:

> From: Jarkko Nikula <jhnikula@gmail.com>
>
> sr_start_vddautocomp and sr_stop_autocomp functions can be reused from
> omap_sr_enable, omap_sr_disable and omap_sr_disable_reset_volt and by
> adding one additional argument sr_stop_autocomp. This allows us to have
> a single point where SR enable and disable operations are controlled from.
>
> [nm@ti.com: synced it up with class start/stop as well. autocomp flag
>  should only be disabled when SR is disabled for that domain]
> Signed-off-by: Nishanth Menon <nm@ti.com>
> Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
> ---
> Side note: Jarkko has'nt seen this rev as I just finished the rebase and tested
> but adding his signed-off anyways as he is primary contributor to the idea
> and the patch.

This one looks fine, but will wait to apply it since it depends on the
previous one which needs some minor fixups.

Kevin

>  arch/arm/mach-omap2/smartreflex.c |   66 +++++++++++++------------------------
>  1 files changed, 23 insertions(+), 43 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
> index 592e9a0..d839fa6 100644
> --- a/arch/arm/mach-omap2/smartreflex.c
> +++ b/arch/arm/mach-omap2/smartreflex.c
> @@ -211,8 +211,12 @@ static void sr_set_regfields(struct omap_sr *sr)
>  	}
>  }
>  
> -static void sr_start_vddautocomp(struct omap_sr *sr)
> +static void sr_start_vddautocomp(struct omap_sr *sr, bool class_start)
>  {
> +	int r;
> +	if (sr->autocomp_active)
> +		return;
> +
>  	if (!sr_class || !(sr_class->enable) || !(sr_class->configure)) {
>  		dev_warn(&sr->pdev->dev,
>  			"%s: smartreflex class driver not registered\n",
> @@ -220,19 +224,24 @@ static void sr_start_vddautocomp(struct omap_sr *sr)
>  		return;
>  	}
>  
> -	if (sr_class->start &&
> +	if (class_start && sr_class->start &&
>  	    sr_class->start(sr->voltdm, sr_class->class_priv_data)) {
>  		dev_err(&sr->pdev->dev,
>  			"%s: SRClass initialization failed\n", __func__);
>  		return;
>  	}
>  
> -	if (!sr_class->enable(sr->voltdm))
> +	r = sr_class->enable(sr->voltdm);
> +	if (!r && class_start)
>  		sr->autocomp_active = true;
>  }
>  
> -static void sr_stop_vddautocomp(struct omap_sr *sr)
> +static void sr_stop_vddautocomp(struct omap_sr *sr, bool class_stop,
> +		int is_volt_reset)
>  {
> +	if (!sr->autocomp_active)
> +		return;
> +
>  	if (!sr_class || !(sr_class->disable)) {
>  		dev_warn(&sr->pdev->dev,
>  			"%s: smartreflex class driver not registered\n",
> @@ -240,15 +249,13 @@ static void sr_stop_vddautocomp(struct omap_sr *sr)
>  		return;
>  	}
>  
> -	if (sr->autocomp_active) {
> -		sr_class->disable(sr->voltdm, 1);
> +	sr_class->disable(sr->voltdm, is_volt_reset);
> +	if (class_stop) {
>  		if (sr_class->stop &&
> -		    sr_class->stop(sr->voltdm,
> -			    sr_class->class_priv_data)) {
> +		    sr_class->stop(sr->voltdm, sr_class->class_priv_data))
>  			dev_err(&sr->pdev->dev,
>  				"%s: SR[%d]Class deinitialization failed\n",
>  				__func__, sr->srid);
> -		}
>  		sr->autocomp_active = false;
>  	}
>  }
> @@ -285,7 +292,7 @@ static int sr_late_init(struct omap_sr *sr_info)
>  	}
>  
>  	if (pdata && pdata->enable_on_init)
> -		sr_start_vddautocomp(sr_info);
> +		sr_start_vddautocomp(sr_info, true);
>  
>  	return ret;
>  
> @@ -693,16 +700,7 @@ void omap_sr_enable(struct voltagedomain *voltdm)
>  		return;
>  	}
>  
> -	if (!sr->autocomp_active)
> -		return;
> -
> -	if (!sr_class || !(sr_class->enable) || !(sr_class->configure)) {
> -		dev_warn(&sr->pdev->dev, "%s: smartreflex class driver not"
> -			"registered\n", __func__);
> -		return;
> -	}
> -
> -	sr_class->enable(voltdm);
> +	sr_start_vddautocomp(sr, false);
>  }
>  
>  /**
> @@ -726,16 +724,7 @@ void omap_sr_disable(struct voltagedomain *voltdm)
>  		return;
>  	}
>  
> -	if (!sr->autocomp_active)
> -		return;
> -
> -	if (!sr_class || !(sr_class->disable)) {
> -		dev_warn(&sr->pdev->dev, "%s: smartreflex class driver not"
> -			"registered\n", __func__);
> -		return;
> -	}
> -
> -	sr_class->disable(voltdm, 0);
> +	sr_stop_vddautocomp(sr, false, 0);
>  }
>  
>  /**
> @@ -759,16 +748,7 @@ void omap_sr_disable_reset_volt(struct voltagedomain *voltdm)
>  		return;
>  	}
>  
> -	if (!sr->autocomp_active)
> -		return;
> -
> -	if (!sr_class || !(sr_class->disable)) {
> -		dev_warn(&sr->pdev->dev, "%s: smartreflex class driver not"
> -			"registered\n", __func__);
> -		return;
> -	}
> -
> -	sr_class->disable(voltdm, 1);
> +	sr_stop_vddautocomp(sr, false, 1);
>  }
>  
>  /**
> @@ -823,9 +803,9 @@ static int omap_sr_autocomp_store(void *data, u64 val)
>  	/* control enable/disable only if there is a delta in value */
>  	if (sr_info->autocomp_active != val) {
>  		if (!val)
> -			sr_stop_vddautocomp(sr_info);
> +			sr_stop_vddautocomp(sr_info, true, 1);
>  		else
> -			sr_start_vddautocomp(sr_info);
> +			sr_start_vddautocomp(sr_info, true);
>  	}
>  
>  	return 0;
> @@ -987,7 +967,7 @@ static int __devexit omap_sr_remove(struct platform_device *pdev)
>  	}
>  
>  	if (sr_info->autocomp_active)
> -		sr_stop_vddautocomp(sr_info);
> +		sr_stop_vddautocomp(sr_info, true, 1);
>  
>  	list_del(&sr_info->node);
>  	iounmap(sr_info->base);

WARNING: multiple messages have this Message-ID (diff)
From: khilman@ti.com (Kevin Hilman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V3 13/19] OMAP3+: SR: Reuse sr_[start|stop]_vddautocomp functions
Date: Thu, 17 Mar 2011 10:25:30 -0700	[thread overview]
Message-ID: <87r5a57j79.fsf@ti.com> (raw)
In-Reply-To: <1299338962-5602-14-git-send-email-nm@ti.com> (Nishanth Menon's message of "Sat, 5 Mar 2011 20:59:16 +0530")

Nishanth Menon <nm@ti.com> writes:

> From: Jarkko Nikula <jhnikula@gmail.com>
>
> sr_start_vddautocomp and sr_stop_autocomp functions can be reused from
> omap_sr_enable, omap_sr_disable and omap_sr_disable_reset_volt and by
> adding one additional argument sr_stop_autocomp. This allows us to have
> a single point where SR enable and disable operations are controlled from.
>
> [nm at ti.com: synced it up with class start/stop as well. autocomp flag
>  should only be disabled when SR is disabled for that domain]
> Signed-off-by: Nishanth Menon <nm@ti.com>
> Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
> ---
> Side note: Jarkko has'nt seen this rev as I just finished the rebase and tested
> but adding his signed-off anyways as he is primary contributor to the idea
> and the patch.

This one looks fine, but will wait to apply it since it depends on the
previous one which needs some minor fixups.

Kevin

>  arch/arm/mach-omap2/smartreflex.c |   66 +++++++++++++------------------------
>  1 files changed, 23 insertions(+), 43 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
> index 592e9a0..d839fa6 100644
> --- a/arch/arm/mach-omap2/smartreflex.c
> +++ b/arch/arm/mach-omap2/smartreflex.c
> @@ -211,8 +211,12 @@ static void sr_set_regfields(struct omap_sr *sr)
>  	}
>  }
>  
> -static void sr_start_vddautocomp(struct omap_sr *sr)
> +static void sr_start_vddautocomp(struct omap_sr *sr, bool class_start)
>  {
> +	int r;
> +	if (sr->autocomp_active)
> +		return;
> +
>  	if (!sr_class || !(sr_class->enable) || !(sr_class->configure)) {
>  		dev_warn(&sr->pdev->dev,
>  			"%s: smartreflex class driver not registered\n",
> @@ -220,19 +224,24 @@ static void sr_start_vddautocomp(struct omap_sr *sr)
>  		return;
>  	}
>  
> -	if (sr_class->start &&
> +	if (class_start && sr_class->start &&
>  	    sr_class->start(sr->voltdm, sr_class->class_priv_data)) {
>  		dev_err(&sr->pdev->dev,
>  			"%s: SRClass initialization failed\n", __func__);
>  		return;
>  	}
>  
> -	if (!sr_class->enable(sr->voltdm))
> +	r = sr_class->enable(sr->voltdm);
> +	if (!r && class_start)
>  		sr->autocomp_active = true;
>  }
>  
> -static void sr_stop_vddautocomp(struct omap_sr *sr)
> +static void sr_stop_vddautocomp(struct omap_sr *sr, bool class_stop,
> +		int is_volt_reset)
>  {
> +	if (!sr->autocomp_active)
> +		return;
> +
>  	if (!sr_class || !(sr_class->disable)) {
>  		dev_warn(&sr->pdev->dev,
>  			"%s: smartreflex class driver not registered\n",
> @@ -240,15 +249,13 @@ static void sr_stop_vddautocomp(struct omap_sr *sr)
>  		return;
>  	}
>  
> -	if (sr->autocomp_active) {
> -		sr_class->disable(sr->voltdm, 1);
> +	sr_class->disable(sr->voltdm, is_volt_reset);
> +	if (class_stop) {
>  		if (sr_class->stop &&
> -		    sr_class->stop(sr->voltdm,
> -			    sr_class->class_priv_data)) {
> +		    sr_class->stop(sr->voltdm, sr_class->class_priv_data))
>  			dev_err(&sr->pdev->dev,
>  				"%s: SR[%d]Class deinitialization failed\n",
>  				__func__, sr->srid);
> -		}
>  		sr->autocomp_active = false;
>  	}
>  }
> @@ -285,7 +292,7 @@ static int sr_late_init(struct omap_sr *sr_info)
>  	}
>  
>  	if (pdata && pdata->enable_on_init)
> -		sr_start_vddautocomp(sr_info);
> +		sr_start_vddautocomp(sr_info, true);
>  
>  	return ret;
>  
> @@ -693,16 +700,7 @@ void omap_sr_enable(struct voltagedomain *voltdm)
>  		return;
>  	}
>  
> -	if (!sr->autocomp_active)
> -		return;
> -
> -	if (!sr_class || !(sr_class->enable) || !(sr_class->configure)) {
> -		dev_warn(&sr->pdev->dev, "%s: smartreflex class driver not"
> -			"registered\n", __func__);
> -		return;
> -	}
> -
> -	sr_class->enable(voltdm);
> +	sr_start_vddautocomp(sr, false);
>  }
>  
>  /**
> @@ -726,16 +724,7 @@ void omap_sr_disable(struct voltagedomain *voltdm)
>  		return;
>  	}
>  
> -	if (!sr->autocomp_active)
> -		return;
> -
> -	if (!sr_class || !(sr_class->disable)) {
> -		dev_warn(&sr->pdev->dev, "%s: smartreflex class driver not"
> -			"registered\n", __func__);
> -		return;
> -	}
> -
> -	sr_class->disable(voltdm, 0);
> +	sr_stop_vddautocomp(sr, false, 0);
>  }
>  
>  /**
> @@ -759,16 +748,7 @@ void omap_sr_disable_reset_volt(struct voltagedomain *voltdm)
>  		return;
>  	}
>  
> -	if (!sr->autocomp_active)
> -		return;
> -
> -	if (!sr_class || !(sr_class->disable)) {
> -		dev_warn(&sr->pdev->dev, "%s: smartreflex class driver not"
> -			"registered\n", __func__);
> -		return;
> -	}
> -
> -	sr_class->disable(voltdm, 1);
> +	sr_stop_vddautocomp(sr, false, 1);
>  }
>  
>  /**
> @@ -823,9 +803,9 @@ static int omap_sr_autocomp_store(void *data, u64 val)
>  	/* control enable/disable only if there is a delta in value */
>  	if (sr_info->autocomp_active != val) {
>  		if (!val)
> -			sr_stop_vddautocomp(sr_info);
> +			sr_stop_vddautocomp(sr_info, true, 1);
>  		else
> -			sr_start_vddautocomp(sr_info);
> +			sr_start_vddautocomp(sr_info, true);
>  	}
>  
>  	return 0;
> @@ -987,7 +967,7 @@ static int __devexit omap_sr_remove(struct platform_device *pdev)
>  	}
>  
>  	if (sr_info->autocomp_active)
> -		sr_stop_vddautocomp(sr_info);
> +		sr_stop_vddautocomp(sr_info, true, 1);
>  
>  	list_del(&sr_info->node);
>  	iounmap(sr_info->base);

  parent reply	other threads:[~2011-03-17 17:25 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-05 15:29 [PATCH V3 00/19] OMAP3+: PM: introduce SR class 1.5 Nishanth Menon
2011-03-05 15:29 ` Nishanth Menon
2011-03-05 15:29 ` [PATCH V3 01/19] OMAP3: hwmod: add SmartReflex IRQs Nishanth Menon
2011-03-05 15:29   ` Nishanth Menon
2011-03-17 14:41   ` Kevin Hilman
2011-03-17 14:41     ` Kevin Hilman
2011-07-26 13:11   ` Felipe Balbi
2011-07-26 13:11     ` Felipe Balbi
2011-03-05 15:29 ` [PATCH V3 02/19] OMAP3+: voltage: fix build warning Nishanth Menon
2011-03-05 15:29   ` Nishanth Menon
2011-03-17 14:49   ` Kevin Hilman
2011-03-17 14:49     ` Kevin Hilman
2011-07-26 13:12   ` Felipe Balbi
2011-07-26 13:12     ` Felipe Balbi
2011-03-05 15:29 ` [PATCH V3 03/19] OMAP3+: voltage: remove initial voltage Nishanth Menon
2011-03-05 15:29   ` Nishanth Menon
2011-03-06 13:37   ` Sergei Shtylyov
2011-03-06 13:37     ` Sergei Shtylyov
2011-03-07  2:52     ` Nishanth Menon
2011-03-07  2:52       ` Nishanth Menon
2011-03-07 16:23       ` Sergei Shtylyov
2011-03-07 16:23         ` Sergei Shtylyov
2011-03-08  1:52         ` Nishanth Menon
2011-03-08  1:52           ` Nishanth Menon
2011-07-26 13:17           ` Felipe Balbi
2011-07-26 13:17             ` Felipe Balbi
2011-03-17 14:53   ` Kevin Hilman
2011-03-17 14:53     ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 04/19] OMAP3+: voltage: remove spurious pr_notice for debugfs Nishanth Menon
2011-03-05 15:29   ` Nishanth Menon
2011-03-17 14:55   ` Kevin Hilman
2011-03-17 14:55     ` Kevin Hilman
2011-07-26 13:18   ` Felipe Balbi
2011-07-26 13:18     ` Felipe Balbi
2011-03-05 15:29 ` [PATCH V3 05/19] OMAP3+: voltage: use IS_ERR_OR_NULL Nishanth Menon
2011-03-05 15:29   ` Nishanth Menon
2011-03-05 17:36   ` David Cohen
2011-03-05 17:36     ` David Cohen
2011-03-06  2:45     ` Nishanth Menon
2011-03-06  2:45       ` Nishanth Menon
2011-03-06  8:18       ` Russell King - ARM Linux
2011-03-06  8:18         ` Russell King - ARM Linux
2011-03-07  2:56         ` Nishanth Menon
2011-03-07  2:56           ` Nishanth Menon
2011-07-26 13:19   ` Felipe Balbi
2011-07-26 13:19     ` Felipe Balbi
2011-03-05 15:29 ` [PATCH V3 06/19] OMAP3+: voltage: use volt_data pointer instead values Nishanth Menon
2011-03-05 15:29   ` Nishanth Menon
2011-03-17 17:09   ` Kevin Hilman
2011-03-17 17:09     ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 07/19] OMAP3+: voltage: add transdone APIs Nishanth Menon
2011-03-05 15:29   ` Nishanth Menon
2011-03-17 17:14   ` Kevin Hilman
2011-03-17 17:14     ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 08/19] OMAP3+: SR: make notify independent of class Nishanth Menon
2011-03-05 15:29   ` Nishanth Menon
2011-03-17 17:18   ` Kevin Hilman
2011-03-17 17:18     ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 09/19] OMAP3+: SR: disable interrupt by default Nishanth Menon
2011-03-05 15:29   ` Nishanth Menon
2011-03-17 17:19   ` Kevin Hilman
2011-03-17 17:19     ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 10/19] OMAP3+: SR: enable/disable SR only on need Nishanth Menon
2011-03-05 15:29   ` Nishanth Menon
2011-03-17 17:20   ` Kevin Hilman
2011-03-17 17:20     ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 11/19] OMAP3+: SR: fix cosmetic indentation Nishanth Menon
2011-03-05 15:29   ` Nishanth Menon
2011-03-17 17:21   ` Kevin Hilman
2011-03-17 17:21     ` Kevin Hilman
2011-03-17 17:43     ` Aaro Koskinen
2011-03-17 17:43       ` Aaro Koskinen
2011-03-17 20:02       ` Kevin Hilman
2011-03-17 20:02         ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 12/19] OMAP3+: SR: introduce class start,stop and priv data Nishanth Menon
2011-03-05 15:29   ` [PATCH V3 12/19] OMAP3+: SR: introduce class start, stop " Nishanth Menon
2011-03-17 17:23   ` [PATCH V3 12/19] OMAP3+: SR: introduce class start,stop " Kevin Hilman
2011-03-17 17:23     ` [PATCH V3 12/19] OMAP3+: SR: introduce class start, stop " Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 13/19] OMAP3+: SR: Reuse sr_[start|stop]_vddautocomp functions Nishanth Menon
2011-03-05 15:29   ` Nishanth Menon
2011-03-07 14:40   ` Jarkko Nikula
2011-03-07 14:40     ` Jarkko Nikula
2011-03-17 17:25   ` Kevin Hilman [this message]
2011-03-17 17:25     ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 14/19] OMAP3+: SR: introduce notifiers flags Nishanth Menon
2011-03-05 15:29   ` Nishanth Menon
2011-03-17 17:28   ` Kevin Hilman
2011-03-17 17:28     ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 15/19] OMAP3+: SR: introduce notifier_control Nishanth Menon
2011-03-05 15:29   ` Nishanth Menon
2011-03-17 17:35   ` Kevin Hilman
2011-03-17 17:35     ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 16/19] OMAP3+: SR: disable spamming interrupts Nishanth Menon
2011-03-05 15:29   ` Nishanth Menon
2011-03-05 15:29 ` [PATCH V3 17/19] OMAP3+: SR: make enable path use volt_data pointer Nishanth Menon
2011-03-05 15:29   ` Nishanth Menon
2011-03-17 17:41   ` Kevin Hilman
2011-03-17 17:41     ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 18/19] OMAP3630+: SR: add support for class 1.5 Nishanth Menon
2011-03-05 15:29   ` Nishanth Menon
2011-03-17 19:57   ` Kevin Hilman
2011-03-17 19:57     ` Kevin Hilman
2011-03-05 15:29 ` [PATCH V3 19/19] OMAP3430: SR: class3: restrict CPU to run on Nishanth Menon
2011-03-05 15:29   ` Nishanth Menon
2011-03-17 19:58   ` Kevin Hilman
2011-03-17 19:58     ` Kevin Hilman

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=87r5a57j79.fsf@ti.com \
    --to=khilman@ti.com \
    --cc=jhnikula@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=paul@pwsan.com \
    --cc=tony@atomide.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.