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

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

Merge "power: smb358-charger: Remove vadc dependency"

parents be9ce18a f81a271d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@ Required Properties:
				power supply name.
- qcom,float-voltage-mv		Float Voltage in mV - the maximum voltage up to which
				the battery is charged. Supported range 3500mV to 4500mV
- qcom,chg-vadc			Corresponding VADC device's phandle.

Optional Properties:

@@ -66,6 +65,7 @@ Optional Properties:
- qcom,cool-bat-ma:		Maximum cool battery charge current in milli-amps.
- qcom,warm-bat-mv:		Maximum warm battery target voltage in milli-volts.
- qcom,cool-bat-mv:		Maximum cool battery target voltage in milli-volts.
- qcom,chg-vadc			Corresponding VADC device's phandle.

Example:
	i2c@f9967000 {
+13 −8
Original line number Diff line number Diff line
@@ -944,7 +944,7 @@ static int smb358_get_prop_batt_temp(struct smb358_charger *chip)
	int rc = 0;
	struct qpnp_vadc_result results;

	if (!smb358_get_prop_batt_present(chip))
	if (!smb358_get_prop_batt_present(chip) || !chip->vadc_dev)
		return DEFAULT_TEMP;

	rc = qpnp_vadc_read(chip->vadc_dev, LR_MUX1_BATT_THERM, &results);
@@ -964,6 +964,9 @@ smb358_get_prop_battery_voltage_now(struct smb358_charger *chip)
	int rc = 0;
	struct qpnp_vadc_result results;

	if (!chip->vadc_dev)
		return 0;

	rc = qpnp_vadc_read(chip->vadc_dev, VBAT_SNS, &results);
	if (rc) {
		pr_err("Unable to read vbat rc=%d\n", rc);
@@ -2399,14 +2402,16 @@ static int smb358_charger_probe(struct i2c_client *client,
	chip->usb_psy = usb_psy;
	chip->fake_battery_soc = -EINVAL;

	if (of_find_property(chip->dev->of_node, "qcom,chg-vadc", NULL)) {
		/* early for VADC get, defer probe if needed */
		chip->vadc_dev = qpnp_get_vadc(chip->dev, "chg");
		if (IS_ERR(chip->vadc_dev)) {
			rc = PTR_ERR(chip->vadc_dev);
			if (rc != -EPROBE_DEFER)
			pr_err("vadc property missing\n");
				pr_err("vadc property configured incorrectly\n");
			return rc;
		}
	}

	rc = smb_parse_dt(chip);
	if (rc) {