mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 22:40:54 -04:00
mmi_charger: set wls charging as dts configuration
When wls charger connected, charger core will get charger type from "online" property of wls. And set relative charging current as dts configuration "mmi,wls-max-icl-ua". Change-Id: Ie20fd2fb44a4dda15fc5d94e227a5a29a0eed6b2 Reviewed-on: https://gerrit.mot.com/2250276 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Haijian Ma <mahj8@motorola.com> Reviewed-by: Huosheng Liao <liaohs@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
2fe305b4d6
commit
96e289fc8e
2 changed files with 23 additions and 0 deletions
|
|
@ -85,6 +85,11 @@ static int mmi_discrete_parse_dts(struct mmi_discrete_charger *chip)
|
|||
if (chip->hvdcp2_max_icl_ua <= 0)
|
||||
chip->hvdcp2_max_icl_ua = MICRO_1P5A;
|
||||
|
||||
of_property_read_u32(node, "mmi,wls-max-icl-ua",
|
||||
&chip->wls_max_icl_ua);
|
||||
if (chip->wls_max_icl_ua <= 0)
|
||||
chip->wls_max_icl_ua = WIRELESS_CURRENT_DEFAULT_UA;
|
||||
|
||||
rc = of_property_read_u32(node, "mmi,dc-icl-ma",
|
||||
&chip->dc_cl_ma);
|
||||
if (rc)
|
||||
|
|
@ -630,6 +635,13 @@ static int mmi_discrete_update_usb_type(struct mmi_discrete_charger *chip)
|
|||
if (!chip->master_chg_dev)
|
||||
return -EINVAL;
|
||||
|
||||
if (is_wls_online(chip)) {
|
||||
mmi_info(chip, "wireless charger detected\n");
|
||||
chip->real_charger_type = POWER_SUPPLY_TYPE_WIRELESS;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
rc = charger_dev_get_real_charger_type(chip->master_chg_dev, &chg_type);
|
||||
|
||||
if (rc) {
|
||||
|
|
@ -1903,6 +1915,10 @@ static void update_sw_icl_max(struct mmi_discrete_charger *chg)
|
|||
vote(chg->usb_icl_votable, SW_ICL_MAX_VOTER, true,
|
||||
SDP_CURRENT_UA);
|
||||
break;
|
||||
case POWER_SUPPLY_TYPE_WIRELESS:
|
||||
vote(chg->usb_icl_votable, SW_ICL_MAX_VOTER, true,
|
||||
chg->wls_max_icl_ua);
|
||||
break;
|
||||
case POWER_SUPPLY_TYPE_UNKNOWN:
|
||||
default:
|
||||
vote(chg->usb_icl_votable, SW_ICL_MAX_VOTER, true,
|
||||
|
|
@ -2012,6 +2028,9 @@ int mmi_discrete_get_hw_current_max(struct mmi_discrete_charger *chip, int *tota
|
|||
case POWER_SUPPLY_TYPE_USB:
|
||||
current_ua = SDP_CURRENT_UA;
|
||||
break;
|
||||
case POWER_SUPPLY_TYPE_WIRELESS:
|
||||
current_ua = chip->wls_max_icl_ua;
|
||||
break;
|
||||
default:
|
||||
current_ua = 0;
|
||||
break;
|
||||
|
|
@ -2346,6 +2365,8 @@ static int mmi_discrete_get_chg_info(void *data, struct mmi_charger_info *chg_in
|
|||
chip->chg_info.chrg_pmax_mw = 30000;
|
||||
else if (usb_type == POWER_SUPPLY_TYPE_USB_PD)
|
||||
chip->chg_info.chrg_pmax_mw = chip->constraint.pd_pmax;
|
||||
else if (usb_type == POWER_SUPPLY_TYPE_WIRELESS)
|
||||
chip->chg_info.chrg_pmax_mw = chip->constraint.wls_pmax;
|
||||
else
|
||||
chip->chg_info.chrg_pmax_mw = 2500;
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
#define TYPEC_DEFAULT_CURRENT_UA 900000
|
||||
#define TYPEC_MEDIUM_CURRENT_UA 1500000
|
||||
#define TYPEC_HIGH_CURRENT_UA 3000000
|
||||
#define WIRELESS_CURRENT_DEFAULT_UA 1000000
|
||||
|
||||
static const unsigned int mmi_discrete_extcon_cable[] = {
|
||||
EXTCON_USB,
|
||||
|
|
@ -92,6 +93,7 @@ struct mmi_discrete_charger {
|
|||
bool vbus_enabled;
|
||||
int real_charger_type;
|
||||
int hvdcp2_max_icl_ua;
|
||||
int wls_max_icl_ua;
|
||||
|
||||
struct delayed_work monitor_ibat_work;
|
||||
int bat_ocp_ua;
|
||||
|
|
|
|||
Loading…
Reference in a new issue