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

Commit 59e53ddb authored by Anirudh Ghayal's avatar Anirudh Ghayal
Browse files

power: smb349-charger: Report supply type as SDP when APSD is disabled



The USB driver expects the supply type as SDP if the charger is unable
to detect a valid type. Report the same when apsd is disabled.

Change-Id: If64e21d18b6fb77e34b868dda01184dd8742fa3e
Signed-off-by: default avatarAnirudh Ghayal <aghayal@codeaurora.org>
parent cb167fec
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -21,9 +21,6 @@ Optional Properties:
- qcom,chg-autonomous-mode	This is a bool property and it indicates that the
				charger is configured for autonomous operation and
				does not require any software configuration.
- qcom,enable-chg-type-detection This is bool property and it indicates
				if charger detection is supported by this
				driver.
- qcom,disable-apsd		This is a bool property which disables Automatic
				power source detection (apsd). If this is set
				charger detection is done by DCIN UV irq.
+4 −11
Original line number Diff line number Diff line
@@ -161,7 +161,6 @@ struct smb349_charger {
	int			chg_present;
	bool			chg_autonomous_mode;
	bool			disable_apsd;
	bool			enable_chg_type_detection;
	bool			battery_missing;
	bool			supply_update;
	const char		*bms_psy_name;
@@ -915,11 +914,7 @@ static int apsd_complete(struct smb349_charger *chip, u8 status)
	dev_dbg(chip->dev, "APSD complete. USB type detected=%d chg_present=%d",
						type, chip->chg_present);

	if (chip->enable_chg_type_detection) {
		dev_dbg(chip->dev, "%s updating usb_psy with type=%d", __func__,
				type);
	power_supply_set_supply_type(chip->usb_psy, type);
	}

	 /* SMB is now done sampling the D+/D- lines, indicate USB driver */
	dev_dbg(chip->dev, "%s updating usb_psy present=%d", __func__,
@@ -936,6 +931,8 @@ static int chg_uv(struct smb349_charger *chip, u8 status)
		chip->chg_present = true;
		dev_dbg(chip->dev, "%s updating usb_psy present=%d",
				__func__, chip->chg_present);
		power_supply_set_supply_type(chip->usb_psy,
						POWER_SUPPLY_TYPE_USB);
		power_supply_set_present(chip->usb_psy, chip->chg_present);
	}

@@ -943,7 +940,6 @@ static int chg_uv(struct smb349_charger *chip, u8 status)
		chip->chg_present = false;
		dev_dbg(chip->dev, "%s updating usb_psy present=%d",
				__func__, chip->chg_present);
		if (chip->enable_chg_type_detection)
		power_supply_set_supply_type(chip->usb_psy,
						POWER_SUPPLY_TYPE_UNKNOWN);
		power_supply_set_present(chip->usb_psy, chip->chg_present);
@@ -1137,9 +1133,6 @@ static int smb_parse_dt(struct smb349_charger *chip)
	chip->chg_autonomous_mode = of_property_read_bool(node,
					"qcom,chg-autonomous-mode");

	chip->enable_chg_type_detection = of_property_read_bool(node,
					"qcom,enable-chg-type-detection");

	chip->disable_apsd = of_property_read_bool(node, "qcom,disable-apsd");

	rc = of_property_read_string(node, "qcom,bms-psy-name",