All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: "Uwe Kleine-König" <uwe@kleine-koenig.org>
Cc: linux-pwm@vger.kernel.org,
	Ludovic Desroches <ludovic.desroches@microchip.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Claudiu Beznea <claudiu.beznea@microchip.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 4/3] pwm: atmel: document known weaknesses of both hardware and software
Date: Fri, 16 Aug 2019 22:43:57 +0200	[thread overview]
Message-ID: <20190816204357.GG3545@piout.net> (raw)
In-Reply-To: <20190816093748.11769-1-uwe@kleine-koenig.org>

On 16/08/2019 11:37:48+0200, Uwe Kleine-König wrote:
> Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
> ---
>  drivers/pwm/pwm-atmel.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/pwm/pwm-atmel.c b/drivers/pwm/pwm-atmel.c
> index 42fe7bc043a8..1ddb93db9627 100644
> --- a/drivers/pwm/pwm-atmel.c
> +++ b/drivers/pwm/pwm-atmel.c
> @@ -7,6 +7,16 @@
>   *
>   * Reference manual for "atmel,at91sam9rl-pwm":
>   *   http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-11032-32-bit-ARM926EJ-S-Microcontroller-SAM9G25_Datasheet.pdf
> + *
> + * Limitations:
> + * - Periods start with the inactive level.
> + * - Hardware has to be stopped in general to update settings.
> + *
> + * Software bugs/possible improvements:
> + * - When atmel_pwm_apply() is called with state->enabled=false a change in
> + *   state->polarity isn't honored.
> + * - Instead of sleeping to wait for a completed period, the interrupt
> + *   functionality could be used.

This is definitively not trivial to do right. The main reason it is not
done so is that reading PWM_ISR will clear all the bits so it is
necessary to be very careful to avoid race conditions. I'm not sure it
is worth the effort.


-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

WARNING: multiple messages have this Message-ID (diff)
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: "Uwe Kleine-König" <uwe@kleine-koenig.org>
Cc: linux-pwm@vger.kernel.org,
	Ludovic Desroches <ludovic.desroches@microchip.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Claudiu Beznea <claudiu.beznea@microchip.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 4/3] pwm: atmel: document known weaknesses of both hardware and software
Date: Fri, 16 Aug 2019 22:43:57 +0200	[thread overview]
Message-ID: <20190816204357.GG3545@piout.net> (raw)
In-Reply-To: <20190816093748.11769-1-uwe@kleine-koenig.org>

On 16/08/2019 11:37:48+0200, Uwe Kleine-König wrote:
> Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
> ---
>  drivers/pwm/pwm-atmel.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/pwm/pwm-atmel.c b/drivers/pwm/pwm-atmel.c
> index 42fe7bc043a8..1ddb93db9627 100644
> --- a/drivers/pwm/pwm-atmel.c
> +++ b/drivers/pwm/pwm-atmel.c
> @@ -7,6 +7,16 @@
>   *
>   * Reference manual for "atmel,at91sam9rl-pwm":
>   *   http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-11032-32-bit-ARM926EJ-S-Microcontroller-SAM9G25_Datasheet.pdf
> + *
> + * Limitations:
> + * - Periods start with the inactive level.
> + * - Hardware has to be stopped in general to update settings.
> + *
> + * Software bugs/possible improvements:
> + * - When atmel_pwm_apply() is called with state->enabled=false a change in
> + *   state->polarity isn't honored.
> + * - Instead of sleeping to wait for a completed period, the interrupt
> + *   functionality could be used.

This is definitively not trivial to do right. The main reason it is not
done so is that reading PWM_ISR will clear all the bits so it is
necessary to be very careful to avoid race conditions. I'm not sure it
is worth the effort.


-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-08-16 20:43 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-15 21:41 [PATCH 1/3] pwm: atmel: Add link to reference manual Uwe Kleine-König
2019-08-15 21:41 ` [PATCH 2/3] pwm: atmel: use a constant for maximum prescale value Uwe Kleine-König
2019-08-19  9:27   ` Claudiu.Beznea
2019-08-19  9:27     ` Claudiu.Beznea
2019-08-15 21:41 ` [PATCH 3/3] pwm: atmel: replace loop in prescale calculation by ad-hoc calculation Uwe Kleine-König
2019-08-19  9:27   ` Claudiu.Beznea
2019-08-19  9:27     ` Claudiu.Beznea
2019-08-16  9:37 ` [PATCH 4/3] pwm: atmel: document known weaknesses of both hardware and software Uwe Kleine-König
2019-08-16 20:43   ` Alexandre Belloni [this message]
2019-08-16 20:43     ` Alexandre Belloni
2019-08-19  8:10     ` Uwe Kleine-König
2019-08-19  9:26   ` Claudiu.Beznea
2019-08-19  9:26     ` Claudiu.Beznea
2019-08-19 10:46     ` Uwe Kleine-König
2019-08-19 10:46       ` Uwe Kleine-König
2019-08-19 12:28       ` Claudiu.Beznea
2019-08-19 12:28         ` Claudiu.Beznea
2019-08-19 15:20         ` Uwe Kleine-König
2019-08-19 15:20           ` Uwe Kleine-König
2019-08-19  9:26 ` [PATCH 1/3] pwm: atmel: Add link to reference manual Claudiu.Beznea
2019-08-19  9:26   ` Claudiu.Beznea
2019-08-19  9:46   ` Nicolas.Ferre
2019-08-19  9:46     ` Nicolas.Ferre

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=20190816204357.GG3545@piout.net \
    --to=alexandre.belloni@bootlin.com \
    --cc=claudiu.beznea@microchip.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=ludovic.desroches@microchip.com \
    --cc=thierry.reding@gmail.com \
    --cc=uwe@kleine-koenig.org \
    /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.