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

Commit 166e851c authored by Subbaraman Narayanamurthy's avatar Subbaraman Narayanamurthy
Browse files

qpnp-smb2: smb-lib: add charge_done property



Currently, charging status is shown as full for both the charge
termination and inhibit cases. However, there is a need to know
when the charge termination really happens.

Add charge_done property to qpnp-smb2 driver so that the clients
can read that property to distinguish termination and inhibit.

Change-Id: If2bd750af412adf1eea7b913caed9a3eb3b763db
Signed-off-by: default avatarSubbaraman Narayanamurthy <subbaram@codeaurora.org>
parent 40af50ac
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -605,6 +605,7 @@ static enum power_supply_property smb2_batt_props[] = {
	POWER_SUPPLY_PROP_TECHNOLOGY,
	POWER_SUPPLY_PROP_STEP_CHARGING_ENABLED,
	POWER_SUPPLY_PROP_STEP_CHARGING_STEP,
	POWER_SUPPLY_PROP_CHARGE_DONE,
};

static int smb2_batt_get_prop(struct power_supply *psy,
@@ -662,6 +663,9 @@ static int smb2_batt_get_prop(struct power_supply *psy,
	case POWER_SUPPLY_PROP_TECHNOLOGY:
		val->intval = POWER_SUPPLY_TECHNOLOGY_LION;
		break;
	case POWER_SUPPLY_PROP_CHARGE_DONE:
		val->intval = chg->chg_done;
		break;
	default:
		pr_err("batt power supply prop %d not supported\n", psp);
		return -EINVAL;
@@ -692,6 +696,9 @@ 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;
	}
+4 −1
Original line number Diff line number Diff line
@@ -888,7 +888,6 @@ int smblib_get_prop_batt_status(struct smb_charger *chg,
	u8 stat;
	int rc;


	rc = smblib_get_prop_usb_online(chg, &pval);
	if (rc < 0) {
		dev_err(chg->dev, "Couldn't get usb online property rc=%d\n",
@@ -1717,6 +1716,7 @@ 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;
@@ -1733,6 +1733,9 @@ 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;
}
+1 −0
Original line number Diff line number Diff line
@@ -163,6 +163,7 @@ struct smb_charger {

	bool			step_chg_enabled;
	bool			is_hdc;
	bool			chg_done;

	/* workaround flag */
	u32			wa_flags;