Loading drivers/power/qcom-charger/qpnp-smb2.c +5 −1 Original line number Diff line number Diff line Loading @@ -588,6 +588,7 @@ static enum power_supply_property smb2_batt_props[] = { POWER_SUPPLY_PROP_SYSTEM_TEMP_LEVEL, POWER_SUPPLY_PROP_CHARGER_TEMP, POWER_SUPPLY_PROP_CHARGER_TEMP_MAX, POWER_SUPPLY_PROP_INPUT_CURRENT_LIMITED, }; static int smb2_batt_get_prop(struct power_supply *psy, Loading Loading @@ -625,6 +626,9 @@ static int smb2_batt_get_prop(struct power_supply *psy, case POWER_SUPPLY_PROP_CHARGER_TEMP_MAX: rc = smblib_get_prop_charger_temp_max(chg, val); break; case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMITED: rc = smblib_get_prop_input_current_limited(chg, val); break; default: pr_err("batt power supply prop %d not supported\n", psp); return -EINVAL; Loading Loading @@ -1121,7 +1125,7 @@ static struct smb2_irq_info smb2_irqs[] = { { "wdog-bark", NULL }, { "aicl-fail", smblib_handle_debug }, { "aicl-done", smblib_handle_debug }, { "high-duty-cycle", smblib_handle_debug }, { "high-duty-cycle", smblib_handle_high_duty_cycle, true }, { "input-current-limiting", smblib_handle_debug }, { "temperature-change", smblib_handle_debug }, { "switcher-power-ok", smblib_handle_debug }, Loading drivers/power/qcom-charger/smb-lib.c +35 −0 Original line number Diff line number Diff line Loading @@ -988,6 +988,21 @@ int smblib_get_prop_system_temp_level(struct smb_charger *chg, return 0; } int smblib_get_prop_input_current_limited(struct smb_charger *chg, union power_supply_propval *val) { u8 stat; int rc; rc = smblib_read(chg, AICL_STATUS_REG, &stat); if (rc < 0) { dev_err(chg->dev, "Couldn't read AICL_STATUS rc=%d\n", rc); return rc; } val->intval = (stat & SOFT_ILIMIT_BIT) || chg->is_hdc; return 0; } /*********************** * BATTERY PSY SETTERS * ***********************/ Loading Loading @@ -1965,6 +1980,17 @@ irqreturn_t smblib_handle_usb_typec_change(int irq, void *data) return IRQ_HANDLED; } irqreturn_t smblib_handle_high_duty_cycle(int irq, void *data) { struct smb_irq_data *irq_data = data; struct smb_charger *chg = irq_data->parent_data; chg->is_hdc = true; schedule_delayed_work(&chg->clear_hdc_work, msecs_to_jiffies(60)); return IRQ_HANDLED; } /*************** * Work Queues * ***************/ Loading Loading @@ -2054,6 +2080,14 @@ done: vote(chg->awake_votable, PL_VOTER, false, 0); } static void clear_hdc_work(struct work_struct *work) { struct smb_charger *chg = container_of(work, struct smb_charger, clear_hdc_work.work); chg->is_hdc = 0; } static int smblib_create_votables(struct smb_charger *chg) { int rc = 0; Loading Loading @@ -2194,6 +2228,7 @@ int smblib_init(struct smb_charger *chg) INIT_DELAYED_WORK(&chg->hvdcp_detect_work, smblib_hvdcp_detect_work); INIT_DELAYED_WORK(&chg->pl_taper_work, smblib_pl_taper_work); INIT_DELAYED_WORK(&chg->step_soc_req_work, step_soc_req_work); INIT_DELAYED_WORK(&chg->clear_hdc_work, clear_hdc_work); chg->fake_capacity = -EINVAL; switch (chg->mode) { Loading drivers/power/qcom-charger/smb-lib.h +5 −0 Original line number Diff line number Diff line Loading @@ -145,6 +145,7 @@ struct smb_charger { struct delayed_work ps_change_timeout_work; struct delayed_work pl_taper_work; struct delayed_work step_soc_req_work; struct delayed_work clear_hdc_work; /* cached status */ int voltage_min_uv; Loading @@ -159,6 +160,7 @@ struct smb_charger { int fake_capacity; bool step_chg_enabled; bool is_hdc; }; int smblib_read(struct smb_charger *chg, u16 addr, u8 *val); Loading Loading @@ -202,6 +204,7 @@ irqreturn_t smblib_handle_usb_plugin(int irq, void *data); irqreturn_t smblib_handle_usb_source_change(int irq, void *data); irqreturn_t smblib_handle_icl_change(int irq, void *data); irqreturn_t smblib_handle_usb_typec_change(int irq, void *data); irqreturn_t smblib_handle_high_duty_cycle(int irq, void *data); int smblib_get_prop_input_suspend(struct smb_charger *chg, union power_supply_propval *val); Loading @@ -217,6 +220,8 @@ int smblib_get_prop_batt_health(struct smb_charger *chg, union power_supply_propval *val); int smblib_get_prop_system_temp_level(struct smb_charger *chg, union power_supply_propval *val); int smblib_get_prop_input_current_limited(struct smb_charger *chg, union power_supply_propval *val); int smblib_set_prop_input_suspend(struct smb_charger *chg, const union power_supply_propval *val); Loading Loading
drivers/power/qcom-charger/qpnp-smb2.c +5 −1 Original line number Diff line number Diff line Loading @@ -588,6 +588,7 @@ static enum power_supply_property smb2_batt_props[] = { POWER_SUPPLY_PROP_SYSTEM_TEMP_LEVEL, POWER_SUPPLY_PROP_CHARGER_TEMP, POWER_SUPPLY_PROP_CHARGER_TEMP_MAX, POWER_SUPPLY_PROP_INPUT_CURRENT_LIMITED, }; static int smb2_batt_get_prop(struct power_supply *psy, Loading Loading @@ -625,6 +626,9 @@ static int smb2_batt_get_prop(struct power_supply *psy, case POWER_SUPPLY_PROP_CHARGER_TEMP_MAX: rc = smblib_get_prop_charger_temp_max(chg, val); break; case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMITED: rc = smblib_get_prop_input_current_limited(chg, val); break; default: pr_err("batt power supply prop %d not supported\n", psp); return -EINVAL; Loading Loading @@ -1121,7 +1125,7 @@ static struct smb2_irq_info smb2_irqs[] = { { "wdog-bark", NULL }, { "aicl-fail", smblib_handle_debug }, { "aicl-done", smblib_handle_debug }, { "high-duty-cycle", smblib_handle_debug }, { "high-duty-cycle", smblib_handle_high_duty_cycle, true }, { "input-current-limiting", smblib_handle_debug }, { "temperature-change", smblib_handle_debug }, { "switcher-power-ok", smblib_handle_debug }, Loading
drivers/power/qcom-charger/smb-lib.c +35 −0 Original line number Diff line number Diff line Loading @@ -988,6 +988,21 @@ int smblib_get_prop_system_temp_level(struct smb_charger *chg, return 0; } int smblib_get_prop_input_current_limited(struct smb_charger *chg, union power_supply_propval *val) { u8 stat; int rc; rc = smblib_read(chg, AICL_STATUS_REG, &stat); if (rc < 0) { dev_err(chg->dev, "Couldn't read AICL_STATUS rc=%d\n", rc); return rc; } val->intval = (stat & SOFT_ILIMIT_BIT) || chg->is_hdc; return 0; } /*********************** * BATTERY PSY SETTERS * ***********************/ Loading Loading @@ -1965,6 +1980,17 @@ irqreturn_t smblib_handle_usb_typec_change(int irq, void *data) return IRQ_HANDLED; } irqreturn_t smblib_handle_high_duty_cycle(int irq, void *data) { struct smb_irq_data *irq_data = data; struct smb_charger *chg = irq_data->parent_data; chg->is_hdc = true; schedule_delayed_work(&chg->clear_hdc_work, msecs_to_jiffies(60)); return IRQ_HANDLED; } /*************** * Work Queues * ***************/ Loading Loading @@ -2054,6 +2080,14 @@ done: vote(chg->awake_votable, PL_VOTER, false, 0); } static void clear_hdc_work(struct work_struct *work) { struct smb_charger *chg = container_of(work, struct smb_charger, clear_hdc_work.work); chg->is_hdc = 0; } static int smblib_create_votables(struct smb_charger *chg) { int rc = 0; Loading Loading @@ -2194,6 +2228,7 @@ int smblib_init(struct smb_charger *chg) INIT_DELAYED_WORK(&chg->hvdcp_detect_work, smblib_hvdcp_detect_work); INIT_DELAYED_WORK(&chg->pl_taper_work, smblib_pl_taper_work); INIT_DELAYED_WORK(&chg->step_soc_req_work, step_soc_req_work); INIT_DELAYED_WORK(&chg->clear_hdc_work, clear_hdc_work); chg->fake_capacity = -EINVAL; switch (chg->mode) { Loading
drivers/power/qcom-charger/smb-lib.h +5 −0 Original line number Diff line number Diff line Loading @@ -145,6 +145,7 @@ struct smb_charger { struct delayed_work ps_change_timeout_work; struct delayed_work pl_taper_work; struct delayed_work step_soc_req_work; struct delayed_work clear_hdc_work; /* cached status */ int voltage_min_uv; Loading @@ -159,6 +160,7 @@ struct smb_charger { int fake_capacity; bool step_chg_enabled; bool is_hdc; }; int smblib_read(struct smb_charger *chg, u16 addr, u8 *val); Loading Loading @@ -202,6 +204,7 @@ irqreturn_t smblib_handle_usb_plugin(int irq, void *data); irqreturn_t smblib_handle_usb_source_change(int irq, void *data); irqreturn_t smblib_handle_icl_change(int irq, void *data); irqreturn_t smblib_handle_usb_typec_change(int irq, void *data); irqreturn_t smblib_handle_high_duty_cycle(int irq, void *data); int smblib_get_prop_input_suspend(struct smb_charger *chg, union power_supply_propval *val); Loading @@ -217,6 +220,8 @@ int smblib_get_prop_batt_health(struct smb_charger *chg, union power_supply_propval *val); int smblib_get_prop_system_temp_level(struct smb_charger *chg, union power_supply_propval *val); int smblib_get_prop_input_current_limited(struct smb_charger *chg, union power_supply_propval *val); int smblib_set_prop_input_suspend(struct smb_charger *chg, const union power_supply_propval *val); Loading