Lines Matching +full:pm8941 +full:- +full:misc
1 // SPDX-License-Identifier: GPL-2.0-only
3 * extcon-qcom-spmi-misc.c - Qualcomm USB extcon driver to support USB ID
4 * and VBUS detection based on extcon-usb-gpio.c.
10 #include <linux/devm-helpers.h>
11 #include <linux/extcon-provider.h>
46 if (info->id_irq > 0) { in qcom_usb_extcon_detect_cable()
48 ret = irq_get_irqchip_state(info->id_irq, in qcom_usb_extcon_detect_cable()
55 extcon_set_property(info->edev, EXTCON_USB_HOST, in qcom_usb_extcon_detect_cable()
58 extcon_set_state_sync(info->edev, EXTCON_USB_HOST, !state); in qcom_usb_extcon_detect_cable()
61 if (info->vbus_irq > 0) { in qcom_usb_extcon_detect_cable()
63 ret = irq_get_irqchip_state(info->vbus_irq, in qcom_usb_extcon_detect_cable()
70 extcon_set_property(info->edev, EXTCON_USB, in qcom_usb_extcon_detect_cable()
73 extcon_set_state_sync(info->edev, EXTCON_USB, state); in qcom_usb_extcon_detect_cable()
81 queue_delayed_work(system_power_efficient_wq, &info->wq_detcable, in qcom_usb_irq_handler()
82 info->debounce_jiffies); in qcom_usb_irq_handler()
89 struct device *dev = &pdev->dev; in qcom_usb_extcon_probe()
95 return -ENOMEM; in qcom_usb_extcon_probe()
97 info->edev = devm_extcon_dev_allocate(dev, qcom_usb_extcon_cable); in qcom_usb_extcon_probe()
98 if (IS_ERR(info->edev)) { in qcom_usb_extcon_probe()
100 return -ENOMEM; in qcom_usb_extcon_probe()
103 ret = devm_extcon_dev_register(dev, info->edev); in qcom_usb_extcon_probe()
109 ret = extcon_set_property_capability(info->edev, in qcom_usb_extcon_probe()
111 ret |= extcon_set_property_capability(info->edev, in qcom_usb_extcon_probe()
119 info->debounce_jiffies = msecs_to_jiffies(USB_ID_DEBOUNCE_MS); in qcom_usb_extcon_probe()
121 ret = devm_delayed_work_autocancel(dev, &info->wq_detcable, in qcom_usb_extcon_probe()
126 info->id_irq = platform_get_irq_byname_optional(pdev, "usb_id"); in qcom_usb_extcon_probe()
127 if (info->id_irq > 0) { in qcom_usb_extcon_probe()
128 ret = devm_request_threaded_irq(dev, info->id_irq, NULL, in qcom_usb_extcon_probe()
132 pdev->name, info); in qcom_usb_extcon_probe()
139 info->vbus_irq = platform_get_irq_byname_optional(pdev, "usb_vbus"); in qcom_usb_extcon_probe()
140 if (info->vbus_irq > 0) { in qcom_usb_extcon_probe()
141 ret = devm_request_threaded_irq(dev, info->vbus_irq, NULL, in qcom_usb_extcon_probe()
145 pdev->name, info); in qcom_usb_extcon_probe()
152 if (info->id_irq < 0 && info->vbus_irq < 0) { in qcom_usb_extcon_probe()
154 return -EINVAL; in qcom_usb_extcon_probe()
161 qcom_usb_extcon_detect_cable(&info->wq_detcable.work); in qcom_usb_extcon_probe()
173 if (info->id_irq > 0) in qcom_usb_extcon_suspend()
174 ret = enable_irq_wake(info->id_irq); in qcom_usb_extcon_suspend()
175 if (info->vbus_irq > 0) in qcom_usb_extcon_suspend()
176 ret = enable_irq_wake(info->vbus_irq); in qcom_usb_extcon_suspend()
188 if (info->id_irq > 0) in qcom_usb_extcon_resume()
189 ret = disable_irq_wake(info->id_irq); in qcom_usb_extcon_resume()
190 if (info->vbus_irq > 0) in qcom_usb_extcon_resume()
191 ret = disable_irq_wake(info->vbus_irq); in qcom_usb_extcon_resume()
202 { .compatible = "qcom,pm8941-misc", },
210 .name = "extcon-pm8941-misc",