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

Commit 70a7fbc3 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: fg-util: Update fg_get_battery_type"

parents 9ee89464 0c59c634
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -417,7 +417,6 @@ struct fg_dev {
	int			last_msoc;
	int			last_recharge_volt_mv;
	bool			profile_available;
	bool			profile_loaded;
	enum prof_load_status	profile_load_status;
	bool			battery_missing;
	bool			fg_restarting;
+17 −10
Original line number Diff line number Diff line
@@ -886,19 +886,26 @@ int fg_get_msoc(struct fg_dev *fg, int *msoc)
#define SKIP_BATT_TYPE		"Skipped loading battery"
const char *fg_get_battery_type(struct fg_dev *fg)
{
	if (fg->battery_missing ||
		fg->profile_load_status == PROFILE_MISSING)
	switch (fg->profile_load_status) {
	case PROFILE_MISSING:
		return DEFAULT_BATT_TYPE;
	case PROFILE_SKIPPED:
		return SKIP_BATT_TYPE;
	case PROFILE_LOADED:
		if (fg->bp.batt_type_str)
			return fg->bp.batt_type_str;
		break;
	case PROFILE_NOT_LOADED:
		return MISSING_BATT_TYPE;
	default:
		break;
	};

	if (fg->profile_load_status == PROFILE_SKIPPED)
		return SKIP_BATT_TYPE;
	if (fg->battery_missing)
		return MISSING_BATT_TYPE;

	if (fg->bp.batt_type_str) {
		if (fg->profile_loaded)
			return fg->bp.batt_type_str;
		else if (fg->profile_available)
	if (fg->profile_available)
		return LOADING_BATT_TYPE;
	}

	return DEFAULT_BATT_TYPE;
}
+0 −4
Original line number Diff line number Diff line
@@ -2560,9 +2560,6 @@ static void profile_load_work(struct work_struct *work)
	batt_psy_initialized(fg);
	fg_notify_charger(fg);

	if (fg->profile_load_status == PROFILE_LOADED)
		fg->profile_loaded = true;

	fg_dbg(fg, FG_STATUS, "profile loaded successfully");
out:
	fg->soc_reporting_ready = true;
@@ -3927,7 +3924,6 @@ static irqreturn_t fg_batt_missing_irq_handler(int irq, void *data)

	if (fg->battery_missing) {
		fg->profile_available = false;
		fg->profile_loaded = false;
		fg->profile_load_status = PROFILE_NOT_LOADED;
		fg->soc_reporting_ready = false;
		fg->batt_id_ohms = -EINVAL;
+0 −4
Original line number Diff line number Diff line
@@ -1031,9 +1031,6 @@ static void profile_load_work(struct work_struct *work)
	batt_psy_initialized(fg);
	fg_notify_charger(fg);

	if (fg->profile_load_status == PROFILE_LOADED)
		fg->profile_loaded = true;

	fg_dbg(fg, FG_STATUS, "profile loaded successfully");
out:
	fg->soc_reporting_ready = true;
@@ -1284,7 +1281,6 @@ static irqreturn_t fg_batt_missing_irq_handler(int irq, void *data)

	if (fg->battery_missing) {
		fg->profile_available = false;
		fg->profile_loaded = false;
		fg->profile_load_status = PROFILE_NOT_LOADED;
		fg->soc_reporting_ready = false;
		fg->batt_id_ohms = -EINVAL;