Loading drivers/platform/msm/gpio-usbdetect.c +25 −3 Original line number Diff line number Diff line /* Copyright (c) 2013-2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2013-2018, 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 @@ -173,6 +173,28 @@ static irqreturn_t gpio_usbdetect_vbus_irq(int irq, void *data) return IRQ_HANDLED; } static int gpio_usbdetect_notify_usb_type(struct gpio_usbdetect *usb, enum power_supply_type type) { int rc; union power_supply_propval pval = {0, }; pval.intval = type; rc = usb->usb_psy->set_property(usb->usb_psy, POWER_SUPPLY_PROP_REAL_TYPE, &pval); if (rc < 0) { if (rc == -EINVAL) { rc = usb->usb_psy->set_property(usb->usb_psy, POWER_SUPPLY_PROP_TYPE, &pval); if (!rc) return 0; } pr_err("notify charger type to usb_psy failed, rc=%d\n", rc); } return rc; } static void gpio_usbdetect_chg_work(struct work_struct *w) { struct gpio_usbdetect *usb = container_of(w, struct gpio_usbdetect, Loading @@ -183,13 +205,13 @@ static void gpio_usbdetect_chg_work(struct work_struct *w) power_supply_set_usb_otg(usb->usb_psy, 0); if (!usb->disable_device_mode) { power_supply_set_supply_type(usb->usb_psy, gpio_usbdetect_notify_usb_type(usb, POWER_SUPPLY_TYPE_USB); power_supply_set_present(usb->usb_psy, usb->vbus); } } else { /* notify gpio_state = LOW as disconnect */ power_supply_set_supply_type(usb->usb_psy, gpio_usbdetect_notify_usb_type(usb, POWER_SUPPLY_TYPE_UNKNOWN); power_supply_set_present(usb->usb_psy, usb->vbus); Loading Loading
drivers/platform/msm/gpio-usbdetect.c +25 −3 Original line number Diff line number Diff line /* Copyright (c) 2013-2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2013-2018, 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 @@ -173,6 +173,28 @@ static irqreturn_t gpio_usbdetect_vbus_irq(int irq, void *data) return IRQ_HANDLED; } static int gpio_usbdetect_notify_usb_type(struct gpio_usbdetect *usb, enum power_supply_type type) { int rc; union power_supply_propval pval = {0, }; pval.intval = type; rc = usb->usb_psy->set_property(usb->usb_psy, POWER_SUPPLY_PROP_REAL_TYPE, &pval); if (rc < 0) { if (rc == -EINVAL) { rc = usb->usb_psy->set_property(usb->usb_psy, POWER_SUPPLY_PROP_TYPE, &pval); if (!rc) return 0; } pr_err("notify charger type to usb_psy failed, rc=%d\n", rc); } return rc; } static void gpio_usbdetect_chg_work(struct work_struct *w) { struct gpio_usbdetect *usb = container_of(w, struct gpio_usbdetect, Loading @@ -183,13 +205,13 @@ static void gpio_usbdetect_chg_work(struct work_struct *w) power_supply_set_usb_otg(usb->usb_psy, 0); if (!usb->disable_device_mode) { power_supply_set_supply_type(usb->usb_psy, gpio_usbdetect_notify_usb_type(usb, POWER_SUPPLY_TYPE_USB); power_supply_set_present(usb->usb_psy, usb->vbus); } } else { /* notify gpio_state = LOW as disconnect */ power_supply_set_supply_type(usb->usb_psy, gpio_usbdetect_notify_usb_type(usb, POWER_SUPPLY_TYPE_UNKNOWN); power_supply_set_present(usb->usb_psy, usb->vbus); Loading