All of lore.kernel.org
 help / color / mirror / Atom feed
From: Doug Brown <doug@schmorgal.com>
To: "Thierry Reding" <thierry.reding@gmail.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: linux-pwm@vger.kernel.org, Doug Brown <doug@schmorgal.com>
Subject: [PATCH v2 0/5] pwm: pxa: Fixes for enable/disable transitions
Date: Sun,  2 Oct 2022 18:55:41 -0700	[thread overview]
Message-ID: <20221003015546.202308-1-doug@schmorgal.com> (raw)

I ran into a couple of problems while getting this driver working on the
PXA168. It wouldn't always activate properly when I turned it on, and it
wouldn't always deactivate properly when I turned it off. These patches
fix issues with the clock enable/disable transitions.

With these patches applied, the driver works flawlessly with my use
cases on the PXA168. I don't have any other PXAxxx devices to test with.

Changes since v1:

- Remove pxa_pwm_enable and pxa_pwm_disable.
- Reorganize pxa_pwm_apply based on Uwe's suggestions.
- Enable this driver with ARCH_MMP for the PXA168.
- Add delay after clock is disabled (and inhibit brief on/off blips).

After applying the first round of suggested fixes, I discovered (while
using it as a PWM backlight) that I was once again being affected by the
"too quick" on->off->on transitions, which resulted in silent failure.
Hopefully this isn't too crazy, but I fixed it by adding a delay to
allow the last period to finish after the clock is requested to be
disabled. When you turn the clock off, it stays latched on until the
period finishes (because PWMCR_SD is not set). If you try to turn it
back on during this time, the request is ignored and it shuts off
anyway. Waiting a full period before attempting to start the clock again
avoids the problem.

I also inhibited register setup if PWM is already disabled and staying
disabled in an attempt to avoid unnecessary brief on/off "blips".

Doug Brown (5):
  pwm: pxa: Remove pxa_pwm_enable/disable
  pwm: pxa: Set duty cycle to 0 when disabling PWM
  pwm: pxa: Remove clk enable/disable from pxa_pwm_config
  pwm: pxa: Wait for final PWM period to finish
  pwm: pxa: Enable for MMP platform

 drivers/pwm/Kconfig   |  2 +-
 drivers/pwm/pwm-pxa.c | 64 ++++++++++++++++++++++---------------------
 2 files changed, 34 insertions(+), 32 deletions(-)

-- 
2.34.1


             reply	other threads:[~2022-10-03  1:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-03  1:55 Doug Brown [this message]
2022-10-03  1:55 ` [PATCH v2 1/5] pwm: pxa: Remove pxa_pwm_enable/disable Doug Brown
2022-10-19  7:30   ` Uwe Kleine-König
2022-10-03  1:55 ` [PATCH v2 2/5] pwm: pxa: Set duty cycle to 0 when disabling PWM Doug Brown
2022-10-19  7:34   ` Uwe Kleine-König
2022-11-13 23:15     ` Doug Brown
2022-10-03  1:55 ` [PATCH v2 3/5] pwm: pxa: Remove clk enable/disable from pxa_pwm_config Doug Brown
2022-10-19  7:35   ` Uwe Kleine-König
2022-10-03  1:55 ` [PATCH v2 4/5] pwm: pxa: Wait for final PWM period to finish Doug Brown
2022-10-19  7:39   ` Uwe Kleine-König
2022-10-22 19:35     ` Doug Brown
2022-11-09  9:26       ` Uwe Kleine-König
2022-11-13 22:29         ` Doug Brown
2022-10-03  1:55 ` [PATCH v2 5/5] pwm: pxa: Enable for MMP platform Doug Brown
2022-10-19  7:40   ` Uwe Kleine-König

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=20221003015546.202308-1-doug@schmorgal.com \
    --to=doug@schmorgal.com \
    --cc=linux-pwm@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /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.