Loading drivers/power/supply/qcom/qpnp-smb5.c +15 −6 Original line number Diff line number Diff line Loading @@ -267,6 +267,7 @@ static int smb5_chg_config_init(struct smb5 *chip) } #define MICRO_1P5A 1500000 #define MICRO_1PA 1000000 #define MICRO_P1A 100000 #define OTG_DEFAULT_DEGLITCH_TIME_MS 50 #define MIN_WD_BARK_TIME 16 Loading Loading @@ -317,7 +318,8 @@ static int smb5_parse_dt(struct smb5 *chip) rc = of_property_read_u32(node, "qcom,otg-cl-ua", &chg->otg_cl_ua); if (rc < 0) chg->otg_cl_ua = MICRO_1P5A; chg->otg_cl_ua = (chip->chg.smb_version == PMI632_SUBTYPE) ? MICRO_1PA : MICRO_1P5A; if (of_find_property(node, "qcom,thermal-mitigation", &byte_len)) { chg->thermal_mitigation = devm_kzalloc(chg->dev, byte_len, Loading Loading @@ -1623,6 +1625,13 @@ static int smb5_init_hw(struct smb5 *chip) return rc; } /* set OTG current limit */ rc = smblib_set_charge_param(chg, &chg->param.otg_cl, chg->otg_cl_ua); if (rc < 0) { pr_err("Couldn't set otg current limit rc=%d\n", rc); return rc; } /* vote 0mA on usb_icl for non battery platforms */ vote(chg->usb_icl_votable, DEFAULT_VOTER, chip->dt.no_battery, 0); Loading Loading @@ -2386,16 +2395,16 @@ static int smb5_probe(struct platform_device *pdev) return -EINVAL; } rc = smb5_parse_dt(chip); rc = smb5_chg_config_init(chip); if (rc < 0) { pr_err("Couldn't parse device tree rc=%d\n", rc); if (rc != -EPROBE_DEFER) pr_err("Couldn't setup chg_config rc=%d\n", rc); return rc; } rc = smb5_chg_config_init(chip); rc = smb5_parse_dt(chip); if (rc < 0) { if (rc != -EPROBE_DEFER) pr_err("Couldn't setup chg_config rc=%d\n", rc); pr_err("Couldn't parse device tree rc=%d\n", rc); return rc; } Loading drivers/power/supply/qcom/smb5-lib.c +17 −0 Original line number Diff line number Diff line Loading @@ -472,6 +472,23 @@ static int smblib_set_adapter_allowance(struct smb_charger *chg, { int rc = 0; /* PMI632 only support max. 9V */ if (chg->smb_version == PMI632_SUBTYPE) { switch (allowed_voltage) { case USBIN_ADAPTER_ALLOW_12V: case USBIN_ADAPTER_ALLOW_9V_TO_12V: allowed_voltage = USBIN_ADAPTER_ALLOW_9V; break; case USBIN_ADAPTER_ALLOW_5V_OR_12V: case USBIN_ADAPTER_ALLOW_5V_OR_9V_TO_12V: allowed_voltage = USBIN_ADAPTER_ALLOW_5V_OR_9V; break; case USBIN_ADAPTER_ALLOW_5V_TO_12V: allowed_voltage = USBIN_ADAPTER_ALLOW_5V_TO_9V; break; } } rc = smblib_write(chg, USBIN_ADAPTER_ALLOW_CFG_REG, allowed_voltage); if (rc < 0) { smblib_err(chg, "Couldn't write 0x%02x to USBIN_ADAPTER_ALLOW_CFG rc=%d\n", Loading Loading
drivers/power/supply/qcom/qpnp-smb5.c +15 −6 Original line number Diff line number Diff line Loading @@ -267,6 +267,7 @@ static int smb5_chg_config_init(struct smb5 *chip) } #define MICRO_1P5A 1500000 #define MICRO_1PA 1000000 #define MICRO_P1A 100000 #define OTG_DEFAULT_DEGLITCH_TIME_MS 50 #define MIN_WD_BARK_TIME 16 Loading Loading @@ -317,7 +318,8 @@ static int smb5_parse_dt(struct smb5 *chip) rc = of_property_read_u32(node, "qcom,otg-cl-ua", &chg->otg_cl_ua); if (rc < 0) chg->otg_cl_ua = MICRO_1P5A; chg->otg_cl_ua = (chip->chg.smb_version == PMI632_SUBTYPE) ? MICRO_1PA : MICRO_1P5A; if (of_find_property(node, "qcom,thermal-mitigation", &byte_len)) { chg->thermal_mitigation = devm_kzalloc(chg->dev, byte_len, Loading Loading @@ -1623,6 +1625,13 @@ static int smb5_init_hw(struct smb5 *chip) return rc; } /* set OTG current limit */ rc = smblib_set_charge_param(chg, &chg->param.otg_cl, chg->otg_cl_ua); if (rc < 0) { pr_err("Couldn't set otg current limit rc=%d\n", rc); return rc; } /* vote 0mA on usb_icl for non battery platforms */ vote(chg->usb_icl_votable, DEFAULT_VOTER, chip->dt.no_battery, 0); Loading Loading @@ -2386,16 +2395,16 @@ static int smb5_probe(struct platform_device *pdev) return -EINVAL; } rc = smb5_parse_dt(chip); rc = smb5_chg_config_init(chip); if (rc < 0) { pr_err("Couldn't parse device tree rc=%d\n", rc); if (rc != -EPROBE_DEFER) pr_err("Couldn't setup chg_config rc=%d\n", rc); return rc; } rc = smb5_chg_config_init(chip); rc = smb5_parse_dt(chip); if (rc < 0) { if (rc != -EPROBE_DEFER) pr_err("Couldn't setup chg_config rc=%d\n", rc); pr_err("Couldn't parse device tree rc=%d\n", rc); return rc; } Loading
drivers/power/supply/qcom/smb5-lib.c +17 −0 Original line number Diff line number Diff line Loading @@ -472,6 +472,23 @@ static int smblib_set_adapter_allowance(struct smb_charger *chg, { int rc = 0; /* PMI632 only support max. 9V */ if (chg->smb_version == PMI632_SUBTYPE) { switch (allowed_voltage) { case USBIN_ADAPTER_ALLOW_12V: case USBIN_ADAPTER_ALLOW_9V_TO_12V: allowed_voltage = USBIN_ADAPTER_ALLOW_9V; break; case USBIN_ADAPTER_ALLOW_5V_OR_12V: case USBIN_ADAPTER_ALLOW_5V_OR_9V_TO_12V: allowed_voltage = USBIN_ADAPTER_ALLOW_5V_OR_9V; break; case USBIN_ADAPTER_ALLOW_5V_TO_12V: allowed_voltage = USBIN_ADAPTER_ALLOW_5V_TO_9V; break; } } rc = smblib_write(chg, USBIN_ADAPTER_ALLOW_CFG_REG, allowed_voltage); if (rc < 0) { smblib_err(chg, "Couldn't write 0x%02x to USBIN_ADAPTER_ALLOW_CFG rc=%d\n", Loading