mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-25 06:03:36 -04:00
charging: add config charger mode to FG
As mm8013 fg need charger mode info, so add config charger mode to FG Change-Id: I70758ccdc6ce0328cf4e7959782d77df7a282cf9 Signed-off-by: Haijian Ma <mahj8@motorola.com> Reviewed-on: https://gerrit.mot.com/2274890 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Yuecai Liu <liuyc20@motorola.com> Reviewed-by: Huosheng Liao <liaohs@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
fd90788699
commit
cc4f1a773d
2 changed files with 37 additions and 0 deletions
|
|
@ -120,6 +120,9 @@ static int mmi_discrete_parse_dts(struct mmi_discrete_charger *chip)
|
|||
|
||||
chip->pd_supported = of_property_read_bool(node, "mmi,usb-pd-supported");
|
||||
|
||||
/*mm8013 fg need charging mode info*/
|
||||
chip->chgmod_to_fg = of_property_read_bool(node, "mmi,cfg-chgmod-to-fg");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1198,6 +1201,35 @@ static void mmi_discrete_config_charger_output(struct mmi_discrete_charger *chip
|
|||
}
|
||||
}
|
||||
|
||||
enum {
|
||||
MMI_CHARGER_MODE_FFC = 0,
|
||||
MMI_CHARGER_MODE_NORMAL,
|
||||
MMI_CHARGER_MODE_USB,
|
||||
};
|
||||
|
||||
#define TURBO_CHRG_FFC_THRSH_MW 25000
|
||||
|
||||
static void mmi_discrete_config_chgmod_to_fg(struct mmi_discrete_charger *chip)
|
||||
{
|
||||
union power_supply_propval val;
|
||||
int rc = 0;
|
||||
|
||||
if (!chip->bms_psy || !chip->chgmod_to_fg)
|
||||
return;
|
||||
|
||||
if (chip->chg_info.chrg_pmax_mw > TURBO_CHRG_FFC_THRSH_MW) {
|
||||
val.intval = MMI_CHARGER_MODE_FFC;
|
||||
} else if (chip->chg_info.chrg_type == POWER_SUPPLY_TYPE_USB) {
|
||||
val.intval = MMI_CHARGER_MODE_USB;
|
||||
} else {
|
||||
val.intval = MMI_CHARGER_MODE_NORMAL;
|
||||
}
|
||||
|
||||
rc = power_supply_set_property(chip->bms_psy, POWER_SUPPLY_PROP_TYPE, &val);
|
||||
mmi_dbg(chip, "%s config charger mode to fg\n", rc? "Can't" : "success");
|
||||
|
||||
}
|
||||
|
||||
static void mmi_discrete_charger_work(struct work_struct *work)
|
||||
{
|
||||
struct mmi_discrete_charger *chip = container_of(work,
|
||||
|
|
@ -1213,6 +1245,8 @@ static void mmi_discrete_charger_work(struct work_struct *work)
|
|||
mmi_discrete_config_charger_input(chip);
|
||||
mmi_discrete_config_charger_output(chip);
|
||||
|
||||
mmi_discrete_config_chgmod_to_fg(chip);
|
||||
|
||||
mmi_info(chip, "FV=%d, FCC=%d, CHGDIS=%d, USBICL=%d, USBDIS=%d\n",
|
||||
get_effective_result(chip->fv_votable),
|
||||
get_effective_result(chip->fcc_votable),
|
||||
|
|
|
|||
|
|
@ -125,6 +125,9 @@ struct mmi_discrete_charger {
|
|||
int *thermal_mitigation;
|
||||
int typec_mode;
|
||||
bool use_extcon;
|
||||
|
||||
/*FG*/
|
||||
bool chgmod_to_fg;
|
||||
};
|
||||
|
||||
int mmi_discrete_otg_enable(struct mmi_discrete_charger *chip, bool en);
|
||||
|
|
|
|||
Loading…
Reference in a new issue