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

Commit f024a86a authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "qpnp-smb2: smb-lib: update reading charge_done property"

parents 91034055 c7efbfff
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -687,7 +687,7 @@ static int smb2_batt_get_prop(struct power_supply *psy,
		val->intval = POWER_SUPPLY_TECHNOLOGY_LION;
		break;
	case POWER_SUPPLY_PROP_CHARGE_DONE:
		val->intval = chg->chg_done;
		rc = smblib_get_prop_batt_charge_done(chg, val);
		break;
	default:
		pr_err("batt power supply prop %d not supported\n", psp);
@@ -719,9 +719,6 @@ static int smb2_batt_set_prop(struct power_supply *psy,
	case POWER_SUPPLY_PROP_CAPACITY:
		rc = smblib_set_prop_batt_capacity(chg, val);
		break;
	case POWER_SUPPLY_PROP_CHARGE_DONE:
		chg->chg_done = val->intval;
		break;
	default:
		rc = -EINVAL;
	}
+18 −4
Original line number Diff line number Diff line
@@ -1165,6 +1165,24 @@ int smblib_get_prop_step_chg_step(struct smb_charger *chg,
	return rc;
}

int smblib_get_prop_batt_charge_done(struct smb_charger *chg,
					union power_supply_propval *val)
{
	int rc;
	u8 stat;

	rc = smblib_read(chg, BATTERY_CHARGER_STATUS_1_REG, &stat);
	if (rc < 0) {
		dev_err(chg->dev, "Couldn't read BATTERY_CHARGER_STATUS_1 rc=%d\n",
			rc);
		return rc;
	}

	stat = stat & BATTERY_CHARGER_STATUS_MASK;
	val->intval = (stat == TERMINATE_CHARGE);
	return 0;
}

/***********************
 * BATTERY PSY SETTERS *
 ***********************/
@@ -1809,7 +1827,6 @@ static void smblib_pl_handle_chg_state_change(struct smb_charger *chg, u8 stat)

irqreturn_t smblib_handle_chg_state_change(int irq, void *data)
{
	union power_supply_propval pval = {0, };
	struct smb_irq_data *irq_data = data;
	struct smb_charger *chg = irq_data->parent_data;
	u8 stat;
@@ -1826,9 +1843,6 @@ irqreturn_t smblib_handle_chg_state_change(int irq, void *data)

	stat = stat & BATTERY_CHARGER_STATUS_MASK;
	smblib_pl_handle_chg_state_change(chg, stat);
	pval.intval = (stat == TERMINATE_CHARGE);
	power_supply_set_property(chg->batt_psy, POWER_SUPPLY_PROP_CHARGE_DONE,
		&pval);
	power_supply_changed(chg->batt_psy);
	return IRQ_HANDLED;
}
+2 −0
Original line number Diff line number Diff line
@@ -234,6 +234,8 @@ int smblib_get_prop_batt_status(struct smb_charger *chg,
				union power_supply_propval *val);
int smblib_get_prop_batt_charge_type(struct smb_charger *chg,
				union power_supply_propval *val);
int smblib_get_prop_batt_charge_done(struct smb_charger *chg,
				union power_supply_propval *val);
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,