Skip to content

Commit 9b3420f

Browse files
committed
fwk: add a workaound to fix get_alternate_modes error message
Signed-off-by: Josh-Tsai <[email protected]>
1 parent 4644b5f commit 9b3420f

File tree

1 file changed

+15
-2
lines changed
  • zephyr/program/lotus/src

1 file changed

+15
-2
lines changed

zephyr/program/lotus/src/ucsi.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,15 @@ int ucsi_write_tunnel(void)
126126
case UCSI_CMD_GET_ALTERNATE_MODES:
127127
case UCSI_CMD_GET_CURRENT_CAM:
128128

129-
if (*command == UCSI_CMD_GET_ALTERNATE_MODES)
129+
if (*command == UCSI_CMD_GET_ALTERNATE_MODES) {
130+
/**
131+
* Workaround: PD chip cannot process the SOP/SOP'/SOP'' alternate mode
132+
* event, ignore the recipient field.
133+
*/
134+
*host_get_memmap(EC_CUSTOMIZED_MEMMAP_UCSI_CTR_SPECIFIC) =
135+
(*host_get_memmap(EC_CUSTOMIZED_MEMMAP_UCSI_CTR_SPECIFIC) & 0xFC);
130136
offset = 1;
137+
}
131138

132139
/**
133140
* those command will control specific pd port,
@@ -328,8 +335,14 @@ int ucsi_read_tunnel(int controller)
328335
if (!chipset_in_state(CHIPSET_STATE_ON) && !chipset_in_state(CHIPSET_STATE_ANY_OFF))
329336
return EC_SUCCESS;
330337

338+
/**
339+
* 1. Ignore the same CCI indicator without any command
340+
* 2. Ignore the same CCI indicator with busy flags
341+
*/
331342
if (!(memcmp(host_get_memmap(EC_CUSTOMIZED_MEMMAP_UCSI_CONN_CHANGE),
332-
&pd_chip_ucsi_info[controller].cci, 4)))
343+
&pd_chip_ucsi_info[controller].cci, 4)) &&
344+
((*host_get_memmap(EC_CUSTOMIZED_MEMMAP_UCSI_COMMAND) == 0) ||
345+
*(uint32_t *)host_get_memmap(EC_CUSTOMIZED_MEMMAP_UCSI_CONN_CHANGE)&CCI_BUSY_FLAG))
333346
return EC_ERROR_UNKNOWN;
334347

335348
pd_chip_ucsi_info[controller].read_tunnel_complete = 1;

0 commit comments

Comments
 (0)