All of lore.kernel.org
 help / color / mirror / Atom feed
From: linux@prisktech.co.nz (Tony Prisk)
To: linux-arm-kernel@lists.infradead.org
Subject: clock_enable mismatches in pwm-backlight/pwm_enable
Date: Fri, 14 Dec 2012 08:50:33 +1300	[thread overview]
Message-ID: <1355428233.2159.15.camel@gitbox> (raw)

Hi Thierry,

This works out quite well with you looking after pwm and pwm-backlight.

I noticed while troubleshooting pwm on arch-vt8500 last night that the
clk_enable count was getting huge for no obvious reason, and I narrowed
it down to the pwm-backlight driver.

in pwm-bl.c::pwm_backlight_update_status()

if (brightness == 0) {
		pwm_config(pb->pwm, 0, pb->period);
		pwm_disable(pb->pwm);
	} else {
		...
		pwm_config(pb->pwm, duty_cycle, pb->period);
		pwm_enable(pb->pwm);
	}

Which looks fine on its own, except that in pwm_enable() it's not
uncommon to have clk_<prepare_>enable calls.

What happens is everytime the backlight level is changed to anything
except 0, pwm_enable() is called, which calls clk_enable() and the
counter goes up. Only when brightness=0 does pwm_disable() get called
and the accompanying clk_disable().

If you change brightness 3-4 times, then set brightness=0, the clock is
enable 3-4 times, but only disabled 1.

At first I thought it was my bad, but it seems Tegra and IMX suffer from
this problem as well - they both do clk_ calls in pwm_enable - which
doesn't seem unreasonable.

Any thoughts on how this could be rectified?

Regards
Tony Prisk

PS: I have cc: Stephen for Tegra and Sascha for IMX as I don't know who
looks after pwm on those systems.

             reply	other threads:[~2012-12-13 19:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-13 19:50 Tony Prisk [this message]
2012-12-14  6:48 ` clock_enable mismatches in pwm-backlight/pwm_enable Thierry Reding

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=1355428233.2159.15.camel@gitbox \
    --to=linux@prisktech.co.nz \
    --cc=linux-arm-kernel@lists.infradead.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.