Skip to content

Commit 670160f

Browse files
Prashant MalaniEnric Balletbo i Serra
authored andcommitted
platform/chrome: cros_ec_typec: Track port role
Stash the currently reported port role in the port struct and add a check for that too while determining whether to re-configure on-board Type C switches (this deals with cases like role swaps where the mux flags don't change, but the port role does). Signed-off-by: Prashant Malani <[email protected]> Suggested-by: Nikunj A. Dadhania <[email protected]> Tested-by: Deepti Deshatty <[email protected]> Signed-off-by: Enric Balletbo i Serra <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent c6e939c commit 670160f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/platform/chrome/cros_ec_typec.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ struct cros_typec_port {
5858
/* Variables keeping track of switch state. */
5959
struct typec_mux_state state;
6060
uint8_t mux_flags;
61+
uint8_t role;
6162

6263
/* Port alt modes. */
6364
struct typec_altmode p_altmode[CROS_EC_ALTMODE_MAX];
@@ -995,10 +996,12 @@ static int cros_typec_port_update(struct cros_typec_data *typec, int port_num)
995996
}
996997

997998
/* No change needs to be made, let's exit early. */
998-
if (typec->ports[port_num]->mux_flags == mux_resp.flags)
999+
if (typec->ports[port_num]->mux_flags == mux_resp.flags &&
1000+
typec->ports[port_num]->role == resp.role)
9991001
return 0;
10001002

10011003
typec->ports[port_num]->mux_flags = mux_resp.flags;
1004+
typec->ports[port_num]->role = resp.role;
10021005
ret = cros_typec_configure_mux(typec, port_num, mux_resp.flags, &resp);
10031006
if (ret)
10041007
dev_warn(typec->dev, "Configure muxes failed, err = %d\n", ret);

0 commit comments

Comments
 (0)