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

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

Merge "power: smb135x-charger: support external battery thermistor bias voltage"

parents ecf70274 f6c4c69c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -46,6 +46,9 @@ Optional Properties:
					the float voltage compensation needs to be disabled to avoid
					that reverse boost.
- regulator-name			A string used as a descriptive name for OTG regulator.
- therm-bias-supply			The supply that provides bias voltage to the battery
					thermistor. This is useful in designs that do not use the SYSON
					pin to bias the thermistor.

Example:
	i2c@f9967000 {
+25 −0
Original line number Diff line number Diff line
@@ -270,6 +270,7 @@ struct smb135x_chg {
	u32				workaround_flags;
	bool				soft_vfloat_comp_disabled;
	struct mutex			irq_complete;
	struct regulator		*therm_bias_vreg;
};

static int smb135x_read(struct smb135x_chg *chip, int reg,
@@ -1833,6 +1834,14 @@ static int smb135x_hw_init(struct smb135x_chg *chip)
	int i;
	u8 reg, mask, dc_cur_val;

	if (chip->therm_bias_vreg) {
		rc = regulator_enable(chip->therm_bias_vreg);
		if (rc) {
			pr_err("Couldn't enable therm-bias rc = %d\n", rc);
			return rc;
		}
	}

	rc = smb135x_enable_volatile_writes(chip);
	if (rc < 0) {
		dev_err(chip->dev, "Couldn't configure for volatile rc = %d\n",
@@ -2197,6 +2206,15 @@ static int smb_parse_dt(struct smb135x_chg *chip)

	chip->soft_vfloat_comp_disabled = of_property_read_bool(node,
					"qcom,soft-vfloat-comp-disabled");

	if (of_find_property(node, "therm-bias-supply", NULL)) {
		/* get the thermistor bias regulator */
		chip->therm_bias_vreg = devm_regulator_get(chip->dev,
							"therm-bias");
		if (IS_ERR(chip->therm_bias_vreg))
			return PTR_ERR(chip->therm_bias_vreg);
	}

	return 0;
}

@@ -2426,8 +2444,15 @@ free_regulator:

static int smb135x_charger_remove(struct i2c_client *client)
{
	int rc;
	struct smb135x_chg *chip = i2c_get_clientdata(client);

	if (chip->therm_bias_vreg) {
		rc = regulator_disable(chip->therm_bias_vreg);
		if (rc)
			pr_err("Couldn't disable therm-bias rc = %d\n", rc);
	}

	debugfs_remove_recursive(chip->debug_root);

	if (chip->dc_psy_type != -EINVAL)