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

Commit af346132 authored by Jack Pham's avatar Jack Pham
Browse files

usb: dwc3-msm: Get usb power_supply from device tree



Not all instances of the controller should be tied to the
USB power_supply. For example in cases of multiple instances,
we do not want all instances manipulating the SDP current
draw by setting the power_supply property, as there is only
usually only a single charger instance.

Replace power_supply lookup by "usb" name to a phandle lookup.
DT must specify a "qcom,usb-charger" property pointing to the
charger instance.

Change-Id: Ibd90337782b23f5e1a1a1c2af5a48c49be37823d
Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
parent 505da987
Loading
Loading
Loading
Loading
+6 −3
Original line number Original line Diff line number Diff line
@@ -4537,11 +4537,14 @@ static int dwc3_msm_gadget_vbus_draw(struct dwc3_msm *mdwc, unsigned int mA)
	int ret;
	int ret;


	if (!mdwc->usb_psy) {
	if (!mdwc->usb_psy) {
		mdwc->usb_psy = power_supply_get_by_name("usb");
		mdwc->usb_psy = power_supply_get_by_phandle(mdwc->dev->of_node,
		if (!mdwc->usb_psy) {
				"qcom,usb-charger");
			dev_err(mdwc->dev, "Could not get usb psy\n");
		if (IS_ERR_OR_NULL(mdwc->usb_psy)) {
			dev_info(mdwc->dev, "Could not get usb psy\n");
			return -ENODEV;
			return -ENODEV;
		}
		}
	} else if (IS_ERR(mdwc->usb_psy)) {
		return 0;
	}
	}


	if (mdwc->max_power == mA)
	if (mdwc->max_power == mA)