sgm4154x: support 8w wireless charging

sgm4154x:
Setting ichg to 360mA for 8w wireless charging in Juno. 

Change-Id: Icc2fb0bde8cd766fb1354b9bdad68514387a879d
Reviewed-on: https://gerrit.mot.com/2604889
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Wentao Xu <xuwt2@motorola.com>
Reviewed-by: Guobin Zhang <zhanggb@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
litong20 authored and Wentao Xu committed 2023-05-11 22:19:56 -05:00
1 parent e12191b812
commit b7c07a15f7
2 files changed
+18 -3

No files matched your search

@@ -28,6 +28,7 @@
#define DEF_IBAT_OCCP_MA (1500)
#define DEF_PROTECT_DURATION_MS (60000)
#define DEF_USB_CURRENT_MA (500000)
#define DEF_WLS_8W_VOLTAGE_UV (7000000)
#ifndef MIN_VAL
#define MIN_VAL( x, y ) ( ((x) < (y)) ? (x) : (y) )
@@ -1954,6 +1955,15 @@ static int sgm4154x_parse_dt(struct sgm4154x_device *sgm)
pr_info("wireless ichg current limit: %duA\n", sgm->init_data.wls_ichg_ilim);
ret = device_property_read_u32(sgm->dev,
"wls-8w-ichg-limit-microamp",
&sgm->init_data.wls_8w_ichg_ilim);
if (ret)
sgm->init_data.wls_8w_ichg_ilim = SGM4154x_ICHRG_I_MIN_uA;
pr_info("wireless 8w ichg current limit: %duA\n", sgm->init_data.wls_8w_ichg_ilim);
irq_gpio = of_get_named_gpio(sgm->dev->of_node, "sgm,irq-gpio", 0);
if (!gpio_is_valid(irq_gpio))
{
@@ -2592,14 +2602,18 @@ static int sgm4154x_charger_config_charge(void *data, struct mmi_charger_cfg *co
if (curr_in_limit > chg->sgm->init_data.ilim)
curr_in_limit = chg->sgm->init_data.ilim;
} else if (chg->chg_info.chrg_present && chg->chg_info.chrg_type == SGM4154x_WLS_TYPE) {
ichg_in_limit = MIN_VAL(chg->sgm->init_data.wls_ichg_ilim, chg->chg_cfg.target_fcc * 1000);
if (state.vbus_adc < DEF_WLS_8W_VOLTAGE_UV) {
ichg_in_limit = MIN_VAL(chg->sgm->init_data.wls_ichg_ilim, chg->chg_cfg.target_fcc * 1000);
} else {
ichg_in_limit = MIN_VAL(chg->sgm->init_data.wls_8w_ichg_ilim, chg->chg_cfg.target_fcc * 1000);
}
if (chg->sgm->ichg != ichg_in_limit) {
rc = sgm4154x_set_ichrg_curr(chg->sgm, ichg_in_limit);
}
curr_in_limit = chg->sgm->init_data.wls_ilim;
volt_in_limit = chg->sgm->init_data.wls_vlim;
pr_debug("wireless is on, curr_in_limit=%d, volt_in_limit=%d, ichg_in_limit=%d\n",
curr_in_limit, volt_in_limit, ichg_in_limit);
pr_debug("wireless is on, curr_in_limit=%d, volt_in_limit=%d, ichg_in_limit=%d, vbus_adc = %d\n",
curr_in_limit, volt_in_limit, ichg_in_limit, state.vbus_adc);
} else {
curr_in_limit = 0;
}
@@ -225,6 +225,7 @@ struct sgm4154x_init_data {
u32 ilim; /* input current */
u32 wls_ilim; /* wireless input current */
u32 wls_ichg_ilim; /* wireless charge current(FCC) */
u32 wls_8w_ichg_ilim; /* wireless 8W charge current(FCC) */
u32 vreg; /* regulation voltage */
u32 iterm; /* termination current */
u32 iprechg; /* precharge current */