smb: enable otg feature on driver init and based on dash status
Change-Id: Ic8d554e9df4457bc9e3ad8c2182d5b555b3513bf
This commit is contained in:
parent
5ca00b233b
commit
d3a2b7ab76
1 changed files with 12 additions and 0 deletions
|
@ -47,6 +47,9 @@
|
||||||
#define BATT_REMOVE_TEMP -400
|
#define BATT_REMOVE_TEMP -400
|
||||||
#define BATT_TEMP_HYST 20
|
#define BATT_TEMP_HYST 20
|
||||||
|
|
||||||
|
const union power_supply_propval otg_on = {1,};
|
||||||
|
const union power_supply_propval otg_off = {0,};
|
||||||
|
|
||||||
struct smb_charger *g_chg;
|
struct smb_charger *g_chg;
|
||||||
struct qpnp_pon *pm_pon;
|
struct qpnp_pon *pm_pon;
|
||||||
|
|
||||||
|
@ -5216,11 +5219,15 @@ static void set_usb_switch(struct smb_charger *chg, bool enable)
|
||||||
|
|
||||||
if (!fast_charger) {
|
if (!fast_charger) {
|
||||||
pr_err("no fast_charger register found\n");
|
pr_err("no fast_charger register found\n");
|
||||||
|
// Enable otg feature when not connected to dash charger
|
||||||
|
op_set_prop_otg_switch(chg, &otg_on);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enable) {
|
if (enable) {
|
||||||
pr_err("switch on fastchg\n");
|
pr_err("switch on fastchg\n");
|
||||||
|
// Disable otg feature when connected to dash charger
|
||||||
|
op_set_prop_otg_switch(chg, &otg_off);
|
||||||
if (chg->boot_usb_present && chg->re_trigr_dash_done) {
|
if (chg->boot_usb_present && chg->re_trigr_dash_done) {
|
||||||
vote(chg->usb_icl_votable, AICL_RERUN_VOTER,
|
vote(chg->usb_icl_votable, AICL_RERUN_VOTER,
|
||||||
true, 0);
|
true, 0);
|
||||||
|
@ -5244,6 +5251,8 @@ static void set_usb_switch(struct smb_charger *chg, bool enable)
|
||||||
pr_err("switch off fastchg\n");
|
pr_err("switch off fastchg\n");
|
||||||
usb_sw_gpio_set(0);
|
usb_sw_gpio_set(0);
|
||||||
mcu_en_gpio_set(1);
|
mcu_en_gpio_set(1);
|
||||||
|
// Enable otg feature when disconnected from dash charger
|
||||||
|
op_set_prop_otg_switch(chg, &otg_on);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7530,6 +7539,9 @@ int smblib_init(struct smb_charger *chg)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enable otg feature on init
|
||||||
|
op_set_prop_otg_switch(chg, &otg_on);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue