Loading Documentation/devicetree/bindings/platform/msm/gpio-usbdetect.txt +2 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ Optional Properties: disconnect. - qcom,gpio-mode-sel: If present, specifies a gpio to switch to host mode if value is 0 or device mode if 1. - qcom,disable-device-mode: If present then don't treat GPIO high as Vbus high. And only notify host mode similar to ID line. Example: Loading drivers/platform/msm/gpio-usbdetect.c +9 −4 Original line number Diff line number Diff line /* Copyright (c) 2013-2016, The Linux Foundation. All rights reserved. /* Copyright (c) 2013-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -33,6 +33,7 @@ struct gpio_usbdetect { struct regulator *vdd12; int gpio_usbdetect; bool notify_host_mode; bool disable_device_mode; }; static int gpio_enable_ldos(struct gpio_usbdetect *usb, int on) Loading Loading @@ -162,9 +163,11 @@ static irqreturn_t gpio_usbdetect_vbus_irq(int irq, void *data) if (usb->notify_host_mode) power_supply_set_usb_otg(usb->usb_psy, 0); if (!usb->disable_device_mode) { power_supply_set_supply_type(usb->usb_psy, POWER_SUPPLY_TYPE_USB); power_supply_set_present(usb->usb_psy, vbus); } } else { /* notify gpio_state = LOW as disconnect */ power_supply_set_supply_type(usb->usb_psy, Loading Loading @@ -199,6 +202,8 @@ static int gpio_usbdetect_probe(struct platform_device *pdev) usb->usb_psy = usb_psy; usb->notify_host_mode = of_property_read_bool(pdev->dev.of_node, "qcom,notify-host-mode"); usb->disable_device_mode = of_property_read_bool(pdev->dev.of_node, "qcom,disable-device-mode"); rc = gpio_enable_ldos(usb, 1); if (rc) return rc; Loading Loading
Documentation/devicetree/bindings/platform/msm/gpio-usbdetect.txt +2 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,8 @@ Optional Properties: disconnect. - qcom,gpio-mode-sel: If present, specifies a gpio to switch to host mode if value is 0 or device mode if 1. - qcom,disable-device-mode: If present then don't treat GPIO high as Vbus high. And only notify host mode similar to ID line. Example: Loading
drivers/platform/msm/gpio-usbdetect.c +9 −4 Original line number Diff line number Diff line /* Copyright (c) 2013-2016, The Linux Foundation. All rights reserved. /* Copyright (c) 2013-2017, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -33,6 +33,7 @@ struct gpio_usbdetect { struct regulator *vdd12; int gpio_usbdetect; bool notify_host_mode; bool disable_device_mode; }; static int gpio_enable_ldos(struct gpio_usbdetect *usb, int on) Loading Loading @@ -162,9 +163,11 @@ static irqreturn_t gpio_usbdetect_vbus_irq(int irq, void *data) if (usb->notify_host_mode) power_supply_set_usb_otg(usb->usb_psy, 0); if (!usb->disable_device_mode) { power_supply_set_supply_type(usb->usb_psy, POWER_SUPPLY_TYPE_USB); power_supply_set_present(usb->usb_psy, vbus); } } else { /* notify gpio_state = LOW as disconnect */ power_supply_set_supply_type(usb->usb_psy, Loading Loading @@ -199,6 +202,8 @@ static int gpio_usbdetect_probe(struct platform_device *pdev) usb->usb_psy = usb_psy; usb->notify_host_mode = of_property_read_bool(pdev->dev.of_node, "qcom,notify-host-mode"); usb->disable_device_mode = of_property_read_bool(pdev->dev.of_node, "qcom,disable-device-mode"); rc = gpio_enable_ldos(usb, 1); if (rc) return rc; Loading