Skip to contentSkip to conversation

backlight: lm3630a: turn off both led strings when display is blank

PATCH Superseded Maximilian Weigand 3 participants 5 messages May 5, 2023 – May 10, 2023

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 backlight: lm3630a: turn off both led strings when display is blank

From: Maximilian Weigand <[email protected]>

Use display_is_blank() to determine if the led strings should be turned off in the update_status() functions of both strings.

---
 drivers/video/backlight/lm3630a_bl.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/video/backlight/lm3630a_bl.c +6 -2
index d8c42acecb5d..5498b57329f9 100644
@@ -202,7 +202,9 @@ static int lm3630a_bank_a_update_status(struct backlight_device *bl)
 	usleep_range(1000, 2000);
 	/* minimum brightness is 0x04 */
 	ret = lm3630a_write(pchip, REG_BRT_A, bl->props.brightness);
-	if (bl->props.brightness < 0x4)
+
+	if (backlight_is_blank(bl) || (bl->props.brightness < 0x4))
+		/* turn the string off  */
 		ret |= lm3630a_update(pchip, REG_CTRL, LM3630A_LEDA_ENABLE, 0);
 	else
 		ret |= lm3630a_update(pchip, REG_CTRL,
@@ -277,7 +279,9 @@ static int lm3630a_bank_b_update_status(struct backlight_device *bl)
 	usleep_range(1000, 2000);
 	/* minimum brightness is 0x04 */
 	ret = lm3630a_write(pchip, REG_BRT_B, bl->props.brightness);
-	if (bl->props.brightness < 0x4)
+
+	if (backlight_is_blank(bl) || (bl->props.brightness < 0x4))
+		/* turn the string off  */
 		ret |= lm3630a_update(pchip, REG_CTRL, LM3630A_LEDB_ENABLE, 0);
 	else
 		ret |= lm3630a_update(pchip, REG_CTRL,

base-commit: 457391b0380335d5e9a5babdec90ac53928b23b4 --
2.39.2

Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Maximilian Weigand

From: Maximilian Weigand <[email protected]>

Use display_is_blank() to determine if the led strings should be turned

Shouldn't this be backlight_is_blank()?

Quoted 1 line

off in the update_status() functions of both strings.

Once the description is fixed this is:

Daniel.

#2 lore raw
Quoted 5 lines
Quoted 3 lines

Use display_is_blank() to determine if the led strings should be turned

Shouldn't this be backlight_is_blank()?

Yes, indeed. Thanks for pointing this out. Fixed in v2.

#3 lore raw
In reply to Maximilian Weigand
Quoted 15 lines · Maximilian Weigand

From: Maximilian Weigand <[email protected]>

Use display_is_blank() to determine if the led strings should be turned off in the update_status() functions of both strings.

---
 drivers/video/backlight/lm3630a_bl.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/video/backlight/lm3630a_bl.c +0 -0
index d8c42acecb5d..5498b57329f9 100644

drivers/video/backlight/lm3630a_bl.c static int lm3630a_bank_a_update_status(struct backlight_device *bl) · line 206

Quoted 6 lines
drivers/video/backlight/lm3630a_bl.c +2 -1
@@ -202,7 +202,9 @@ static int lm3630a_bank_a_update_status(struct backlight_device *bl)
 	usleep_range(1000, 2000);
 	/* minimum brightness is 0x04 */
 	ret = lm3630a_write(pchip, REG_BRT_A, bl->props.brightness);
-	if (bl->props.brightness < 0x4)
+
+	if (backlight_is_blank(bl) || (bl->props.brightness < 0x4))

You could replace bl->props.brightness with backlight_get_brightness(bl) to avoid direct access to the properties.

drivers/video/backlight/lm3630a_bl.c static int lm3630a_bank_b_update_status(struct backlight_device *bl) · line 283

Quoted 11 lines
drivers/video/backlight/lm3630a_bl.c +3 -1
+		/* turn the string off  */
 		ret |= lm3630a_update(pchip, REG_CTRL, LM3630A_LEDA_ENABLE, 0);
 	else
 		ret |= lm3630a_update(pchip, REG_CTRL,
@@ -277,7 +279,9 @@ static int lm3630a_bank_b_update_status(struct backlight_device *bl)
 	usleep_range(1000, 2000);
 	/* minimum brightness is 0x04 */
 	ret = lm3630a_write(pchip, REG_BRT_B, bl->props.brightness);
-	if (bl->props.brightness < 0x4)
+
+	if (backlight_is_blank(bl) || (bl->props.brightness < 0x4))

Same here

Sam

#4 lore raw
Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +1 -0
+	if (backlight_is_blank(bl) || (bl->props.brightness < 0x4))

You could replace bl->props.brightness with backlight_get_brightness(bl) to avoid direct access to the properties.

Thanks. Changed in v2.

Quoted 11 lines

drivers/video/backlight/lm3630a_bl.c static int lm3630a_bank_b_update_status(struct backlight_device *bl) · line 283

Quoted 11 lines
drivers/video/backlight/lm3630a_bl.c +3 -1
+		/* turn the string off  */
 		ret |= lm3630a_update(pchip, REG_CTRL, LM3630A_LEDA_ENABLE, 0);
 	else
 		ret |= lm3630a_update(pchip, REG_CTRL,
@@ -277,7 +279,9 @@ static int lm3630a_bank_b_update_status(struct backlight_device *bl)
 	usleep_range(1000, 2000);
 	/* minimum brightness is 0x04 */
 	ret = lm3630a_write(pchip, REG_BRT_B, bl->props.brightness);
-	if (bl->props.brightness < 0x4)
+
+	if (backlight_is_blank(bl) || (bl->props.brightness < 0x4))

Thanks. Changed in v2.