drivers/pwm/pwm-tegra.c | 141 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 98 insertions(+), 43 deletions(-)
Hello,
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.
This series adds only basic support with fixed depth -- configurable
depth will come later.
The series uses the nvidia,tegra264-pwm compatible string. Bindings
for this are added in Thierry's series
https://lore.kernel.org/linux-tegra/20260320234056.2579010-1-thierry.reding@kernel.org/
Thanks,
Mikko
---
Mikko Perttunen (4):
pwm: tegra: Modify read/write accessors for multi-register channel
pwm: tegra: Parametrize enable register offset
pwm: tegra: Parametrize duty and scale field widths
pwm: tegra: Add support for Tegra264
Yi-Wei Wang (1):
pwm: tegra: Avoid hard-coded max clock frequency
drivers/pwm/pwm-tegra.c | 141 +++++++++++++++++++++++++++++++++---------------
1 file changed, 98 insertions(+), 43 deletions(-)
---
base-commit: b7cac19bc4780fe1156b217a1c5c96a3e23b275b
change-id: 20260303-t264-pwm-57e10d039df1
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 :-)
Best regards
Uwe
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
On 23/03/2026 03:36, Mikko Perttunen wrote: > Hello, > > 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. > > This series adds only basic support with fixed depth -- configurable > depth will come later. > > The series uses the nvidia,tegra264-pwm compatible string. Bindings > for this are added in Thierry's series > > https://lore.kernel.org/linux-tegra/20260320234056.2579010-1-thierry.reding@kernel.org/ NAK, that's not how you send driver code. Best regards, Krzysztof
On Monday, March 23, 2026 4:24 PM Krzysztof Kozlowski wrote: > On 23/03/2026 03:36, Mikko Perttunen wrote: > > Hello, > > > > 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. > > > > This series adds only basic support with fixed depth -- configurable > > depth will come later. > > > > The series uses the nvidia,tegra264-pwm compatible string. Bindings > > for this are added in Thierry's series > > > > https://lore.kernel.org/linux-tegra/20260320234056.2579010-1-thierry.red > > ing@kernel.org/ > NAK, that's not how you send driver code. > > Best regards, > Krzysztof I will pick up Thierry's patches for subsequent revisions. Mikko
© 2016 - 2026 Red Hat, Inc.