Lines Matching refs:info
72 struct usb_extcon_info *info = container_of(to_delayed_work(work), in usb_extcon_detect_cable() local
77 id = info->id_gpiod ? in usb_extcon_detect_cable()
78 gpiod_get_value_cansleep(info->id_gpiod) : 1; in usb_extcon_detect_cable()
79 vbus = info->vbus_gpiod ? in usb_extcon_detect_cable()
80 gpiod_get_value_cansleep(info->vbus_gpiod) : id; in usb_extcon_detect_cable()
84 extcon_set_state_sync(info->edev, EXTCON_USB_HOST, false); in usb_extcon_detect_cable()
86 extcon_set_state_sync(info->edev, EXTCON_USB, false); in usb_extcon_detect_cable()
89 extcon_set_state_sync(info->edev, EXTCON_USB_HOST, true); in usb_extcon_detect_cable()
92 extcon_set_state_sync(info->edev, EXTCON_USB, true); in usb_extcon_detect_cable()
98 struct usb_extcon_info *info = dev_id; in usb_irq_handler() local
100 queue_delayed_work(system_power_efficient_wq, &info->wq_detcable, in usb_irq_handler()
101 info->debounce_jiffies); in usb_irq_handler()
110 struct usb_extcon_info *info; in usb_extcon_probe() local
116 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); in usb_extcon_probe()
117 if (!info) in usb_extcon_probe()
120 info->dev = dev; in usb_extcon_probe()
121 info->id_gpiod = devm_gpiod_get_optional(&pdev->dev, "id", GPIOD_IN); in usb_extcon_probe()
122 info->vbus_gpiod = devm_gpiod_get_optional(&pdev->dev, "vbus", in usb_extcon_probe()
125 if (!info->id_gpiod && !info->vbus_gpiod) { in usb_extcon_probe()
130 if (IS_ERR(info->id_gpiod)) in usb_extcon_probe()
131 return PTR_ERR(info->id_gpiod); in usb_extcon_probe()
133 if (IS_ERR(info->vbus_gpiod)) in usb_extcon_probe()
134 return PTR_ERR(info->vbus_gpiod); in usb_extcon_probe()
136 info->edev = devm_extcon_dev_allocate(dev, usb_extcon_cable); in usb_extcon_probe()
137 if (IS_ERR(info->edev)) { in usb_extcon_probe()
142 ret = devm_extcon_dev_register(dev, info->edev); in usb_extcon_probe()
148 if (info->id_gpiod) in usb_extcon_probe()
149 ret = gpiod_set_debounce(info->id_gpiod, in usb_extcon_probe()
151 if (!ret && info->vbus_gpiod) in usb_extcon_probe()
152 ret = gpiod_set_debounce(info->vbus_gpiod, in usb_extcon_probe()
156 info->debounce_jiffies = msecs_to_jiffies(USB_GPIO_DEBOUNCE_MS); in usb_extcon_probe()
158 INIT_DELAYED_WORK(&info->wq_detcable, usb_extcon_detect_cable); in usb_extcon_probe()
160 if (info->id_gpiod) { in usb_extcon_probe()
161 info->id_irq = gpiod_to_irq(info->id_gpiod); in usb_extcon_probe()
162 if (info->id_irq < 0) { in usb_extcon_probe()
164 return info->id_irq; in usb_extcon_probe()
167 ret = devm_request_threaded_irq(dev, info->id_irq, NULL, in usb_extcon_probe()
171 pdev->name, info); in usb_extcon_probe()
178 if (info->vbus_gpiod) { in usb_extcon_probe()
179 info->vbus_irq = gpiod_to_irq(info->vbus_gpiod); in usb_extcon_probe()
180 if (info->vbus_irq < 0) { in usb_extcon_probe()
182 return info->vbus_irq; in usb_extcon_probe()
185 ret = devm_request_threaded_irq(dev, info->vbus_irq, NULL, in usb_extcon_probe()
189 pdev->name, info); in usb_extcon_probe()
196 platform_set_drvdata(pdev, info); in usb_extcon_probe()
200 usb_extcon_detect_cable(&info->wq_detcable.work); in usb_extcon_probe()
207 struct usb_extcon_info *info = platform_get_drvdata(pdev); in usb_extcon_remove() local
209 cancel_delayed_work_sync(&info->wq_detcable); in usb_extcon_remove()
218 struct usb_extcon_info *info = dev_get_drvdata(dev); in usb_extcon_suspend() local
222 if (info->id_gpiod) { in usb_extcon_suspend()
223 ret = enable_irq_wake(info->id_irq); in usb_extcon_suspend()
227 if (info->vbus_gpiod) { in usb_extcon_suspend()
228 ret = enable_irq_wake(info->vbus_irq); in usb_extcon_suspend()
230 if (info->id_gpiod) in usb_extcon_suspend()
231 disable_irq_wake(info->id_irq); in usb_extcon_suspend()
243 if (info->id_gpiod) in usb_extcon_suspend()
244 disable_irq(info->id_irq); in usb_extcon_suspend()
245 if (info->vbus_gpiod) in usb_extcon_suspend()
246 disable_irq(info->vbus_irq); in usb_extcon_suspend()
256 struct usb_extcon_info *info = dev_get_drvdata(dev); in usb_extcon_resume() local
263 if (info->id_gpiod) { in usb_extcon_resume()
264 ret = disable_irq_wake(info->id_irq); in usb_extcon_resume()
268 if (info->vbus_gpiod) { in usb_extcon_resume()
269 ret = disable_irq_wake(info->vbus_irq); in usb_extcon_resume()
271 if (info->id_gpiod) in usb_extcon_resume()
272 enable_irq_wake(info->id_irq); in usb_extcon_resume()
279 if (info->id_gpiod) in usb_extcon_resume()
280 enable_irq(info->id_irq); in usb_extcon_resume()
281 if (info->vbus_gpiod) in usb_extcon_resume()
282 enable_irq(info->vbus_irq); in usb_extcon_resume()
285 &info->wq_detcable, 0); in usb_extcon_resume()