From c74c0785927ab7770143d5ff503b4c0ca9df9ff1 Mon Sep 17 00:00:00 2001 From: Caveh Jalali Date: Tue, 20 Jun 2017 18:20:00 -0700 Subject: tcpm: add .release driver operation. similar to the USB_PD_TCPC case, add release/init operations when the pd_task enters/leaves the PD_STATE_SUSPENDED state. one use case for PD_SUSPEND is to get exlusive access to the TCPC for things like firmware update, so the release/init operation is needed to get the TCPC and driver into a good state. updated all tcpm_drv style drivers. for backward compatibility, "old" drivers that may not handle init/release properly simply return EC_ERROR_UNIMPLEMENTED for tcpm_release(). pd_task() uses this as a signal that it should not try to re-init() the driver. TEST=tested in combination with follow-on CLs to do TCPC firmware update on electro. also built for kevin, eve, sand which are some of the other boards using these drivers. "make buildall -j" passes. BRANCH=none BUG=b:35586896 Change-Id: I3d2964a79e710428f7a6e7004d68ab424af85be8 Signed-off-by: Caveh Jalali Reviewed-on: https://chromium-review.googlesource.com/544660 Reviewed-by: Shawn N --- driver/tcpm/anx7688.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'driver/tcpm/anx7688.c') diff --git a/driver/tcpm/anx7688.c b/driver/tcpm/anx7688.c index 7dda345302..6b73108739 100644 --- a/driver/tcpm/anx7688.c +++ b/driver/tcpm/anx7688.c @@ -61,6 +61,11 @@ static int anx7688_init(int port) return rv; } +static int anx7688_release(int port) +{ + return EC_ERROR_UNIMPLEMENTED; +} + static void anx7688_update_hpd_enable(int port) { int status, reg, rv; @@ -178,6 +183,7 @@ static int anx7688_tcpm_get_vbus_level(int port) /* ANX7688 is a TCPCI compatible port controller */ const struct tcpm_drv anx7688_tcpm_drv = { .init = &anx7688_init, + .release = &anx7688_release, .get_cc = &tcpci_tcpm_get_cc, #ifdef CONFIG_USB_PD_VBUS_DETECT_TCPC .get_vbus_level = &anx7688_tcpm_get_vbus_level, @@ -200,4 +206,3 @@ const struct usb_mux_driver anx7688_usb_mux_driver = { .get = tcpci_tcpm_mux_get, }; #endif /* CONFIG_USB_PD_TCPM_MUX */ - -- cgit v1.2.1