mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-08 04:42:04 -04:00
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: Jack Pham <jackp@codeaurora.org>
This commit is contained in:
parent
505da987be
commit
af34613293
1 changed files with 6 additions and 3 deletions
|
|
@ -4537,11 +4537,14 @@ static int dwc3_msm_gadget_vbus_draw(struct dwc3_msm *mdwc, unsigned int mA)
|
|||
int ret;
|
||||
|
||||
if (!mdwc->usb_psy) {
|
||||
mdwc->usb_psy = power_supply_get_by_name("usb");
|
||||
if (!mdwc->usb_psy) {
|
||||
dev_err(mdwc->dev, "Could not get usb psy\n");
|
||||
mdwc->usb_psy = power_supply_get_by_phandle(mdwc->dev->of_node,
|
||||
"qcom,usb-charger");
|
||||
if (IS_ERR_OR_NULL(mdwc->usb_psy)) {
|
||||
dev_info(mdwc->dev, "Could not get usb psy\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
} else if (IS_ERR(mdwc->usb_psy)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (mdwc->max_power == mA)
|
||||
|
|
|
|||
Loading…
Reference in a new issue