Loading Documentation/devicetree/bindings/platform/msm/qpnp-usbdetect.txt +3 −1 Original line number Diff line number Diff line Loading @@ -11,7 +11,9 @@ Required Properties: - compatible: must be "qcom,qpnp-usbdetect" - interrupts: an interrupt triggered by the output of the detection circuit - interrupt-names: must be "vbus_det_irq" - vin-supply: phandle to a regulator that supplies 5V to this circuit Optional Properties: - vin-supply: phandle to a regulator that powers this circuit, if needed Example: Loading drivers/platform/msm/qpnp-usbdetect.c +20 −12 Original line number Diff line number Diff line Loading @@ -59,21 +59,27 @@ static int qpnp_usbdetect_probe(struct platform_device *pdev) usb->pdev = pdev; usb->usb_psy = usb_psy; if (of_get_property(pdev->dev.of_node, "vin-supply", NULL)) { usb->vin = devm_regulator_get(&pdev->dev, "vin"); if (IS_ERR(usb->vin)) { dev_err(&pdev->dev, "Failed to get VIN regulator: %ld\n", PTR_ERR(usb->vin)); return PTR_ERR(usb->vin); } } if (usb->vin) { rc = regulator_enable(usb->vin); if (rc) { dev_err(&pdev->dev, "Failed to enable VIN regulator: %d\n", rc); dev_err(&pdev->dev, "Failed to enable VIN regulator: %d\n", rc); return rc; } } usb->vbus_det_irq = platform_get_irq_byname(pdev, "vbus_det_irq"); if (usb->vbus_det_irq < 0) { if (usb->vin) regulator_disable(usb->vin); return usb->vbus_det_irq; } Loading @@ -85,6 +91,7 @@ static int qpnp_usbdetect_probe(struct platform_device *pdev) if (rc) { dev_err(&pdev->dev, "request for vbus_det_irq failed: %d\n", rc); if (usb->vin) regulator_disable(usb->vin); return rc; } Loading @@ -108,6 +115,7 @@ static int qpnp_usbdetect_remove(struct platform_device *pdev) disable_irq_wake(usb->vbus_det_irq); disable_irq(usb->vbus_det_irq); if (usb->vin) regulator_disable(usb->vin); return 0; Loading Loading
Documentation/devicetree/bindings/platform/msm/qpnp-usbdetect.txt +3 −1 Original line number Diff line number Diff line Loading @@ -11,7 +11,9 @@ Required Properties: - compatible: must be "qcom,qpnp-usbdetect" - interrupts: an interrupt triggered by the output of the detection circuit - interrupt-names: must be "vbus_det_irq" - vin-supply: phandle to a regulator that supplies 5V to this circuit Optional Properties: - vin-supply: phandle to a regulator that powers this circuit, if needed Example: Loading
drivers/platform/msm/qpnp-usbdetect.c +20 −12 Original line number Diff line number Diff line Loading @@ -59,21 +59,27 @@ static int qpnp_usbdetect_probe(struct platform_device *pdev) usb->pdev = pdev; usb->usb_psy = usb_psy; if (of_get_property(pdev->dev.of_node, "vin-supply", NULL)) { usb->vin = devm_regulator_get(&pdev->dev, "vin"); if (IS_ERR(usb->vin)) { dev_err(&pdev->dev, "Failed to get VIN regulator: %ld\n", PTR_ERR(usb->vin)); return PTR_ERR(usb->vin); } } if (usb->vin) { rc = regulator_enable(usb->vin); if (rc) { dev_err(&pdev->dev, "Failed to enable VIN regulator: %d\n", rc); dev_err(&pdev->dev, "Failed to enable VIN regulator: %d\n", rc); return rc; } } usb->vbus_det_irq = platform_get_irq_byname(pdev, "vbus_det_irq"); if (usb->vbus_det_irq < 0) { if (usb->vin) regulator_disable(usb->vin); return usb->vbus_det_irq; } Loading @@ -85,6 +91,7 @@ static int qpnp_usbdetect_probe(struct platform_device *pdev) if (rc) { dev_err(&pdev->dev, "request for vbus_det_irq failed: %d\n", rc); if (usb->vin) regulator_disable(usb->vin); return rc; } Loading @@ -108,6 +115,7 @@ static int qpnp_usbdetect_remove(struct platform_device *pdev) disable_irq_wake(usb->vbus_det_irq); disable_irq(usb->vbus_det_irq); if (usb->vin) regulator_disable(usb->vin); return 0; Loading