* [PATCH] platform/chrome: cros_ec_typec: Track port role
@ 2021-04-20 17:10 Prashant Malani
2021-04-23 6:57 ` Enric Balletbo i Serra
0 siblings, 1 reply; 2+ messages in thread
From: Prashant Malani @ 2021-04-20 17:10 UTC (permalink / raw)
To: linux-kernel
Cc: Prashant Malani, Nikunj A . Dadhania, Deepti Deshatty,
Benson Leung, Enric Balletbo i Serra, Guenter Roeck
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 <pmalani@chromium.org>
Suggested-by: Nikunj A. Dadhania <nikunj.dadhania@intel.com>
Tested-by: Deepti Deshatty <deepti.deshatty@intel.com>
---
drivers/platform/chrome/cros_ec_typec.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c
index d3df1717a5fd..1a06b8c80f80 100644
--- a/drivers/platform/chrome/cros_ec_typec.c
+++ b/drivers/platform/chrome/cros_ec_typec.c
@@ -58,6 +58,7 @@ struct cros_typec_port {
/* Variables keeping track of switch state. */
struct typec_mux_state state;
uint8_t mux_flags;
+ uint8_t role;
/* Port alt modes. */
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)
}
/* No change needs to be made, let's exit early. */
- if (typec->ports[port_num]->mux_flags == mux_resp.flags)
+ if (typec->ports[port_num]->mux_flags == mux_resp.flags &&
+ typec->ports[port_num]->role == resp.role)
return 0;
typec->ports[port_num]->mux_flags = mux_resp.flags;
+ typec->ports[port_num]->role = resp.role;
ret = cros_typec_configure_mux(typec, port_num, mux_resp.flags, &resp);
if (ret)
dev_warn(typec->dev, "Configure muxes failed, err = %d\n", ret);
--
2.31.1.368.gbe11c130af-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] platform/chrome: cros_ec_typec: Track port role
2021-04-20 17:10 [PATCH] platform/chrome: cros_ec_typec: Track port role Prashant Malani
@ 2021-04-23 6:57 ` Enric Balletbo i Serra
0 siblings, 0 replies; 2+ messages in thread
From: Enric Balletbo i Serra @ 2021-04-23 6:57 UTC (permalink / raw)
To: linux-kernel, Prashant Malani
Cc: Guenter Roeck, Benson Leung, Deepti Deshatty, Nikunj A . Dadhania
On Tue, 20 Apr 2021 10:10:09 -0700, Prashant Malani wrote:
> 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).
Applied, thanks!
[1/1] platform/chrome: cros_ec_typec: Track port role
commit: 670160fea22c587b384d56698bbb661fa4801534
Best regards,
--
Enric Balletbo i Serra <enric.balletbo@collabora.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-04-23 6:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-20 17:10 [PATCH] platform/chrome: cros_ec_typec: Track port role Prashant Malani
2021-04-23 6:57 ` Enric Balletbo i Serra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).