lkml.org 
[lkml]   [2023]   [Mar]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v7 2/5] pwm: Add Apple PWM controller
Hello,

On Sat, Jan 14, 2023 at 04:25:05PM +0300, Sasha Finkelstein wrote:
> +static int apple_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
> + const struct pwm_state *state)
> +{
> + struct apple_pwm *fpwm;
> +
> + if (state->polarity == PWM_POLARITY_INVERSED)
> + return -EINVAL;
> +
> + fpwm = to_apple_pwm(chip);
> + if (state->enabled) {
> + u64 on_cycles, off_cycles;
> +
> + on_cycles = mul_u64_u64_div_u64(fpwm->clkrate,
> + state->duty_cycle, NSEC_PER_SEC);
> + if (on_cycles > 0xFFFFFFFF)
> + return -ERANGE;

The idea is to configure the biggest duty_cycle that is not bigger than
the requested duty_cycle. So don't return an error here, but use
0xffffffff instead.

I should have catched that in my v4 and my v6 review, sorry, I missed
that.

Best regards
Uwe

--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2023-03-27 00:53    [W:0.087 / U:0.416 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site