From: Jonas Schwöbel Date: Tue, 11 Mar 2025 22:11:47 +0000 (+0100) Subject: pwm: tegra: fix pulse_width calculation X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2fcb08a2b477667741f194b8b8a8a08a711dc974;p=thirdparty%2Fu-boot.git pwm: tegra: fix pulse_width calculation The pulse_width is expressed as N/256. A 100% duty cycle is only possible when multiplied by 256 instead of 255. Signed-off-by: Jonas Schwöbel Signed-off-by: Svyatoslav Ryhel --- diff --git a/drivers/pwm/tegra_pwm.c b/drivers/pwm/tegra_pwm.c index 4b57751f73f..4bbfeba8d98 100644 --- a/drivers/pwm/tegra_pwm.c +++ b/drivers/pwm/tegra_pwm.c @@ -40,7 +40,7 @@ static int tegra_pwm_set_config(struct udevice *dev, uint channel, return -EINVAL; debug("%s: Configure '%s' channel %u\n", __func__, dev->name, channel); - pulse_width = duty_ns * 255 / period_ns; + pulse_width = duty_ns * 256 / period_ns; if (priv->polarity & BIT(channel)) pulse_width = 256 - pulse_width;