Skip to content

Commit b1528e8

Browse files
LeoCX-Tsaiquinchou77
authored andcommitted
fwk: main: fix keyboard backlight auto will flash when bootup
when shutdown will write auto_value(99) to bbram so if bootup run board_kblight_init will set 99 to kbbl BRANCH=fwk-main BUG=when bootup kbbl will flash once then off TEST=on lilac, change to auto kbbl(fn+space), than shutdown unit and bootup check when bootup kbbl still keep off. TEST=on lilac, change to auto kbbl(fn+space), cover als sensor then shutdown unit and bootup, make sure kbbl will not flash and after 2sec light up Signed-off-by: LeoCX_Tsai <[email protected]> (cherry picked from commit ab98421f8a339868b6789cce74fab5c7faab6910)
1 parent c280451 commit b1528e8

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

zephyr/program/framework/include/led.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ enum backlight_brightness {
5959
KEYBOARD_BL_BRIGHTNESS_MED_LOW = 50,
6060
KEYBOARD_BL_BRIGHTNESS_MED = 75,
6161
KEYBOARD_BL_BRIGHTNESS_HIGH = 100,
62-
KEYBOARD_BL_BRIGHTNESS_AUTO = 99,
62+
/* Out of range of valid values. kblight_set will ignore it, but we can detect that auto brightness is enabled */
63+
KEYBOARD_BL_BRIGHTNESS_AUTO = 101,
6364
};
6465

6566
/* EC_LED_COLOR maps to LED_COLOR - 1 */

zephyr/program/framework/src/keyboard_customization_13.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ void board_kblight_init(void)
154154

155155
if (system_get_bbram(SYSTEM_BBRAM_IDX_KBSTATE, &current_kblight) == EC_SUCCESS) {
156156
kblight_set(current_kblight & 0x7F);
157-
if (kblight_get() == KEYBOARD_BL_BRIGHTNESS_AUTO)
157+
if (current_kblight == KEYBOARD_BL_BRIGHTNESS_AUTO)
158158
kb_als_auto_brightness = true;
159159
}
160160
}

zephyr/program/framework/src/led.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ static int als_lux_get(void)
178178
als_init_deadline.val = now.val;
179179
if (als_stable) {
180180
als_stable = false;
181-
real_illuminance = 0;
181+
real_illuminance = 10;
182182
/* clear als data and set default level for next time bootup */
183183
*(uint16_t *)host_get_memmap(EC_MEMMAP_ALS) = 0;
184184
system_set_bbram(SYSTEM_BBRAM_IDX_FP_LED_LEVEL, FP_LED_HIGH);
@@ -228,7 +228,8 @@ void auto_als_led_brightness(void)
228228
#ifdef CONFIG_PLATFORM_EC_KEYBOARD
229229
int kb_brightness;
230230

231-
if (kbbl_auto_dim_is_enable()) {
231+
if (kbbl_auto_dim_is_enable() &&
232+
chipset_in_state(CHIPSET_STATE_ON)) {
232233
last_kbbl_led_brightness = kblight_get();
233234

234235
if (als_lux > 5)

0 commit comments

Comments
 (0)