Loading drivers/power/supply/qcom/qpnp-smb5.c +4 −1 Original line number Original line Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only /* /* * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved. * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. */ */ #include <linux/debugfs.h> #include <linux/debugfs.h> Loading Loading @@ -463,6 +463,9 @@ static int smb5_parse_dt_misc(struct smb5 *chip, struct device_node *node) chg->sw_jeita_enabled = of_property_read_bool(node, chg->sw_jeita_enabled = of_property_read_bool(node, "qcom,sw-jeita-enable"); "qcom,sw-jeita-enable"); chg->jeita_arb_enable = of_property_read_bool(node, "qcom,jeita-arb-enable"); chg->pd_not_supported = chg->pd_not_supported || chg->pd_not_supported = chg->pd_not_supported || of_property_read_bool(node, "qcom,usb-pd-disable"); of_property_read_bool(node, "qcom,usb-pd-disable"); Loading drivers/power/supply/qcom/smb5-lib.c +18 −6 Original line number Original line Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only /* /* * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved. * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. */ */ #include <linux/device.h> #include <linux/device.h> Loading Loading @@ -5087,7 +5087,9 @@ static void smblib_eval_chg_termination(struct smb_charger *chg, u8 batt_status) * battery. Trigger the charge termination WA once charging is completed * battery. Trigger the charge termination WA once charging is completed * to prevent overcharing. * to prevent overcharing. */ */ if ((batt_status == TERMINATE_CHARGE) && (pval.intval == 100)) { if ((batt_status == TERMINATE_CHARGE) && (pval.intval == 100) && (ktime_to_ms(alarm_expires_remaining(/* alarm not pending */ &chg->chg_termination_alarm)) <= 0)) { chg->cc_soc_ref = 0; chg->cc_soc_ref = 0; chg->last_cc_soc = 0; chg->last_cc_soc = 0; chg->term_vbat_uv = 0; chg->term_vbat_uv = 0; Loading Loading @@ -7474,6 +7476,7 @@ static void smblib_chg_termination_work(struct work_struct *work) chg_termination_work); chg_termination_work); int rc, input_present, delay = CHG_TERM_WA_ENTRY_DELAY_MS; int rc, input_present, delay = CHG_TERM_WA_ENTRY_DELAY_MS; int vbat_now_uv, max_fv_uv; int vbat_now_uv, max_fv_uv; u8 stat = 0; /* /* * Hold awake votable to prevent pm_relax being called prior to * Hold awake votable to prevent pm_relax being called prior to Loading @@ -7488,9 +7491,18 @@ static void smblib_chg_termination_work(struct work_struct *work) rc = smblib_get_prop_from_bms(chg, rc = smblib_get_prop_from_bms(chg, POWER_SUPPLY_PROP_REAL_CAPACITY, &pval); POWER_SUPPLY_PROP_REAL_CAPACITY, &pval); if ((rc < 0) || (pval.intval < 100)) { if ((rc < 0) || (pval.intval < 100)) { vote(chg->usb_icl_votable, CHG_TERMINATION_VOTER, false, 0); rc = smblib_read(chg, BATTERY_CHARGER_STATUS_1_REG, &stat); vote(chg->dc_suspend_votable, CHG_TERMINATION_VOTER, false, 0); if (rc < 0) goto out; goto out; /* check we are not in termination to exit the WA */ if ((stat & BATTERY_CHARGER_STATUS_MASK) != TERMINATE_CHARGE) { vote(chg->usb_icl_votable, CHG_TERMINATION_VOTER, false, 0); vote(chg->dc_suspend_votable, CHG_TERMINATION_VOTER, false, 0); goto out; } } } /* Get the battery float voltage */ /* Get the battery float voltage */ Loading Loading @@ -8161,7 +8173,7 @@ int smblib_init(struct smb_charger *chg) } } rc = qcom_step_chg_init(chg->dev, chg->step_chg_enabled, rc = qcom_step_chg_init(chg->dev, chg->step_chg_enabled, chg->sw_jeita_enabled, false); chg->sw_jeita_enabled, chg->jeita_arb_enable); if (rc < 0) { if (rc < 0) { smblib_err(chg, "Couldn't init qcom_step_chg_init rc=%d\n", smblib_err(chg, "Couldn't init qcom_step_chg_init rc=%d\n", rc); rc); Loading drivers/power/supply/qcom/smb5-lib.h +2 −1 Original line number Original line Diff line number Diff line /* SPDX-License-Identifier: GPL-2.0 */ /* SPDX-License-Identifier: GPL-2.0 */ /* /* * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved. * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. */ */ #ifndef __SMB5_CHARGER_H #ifndef __SMB5_CHARGER_H Loading Loading @@ -510,6 +510,7 @@ struct smb_charger { int fake_batt_status; int fake_batt_status; bool step_chg_enabled; bool step_chg_enabled; bool sw_jeita_enabled; bool sw_jeita_enabled; bool jeita_arb_enable; bool typec_legacy_use_rp_icl; bool typec_legacy_use_rp_icl; bool is_hdc; bool is_hdc; bool chg_done; bool chg_done; Loading Loading
drivers/power/supply/qcom/qpnp-smb5.c +4 −1 Original line number Original line Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only /* /* * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved. * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. */ */ #include <linux/debugfs.h> #include <linux/debugfs.h> Loading Loading @@ -463,6 +463,9 @@ static int smb5_parse_dt_misc(struct smb5 *chip, struct device_node *node) chg->sw_jeita_enabled = of_property_read_bool(node, chg->sw_jeita_enabled = of_property_read_bool(node, "qcom,sw-jeita-enable"); "qcom,sw-jeita-enable"); chg->jeita_arb_enable = of_property_read_bool(node, "qcom,jeita-arb-enable"); chg->pd_not_supported = chg->pd_not_supported || chg->pd_not_supported = chg->pd_not_supported || of_property_read_bool(node, "qcom,usb-pd-disable"); of_property_read_bool(node, "qcom,usb-pd-disable"); Loading
drivers/power/supply/qcom/smb5-lib.c +18 −6 Original line number Original line Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only /* /* * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved. * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. */ */ #include <linux/device.h> #include <linux/device.h> Loading Loading @@ -5087,7 +5087,9 @@ static void smblib_eval_chg_termination(struct smb_charger *chg, u8 batt_status) * battery. Trigger the charge termination WA once charging is completed * battery. Trigger the charge termination WA once charging is completed * to prevent overcharing. * to prevent overcharing. */ */ if ((batt_status == TERMINATE_CHARGE) && (pval.intval == 100)) { if ((batt_status == TERMINATE_CHARGE) && (pval.intval == 100) && (ktime_to_ms(alarm_expires_remaining(/* alarm not pending */ &chg->chg_termination_alarm)) <= 0)) { chg->cc_soc_ref = 0; chg->cc_soc_ref = 0; chg->last_cc_soc = 0; chg->last_cc_soc = 0; chg->term_vbat_uv = 0; chg->term_vbat_uv = 0; Loading Loading @@ -7474,6 +7476,7 @@ static void smblib_chg_termination_work(struct work_struct *work) chg_termination_work); chg_termination_work); int rc, input_present, delay = CHG_TERM_WA_ENTRY_DELAY_MS; int rc, input_present, delay = CHG_TERM_WA_ENTRY_DELAY_MS; int vbat_now_uv, max_fv_uv; int vbat_now_uv, max_fv_uv; u8 stat = 0; /* /* * Hold awake votable to prevent pm_relax being called prior to * Hold awake votable to prevent pm_relax being called prior to Loading @@ -7488,9 +7491,18 @@ static void smblib_chg_termination_work(struct work_struct *work) rc = smblib_get_prop_from_bms(chg, rc = smblib_get_prop_from_bms(chg, POWER_SUPPLY_PROP_REAL_CAPACITY, &pval); POWER_SUPPLY_PROP_REAL_CAPACITY, &pval); if ((rc < 0) || (pval.intval < 100)) { if ((rc < 0) || (pval.intval < 100)) { vote(chg->usb_icl_votable, CHG_TERMINATION_VOTER, false, 0); rc = smblib_read(chg, BATTERY_CHARGER_STATUS_1_REG, &stat); vote(chg->dc_suspend_votable, CHG_TERMINATION_VOTER, false, 0); if (rc < 0) goto out; goto out; /* check we are not in termination to exit the WA */ if ((stat & BATTERY_CHARGER_STATUS_MASK) != TERMINATE_CHARGE) { vote(chg->usb_icl_votable, CHG_TERMINATION_VOTER, false, 0); vote(chg->dc_suspend_votable, CHG_TERMINATION_VOTER, false, 0); goto out; } } } /* Get the battery float voltage */ /* Get the battery float voltage */ Loading Loading @@ -8161,7 +8173,7 @@ int smblib_init(struct smb_charger *chg) } } rc = qcom_step_chg_init(chg->dev, chg->step_chg_enabled, rc = qcom_step_chg_init(chg->dev, chg->step_chg_enabled, chg->sw_jeita_enabled, false); chg->sw_jeita_enabled, chg->jeita_arb_enable); if (rc < 0) { if (rc < 0) { smblib_err(chg, "Couldn't init qcom_step_chg_init rc=%d\n", smblib_err(chg, "Couldn't init qcom_step_chg_init rc=%d\n", rc); rc); Loading
drivers/power/supply/qcom/smb5-lib.h +2 −1 Original line number Original line Diff line number Diff line /* SPDX-License-Identifier: GPL-2.0 */ /* SPDX-License-Identifier: GPL-2.0 */ /* /* * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved. * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. */ */ #ifndef __SMB5_CHARGER_H #ifndef __SMB5_CHARGER_H Loading Loading @@ -510,6 +510,7 @@ struct smb_charger { int fake_batt_status; int fake_batt_status; bool step_chg_enabled; bool step_chg_enabled; bool sw_jeita_enabled; bool sw_jeita_enabled; bool jeita_arb_enable; bool typec_legacy_use_rp_icl; bool typec_legacy_use_rp_icl; bool is_hdc; bool is_hdc; bool chg_done; bool chg_done; Loading