Re: [PATCH] pwm: tegra: fix doubled output frequency due to divider truncation

Uwe Kleine-König <[email protected]> Tue, 14 Jul 2026 14:08:33 +0200
Newsgroups org.kernel.vger.linux-pwm,org.kernel.vger.linux-kernel,org.kernel.vger.linux-tegra
Message-ID <alYmY0535HVPRNz2@monoceros>
Hello again,

On Tue, Jul 14, 2026 at 11:14:58AM +0200, Uwe Kleine-König wrote:
> The usual behaviour for .apply() is to pick the largest possible period
> not larger than the requested period (and similar for duty_cycle). The
> tegra PWM driver doesn't do that and instead trys to pick a nearest
> match. If you change how the configuration happens, the only acceptable
> way is to migrate to the usual behaviour, still better, convert to the
> waveform callbacks.
> 
> The driver also lacks a .get_state() callback and should not use
> pwm_is_enabled(). Also calling tegra_pwm_config() discards bits from
> state->duty_cycle and state->period if they are bigger than INT_MAX.
> 
> So there are some things to work on in that driver, but don't make the
> clock selection not more complicated as it already is and as is
> necessary.

I started on that, but failed to Cc: you. Please see
https://lore.kernel.org/linux-pwm/[email protected]

Best regards
Uwe
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAABCgAdFiEEP4GsaTp6HlmJrf7Tj4D7WH0S/k4FAmpWJr4ACgkQj4D7WH0S
/k7FhQf/asLvaUiHOopjiDbi9CHLkv3NquzJwY4hRuPuXYi97Fs2iz/b+6F3UjwB
dPtkhMrrcEqdOJLq3uMeboDwO8Pl8YxfXvDzkKcawlGnHVEU3okDqTObSRDsnws/
52OMgQDOk+NyuZIt8NoptSSm8H8fxI01BYcAtKLHZB7RayEG8ln/rioGme3+zEXu
fZrFzECYtEZV3aaiNU9eKahXpOEfJXnQtMKK9MsZ1H78S2pQfiC5kEEsbQbhIiXx
mNQWtJxFgkzw7a1wBSOBSW9Lmi9M4dixG1Spie13A2hMHlJsVS2bXbsNbBxC41Zp
y22N2oiJ7O2OotQDa5vXmYxtZgyLgg==
=jVt5
-----END PGP SIGNATURE-----