Messages in this thread | ![/](/images/icornerl.gif) | | Date | Fri, 5 Apr 2024 17:14:41 +0200 | From | Uwe Kleine-König <> | Subject | Re: [RFC PATCH 0/3] pwm: add support for duty_offset |
| |
Hello Trevor,
On Fri, Apr 05, 2024 at 10:19:20AM -0400, Trevor Gamblin wrote: > On 2024-04-05 08:23, Uwe Kleine-König wrote: > > Having said that I don't like the addition of .supports_offset to > > struct pwm_chip, which only signals a new incomplete evolution of the > > pwm framework. Better adapt all drivers and then assume all of them > > support it. > Can you clarify what you mean here - is the intent to put basic handling of > duty_offset (even if that means simply setting it to 0) in each driver?
Well, it's a bit more complicated than setting it to 0. It involves translating a setting with inverted polarity to one using .duty_offset and make all drivers implement that accordingly.
For drivers that support both polarities the logic in .apply should be:
if (.duty_offset >= .period - .duty_cycle) ... set inverted polarity else ... set normal polarity
I'm usure how to do the transformation in reviewable chunks. Maybe the easiest option is a new .apply callback that honors .duty_offset?
Best regards Uwe
-- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ | [unhandled content-type:application/pgp-signature] | ![\](/images/icornerr.gif) |