summaryrefslogtreecommitdiff
path: root/drivers/pwm/sandbox_pwm.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2021-04-11 07:40:25 -0400
committerTom Rini <trini@konsulko.com>2021-04-11 07:40:25 -0400
commitc6a4ee2aaee541c12d290dd25561e771396817cc (patch)
treedcc1c02b7c2dd1b6834c29317e16eab747558da0 /drivers/pwm/sandbox_pwm.c
parent59e84da0b88e4465f15d196bba59f22c906fa50d (diff)
parent38e18d6392fca9f6809cb3079af3069efc3d181f (diff)
Merge tag 'video-2021-07-rc1' of https://source.denx.de/u-boot/custodians/u-boot-video
- rk3399 eDP support - pwm backlight without a known period_ns - add Chrome OS EC PWM driver - Kconfig SIMPLE_PANEL DM_GPIO dependency - remove mb862xx driver remnants - fix KiB format in reserve_video() debug trace - fix tegra124 sor CSTM LVDS_EN_ENABLE/DISABLE config - fix line padding calculation for 16 and 24 BPP bitmaps
Diffstat (limited to 'drivers/pwm/sandbox_pwm.c')
-rw-r--r--drivers/pwm/sandbox_pwm.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/pwm/sandbox_pwm.c b/drivers/pwm/sandbox_pwm.c
index 318dce7c149..4df15f0a2e8 100644
--- a/drivers/pwm/sandbox_pwm.c
+++ b/drivers/pwm/sandbox_pwm.c
@@ -59,8 +59,15 @@ static int sandbox_pwm_set_config(struct udevice *dev, uint channel,
if (channel >= NUM_CHANNELS)
return -ENOSPC;
chan = &priv->chan[channel];
- chan->period_ns = period_ns;
- chan->duty_ns = duty_ns;
+
+ if (channel == 2) {
+ /* Pretend to have some fixed period */
+ chan->period_ns = 4096;
+ chan->duty_ns = duty_ns * 4096 / period_ns;
+ } else {
+ chan->period_ns = period_ns;
+ chan->duty_ns = duty_ns;
+ }
return 0;
}