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

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

Merge "smb-lib: smb138x-charger: add parallel current to parallel psy"

parents 1086876c 42d047fc
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -1749,6 +1749,22 @@ int smblib_set_prop_pd_active(struct smb_charger *chg,
	return rc;
}

/************************
 * PARALLEL PSY GETTERS *
 ************************/

int smblib_get_prop_slave_current_now(struct smb_charger *chg,
				      union power_supply_propval *pval)
{
	if (IS_ERR_OR_NULL(chg->iio.batt_i_chan))
		chg->iio.batt_i_chan = iio_channel_get(chg->dev, "batt_i");

	if (IS_ERR(chg->iio.batt_i_chan))
		return PTR_ERR(chg->iio.batt_i_chan);

	return iio_read_channel_processed(chg->iio.batt_i_chan, &pval->intval);
}

/**********************
 * INTERRUPT HANDLERS *
 **********************/
@@ -2440,6 +2456,8 @@ static void smblib_iio_deinit(struct smb_charger *chg)
		iio_channel_release(chg->iio.usbin_i_chan);
	if (!IS_ERR_OR_NULL(chg->iio.usbin_v_chan))
		iio_channel_release(chg->iio.usbin_v_chan);
	if (!IS_ERR_OR_NULL(chg->iio.batt_i_chan))
		iio_channel_release(chg->iio.batt_i_chan);
}

int smblib_init(struct smb_charger *chg)
+4 −0
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@ struct smb_iio {
	struct iio_channel	*temp_max_chan;
	struct iio_channel	*usbin_i_chan;
	struct iio_channel	*usbin_v_chan;
	struct iio_channel	*batt_i_chan;
};

struct smb_charger {
@@ -301,6 +302,9 @@ int smblib_set_prop_typec_power_role(struct smb_charger *chg,
int smblib_set_prop_pd_active(struct smb_charger *chg,
				const union power_supply_propval *val);

int smblib_get_prop_slave_current_now(struct smb_charger *chg,
				union power_supply_propval *val);

int smblib_init(struct smb_charger *chg);
int smblib_deinit(struct smb_charger *chg);
#endif /* __SMB2_CHARGER_H */
+4 −0
Original line number Diff line number Diff line
@@ -395,6 +395,7 @@ static enum power_supply_property smb138x_parallel_props[] = {
	POWER_SUPPLY_PROP_INPUT_SUSPEND,
	POWER_SUPPLY_PROP_VOLTAGE_MAX,
	POWER_SUPPLY_PROP_CURRENT_MAX,
	POWER_SUPPLY_PROP_CURRENT_NOW,
	POWER_SUPPLY_PROP_CHARGER_TEMP,
	POWER_SUPPLY_PROP_CHARGER_TEMP_MAX,
};
@@ -431,6 +432,9 @@ static int smb138x_parallel_get_prop(struct power_supply *psy,
		rc = smblib_get_charge_param(chg, &chg->param.fcc,
					     &val->intval);
		break;
	case POWER_SUPPLY_PROP_CURRENT_NOW:
		rc = smblib_get_prop_slave_current_now(chg, val);
		break;
	case POWER_SUPPLY_PROP_CHARGER_TEMP:
		rc = smblib_get_prop_charger_temp(chg, val);
		break;