Skip to content

Commit 36065b1

Browse files
committed
ensure ports get reset on cold boot
Ports were not getting reset on cold boot because we did not set the G3 flag because the PD task was busy Signed-off-by: Kieran Levin <ktl@frame.work>
1 parent 4e459f7 commit 36065b1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

zephyr/program/lotus/src/cypress_pd_common.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,7 +1238,7 @@ static void perform_error_recovery(int controller)
12381238
battery_get_disconnect_state() != BATTERY_NOT_DISCONNECTED)) {
12391239

12401240
if ((pd_port_states[i].c_state == CCG_STATUS_SOURCE) &&
1241-
(batt_os_percentage < 30) && (i == prev_charge_port))
1241+
(batt_os_percentage < 3) && (i == prev_charge_port))
12421242
continue;
12431243

12441244
CPRINTS("Hard reset %d", i);
@@ -1262,7 +1262,7 @@ static void port_to_safe_mode(int port)
12621262
CPRINTS("P%d: Safe", port);
12631263

12641264
}
1265-
bool apu_not_initialized;
1265+
bool apu_not_initialized = true;
12661266
void update_system_power_state(int controller)
12671267
{
12681268
enum power_state ps = power_get_state();
@@ -1276,7 +1276,6 @@ void update_system_power_state(int controller)
12761276
case POWER_S3S5:
12771277
case POWER_S4S5:
12781278
cypd_set_power_state(CCG_POWERSTATE_S5, controller);
1279-
apu_not_initialized = true;
12801279
break;
12811280
case POWER_S3:
12821281
case POWER_S4S3:
@@ -1310,8 +1309,10 @@ void cypd_set_power_active(void)
13101309
void cypd_port_reset(void)
13111310
{
13121311
if (apu_not_initialized) {
1313-
task_set_event(TASK_ID_CYPD, CCG_EVT_PLT_RESET);
1312+
CPRINTS("PD_PLT_RESET");
1313+
13141314
apu_not_initialized = false;
1315+
task_set_event(TASK_ID_CYPD, CCG_EVT_PLT_RESET);
13151316
}
13161317
}
13171318

@@ -1855,6 +1856,7 @@ void cypd_interrupt_handler_task(void *p)
18551856
cypd_update_power_status(2);
18561857

18571858
if (evt & CCG_EVT_PLT_RESET) {
1859+
CPRINTS("PD Platform reset");
18581860
perform_error_recovery(2);
18591861
}
18601862

0 commit comments

Comments
 (0)