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 <jonasschwoebel@yahoo.de>
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
This commit is contained in:
Jonas Schwöbel
2025-03-11 23:11:47 +01:00
committed by Svyatoslav Ryhel
parent 0623b8512e
commit 2fcb08a2b4

View 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;