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

Commit c3ab26fb authored by Anirudh Ghayal's avatar Anirudh Ghayal
Browse files

power: qpnp-qg: Update the error return value



The power-supply framework uses -ENODEV to identify a missing
battery, use the same in the Qgauge driver.

While at it, remove a couple of unnecessary error prints.

Change-Id: Ife1972a4d8e2bdbf482c7c1c7cb3a6f8461d5a45
Signed-off-by: default avatarAnirudh Ghayal <aghayal@codeaurora.org>
parent abc330f5
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -398,10 +398,8 @@ int lookup_soc_ocv(u32 *soc, u32 ocv_uv, int batt_temp, bool charging)
{
	u8 table_index = charging ? TABLE_SOC_OCV1 : TABLE_SOC_OCV2;

	if (!the_battery || !the_battery->profile) {
		pr_err("Battery profile not loaded\n");
	if (!the_battery || !the_battery->profile)
		return -ENODEV;
	}

	*soc = interpolate_soc(&the_battery->profile[table_index],
				batt_temp, UV_TO_DECIUV(ocv_uv));
@@ -416,10 +414,8 @@ int qg_get_nominal_capacity(u32 *nom_cap_uah, int batt_temp, bool charging)
	u8 table_index = charging ? TABLE_FCC1 : TABLE_FCC2;
	u32 fcc_mah;

	if (!the_battery || !the_battery->profile) {
		pr_err("Battery profile not loaded\n");
	if (!the_battery || !the_battery->profile)
		return -ENODEV;
	}

	fcc_mah = interpolate_single_row_lut(
				&the_battery->profile[table_index],
+6 −6
Original line number Diff line number Diff line
@@ -1380,7 +1380,7 @@ static int qg_get_learned_capacity(void *data, int64_t *learned_cap_uah)
		return -ENODEV;

	if (chip->battery_missing || !chip->profile_loaded)
		return -EPERM;
		return -ENODEV;

	rc = qg_sdam_multibyte_read(QG_SDAM_LEARNED_CAPACITY_OFFSET,
					(u8 *)&cc_mah, 2);
@@ -1405,7 +1405,7 @@ static int qg_store_learned_capacity(void *data, int64_t learned_cap_uah)
		return -ENODEV;

	if (chip->battery_missing || !learned_cap_uah)
		return -EPERM;
		return -ENODEV;

	cc_mah = div64_s64(learned_cap_uah, 1000);
	rc = qg_sdam_multibyte_write(QG_SDAM_LEARNED_CAPACITY_OFFSET,
@@ -1445,7 +1445,7 @@ static int qg_restore_cycle_count(void *data, u16 *buf, int length)
		return -ENODEV;

	if (chip->battery_missing || !chip->profile_loaded)
		return -EPERM;
		return -ENODEV;

	if (!buf || length > BUCKET_COUNT)
		return -EINVAL;
@@ -1473,7 +1473,7 @@ static int qg_store_cycle_count(void *data, u16 *buf, int id, int length)
		return -ENODEV;

	if (chip->battery_missing || !chip->profile_loaded)
		return -EPERM;
		return -ENODEV;

	if (!buf || length > BUCKET_COUNT * 2 || id < 0 ||
		id > BUCKET_COUNT - 1 ||
@@ -1615,7 +1615,7 @@ static int qg_get_ttf_param(void *data, enum ttf_param param, int *val)
		return -ENODEV;

	if (chip->battery_missing || !chip->profile_loaded)
		return -EPERM;
		return -ENODEV;

	switch (param) {
	case TTF_MSOC:
@@ -1678,7 +1678,7 @@ static int qg_ttf_awake_voter(void *data, bool val)
		return -ENODEV;

	if (chip->battery_missing || !chip->profile_loaded)
		return -EPERM;
		return -ENODEV;

	vote(chip->awake_votable, TTF_AWAKE_VOTER, val, 0);