[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170531073516.jrpgtu7nlkuizvfx@piout.net>
Date: Wed, 31 May 2017 09:35:16 +0200
From: Alexandre Belloni <alexandre.belloni@...e-electrons.com>
To: Chen-Yu Tsai <wens@...e.org>
Cc: Thierry Reding <thierry.reding@...il.com>,
Olliver Schinagl <o.schinagl@...imaker.com>,
Maxime Ripard <maxime.ripard@...e-electrons.com>,
Boris Brezillon <boris.brezillon@...e-electrons.com>,
Jonathan Liu <net147@...il.com>, linux-pwm@...r.kernel.org,
linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 1/3] pwm: sun4i: improve hardware read out
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@...e-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.
> Otherwise,
>
> Reviewed-by: Chen-Yu Tsai <wens@...e.org>
>
--
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
Powered by blists - more mailing lists