mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-13 16:16:15 -04:00
qc3p:limit ibus 300mA for main charger no ibus adc
Due to discrete main charger have no ibus adc so limit main charger fixed input 300mA. Change-Id: Ic762f33d91552c387aa27d6cbe8e4639b39df388 Signed-off-by: xuwei9 <xuwei9@lenovo.com> Reviewed-on: https://gerrit.mot.com/2150432 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
3f275d7116
commit
dce57a8af0
3 changed files with 23 additions and 1 deletions
|
|
@ -290,6 +290,9 @@ struct mmi_charger_manager {
|
|||
|
||||
#define PPS_INIT_VOLT_COMP 500000
|
||||
#define QC3P_INIT_VOLT_COMP 500000
|
||||
//For discrete main charger have no ibus adc capability
|
||||
#define CP_ENABLED_MAIN_INPUT_LIMIT 300*1000
|
||||
#define CP_DISABLED_MAIN_INPUT_LIMIT 3000*1000
|
||||
extern void mmi_qc3p_chrg_sm_work_func(struct work_struct *work);
|
||||
extern struct mmi_cp_policy_dev g_chrg_list;
|
||||
extern const struct mmi_chrg_dev_ops dev_ops[];
|
||||
|
|
|
|||
|
|
@ -37,14 +37,22 @@
|
|||
#include <linux/power_supply.h>
|
||||
#include "mmi_charger_core.h"
|
||||
#include "mmi_charger_core_iio.h"
|
||||
|
||||
static int cp_enable_charging(struct mmi_charger_device *chrg, bool en)
|
||||
{
|
||||
int rc;
|
||||
struct mmi_charger_manager *chip = dev_get_drvdata(&chrg->dev);
|
||||
static struct power_supply *charger_psy;
|
||||
union power_supply_propval prop = {0,};
|
||||
|
||||
if (!chip)
|
||||
return -ENODEV;
|
||||
|
||||
if (!charger_psy)
|
||||
charger_psy = power_supply_get_by_name("charger");
|
||||
if (!charger_psy)
|
||||
return -ENODEV;
|
||||
|
||||
rc = mmi_charger_write_iio_chan(chip, CP_ENABLE, en);
|
||||
|
||||
if (!rc) {
|
||||
|
|
@ -56,6 +64,17 @@ static int cp_enable_charging(struct mmi_charger_device *chrg, bool en)
|
|||
if(rc)
|
||||
chrg_dev_info(chrg, "%s, enable termination fail\n",__func__);
|
||||
|
||||
if(chrg->charger_enabled) {
|
||||
prop.intval = CP_ENABLED_MAIN_INPUT_LIMIT;
|
||||
}else {
|
||||
prop.intval = CP_DISABLED_MAIN_INPUT_LIMIT;
|
||||
}
|
||||
|
||||
rc = power_supply_set_property(charger_psy,
|
||||
POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT, &prop);
|
||||
if(rc)
|
||||
chrg_dev_info(chrg, "%s, set main charger input limit fail\n",__func__);
|
||||
|
||||
chrg_dev_info(chrg, "%s end, en:%d\n",__func__,en);
|
||||
return rc;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ static int qpnp_pmic_update_charger_status(struct mmi_charger_device *chrg)
|
|||
rc = power_supply_get_property(cp_psy,
|
||||
POWER_SUPPLY_PROP_CURRENT_NOW, &prop);
|
||||
if (!rc)
|
||||
chrg->charger_data.ibus_curr = 100000;
|
||||
chrg->charger_data.ibus_curr = CP_ENABLED_MAIN_INPUT_LIMIT;
|
||||
|
||||
rc = power_supply_get_property(usb_psy,
|
||||
POWER_SUPPLY_PROP_PRESENT, &prop);
|
||||
|
|
|
|||
Loading…
Reference in a new issue