Skip to content

Commit b4c1fb8

Browse files
authored
Merge pull request #986 from FrameworkComputer/fwk.fix_linux_ucsi
fwk: add a workatound to fix get_alternate_modes error message
2 parents 4644b5f + b06cf22 commit b4c1fb8

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

.github/workflows/lotus-azalea-build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
branches:
66
- lotus*
77
- azalea*
8+
- fwk*
9+
- framework*
810
paths:
911
- 'zephyr/program/lotus/**'
1012
- '.github/workflows/**'

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)