lkml.org 
[lkml]   [2013]   [Apr]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 3/3] pwm: pxa: Remove clk_enabled field from struct pxa_pwm_chip
From
2013/4/1 Eric Miao <eric.y.miao@gmail.com>:
> On Sun, Mar 31, 2013 at 11:04 PM, Axel Lin <axel.lin@ingics.com> wrote:
>> clk_enable/clk_disable maintain an enable_count, clk_prepare and clk_unprepare
>> also maintain a prepare_count. These APIs will do prepare/enable when the first
>> user calling these APIs, and do disable/unprepare when the corresponding counter
>> reach 0. Thus We don't need to maintain a clk_enabled counter here.
>
> The original intention is to keep a paired clk enable counter no matter
> how the user calls pwm_enable()/pwm_disable() in pair or not, if that's
> no longer the case.

We don't need to worry that case:
In pwm core, both pwm_enable() and pwm_disable() will always check
PWMF_ENABLED flag.


/**
* pwm_enable() - start a PWM output toggling
* @pwm: PWM device
*/
int pwm_enable(struct pwm_device *pwm)
{
if (pwm && !test_and_set_bit(PWMF_ENABLED, &pwm->flags))
return pwm->chip->ops->enable(pwm->chip, pwm);

return pwm ? 0 : -EINVAL;
}
EXPORT_SYMBOL_GPL(pwm_enable);

/**
* pwm_disable() - stop a PWM output toggling
* @pwm: PWM device
*/
void pwm_disable(struct pwm_device *pwm)
{
if (pwm && test_and_clear_bit(PWMF_ENABLED, &pwm->flags))
pwm->chip->ops->disable(pwm->chip, pwm);
}
EXPORT_SYMBOL_GPL(pwm_disable);


\
 
 \ /
  Last update: 2013-04-01 10:01    [W:0.292 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site