aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb
diff options
context:
space:
mode:
authorBadhri Jagan Sridharan <badhri@google.com>2021-05-17 12:21:11 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-05-21 20:05:56 +0200
commit59d4d06c8ab0375dcc4bab329e6ecd44dd46373e (patch)
tree8eb341a311b8787d90f2f145fbded200d549a71c /include/linux/usb
parentusb: typec: tcpm: Refactor logic to enable/disable auto vbus dicharge (diff)
downloadlinux-dev-59d4d06c8ab0375dcc4bab329e6ecd44dd46373e.tar.xz
linux-dev-59d4d06c8ab0375dcc4bab329e6ecd44dd46373e.zip
usb: typec: tcpm: Move TCPC to APPLY_RC state during PR_SWAP
When vbus auto discharge is enabled, TCPCI based TCPC transitions into Attached.SNK/Attached.SRC state. During PR_SWAP, TCPCI based TCPC would disconnect when partner changes power roles. TCPC has to be moved APPLY RC state during PR_SWAP. This is done by ROLE_CONTROL.CC1 != ROLE_CONTROL.CC2 and POWER_CONTROL.AutodischargeDisconnect is 0. Once the swap sequence is done, AutoDischargeDisconnect is re-enabled. Fixes: f321a02caebd ("usb: typec: tcpm: Implement enabling Auto Discharge disconnect support") Reviewed-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Badhri Jagan Sridharan <badhri@google.com> Link: https://lore.kernel.org/r/20210517192112.40934-3-badhri@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/usb')
-rw-r--r--include/linux/usb/tcpm.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/usb/tcpm.h b/include/linux/usb/tcpm.h
index 42fcfbe10590..bffc8d3e14ad 100644
--- a/include/linux/usb/tcpm.h
+++ b/include/linux/usb/tcpm.h
@@ -66,6 +66,8 @@ enum tcpm_transmit_type {
* For example, some tcpcs may include BC1.2 charger detection
* and use that in this case.
* @set_cc: Called to set value of CC pins
+ * @apply_rc: Optional; Needed to move TCPCI based chipset to APPLY_RC state
+ * as stated by the TCPCI specification.
* @get_cc: Called to read current CC pin values
* @set_polarity:
* Called to set polarity
@@ -120,6 +122,8 @@ struct tcpc_dev {
int (*get_vbus)(struct tcpc_dev *dev);
int (*get_current_limit)(struct tcpc_dev *dev);
int (*set_cc)(struct tcpc_dev *dev, enum typec_cc_status cc);
+ int (*apply_rc)(struct tcpc_dev *dev, enum typec_cc_status cc,
+ enum typec_cc_polarity polarity);
int (*get_cc)(struct tcpc_dev *dev, enum typec_cc_status *cc1,
enum typec_cc_status *cc2);
int (*set_polarity)(struct tcpc_dev *dev,