[Intel-gfx] [PATCH v2 10/15] pwm: crc: Implement apply() method to support the new atomic PWM API
Andy Shevchenko
andriy.shevchenko at linux.intel.com
Tue Jun 9 11:32:20 UTC 2020
On Sun, Jun 07, 2020 at 08:18:35PM +0200, Hans de Goede wrote:
> Replace the enable, disable and config pwm_ops with an apply op,
> to support the new atomic PWM API.
...
> -static int crc_pwm_calc_clk_div(int period_ns)
> +static int crc_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
> + const struct pwm_state *state)
> {
> - int clk_div;
> -
> - clk_div = PWM_BASE_CLK_MHZ * period_ns / (256 * NSEC_PER_MHZ);
> - /* clk_div 1 - 128, maps to register values 0-127 */
> - if (clk_div > 0)
> - clk_div--;
> -
> - return clk_div;
> -}
...
> + clk_div = PWM_BASE_CLK_MHZ * state->period /
> + (256 * NSEC_PER_MHZ);
> + /* clk_div 1 - 128, maps to register values 0-127 */
> + if (clk_div > 0)
> + clk_div--;
And again... :-(
--
With Best Regards,
Andy Shevchenko
More information about the Intel-gfx
mailing list