From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
To: Anand Moon <linux.amoon@gmail.com>
Cc: Thierry Reding <thierry.reding@gmail.com>,
linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-samsung-soc@vger.kernel.org
Subject: Re: [PATCH] pwm: Add clk enable/disable for pwm_samsung_enable/pwm_samsung_disable
Date: Wed, 15 Apr 2015 10:34:07 +0200 [thread overview]
Message-ID: <1429086847.22057.159.camel@collabora.co.uk> (raw)
In-Reply-To: <1429034708-4537-1-git-send-email-linux.amoon@gmail.com>
On Wed, 2015-04-15 at 03:35 +0930, Anand Moon wrote:
> diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c
> index 3e9b583..b579753 100644
> --- a/drivers/pwm/pwm-samsung.c
> +++ b/drivers/pwm/pwm-samsung.c
> @@ -247,6 +247,7 @@ static int pwm_samsung_enable(struct pwm_chip *chip, struct pwm_device *pwm)
> tcon &= ~TCON_MANUALUPDATE(tcon_chan);
> tcon |= TCON_START(tcon_chan) | TCON_AUTORELOAD(tcon_chan);
> writel(tcon, our_chip->base + REG_TCON);
> + clk_prepare_enable(our_chip->base_clk);
>
> spin_unlock_irqrestore(&samsung_pwm_lock, flags);
>
> @@ -265,6 +266,7 @@ static void pwm_samsung_disable(struct pwm_chip *chip, struct pwm_device *pwm)
> tcon = readl(our_chip->base + REG_TCON);
> tcon &= ~TCON_AUTORELOAD(tcon_chan);
> writel(tcon, our_chip->base + REG_TCON);
> + clk_disable_unprepare(our_chip->base_clk);
>
> spin_unlock_irqrestore(&samsung_pwm_lock, flags);
> }
As far as i can tell this code doesn't have any effect.
clk_enable is refcounted, so the clock will stay enabled for as long as
the driver is loaded (as it's enabled in _probe). Your code above just
raises and lowers the clocks enabled refcount, but won't actually ever
cause it to be disabled.
With respect to trying to disabling the clocks on pwm_disable, that will
need some more work to ensure the output signal has the expected level
when you turn of the clock. Specifically, when disabling from a non-100%
duty state the driver relies on the PWM turning the output signal low at
the end of a duty cycle. However if you turn off the clock at the start
of a duty cycle while the output signal is still high it will
unexpectedly remain high.
--
Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Collabora Ltd.
next prev parent reply other threads:[~2015-04-15 8:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-14 18:05 [PATCH] pwm: Add clk enable/disable for pwm_samsung_enable/pwm_samsung_disable Anand Moon
2015-04-15 8:34 ` Sjoerd Simons [this message]
2015-04-15 10:17 ` Anand Moon
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=1429086847.22057.159.camel@collabora.co.uk \
--to=sjoerd.simons@collabora.co.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux.amoon@gmail.com \
--cc=thierry.reding@gmail.com \
/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.