Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: typec: tcpci: don't handle vSafe0V event if it's not enabled

USB TCPCI Spec, 4.4.3 Mask Registers:
"A masked register will still indicate in the ALERT register, but shall
not set the Alert# pin low."

Thus, the Extended Status will still indicate in ALERT register if vSafe0V
is detected by TCPC even though being masked. In current code, howerer,
this event will not be handled in detection time. Rather it will be
handled when next ALERT event coming(CC evnet, PD event, etc).

Tcpm might transition to a wrong state in this situation. Thus, the vSafe0V
event should not be handled when it's masked.

Fixes: 766c485b86ef ("usb: typec: tcpci: Add support to report vSafe0V")
cc: <stable@vger.kernel.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
Link: https://lore.kernel.org/r/20210926101415.3775058-1-xu.yang_2@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Xu Yang and committed by
Greg Kroah-Hartman
05300871 b87d8d0d

+1 -1
+1 -1
drivers/usb/typec/tcpm/tcpci.c
··· 696 696 tcpm_pd_receive(tcpci->port, &msg); 697 697 } 698 698 699 - if (status & TCPC_ALERT_EXTENDED_STATUS) { 699 + if (tcpci->data->vbus_vsafe0v && (status & TCPC_ALERT_EXTENDED_STATUS)) { 700 700 ret = regmap_read(tcpci->regmap, TCPC_EXTENDED_STATUS, &raw); 701 701 if (!ret && (raw & TCPC_EXTENDED_STATUS_VSAFE0V)) 702 702 tcpm_vbus_change(tcpci->port);