mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-12 07:37:31 -04:00
Merge "power: smblite-lib/smb5-lib: Fix partner registration for microusb"
This commit is contained in:
commit
67665e9ea4
2 changed files with 39 additions and 2 deletions
|
|
@ -6574,6 +6574,10 @@ irqreturn_t smb5_typec_attach_detach_irq_handler(int irq, void *data)
|
|||
bool attached = false;
|
||||
int rc;
|
||||
|
||||
/* IRQ not expected to be executed for uUSB, return */
|
||||
if (chg->connector_type == QTI_POWER_SUPPLY_CONNECTOR_MICRO_USB)
|
||||
return IRQ_HANDLED;
|
||||
|
||||
smblib_dbg(chg, PR_INTERRUPT, "IRQ: %s\n", irq_data->name);
|
||||
|
||||
rc = smblib_read(chg, TYPE_C_STATE_MACHINE_STATUS_REG, &stat);
|
||||
|
|
@ -7308,10 +7312,27 @@ static void smblib_uusb_otg_work(struct work_struct *work)
|
|||
goto out;
|
||||
}
|
||||
otg = !!(stat & U_USB_GROUND_NOVBUS_BIT);
|
||||
if (chg->otg_present != otg)
|
||||
if (chg->otg_present != otg) {
|
||||
if (otg) {
|
||||
/* otg cable inserted */
|
||||
if (chg->typec_port) {
|
||||
typec_partner_register(chg);
|
||||
typec_set_data_role(chg->typec_port,
|
||||
TYPEC_HOST);
|
||||
typec_set_pwr_role(chg->typec_port,
|
||||
TYPEC_SOURCE);
|
||||
}
|
||||
} else if (chg->typec_port) {
|
||||
/* otg cable removed */
|
||||
typec_set_data_role(chg->typec_port, TYPEC_DEVICE);
|
||||
typec_set_pwr_role(chg->typec_port, TYPEC_SINK);
|
||||
typec_partner_unregister(chg);
|
||||
}
|
||||
|
||||
smblib_notify_usb_host(chg, otg);
|
||||
else
|
||||
} else {
|
||||
goto out;
|
||||
}
|
||||
|
||||
chg->otg_present = otg;
|
||||
if (!otg)
|
||||
|
|
|
|||
|
|
@ -2907,6 +2907,22 @@ irqreturn_t smblite_usb_id_irq_handler(int irq, void *data)
|
|||
|
||||
smblite_lib_dbg(chg, PR_INTERRUPT, "IRQ: %s, id_state=%d\n",
|
||||
"usb-id-irq", id_state);
|
||||
if (id_state) {
|
||||
/*otg cable removed */
|
||||
if (chg->otg_present) {
|
||||
if (chg->typec_port) {
|
||||
typec_set_data_role(chg->typec_port,
|
||||
TYPEC_DEVICE);
|
||||
typec_set_pwr_role(chg->typec_port, TYPEC_SINK);
|
||||
typec_partner_unregister(chg);
|
||||
}
|
||||
}
|
||||
} else if (chg->typec_port) {
|
||||
/*otg cable inserted */
|
||||
typec_partner_register(chg);
|
||||
typec_set_data_role(chg->typec_port, TYPEC_HOST);
|
||||
typec_set_pwr_role(chg->typec_port, TYPEC_SOURCE);
|
||||
}
|
||||
|
||||
smblite_lib_notify_usb_host(chg, !id_state);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue