Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1654293
| From | Chen-Yu Tsai <wens@csie.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2 1/3] pwm: sun4i: improve hardware read out |
| Date | 2017-05-31 16:20 +0200 |
| Message-ID | <tNcDD-5Wy-5@gated-at.bofh.it> (permalink) |
| References | <tMV9M-30M-7@gated-at.bofh.it> <tMV9M-30M-15@gated-at.bofh.it> <tN2Ei-7OZ-9@gated-at.bofh.it> <tN6oy-1N5-17@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, May 31, 2017 at 3:35 PM, Alexandre Belloni
<alexandre.belloni@free-electrons.com> wrote:
> On 31/05/2017 at 11:34:43 +0800, Chen-Yu Tsai wrote:
>> On Wed, May 31, 2017 at 3:32 AM, Alexandre Belloni
>> <alexandre.belloni@free-electrons.com> wrote:
>> > +static void sun4i_pwm_get_state(struct pwm_chip *chip,
>> > + struct pwm_device *pwm,
>> > + struct pwm_state *state)
>> > +{
>> > + struct sun4i_pwm_chip *sun4i_pwm = to_sun4i_pwm_chip(chip);
>> > + u64 clk_rate, tmp;
>> > + u32 val;
>> > + unsigned int prescaler;
>> > +
>> > + clk_rate = clk_get_rate(sun4i_pwm->clk);
>> > +
>> > + val = sun4i_pwm_readl(sun4i_pwm, PWM_CTRL_REG);
>> > +
>> > + if ((val == PWM_PRESCAL_MASK) && sun4i_pwm->data->has_prescaler_bypass)
>> > + prescaler = 1;
>> > + else
>> > + prescaler = prescaler_table[PWM_REG_PRESCAL(val, pwm->hwpwm)];
>> > +
>> > + if (prescaler == 0)
>> > + return;
>>
>> This looks like an invalid state. How does the PWM core handle it?
>> Or rather, how does the driver signal an invalid state?
>>
>
> It doesn't and it doesn't really matter, if the IP is in an invalid
> state, this bails out without modifying the know state so the core will
> behave as if there was no hardware read out and everything will be
> synchronized on the first ->apply() call.
Cool.
Thanks
ChenYu
>
>> Otherwise,
>>
>> Reviewed-by: Chen-Yu Tsai <wens@csie.org>
>>
>
> --
> Alexandre Belloni, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v2 1/3] pwm: sun4i: improve hardware read out Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2017-05-30 21:40 +0200
Re: [PATCH v2 1/3] pwm: sun4i: improve hardware read out Chen-Yu Tsai <wens@csie.org> - 2017-05-31 05:40 +0200
Re: [PATCH v2 1/3] pwm: sun4i: improve hardware read out Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2017-05-31 09:40 +0200
Re: [PATCH v2 1/3] pwm: sun4i: improve hardware read out Chen-Yu Tsai <wens@csie.org> - 2017-05-31 16:20 +0200
csiph-web