linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] pwm: pwm-tiehrpwm: Update the clock handling of pwm-tiehrpwm driver
@ 2013-01-10 13:05 Philip Avinash
  2013-01-14  7:29 ` Thierry Reding
  2013-01-17 15:52 ` Thierry Reding
  0 siblings, 2 replies; 5+ messages in thread
From: Philip Avinash @ 2013-01-10 13:05 UTC (permalink / raw)
  To: thierry.reding
  Cc: linux-kernel, linux-omap, nsekhar, gururaja.hebbar,
	Philip, Avinash

From: "Philip, Avinash" <avinashphilip@ti.com>

The clock framework has changed and it's now better to invoke
clock_prepare_enable() and clk_disable_unprepare() rather than the
legacy clk_enable() and clk_disable() calls. This patch converts the
pwm-tiehrpwm driver to the new framework.

Signed-off-by: Philip Avinash <avinashphilip@ti.com>
---
Changes Since v1:
	- Check the return value of TBCLK enable in .pwm_enable()

In 3.8-rc1, common clock frame work support added to AM335x.

 drivers/pwm/pwm-tiehrpwm.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/pwm/pwm-tiehrpwm.c b/drivers/pwm/pwm-tiehrpwm.c
index 72a6dd4..4fcafbf 100644
--- a/drivers/pwm/pwm-tiehrpwm.c
+++ b/drivers/pwm/pwm-tiehrpwm.c
@@ -318,6 +318,7 @@ static int ehrpwm_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
 {
 	struct ehrpwm_pwm_chip *pc = to_ehrpwm_pwm_chip(chip);
 	unsigned short aqcsfrc_val, aqcsfrc_mask;
+	int ret;
 
 	/* Leave clock enabled on enabling PWM */
 	pm_runtime_get_sync(chip->dev);
@@ -341,7 +342,12 @@ static int ehrpwm_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
 	configure_polarity(pc, pwm->hwpwm);
 
 	/* Enable TBCLK before enabling PWM device */
-	clk_enable(pc->tbclk);
+	ret = clk_prepare_enable(pc->tbclk);
+	if (ret) {
+		pr_err("Failed to enable TBCLK for %s\n",
+				dev_name(pc->chip.dev));
+		return ret;
+	}
 
 	/* Enable time counter for free_run */
 	ehrpwm_modify(pc->mmio_base, TBCTL, TBCTL_RUN_MASK, TBCTL_FREE_RUN);
@@ -372,7 +378,7 @@ static void ehrpwm_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
 	ehrpwm_modify(pc->mmio_base, AQCSFRC, aqcsfrc_mask, aqcsfrc_val);
 
 	/* Disabling TBCLK on PWM disable */
-	clk_disable(pc->tbclk);
+	clk_disable_unprepare(pc->tbclk);
 
 	/* Stop Time base counter */
 	ehrpwm_modify(pc->mmio_base, TBCTL, TBCTL_RUN_MASK, TBCTL_STOP_NEXT);
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] pwm: pwm-tiehrpwm: Update the clock handling of pwm-tiehrpwm driver
  2013-01-10 13:05 [PATCH v2] pwm: pwm-tiehrpwm: Update the clock handling of pwm-tiehrpwm driver Philip Avinash
@ 2013-01-14  7:29 ` Thierry Reding
  2013-01-17 15:52 ` Thierry Reding
  1 sibling, 0 replies; 5+ messages in thread
From: Thierry Reding @ 2013-01-14  7:29 UTC (permalink / raw)
  To: Philip Avinash; +Cc: linux-kernel, linux-omap, nsekhar, gururaja.hebbar

[-- Attachment #1: Type: text/plain, Size: 462 bytes --]

On Thu, Jan 10, 2013 at 06:35:26PM +0530, Philip Avinash wrote:
> From: "Philip, Avinash" <avinashphilip@ti.com>
> 
> The clock framework has changed and it's now better to invoke
> clock_prepare_enable() and clk_disable_unprepare() rather than the
> legacy clk_enable() and clk_disable() calls. This patch converts the
> pwm-tiehrpwm driver to the new framework.
> 
> Signed-off-by: Philip Avinash <avinashphilip@ti.com>

Applied, thanks.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] pwm: pwm-tiehrpwm: Update the clock handling of pwm-tiehrpwm driver
  2013-01-10 13:05 [PATCH v2] pwm: pwm-tiehrpwm: Update the clock handling of pwm-tiehrpwm driver Philip Avinash
  2013-01-14  7:29 ` Thierry Reding
@ 2013-01-17 15:52 ` Thierry Reding
  2013-01-18  4:18   ` Philip, Avinash
  1 sibling, 1 reply; 5+ messages in thread
From: Thierry Reding @ 2013-01-17 15:52 UTC (permalink / raw)
  To: Philip Avinash; +Cc: linux-kernel, linux-omap, nsekhar, gururaja.hebbar

[-- Attachment #1: Type: text/plain, Size: 848 bytes --]

On Thu, Jan 10, 2013 at 06:35:26PM +0530, Philip Avinash wrote:
> From: "Philip, Avinash" <avinashphilip@ti.com>
> 
> The clock framework has changed and it's now better to invoke
> clock_prepare_enable() and clk_disable_unprepare() rather than the
> legacy clk_enable() and clk_disable() calls. This patch converts the
> pwm-tiehrpwm driver to the new framework.
> 
> Signed-off-by: Philip Avinash <avinashphilip@ti.com>
> ---
> Changes Since v1:
> 	- Check the return value of TBCLK enable in .pwm_enable()
> 
> In 3.8-rc1, common clock frame work support added to AM335x.
> 
>  drivers/pwm/pwm-tiehrpwm.c |   10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)

I had applied this to my for-next branch, but reading the commit message
again it would seem that this should actually go into 3.8, right?

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH v2] pwm: pwm-tiehrpwm: Update the clock handling of pwm-tiehrpwm driver
  2013-01-17 15:52 ` Thierry Reding
@ 2013-01-18  4:18   ` Philip, Avinash
  2013-01-18  6:49     ` Thierry Reding
  0 siblings, 1 reply; 5+ messages in thread
From: Philip, Avinash @ 2013-01-18  4:18 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org,
	Nori, Sekhar, Hebbar, Gururaja

On Thu, Jan 17, 2013 at 21:22:18, Thierry Reding wrote:
> On Thu, Jan 10, 2013 at 06:35:26PM +0530, Philip Avinash wrote:
> > From: "Philip, Avinash" <avinashphilip@ti.com>
> > 
> > The clock framework has changed and it's now better to invoke
> > clock_prepare_enable() and clk_disable_unprepare() rather than the
> > legacy clk_enable() and clk_disable() calls. This patch converts the
> > pwm-tiehrpwm driver to the new framework.
> > 
> > Signed-off-by: Philip Avinash <avinashphilip@ti.com>
> > ---
> > Changes Since v1:
> > 	- Check the return value of TBCLK enable in .pwm_enable()
> > 
> > In 3.8-rc1, common clock frame work support added to AM335x.
> > 
> >  drivers/pwm/pwm-tiehrpwm.c |   10 ++++++++--
> >  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> I had applied this to my for-next branch, but reading the commit message
> again it would seem that this should actually go into 3.8, right?

Common clock framework support added for am335x in 3.8 only, still EHRPWM
tbclk not present in clock tree. I expect this to be in 3.9. So this patch
also requires to be in 3.9 only.

Thanks
Avinash

> 
> Thierry
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] pwm: pwm-tiehrpwm: Update the clock handling of pwm-tiehrpwm driver
  2013-01-18  4:18   ` Philip, Avinash
@ 2013-01-18  6:49     ` Thierry Reding
  0 siblings, 0 replies; 5+ messages in thread
From: Thierry Reding @ 2013-01-18  6:49 UTC (permalink / raw)
  To: Philip, Avinash
  Cc: linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org,
	Nori, Sekhar, Hebbar, Gururaja

[-- Attachment #1: Type: text/plain, Size: 1356 bytes --]

On Fri, Jan 18, 2013 at 04:18:27AM +0000, Philip, Avinash wrote:
> On Thu, Jan 17, 2013 at 21:22:18, Thierry Reding wrote:
> > On Thu, Jan 10, 2013 at 06:35:26PM +0530, Philip Avinash wrote:
> > > From: "Philip, Avinash" <avinashphilip@ti.com>
> > > 
> > > The clock framework has changed and it's now better to invoke
> > > clock_prepare_enable() and clk_disable_unprepare() rather than the
> > > legacy clk_enable() and clk_disable() calls. This patch converts the
> > > pwm-tiehrpwm driver to the new framework.
> > > 
> > > Signed-off-by: Philip Avinash <avinashphilip@ti.com>
> > > ---
> > > Changes Since v1:
> > > 	- Check the return value of TBCLK enable in .pwm_enable()
> > > 
> > > In 3.8-rc1, common clock frame work support added to AM335x.
> > > 
> > >  drivers/pwm/pwm-tiehrpwm.c |   10 ++++++++--
> > >  1 file changed, 8 insertions(+), 2 deletions(-)
> > 
> > I had applied this to my for-next branch, but reading the commit message
> > again it would seem that this should actually go into 3.8, right?
> 
> Common clock framework support added for am335x in 3.8 only, still EHRPWM
> tbclk not present in clock tree. I expect this to be in 3.9. So this patch
> also requires to be in 3.9 only.

Okay, I'll leave it in my for-next branch then, which gets merged into
linux-next and will go into 3.9.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-01-18  6:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-10 13:05 [PATCH v2] pwm: pwm-tiehrpwm: Update the clock handling of pwm-tiehrpwm driver Philip Avinash
2013-01-14  7:29 ` Thierry Reding
2013-01-17 15:52 ` Thierry Reding
2013-01-18  4:18   ` Philip, Avinash
2013-01-18  6:49     ` Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).