* [PATCH 0/2] pwm fixes for 3.8
@ 2012-11-19 2:06 Tony Prisk
2012-11-19 2:06 ` [PATCH 1/2] Fix build error in pwm-vt8500.c Tony Prisk
2012-11-19 2:06 ` [PATCH 2/2] pwm: vt8500: Ensure pwm clock is enabled during pwm_config Tony Prisk
0 siblings, 2 replies; 7+ messages in thread
From: Tony Prisk @ 2012-11-19 2:06 UTC (permalink / raw)
To: linux-arm-kernel
Hi Theirry,
As discussed, here is the patch to correct the issue created by enabling
disabling the pwm clock during pwm_enable/_disable. A second patch is
including which fixes a build error introduced in the same patch.
These should be applied on top of the previous patch.
Tony Prisk (2):
Fix build error in pwm-vt8500.c
pwm: vt8500: Ensure pwm clock is enabled during pwm_config
drivers/pwm/pwm-vt8500.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] Fix build error in pwm-vt8500.c
2012-11-19 2:06 [PATCH 0/2] pwm fixes for 3.8 Tony Prisk
@ 2012-11-19 2:06 ` Tony Prisk
2012-11-19 6:51 ` Thierry Reding
2012-11-19 9:29 ` Russell King - ARM Linux
2012-11-19 2:06 ` [PATCH 2/2] pwm: vt8500: Ensure pwm clock is enabled during pwm_config Tony Prisk
1 sibling, 2 replies; 7+ messages in thread
From: Tony Prisk @ 2012-11-19 2:06 UTC (permalink / raw)
To: linux-arm-kernel
A missing '{' causes a build error in pwm-vt8500.c
Signed-off-by: Tony Prisk <linux@prisktech.co.nz>
---
drivers/pwm/pwm-vt8500.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pwm/pwm-vt8500.c b/drivers/pwm/pwm-vt8500.c
index 970b0c6..806f72c 100644
--- a/drivers/pwm/pwm-vt8500.c
+++ b/drivers/pwm/pwm-vt8500.c
@@ -100,7 +100,7 @@ static int vt8500_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
struct vt8500_chip *vt8500 = to_vt8500_chip(chip);
err = clk_enable(vt8500->clk);
- if (err < 0)
+ if (err < 0) {
dev_err(chip->dev, "failed to enable clock\n");
return err;
};
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] pwm: vt8500: Ensure pwm clock is enabled during pwm_config
2012-11-19 2:06 [PATCH 0/2] pwm fixes for 3.8 Tony Prisk
2012-11-19 2:06 ` [PATCH 1/2] Fix build error in pwm-vt8500.c Tony Prisk
@ 2012-11-19 2:06 ` Tony Prisk
2012-11-19 6:53 ` Thierry Reding
1 sibling, 1 reply; 7+ messages in thread
From: Tony Prisk @ 2012-11-19 2:06 UTC (permalink / raw)
To: linux-arm-kernel
When all PWMs are disabled, PWM module may be disabled during
calls to pwm_config. This patch enables/disables the clock in
pwm_config to ensure the module is active before register read/
writes.
Signed-off-by: Tony Prisk <linux@prisktech.co.nz>
---
drivers/pwm/pwm-vt8500.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/pwm/pwm-vt8500.c b/drivers/pwm/pwm-vt8500.c
index 806f72c..cc97af9 100644
--- a/drivers/pwm/pwm-vt8500.c
+++ b/drivers/pwm/pwm-vt8500.c
@@ -63,6 +63,8 @@ static int vt8500_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
unsigned long long c;
unsigned long period_cycles, prescale, pv, dc;
+ clk_enable(vt8500->clk);
+
c = clk_get_rate(vt8500->clk);
c = c * period_ns;
do_div(c, 1000000000);
@@ -75,8 +77,10 @@ static int vt8500_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
if (pv > 4095)
pv = 4095;
- if (prescale > 1023)
+ if (prescale > 1023) {
+ clk_disable(vt8500->clk);
return -EINVAL;
+ }
c = (unsigned long long)pv * duty_ns;
do_div(c, period_ns);
@@ -91,6 +95,7 @@ static int vt8500_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
pwm_busy_wait(vt8500->base + 0x40 + pwm->hwpwm, (1 << 3));
writel(dc, vt8500->base + 0xc + (pwm->hwpwm << 4));
+ clk_disable(vt8500->clk);
return 0;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 1/2] Fix build error in pwm-vt8500.c
2012-11-19 2:06 ` [PATCH 1/2] Fix build error in pwm-vt8500.c Tony Prisk
@ 2012-11-19 6:51 ` Thierry Reding
2012-11-19 9:29 ` Russell King - ARM Linux
1 sibling, 0 replies; 7+ messages in thread
From: Thierry Reding @ 2012-11-19 6:51 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Nov 19, 2012 at 03:06:19PM +1300, Tony Prisk wrote:
> A missing '{' causes a build error in pwm-vt8500.c
Great, how embarrassing. You've just uncovered a typo in my automated
build test setup. =)
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121119/d8fdd974/attachment-0001.sig>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] pwm: vt8500: Ensure pwm clock is enabled during pwm_config
2012-11-19 2:06 ` [PATCH 2/2] pwm: vt8500: Ensure pwm clock is enabled during pwm_config Tony Prisk
@ 2012-11-19 6:53 ` Thierry Reding
0 siblings, 0 replies; 7+ messages in thread
From: Thierry Reding @ 2012-11-19 6:53 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Nov 19, 2012 at 03:06:20PM +1300, Tony Prisk wrote:
> When all PWMs are disabled, PWM module may be disabled during
> calls to pwm_config. This patch enables/disables the clock in
> pwm_config to ensure the module is active before register read/
> writes.
>
> Signed-off-by: Tony Prisk <linux@prisktech.co.nz>
> ---
> drivers/pwm/pwm-vt8500.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pwm/pwm-vt8500.c b/drivers/pwm/pwm-vt8500.c
> index 806f72c..cc97af9 100644
> --- a/drivers/pwm/pwm-vt8500.c
> +++ b/drivers/pwm/pwm-vt8500.c
> @@ -63,6 +63,8 @@ static int vt8500_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
> unsigned long long c;
> unsigned long period_cycles, prescale, pv, dc;
>
> + clk_enable(vt8500->clk);
This needs a check of the return value. Other than that, looks good.
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121119/5159c5ec/attachment.sig>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] Fix build error in pwm-vt8500.c
2012-11-19 2:06 ` [PATCH 1/2] Fix build error in pwm-vt8500.c Tony Prisk
2012-11-19 6:51 ` Thierry Reding
@ 2012-11-19 9:29 ` Russell King - ARM Linux
2012-11-19 13:03 ` Thierry Reding
1 sibling, 1 reply; 7+ messages in thread
From: Russell King - ARM Linux @ 2012-11-19 9:29 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Nov 19, 2012 at 03:06:19PM +1300, Tony Prisk wrote:
> A missing '{' causes a build error in pwm-vt8500.c
>
> Signed-off-by: Tony Prisk <linux@prisktech.co.nz>
> ---
> drivers/pwm/pwm-vt8500.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pwm/pwm-vt8500.c b/drivers/pwm/pwm-vt8500.c
> index 970b0c6..806f72c 100644
> --- a/drivers/pwm/pwm-vt8500.c
> +++ b/drivers/pwm/pwm-vt8500.c
> @@ -100,7 +100,7 @@ static int vt8500_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
> struct vt8500_chip *vt8500 = to_vt8500_chip(chip);
>
> err = clk_enable(vt8500->clk);
> - if (err < 0)
> + if (err < 0) {
> dev_err(chip->dev, "failed to enable clock\n");
> return err;
> };
Why does this closing brace have a semicolon after it?
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] Fix build error in pwm-vt8500.c
2012-11-19 9:29 ` Russell King - ARM Linux
@ 2012-11-19 13:03 ` Thierry Reding
0 siblings, 0 replies; 7+ messages in thread
From: Thierry Reding @ 2012-11-19 13:03 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Nov 19, 2012 at 09:29:26AM +0000, Russell King - ARM Linux wrote:
> On Mon, Nov 19, 2012 at 03:06:19PM +1300, Tony Prisk wrote:
> > A missing '{' causes a build error in pwm-vt8500.c
> >
> > Signed-off-by: Tony Prisk <linux@prisktech.co.nz>
> > ---
> > drivers/pwm/pwm-vt8500.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/pwm/pwm-vt8500.c b/drivers/pwm/pwm-vt8500.c
> > index 970b0c6..806f72c 100644
> > --- a/drivers/pwm/pwm-vt8500.c
> > +++ b/drivers/pwm/pwm-vt8500.c
> > @@ -100,7 +100,7 @@ static int vt8500_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
> > struct vt8500_chip *vt8500 = to_vt8500_chip(chip);
> >
> > err = clk_enable(vt8500->clk);
> > - if (err < 0)
> > + if (err < 0) {
> > dev_err(chip->dev, "failed to enable clock\n");
> > return err;
> > };
>
> Why does this closing brace have a semicolon after it?
Tony,
can you remove the gratuitous semicolon while at it, please?
Thanks for spotting it Russell.
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121119/65466348/attachment.sig>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-11-19 13:03 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-19 2:06 [PATCH 0/2] pwm fixes for 3.8 Tony Prisk
2012-11-19 2:06 ` [PATCH 1/2] Fix build error in pwm-vt8500.c Tony Prisk
2012-11-19 6:51 ` Thierry Reding
2012-11-19 9:29 ` Russell King - ARM Linux
2012-11-19 13:03 ` Thierry Reding
2012-11-19 2:06 ` [PATCH 2/2] pwm: vt8500: Ensure pwm clock is enabled during pwm_config Tony Prisk
2012-11-19 6:53 ` 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).