]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
pwm: tegra: fix pulse_width calculation
authorJonas Schwöbel <jonasschwoebel@yahoo.de>
Tue, 11 Mar 2025 22:11:47 +0000 (23:11 +0100)
committerSvyatoslav Ryhel <clamor95@gmail.com>
Sun, 22 Mar 2026 12:43:26 +0000 (14:43 +0200)
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 <jonasschwoebel@yahoo.de>
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
drivers/pwm/tegra_pwm.c

index 4b57751f73f1718913c24519c8376125b0f915ad..4bbfeba8d986ccc6ef4a812dae5b79486b0e1f76 100644 (file)
@@ -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;