From 45cab0486d2096cd7afc9b76b20e7f93c13543f5 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Tue, 17 Feb 2026 12:39:29 +0000
Subject: [PATCH] regulator/rpi-panel-v2: Disable the PWM when off

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
 drivers/regulator/rpi-panel-v2-regulator.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/drivers/regulator/rpi-panel-v2-regulator.c
+++ b/drivers/regulator/rpi-panel-v2-regulator.c
@@ -48,7 +48,10 @@ static int rpi_panel_v2_pwm_apply(struct
 		return regmap_write(regmap, REG_PWM, 0);
 
 	duty = pwm_get_relative_duty_cycle(state, PWM_BL_MASK);
-	return regmap_write(regmap, REG_PWM, duty | PWM_BL_ENABLE);
+	if (duty)
+		duty |= PWM_BL_ENABLE;
+
+	return regmap_write(regmap, REG_PWM, duty);
 }
 
 static const struct pwm_ops rpi_panel_v2_pwm_ops = {
