Skip to content

CCG8: after a reverse current error at power-on without a hard reset, an expansion card's port detects the card again only once it is reseated (HDMI Expansion Card lost after EC jumps) #106

Open

Description

@mitar

On a Laptop 13 Pro with the AMD Ryzen AI 300 Series mainboard, EC lilac-4.0.2-fdbf549 and my builds of it, the HDMI Expansion Card (EC port 1, port 1 of PD controller 0) is often gone from USB (32ac:0002) after a jump between EC images, for example after framework_tool --reboot-ec reboot followed by framework_tool --reboot-ec jump-rw, until it is pulled out and inserted again. Chargers on the other ports keep working, so this is not the G3 problem in #105.

What happens (EC console with PD verbose logging): about 4 ms after S3->S0, the controller reports 0xBD (CCG_RESPONSE_REVERSE_CURRENT_ERROR) on the card's port. Usually it sends a hard reset (0x9A, CCG_RESPONSE_HARD_RESET_SENT) right after, and the card connects again within about half a second of the Type-C error recovery which the EC performs at S0:

[2.593100 power state 8 = S3->S0, in 0x0007]
[2.596900 PD Controller 0 Port 1  Code 0xbd Response Len: 0x00]
[2.601500 PD Controller 0 Port 1  Code 0x9a Response Len: 0x00]
[2.701600 PD Controller 0 Port 1  Code 0xa1 Response Len: 0x00]
[3.112600 PD Controller 0 Port 1  Code 0x84 Response Len: 0x00]

Sometimes no hard reset follows. Then the error recovery (0xA1) is followed by nothing, and the port reads like an empty port (CCG_TYPE_C_STATUS_REG(1) 0x00, CCG_PD_STATUS_REG(1) 0x00014036) for as long as I watched (the DIAG lines are from an instrumented build which logs the port status after the error recovery). In one such case a second error recovery followed 2 s later, after "AMD Crossbar is ready", and did not help either:

[1.843500 power state 8 = S3->S0, in 0x0007]
[1.847400 PD Controller 0 Port 1  Code 0xbd Response Len: 0x00]
[1.949900 PD Controller 0 Port 1  Code 0xa1 Response Len: 0x00]
[2.918400 DIAG C0 P1 typec 0x00 pd 0x00014036 alt 0x00]
...
[32.992300 DIAG C0 P1 typec 0x00 pd 0x00014036 alt 0x00]

How often: of 13 logged power-ons after jumps with the card attached, the error came in 12. The exception was a power-on which the EC started by itself 0.3 s after the jump. In 6 of the 12 the controller sent a hard reset and the card stayed. In the other 6 it did not, and the card was lost in all of them until the port was restarted as described below. The error also came at 2 normal power-ons (shutdown and power-on on AC, so the EC kept running), both with a hard reset. Framework's RO, which runs after --reboot-ec reboot, apparently lost the card in the same way twice: its port was already empty when the image I jumped to started, but I have no log of those power-ons. Without jumps, the card stayed in every boot of the last weeks, as far as my journal shows.

What brings the card back, written to the controller through EC_CMD_I2C_PASSTHRU while the card was lost, in this order:

Action Result
Type-C error recovery of the port (CCG_DPM_CMD_REG = {1, 0x04}), seconds after the error nothing
PD hard reset of the port (CCG_DPM_CMD_REG = {1, 0x85}) nothing
the port disabled and enabled again (CCG_PDPORT_ENABLE_REG 0x01, then 0x03 two seconds later) the card connected 0.2 s after the port was enabled

Disabling and enabling port 1 does not disturb the other port of the controller: with a 100 W charger on port 0, the cycle caused no events on port 0, its contract stayed, and AC stayed online.

Fix (commit on my branch): on 0xBD, check the port 5 s later in the CYPD task, and if CCG_TYPE_C_STATUS_REG shows no partner, disable the port with CCG_PDPORT_ENABLE_REG for 2 s, at most once per port per AP power-on or resume, so that a partner which causes the error itself does not keep the port restarting. It uses the so far unused CCG_EVT_PORT_DISABLE and CCG_EVT_PORT_ENABLE events. In both jumps since where the controller sent no hard reset, the EC restarted the port and the card came back:

[3.496800 power state 8 = S3->S0, in 0x0007]
[3.501700 CCG_RESPONSE_REVERSE_CURRENT_ERROR 1]
[3.599200 TYPE_C_ERROR_RECOVERY]
[8.503600 C0 P1: no partner after reverse current, restarting the port]
[10.683000 CYPD_RESPONSE_PORT_CONNECT 1]
[11.908900 CYPD_RESPONSE_PD_CONTRACT_NEGOTIATION_COMPLETE 1]

This treats the symptom. I do not know why the controller sees a reverse current at power-on, nor why it sometimes sends no hard reset afterwards.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions