Re: [PATCH v5 2/2] Add PWM fan controller driver for LGM SoC

From: Uwe Kleine-KÃnig
Date: Mon Jul 27 2020 - 16:00:54 EST


Hello,

On Mon, Jul 27, 2020 at 03:30:16PM +0800, Tanwar, Rahul wrote:
> On 27/7/2020 3:01 pm, Uwe Kleine-König wrote:
> > In v4 you had:
> >
> > if (state->polarity != PWM_POLARITY_NORMAL ||
> > state->period < pc->period)
> > return -EINVAL;
> >
> > That's the right thing to do (even though I was unsettled at one point
> > and wrote it was wrong). The check in v5 with state->period !=
> > pc->period is wrong.
>
> Does that mean we should allow state->period >= pc->period cases?

Yes, the driver is supposed to implement the longest period not longer
than the requested one. This implies everything >= pc->period is fine.

> If the state->period is greater than HW supported pc->period and
> if we allow it then the duty cycle will again be evaluated to be
> incorrect/higher than requested duty cycle. Am i missing something
> else? Thanks.

Yes, similar as with period you're supposed to implement the longest
duty cycle your hardware supports and that is not longer than the
requested duty cycle.

Best regards
Uwe

--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |

Attachment: signature.asc
Description: PGP signature