gjdwebserver-overlay/sys-kernel/pinephone-pro-sources/files/0019-usb-typec-fusb302-Upda...

40 lines
1.4 KiB
Diff

From: Ondrej Jirman <megous@megous.com>
Date: Tue, 23 Nov 2021 17:57:06 +0100
Subject: [PATCH 30/36] usb: typec: fusb302: Update VBUS state even if VBUS
interrupt is not triggered
This seems to improve robustness.
Signed-off-by: Ondrej Jirman <megous@megous.com>
---
drivers/usb/typec/tcpm/fusb302.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c
index 70b0e15..1d5affa 100644
--- a/drivers/usb/typec/tcpm/fusb302.c
+++ b/drivers/usb/typec/tcpm/fusb302.c
@@ -1716,14 +1716,16 @@ static void fusb302_irq_work(struct work_struct *work)
fusb302_print_state(chip);
- if (interrupt & FUSB_REG_INTERRUPT_VBUSOK) {
- vbus_present = !!(status0 & FUSB_REG_STATUS0_VBUSOK);
+ vbus_present = !!(status0 & FUSB_REG_STATUS0_VBUSOK);
+ if (interrupt & FUSB_REG_INTERRUPT_VBUSOK)
fusb302_log(chip, "IRQ: VBUS_OK, vbus=%s",
vbus_present ? "On" : "Off");
- if (vbus_present != chip->vbus_present) {
- chip->vbus_present = vbus_present;
- tcpm_vbus_change(chip->tcpm_port);
- }
+ if (vbus_present != chip->vbus_present) {
+ chip->vbus_present = vbus_present;
+ if (!(interrupt & FUSB_REG_INTERRUPT_VBUSOK))
+ fusb302_log(chip, "IRQ: VBUS changed without interrupt, vbus=%s",
+ vbus_present ? "On" : "Off");
+ tcpm_vbus_change(chip->tcpm_port);
}
if (interrupta & FUSB_REG_INTERRUPTA_TOGDONE) {