]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
usb: typec: fusb302: Fix masking of comparator and bc_lvl interrupts
authorOndrej Jirman <megous@megous.com>
Mon, 8 Nov 2021 10:28:32 +0000 (11:28 +0100)
committerStefan Bader <stefan.bader@canonical.com>
Thu, 3 Feb 2022 17:56:41 +0000 (18:56 +0100)
commita84b9637ddd0123258db6b8d1513d29c2af09abd
treedfdcca0362aa2717e4d72c3e6e4c002b04b1fdb3
parent661ed93943c3942d2588b669f1cba27d2471acfd
usb: typec: fusb302: Fix masking of comparator and bc_lvl interrupts

BugLink: https://bugs.launchpad.net/bugs/1956380
commit 362468830dd5bea8bf6ad5203b2ea61f8a4e8288 upstream.

The code that enables either BC_LVL or COMP_CHNG interrupt in tcpm_set_cc
wrongly assumes that the interrupt is unmasked by writing 1 to the apropriate
bit in the mask register. In fact, interrupts are enabled when the mask
is 0, so the tcpm_set_cc enables interrupt for COMP_CHNG when it expects
BC_LVL interrupt to be enabled.

This causes inability of the driver to recognize cable unplug events
in host mode (unplug is recognized only via a COMP_CHNG interrupt).

In device mode this bug was masked by simultaneous triggering of the VBUS
change interrupt, because of loss of VBUS when the port peer is providing
power.

Fixes: 48242e30532b ("usb: typec: fusb302: Revert "Resolve fixed power role contract setup"")
Cc: stable <stable@vger.kernel.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Ondrej Jirman <megous@megous.com>
Link: https://lore.kernel.org/r/20211108102833.2793803-1-megous@megous.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/usb/typec/tcpm/fusb302.c