Skip to content

Commit 4d6e9cd

Browse files
I-n-o-kLee Jones
authored andcommitted
backlight: qcom-wled: Fix FSC update issue for WLED5
Currently, for WLED5, the FSC (Full scale current) setting is not updated properly due to driver toggling the wrong register after an FSC update. On WLED5 we should only toggle the MOD_SYNC bit after a brightness update. For an FSC update we need to toggle the SYNC bits instead. Fix it by adopting the common wled3_sync_toggle() for WLED5 and introducing new code to the brightness update path to compensate. Signed-off-by: Kiran Gunda <[email protected]> Reviewed-by: Daniel Thompson <[email protected]> Signed-off-by: Lee Jones <[email protected]>
1 parent 4b79ec9 commit 4d6e9cd

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

drivers/video/backlight/qcom-wled.c

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ static int wled3_sync_toggle(struct wled *wled)
348348
return rc;
349349
}
350350

351-
static int wled5_sync_toggle(struct wled *wled)
351+
static int wled5_mod_sync_toggle(struct wled *wled)
352352
{
353353
int rc;
354354
u8 val;
@@ -445,10 +445,23 @@ static int wled_update_status(struct backlight_device *bl)
445445
goto unlock_mutex;
446446
}
447447

448-
rc = wled->wled_sync_toggle(wled);
449-
if (rc < 0) {
450-
dev_err(wled->dev, "wled sync failed rc:%d\n", rc);
451-
goto unlock_mutex;
448+
if (wled->version < 5) {
449+
rc = wled->wled_sync_toggle(wled);
450+
if (rc < 0) {
451+
dev_err(wled->dev, "wled sync failed rc:%d\n", rc);
452+
goto unlock_mutex;
453+
}
454+
} else {
455+
/*
456+
* For WLED5 toggling the MOD_SYNC_BIT updates the
457+
* brightness
458+
*/
459+
rc = wled5_mod_sync_toggle(wled);
460+
if (rc < 0) {
461+
dev_err(wled->dev, "wled mod sync failed rc:%d\n",
462+
rc);
463+
goto unlock_mutex;
464+
}
452465
}
453466
}
454467

@@ -1459,7 +1472,7 @@ static int wled_configure(struct wled *wled)
14591472
size = ARRAY_SIZE(wled5_opts);
14601473
*cfg = wled5_config_defaults;
14611474
wled->wled_set_brightness = wled5_set_brightness;
1462-
wled->wled_sync_toggle = wled5_sync_toggle;
1475+
wled->wled_sync_toggle = wled3_sync_toggle;
14631476
wled->wled_cabc_config = wled5_cabc_config;
14641477
wled->wled_ovp_delay = wled5_ovp_delay;
14651478
wled->wled_auto_detection_required =

0 commit comments

Comments
 (0)