Skip to content

Commit dc0ba74

Browse files
z3ntulag-linaro
authored andcommitted
backlight: lm3630a: Use backlight_get_brightness helper in update_status
As per documentation "drivers are expected to use this function in their update_status() operation to get the brightness value.". With this we can also drop the manual backlight_is_blank() handling since backlight_get_brightness() is already handling this correctly. Signed-off-by: Luca Weiss <[email protected]> Reviewed-by: Daniel Thompson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lee Jones <[email protected]>
1 parent 4bf7ddd commit dc0ba74

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

drivers/video/backlight/lm3630a_bl.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,11 @@ static int lm3630a_bank_a_update_status(struct backlight_device *bl)
189189
int ret;
190190
struct lm3630a_chip *pchip = bl_get_data(bl);
191191
enum lm3630a_pwm_ctrl pwm_ctrl = pchip->pdata->pwm_ctrl;
192+
int brightness = backlight_get_brightness(bl);
192193

193194
/* pwm control */
194195
if ((pwm_ctrl & LM3630A_PWM_BANK_A) != 0)
195-
return lm3630a_pwm_ctrl(pchip, bl->props.brightness,
196+
return lm3630a_pwm_ctrl(pchip, brightness,
196197
bl->props.max_brightness);
197198

198199
/* disable sleep */
@@ -201,9 +202,9 @@ static int lm3630a_bank_a_update_status(struct backlight_device *bl)
201202
goto out_i2c_err;
202203
usleep_range(1000, 2000);
203204
/* minimum brightness is 0x04 */
204-
ret = lm3630a_write(pchip, REG_BRT_A, bl->props.brightness);
205+
ret = lm3630a_write(pchip, REG_BRT_A, brightness);
205206

206-
if (backlight_is_blank(bl) || (backlight_get_brightness(bl) < 0x4))
207+
if (brightness < 0x4)
207208
/* turn the string off */
208209
ret |= lm3630a_update(pchip, REG_CTRL, LM3630A_LEDA_ENABLE, 0);
209210
else
@@ -263,10 +264,11 @@ static int lm3630a_bank_b_update_status(struct backlight_device *bl)
263264
int ret;
264265
struct lm3630a_chip *pchip = bl_get_data(bl);
265266
enum lm3630a_pwm_ctrl pwm_ctrl = pchip->pdata->pwm_ctrl;
267+
int brightness = backlight_get_brightness(bl);
266268

267269
/* pwm control */
268270
if ((pwm_ctrl & LM3630A_PWM_BANK_B) != 0)
269-
return lm3630a_pwm_ctrl(pchip, bl->props.brightness,
271+
return lm3630a_pwm_ctrl(pchip, brightness,
270272
bl->props.max_brightness);
271273

272274
/* disable sleep */
@@ -275,9 +277,9 @@ static int lm3630a_bank_b_update_status(struct backlight_device *bl)
275277
goto out_i2c_err;
276278
usleep_range(1000, 2000);
277279
/* minimum brightness is 0x04 */
278-
ret = lm3630a_write(pchip, REG_BRT_B, bl->props.brightness);
280+
ret = lm3630a_write(pchip, REG_BRT_B, brightness);
279281

280-
if (backlight_is_blank(bl) || (backlight_get_brightness(bl) < 0x4))
282+
if (brightness < 0x4)
281283
/* turn the string off */
282284
ret |= lm3630a_update(pchip, REG_CTRL, LM3630A_LEDB_ENABLE, 0);
283285
else

0 commit comments

Comments
 (0)