Skip to content

Commit ab2d942

Browse files
Josh-Tsaiquinchou77
authored andcommitted
fwk: perform the usbc error recovery with a task event
When the system power on to S0 state, call the task event to perform the usbc error recovery. BRANCH=fwk-main BUG=None TEST=Marigold unit will perform the error recovery during boot-up Signed-off-by: Josh Tsai <Josh_Tsai@compal.com> (cherry picked from commit 75d7420)
1 parent cee943d commit ab2d942

4 files changed

Lines changed: 8 additions & 4 deletions

File tree

zephyr/program/framework/include/cypress_pd_common.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,8 @@ enum pd_task_evt {
297297
CCG_EVT_PDO_C0P1 = BIT(20),
298298
CCG_EVT_PDO_C1P0 = BIT(21),
299299
CCG_EVT_PDO_C1P1 = BIT(22),
300-
CCG_EVT_PDO_RESET = BIT(23),
300+
CCG_EVT_PERFORM_ERROR_RECOVERY = BIT(23),
301+
CCG_EVT_PDO_RESET = BIT(24),
301302
};
302303

303304
/************************************************

zephyr/program/framework/src/cypd_ccg6.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ void update_system_power_state(int controller)
342342
cypd_set_power_state(CCG_POWERSTATE_S0, controller);
343343
/* only execute the error recovery when the system power on */
344344
if (pre_state != CCG_POWERSTATE_S0ix)
345-
perform_error_recovery(controller);
345+
task_set_event(TASK_ID_CYPD, CCG_EVT_PERFORM_ERROR_RECOVERY);
346346
}
347347
pre_state = CCG_POWERSTATE_S0;
348348
break;

zephyr/program/framework/src/cypd_ccg8.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ void update_system_power_state(int controller)
214214
case POWER_S0ixS3: /* S0ix -> S3 */
215215
cypd_set_power_state(CCG_POWERSTATE_S3, controller);
216216
if (pd_prev_power_state < POWER_S3) {
217-
perform_error_recovery(controller);
217+
task_set_event(TASK_ID_CYPD, CCG_EVT_PERFORM_ERROR_RECOVERY);
218218
pd_prev_power_state = ps;
219219
}
220220
break;
@@ -223,7 +223,7 @@ void update_system_power_state(int controller)
223223
case POWER_S0ixS0: /* S0ix -> S0 */
224224
cypd_set_power_state(CCG_POWERSTATE_S0, controller);
225225
if (pd_prev_power_state < POWER_S3) {
226-
perform_error_recovery(controller);
226+
task_set_event(TASK_ID_CYPD, CCG_EVT_PERFORM_ERROR_RECOVERY);
227227
pd_prev_power_state = ps;
228228
}
229229
break;

zephyr/program/framework/src/cypress_pd_common.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1990,6 +1990,9 @@ void cypd_interrupt_handler_task(void *p)
19901990
if (evt & CCG_EVT_UPDATE_PWRSTAT)
19911991
cypd_update_power_status(2);
19921992

1993+
if (evt & CCG_EVT_PERFORM_ERROR_RECOVERY)
1994+
perform_error_recovery(2);
1995+
19931996

19941997
if (evt & (CCG_EVT_INT_CTRL_0 | CCG_EVT_INT_CTRL_1 |
19951998
CCG_EVT_STATE_CTRL_0 | CCG_EVT_STATE_CTRL_1)) {

0 commit comments

Comments
 (0)