Re: [PATCH 0/5] Tegra264 PWM support

From: Mikko Perttunen

Date: Tue Mar 24 2026 - 19:56:35 EST


On Wednesday, March 25, 2026 1:45 AM Uwe Kleine-König wrote:
> Hello Mikko,
>
> On Mon, Mar 23, 2026 at 11:36:36AM +0900, Mikko Perttunen wrote:
> > this adds support for the PWM controller on Tegra264. The controller
> > is similar to previous generations, but the register fields are
> > widened, the depth is made configurable, and the enable bit moves
> > to a different spot.
>
> looking at the driver it would be great if you could provide a
> get_state() callback (or even convert to the waveform callbacks) and
> fix:
>
> static int tegra_pwm_config(struct pwm_chip *chip, struct pwm_device
*pwm,
> int duty_ns, int period_ns)
> {
> ...
> }
>
> static int tegra_pwm_apply(struct pwm_chip *chip, struct pwm_device
*pwm,
> const struct pwm_state *state)
> {
> ...
> err = tegra_pwm_config(chip, pwm, state->duty_cycle, state-
>period);
> ...
> }
>
> where state->duty_cycle and state->period are u64 and thus big values
> are not passed correctly to tegra_pwm_config().
>
> The former helps a lot for testing the driver, and the latter for fixing
> the fallout that you then will probably notice :-)

I agree, there are certainly some improvements to be done here. I was planning
to do some refactoring as part of the followup (adding support for the
configurable depth value), so if you're OK with it I'll fix those then. For
now this basic support is needed to make it possible to keep the board with
its fan/jet engine in the same room.. :)

FWIW, I'm also considering adding some KUnit tests for the duty/scale/depth
configuration. Please let me know if you have any thoughts on that.

Thank you
Mikko

>
> Best regards
> Uwe