summaryrefslogtreecommitdiffstats
path: root/drivers/platform/chrome/cros_ec_typec.c
diff options
context:
space:
mode:
authorPrashant Malani <pmalani@chromium.org>2020-11-16 12:11:44 -0800
committerBenson Leung <bleung@chromium.org>2021-01-05 10:58:59 -0800
commita906f45d148074274ab4f5df4ebc33412bfa9973 (patch)
tree8bfec8435fce4caaff9c9b67d11e6e33e43e6835 /drivers/platform/chrome/cros_ec_typec.c
parente71ba9452f0b5b2e8dc8aa5445198cd9214a6a62 (diff)
downloadlinux-stable-a906f45d148074274ab4f5df4ebc33412bfa9973.tar.gz
linux-stable-a906f45d148074274ab4f5df4ebc33412bfa9973.tar.bz2
linux-stable-a906f45d148074274ab4f5df4ebc33412bfa9973.zip
platform/chrome: cros_ec_typec: Make disc_done flag partner-only
Change the disc_done flag, which indicates whether PD discovery is complete, to sop_disc_done instead, since we will process SOP and SOP' discovery data separately. Signed-off-by: Prashant Malani <pmalani@chromium.org> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Benson Leung <bleung@chromium.org> Link: https://lore.kernel.org/r/20201116201150.2919178-5-pmalani@chromium.org
Diffstat (limited to 'drivers/platform/chrome/cros_ec_typec.c')
-rw-r--r--drivers/platform/chrome/cros_ec_typec.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c
index c43868615790..2d8bda491a0c 100644
--- a/drivers/platform/chrome/cros_ec_typec.c
+++ b/drivers/platform/chrome/cros_ec_typec.c
@@ -57,8 +57,8 @@ struct cros_typec_port {
/* Port alt modes. */
struct typec_altmode p_altmode[CROS_EC_ALTMODE_MAX];
- /* Flag indicating that PD discovery data parsing is completed. */
- bool disc_done;
+ /* Flag indicating that PD partner discovery data parsing is completed. */
+ bool sop_disc_done;
struct ec_response_typec_discovery *sop_disc;
struct list_head partner_mode_list;
};
@@ -210,7 +210,7 @@ static void cros_typec_remove_partner(struct cros_typec_data *typec,
typec_unregister_partner(port->partner);
port->partner = NULL;
memset(&port->p_identity, 0, sizeof(port->p_identity));
- port->disc_done = false;
+ port->sop_disc_done = false;
}
static void cros_unregister_ports(struct cros_typec_data *typec)
@@ -725,18 +725,13 @@ static void cros_typec_handle_status(struct cros_typec_data *typec, int port_num
return;
}
- if (typec->ports[port_num]->disc_done)
- return;
-
/* Handle any events appropriately. */
- if (resp.events & PD_STATUS_EVENT_SOP_DISC_DONE) {
+ if (resp.events & PD_STATUS_EVENT_SOP_DISC_DONE && !typec->ports[port_num]->sop_disc_done) {
ret = cros_typec_handle_sop_disc(typec, port_num);
- if (ret < 0) {
+ if (ret < 0)
dev_err(typec->dev, "Couldn't parse SOP Disc data, port: %d\n", port_num);
- return;
- }
-
- typec->ports[port_num]->disc_done = true;
+ else
+ typec->ports[port_num]->sop_disc_done = true;
}
}