* [PATCH 0/2] pwm: atmel-tcb: config fixes
@ 2013-09-18 15:05 Boris BREZILLON
2013-09-18 15:06 ` [PATCH 1/2] pwm: atmel-tcb: add missing clk source config Boris BREZILLON
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Boris BREZILLON @ 2013-09-18 15:05 UTC (permalink / raw)
To: Thierry Reding; +Cc: linux-pwm, linux-kernel, linux-arm-kernel, Boris BREZILLON
Hello,
This patch series fix 2 bugs regarding the pwm configuration:
- the clock source of the timer channel is never applied
- the maximum time that can be represented when using the slow clock may be
wrong if the tc block provide a 32 bits width counter
Best Regards,
Boris
Boris BREZILLON (2):
pwm: atmel-tcb: add missing clk source config
pwm: atmel-tcb: fix max time computation for slow clk source
drivers/pwm/pwm-atmel-tcb.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 1/2] pwm: atmel-tcb: add missing clk source config
2013-09-18 15:05 [PATCH 0/2] pwm: atmel-tcb: config fixes Boris BREZILLON
@ 2013-09-18 15:06 ` Boris BREZILLON
2013-09-19 7:24 ` Nicolas Ferre
2013-09-18 15:06 ` [PATCH 2/2] pwm: atmel-tcb: fix max time computation for slow clk source Boris BREZILLON
2013-09-19 12:06 ` [PATCH 0/2] pwm: atmel-tcb: config fixes Thierry Reding
2 siblings, 1 reply; 7+ messages in thread
From: Boris BREZILLON @ 2013-09-18 15:06 UTC (permalink / raw)
To: Thierry Reding; +Cc: linux-pwm, linux-kernel, linux-arm-kernel, Boris BREZILLON
Clock source changes are never applied to the CMR register.
This may lead to wrong period/duty cycle configuration.
Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
---
drivers/pwm/pwm-atmel-tcb.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/pwm/pwm-atmel-tcb.c b/drivers/pwm/pwm-atmel-tcb.c
index ba6ce01..0266969 100644
--- a/drivers/pwm/pwm-atmel-tcb.c
+++ b/drivers/pwm/pwm-atmel-tcb.c
@@ -249,6 +249,8 @@ static int atmel_tcb_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
}
}
+ cmr |= (tcbpwm->div & ATMEL_TC_TCCLKS);
+
__raw_writel(cmr, regs + ATMEL_TC_REG(group, CMR));
if (index == 0)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] pwm: atmel-tcb: add missing clk source config
2013-09-18 15:06 ` [PATCH 1/2] pwm: atmel-tcb: add missing clk source config Boris BREZILLON
@ 2013-09-19 7:24 ` Nicolas Ferre
0 siblings, 0 replies; 7+ messages in thread
From: Nicolas Ferre @ 2013-09-19 7:24 UTC (permalink / raw)
To: Boris BREZILLON; +Cc: Thierry Reding, linux-pwm, linux-kernel, linux-arm-kernel
On 18/09/2013 17:06, Boris BREZILLON :
> Clock source changes are never applied to the CMR register.
> This may lead to wrong period/duty cycle configuration.
>
> Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
> drivers/pwm/pwm-atmel-tcb.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/pwm/pwm-atmel-tcb.c b/drivers/pwm/pwm-atmel-tcb.c
> index ba6ce01..0266969 100644
> --- a/drivers/pwm/pwm-atmel-tcb.c
> +++ b/drivers/pwm/pwm-atmel-tcb.c
> @@ -249,6 +249,8 @@ static int atmel_tcb_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm)
> }
> }
>
> + cmr |= (tcbpwm->div & ATMEL_TC_TCCLKS);
> +
> __raw_writel(cmr, regs + ATMEL_TC_REG(group, CMR));
>
> if (index == 0)
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] pwm: atmel-tcb: fix max time computation for slow clk source
2013-09-18 15:05 [PATCH 0/2] pwm: atmel-tcb: config fixes Boris BREZILLON
2013-09-18 15:06 ` [PATCH 1/2] pwm: atmel-tcb: add missing clk source config Boris BREZILLON
@ 2013-09-18 15:06 ` Boris BREZILLON
2013-09-19 7:24 ` Nicolas Ferre
2013-09-19 12:06 ` [PATCH 0/2] pwm: atmel-tcb: config fixes Thierry Reding
2 siblings, 1 reply; 7+ messages in thread
From: Boris BREZILLON @ 2013-09-18 15:06 UTC (permalink / raw)
To: Thierry Reding; +Cc: linux-pwm, linux-kernel, linux-arm-kernel, Boris BREZILLON
Use the the tcb counter width to compute the maximum time that can be
represented using the slow clock source instead of the static 16 bit width.
Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
---
drivers/pwm/pwm-atmel-tcb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pwm/pwm-atmel-tcb.c b/drivers/pwm/pwm-atmel-tcb.c
index 0266969..f3dcd02 100644
--- a/drivers/pwm/pwm-atmel-tcb.c
+++ b/drivers/pwm/pwm-atmel-tcb.c
@@ -307,7 +307,7 @@ static int atmel_tcb_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
i = slowclk;
rate = 32768;
min = div_u64(NSEC_PER_SEC, rate);
- max = min << 16;
+ max = min << tc->tcb_config->counter_width;
/* If period is too big return ERANGE error */
if (max < period_ns)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] pwm: atmel-tcb: fix max time computation for slow clk source
2013-09-18 15:06 ` [PATCH 2/2] pwm: atmel-tcb: fix max time computation for slow clk source Boris BREZILLON
@ 2013-09-19 7:24 ` Nicolas Ferre
0 siblings, 0 replies; 7+ messages in thread
From: Nicolas Ferre @ 2013-09-19 7:24 UTC (permalink / raw)
To: Boris BREZILLON, Thierry Reding; +Cc: linux-pwm, linux-kernel, linux-arm-kernel
On 18/09/2013 17:06, Boris BREZILLON :
> Use the the tcb counter width to compute the maximum time that can be
> represented using the slow clock source instead of the static 16 bit width.
>
> Signed-off-by: Boris BREZILLON <b.brezillon@overkiz.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
> drivers/pwm/pwm-atmel-tcb.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pwm/pwm-atmel-tcb.c b/drivers/pwm/pwm-atmel-tcb.c
> index 0266969..f3dcd02 100644
> --- a/drivers/pwm/pwm-atmel-tcb.c
> +++ b/drivers/pwm/pwm-atmel-tcb.c
> @@ -307,7 +307,7 @@ static int atmel_tcb_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
> i = slowclk;
> rate = 32768;
> min = div_u64(NSEC_PER_SEC, rate);
> - max = min << 16;
> + max = min << tc->tcb_config->counter_width;
>
> /* If period is too big return ERANGE error */
> if (max < period_ns)
>
--
Nicolas Ferre
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] pwm: atmel-tcb: config fixes
2013-09-18 15:05 [PATCH 0/2] pwm: atmel-tcb: config fixes Boris BREZILLON
2013-09-18 15:06 ` [PATCH 1/2] pwm: atmel-tcb: add missing clk source config Boris BREZILLON
2013-09-18 15:06 ` [PATCH 2/2] pwm: atmel-tcb: fix max time computation for slow clk source Boris BREZILLON
@ 2013-09-19 12:06 ` Thierry Reding
2013-09-19 12:11 ` boris brezillon
2 siblings, 1 reply; 7+ messages in thread
From: Thierry Reding @ 2013-09-19 12:06 UTC (permalink / raw)
To: Boris BREZILLON; +Cc: Nicolas Ferre, linux-pwm, linux-kernel, linux-arm-kernel
[-- Attachment #1: Type: text/plain, Size: 676 bytes --]
On Wed, Sep 18, 2013 at 05:05:20PM +0200, Boris BREZILLON wrote:
> Hello,
>
> This patch series fix 2 bugs regarding the pwm configuration:
> - the clock source of the timer channel is never applied
> - the maximum time that can be represented when using the slow clock may be
> wrong if the tc block provide a 32 bits width counter
>
> Best Regards,
>
> Boris
>
> Boris BREZILLON (2):
> pwm: atmel-tcb: add missing clk source config
> pwm: atmel-tcb: fix max time computation for slow clk source
>
> drivers/pwm/pwm-atmel-tcb.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Both applied, with Nicolas' Acked-by.
Thierry
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] pwm: atmel-tcb: config fixes
2013-09-19 12:06 ` [PATCH 0/2] pwm: atmel-tcb: config fixes Thierry Reding
@ 2013-09-19 12:11 ` boris brezillon
0 siblings, 0 replies; 7+ messages in thread
From: boris brezillon @ 2013-09-19 12:11 UTC (permalink / raw)
To: Thierry Reding; +Cc: Nicolas Ferre, linux-pwm, linux-kernel, linux-arm-kernel
On 19/09/2013 14:06, Thierry Reding wrote:
> On Wed, Sep 18, 2013 at 05:05:20PM +0200, Boris BREZILLON wrote:
>> Hello,
>>
>> This patch series fix 2 bugs regarding the pwm configuration:
>> - the clock source of the timer channel is never applied
>> - the maximum time that can be represented when using the slow clock may be
>> wrong if the tc block provide a 32 bits width counter
>>
>> Best Regards,
>>
>> Boris
>>
>> Boris BREZILLON (2):
>> pwm: atmel-tcb: add missing clk source config
>> pwm: atmel-tcb: fix max time computation for slow clk source
>>
>> drivers/pwm/pwm-atmel-tcb.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
> Both applied, with Nicolas' Acked-by.
>
> Thierry
Thanks.
Regards,
Boris
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-09-19 12:11 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-18 15:05 [PATCH 0/2] pwm: atmel-tcb: config fixes Boris BREZILLON
2013-09-18 15:06 ` [PATCH 1/2] pwm: atmel-tcb: add missing clk source config Boris BREZILLON
2013-09-19 7:24 ` Nicolas Ferre
2013-09-18 15:06 ` [PATCH 2/2] pwm: atmel-tcb: fix max time computation for slow clk source Boris BREZILLON
2013-09-19 7:24 ` Nicolas Ferre
2013-09-19 12:06 ` [PATCH 0/2] pwm: atmel-tcb: config fixes Thierry Reding
2013-09-19 12:11 ` boris brezillon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox