Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b2a6e0ff authored by Subbaraman Narayanamurthy's avatar Subbaraman Narayanamurthy
Browse files

power: qcom: step-chg-jeita: Add support to read properties from bms



Currently, step charging and SW JEITA algorithms always read the
properties from battery power supply to determine moving across
ranges. Add a parameter "use_bms" to read the properties from
bms power supply.

Change-Id: I2a086a16282039866f31d06dbfed06e76316a054
Signed-off-by: default avatarSubbaraman Narayanamurthy <subbaram@codeaurora.org>
parent 19f8f87f
Loading
Loading
Loading
Loading
+15 −5
Original line number Original line Diff line number Diff line
@@ -453,8 +453,13 @@ static int handle_step_chg_config(struct step_chg_info *chip)
		goto update_time;
		goto update_time;
	}
	}


	if (chip->step_chg_config->param.use_bms)
		rc = power_supply_get_property(chip->bms_psy,
				chip->step_chg_config->param.psy_prop, &pval);
	else
		rc = power_supply_get_property(chip->batt_psy,
		rc = power_supply_get_property(chip->batt_psy,
				chip->step_chg_config->param.psy_prop, &pval);
				chip->step_chg_config->param.psy_prop, &pval);

	if (rc < 0) {
	if (rc < 0) {
		pr_err("Couldn't read %s property rc=%d\n",
		pr_err("Couldn't read %s property rc=%d\n",
			chip->step_chg_config->param.prop_name, rc);
			chip->step_chg_config->param.prop_name, rc);
@@ -521,8 +526,13 @@ static int handle_jeita(struct step_chg_info *chip)
	if (elapsed_us < STEP_CHG_HYSTERISIS_DELAY_US)
	if (elapsed_us < STEP_CHG_HYSTERISIS_DELAY_US)
		goto reschedule;
		goto reschedule;


	if (chip->jeita_fcc_config->param.use_bms)
		rc = power_supply_get_property(chip->bms_psy,
				chip->jeita_fcc_config->param.psy_prop, &pval);
	else
		rc = power_supply_get_property(chip->batt_psy,
		rc = power_supply_get_property(chip->batt_psy,
				chip->jeita_fcc_config->param.psy_prop, &pval);
				chip->jeita_fcc_config->param.psy_prop, &pval);

	if (rc < 0) {
	if (rc < 0) {
		pr_err("Couldn't read %s property rc=%d\n",
		pr_err("Couldn't read %s property rc=%d\n",
				chip->jeita_fcc_config->param.prop_name, rc);
				chip->jeita_fcc_config->param.prop_name, rc);
@@ -650,7 +660,7 @@ static void status_change_work(struct work_struct *work)
	int reschedule_step_work_us = 0;
	int reschedule_step_work_us = 0;
	union power_supply_propval prop = {0, };
	union power_supply_propval prop = {0, };


	if (!is_batt_available(chip))
	if (!is_batt_available(chip) || !is_bms_available(chip))
		goto exit_work;
		goto exit_work;


	handle_battery_insertion(chip);
	handle_battery_insertion(chip);
+1 −0
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@ struct step_chg_jeita_param {
	u32			psy_prop;
	u32			psy_prop;
	char			*prop_name;
	char			*prop_name;
	int			hysteresis;
	int			hysteresis;
	bool			use_bms;
};
};


struct range_data {
struct range_data {