Skip to content

Commit 530f66c

Browse files
Josh-Tsaiamstan
authored andcommitted
fwk: dogwood: LED2 should blinking if the 12V is not connected
We missed following up on the UI ERS x6 to change the LED2 behavior. EC should blink the LED2 during startup the system if 12V is not connected. BRANCH=fwk-dogwood-27111 BUG=https://app.clickup.com/t/86ettgaw5 TEST=check the LED2 is blinking if 12V is not connected during startup the system and turn off the LED2 after turning off the PSU and shutdown to G3. Signed-off-by: Josh Tsai <Josh_Tsai@compal.com>
1 parent ffcc99a commit 530f66c

1 file changed

Lines changed: 23 additions & 3 deletions

File tree

zephyr/program/framework/dogwood/src/power_sequence.c

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,17 @@ bool power_5vsb_exit(void)
382382
return true;
383383
}
384384

385+
void power_led2_blinking(void);
386+
DECLARE_DEFERRED(power_led2_blinking);
387+
void power_led2_blinking(void)
388+
{
389+
static int tick;
390+
391+
/* blink LED2 with 2 Hz */
392+
gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_led2_drv), !!(tick++ % 2));
393+
hook_call_deferred(&power_led2_blinking_data, 500 * MSEC);
394+
}
395+
385396
static void power_check_12vb_apu(void)
386397
{
387398
int voltage = ina2xx_get_voltage(0); /* Unit: mV */
@@ -391,10 +402,19 @@ static void power_check_12vb_apu(void)
391402
* EC read the ina236 bus voltage register to monitor the
392403
* 12VB_APU is present or not to control the debug led2.
393404
*/
394-
if (voltage < 5000 || psu_is_off) {
395-
set_diagnostic(DIAGNOSTICS_12V_OK, 1);
396-
gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_led2_drv), 0);
405+
if (voltage < 5000) {
406+
407+
if (psu_is_off) {
408+
/* Strat blinking the LED2 (G3) */
409+
hook_call_deferred(&power_led2_blinking_data, -1);
410+
gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_led2_drv), 0);
411+
} else {
412+
/* Strat blinking the LED2 (S0 but 12V is not detected) */
413+
power_led2_blinking();
414+
set_diagnostic(DIAGNOSTICS_12V_OK, 1);
415+
}
397416
} else
417+
/* Turn on the LED2 (S0 and 12V is detected) */
398418
gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_led2_drv), 1);
399419
}
400420

0 commit comments

Comments
 (0)