mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-12 15:49:17 -04:00
sc89890h charger ic factory mode close ico
Modify: factory mode close ico Change-Id: I3e8b3de62820074534f4829306f91a9cd7ac8c34 Signed-off-by: <hq114@motorola.com> Reviewed-on: https://gerrit.mot.com/2372989 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Wei Xu <xuwei9@lenovo.com> Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
dc6b2a00e6
commit
8b30a0a818
1 changed files with 36 additions and 5 deletions
|
|
@ -96,7 +96,7 @@ struct bq2589x_config {
|
|||
bool enable_ico;
|
||||
bool use_absolute_vindpm;
|
||||
bool disable_ilim;
|
||||
|
||||
|
||||
int charge_voltage;
|
||||
int charge_current;
|
||||
int term_current;
|
||||
|
|
@ -185,7 +185,8 @@ struct bq2589x {
|
|||
struct bq2589x_iio iio;
|
||||
#ifdef CONFIG_MMI_QC3P_WT6670_DETECTED
|
||||
struct iio_channel **ext_iio_chans;
|
||||
#endif
|
||||
#endif
|
||||
bool factory_mode;
|
||||
};
|
||||
|
||||
struct pe_ctrl {
|
||||
|
|
@ -2693,7 +2694,35 @@ static int bq2589x_get_real_charger_type(struct charger_device *chg_dev, int *ch
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static bool bq2589x_is_factory_mode(void)
|
||||
{
|
||||
struct device_node *np = of_find_node_by_path("/chosen");
|
||||
bool factory_mode = false;
|
||||
const char *bootargs = NULL;
|
||||
char *bootmode = NULL;
|
||||
char *end = NULL;
|
||||
|
||||
if (!np)
|
||||
return factory_mode;
|
||||
|
||||
if (!of_property_read_string(np, "bootargs", &bootargs)) {
|
||||
bootmode = strstr(bootargs, "androidboot.mode=");
|
||||
if (bootmode) {
|
||||
end = strpbrk(bootmode, " ");
|
||||
bootmode = strpbrk(bootmode, "=");
|
||||
}
|
||||
if (bootmode &&
|
||||
end > bootmode &&
|
||||
strnstr(bootmode, "mot-factory", end - bootmode)) {
|
||||
factory_mode = true;
|
||||
}
|
||||
}
|
||||
of_node_put(np);
|
||||
|
||||
return factory_mode;
|
||||
}
|
||||
|
||||
static int bq2589x_set_icl(struct charger_device *chg_dev, u32 uA)
|
||||
{
|
||||
struct bq2589x *bq = dev_get_drvdata(&chg_dev->dev);
|
||||
|
|
@ -2708,7 +2737,7 @@ static int bq2589x_set_icl(struct charger_device *chg_dev, u32 uA)
|
|||
dev_info(bq->dev, "hvdcp detecting now\n");
|
||||
return 0;
|
||||
}
|
||||
if (bq->part_no == SC89890H) {
|
||||
if (bq->part_no == SC89890H && bq->factory_mode) {
|
||||
if (mA < BQ2589X_ENABLE_ICO_THRESHOLD) {
|
||||
bq2589x_enable_ico(bq, false);
|
||||
} else {
|
||||
|
|
@ -3038,7 +3067,9 @@ static int bq2589x_charger_probe(struct i2c_client *client,
|
|||
pe.enable = false;
|
||||
|
||||
bq2589x_rerun_apsd_if_required(bq);
|
||||
|
||||
|
||||
if (bq2589x_is_factory_mode())
|
||||
bq->factory_mode = true;
|
||||
return 0;
|
||||
|
||||
err_irq:
|
||||
|
|
|
|||
Loading…
Reference in a new issue