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

Commit 4b0ad778 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: Query VADC only if the channel is supported"

parents 56b6baf3 f90ab0eb
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -73,6 +73,8 @@ Optional Properties:
				specified in micro-volts.
- qcom,batt-id-rpullup-kohm	The pull-up resistor connected on the battery-ID
				(vref) line.
- qcom,using-vbat-sns		Bool property to indicate that VBAT sense can be
				done by PMIC.

Example:
	i2c@f9967000 {
+7 −2
Original line number Diff line number Diff line
@@ -208,6 +208,7 @@ struct smb358_charger {
	bool			chg_autonomous_mode;
	bool			disable_apsd;
	bool			using_pmic_therm;
	bool			pmic_vbat_sns;
	bool			battery_missing;
	const char		*bms_psy_name;
	bool			resume_completed;
@@ -1007,7 +1008,9 @@ 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) || !chip->vadc_dev)
	if (!smb358_get_prop_batt_present(chip)
			|| !chip->vadc_dev
			|| !chip->using_pmic_therm)
		return DEFAULT_TEMP;

	rc = qpnp_vadc_read(chip->vadc_dev, LR_MUX1_BATT_THERM, &results);
@@ -1027,7 +1030,7 @@ smb358_get_prop_battery_voltage_now(struct smb358_charger *chip)
	int rc = 0;
	struct qpnp_vadc_result results;

	if (!chip->vadc_dev)
	if (!chip->vadc_dev || !chip->pmic_vbat_sns)
		return 0;

	rc = qpnp_vadc_read(chip->vadc_dev, VBAT_SNS, &results);
@@ -2191,6 +2194,8 @@ static int smb_parse_dt(struct smb358_charger *chip)

	chip->using_pmic_therm = of_property_read_bool(node,
						"qcom,using-pmic-therm");
	chip->pmic_vbat_sns = of_property_read_bool(node,
					"qcom,using-vbat-sns");
	chip->bms_controlled_charging = of_property_read_bool(node,
						"qcom,bms-controlled-charging");