Lines Matching +full:vbus +full:- +full:gpios
1 // SPDX-License-Identifier: GPL-2.0
14 #include <linux/extcon-provider.h>
49 { "id-gpios", &id_gpios, 1, ACPI_GPIO_QUIRK_NO_IO_RESTRICTION },
50 { "vbus-gpios", &vbus_gpios, 1 },
51 { "mux-gpios", &mux_gpios, 1 },
59 int id = gpiod_get_value_cansleep(data->gpio_usb_id); in int3496_do_usb_id()
62 dev_dbg(data->dev, "Connected %s cable\n", id ? "PERIPHERAL" : "HOST"); in int3496_do_usb_id()
65 * Peripheral: set USB mux to peripheral and disable VBUS in int3496_do_usb_id()
66 * Host: set USB mux to host and enable VBUS in int3496_do_usb_id()
68 if (!IS_ERR(data->gpio_usb_mux)) in int3496_do_usb_id()
69 gpiod_direction_output(data->gpio_usb_mux, id); in int3496_do_usb_id()
71 if (!IS_ERR(data->gpio_vbus_en)) in int3496_do_usb_id()
72 gpiod_direction_output(data->gpio_vbus_en, !id); in int3496_do_usb_id()
74 extcon_set_state_sync(data->edev, EXTCON_USB_HOST, !id); in int3496_do_usb_id()
82 mod_delayed_work(system_wq, &data->work, DEBOUNCE_TIME); in int3496_thread_isr()
89 struct device *dev = &pdev->dev; in int3496_probe()
101 return -ENOMEM; in int3496_probe()
103 data->dev = dev; in int3496_probe()
104 INIT_DELAYED_WORK(&data->work, int3496_do_usb_id); in int3496_probe()
106 data->gpio_usb_id = devm_gpiod_get(dev, "id", GPIOD_IN); in int3496_probe()
107 if (IS_ERR(data->gpio_usb_id)) { in int3496_probe()
108 ret = PTR_ERR(data->gpio_usb_id); in int3496_probe()
113 data->usb_id_irq = gpiod_to_irq(data->gpio_usb_id); in int3496_probe()
114 if (data->usb_id_irq < 0) { in int3496_probe()
115 dev_err(dev, "can't get USB ID IRQ: %d\n", data->usb_id_irq); in int3496_probe()
116 return data->usb_id_irq; in int3496_probe()
119 data->gpio_vbus_en = devm_gpiod_get(dev, "vbus", GPIOD_ASIS); in int3496_probe()
120 if (IS_ERR(data->gpio_vbus_en)) in int3496_probe()
121 dev_info(dev, "can't request VBUS EN GPIO\n"); in int3496_probe()
123 data->gpio_usb_mux = devm_gpiod_get(dev, "mux", GPIOD_ASIS); in int3496_probe()
124 if (IS_ERR(data->gpio_usb_mux)) in int3496_probe()
128 data->edev = devm_extcon_dev_allocate(dev, int3496_cable); in int3496_probe()
129 if (IS_ERR(data->edev)) in int3496_probe()
130 return -ENOMEM; in int3496_probe()
132 ret = devm_extcon_dev_register(dev, data->edev); in int3496_probe()
138 ret = devm_request_threaded_irq(dev, data->usb_id_irq, in int3496_probe()
149 /* process id-pin so that we start with the right status */ in int3496_probe()
150 queue_delayed_work(system_wq, &data->work, 0); in int3496_probe()
151 flush_delayed_work(&data->work); in int3496_probe()
162 devm_free_irq(&pdev->dev, data->usb_id_irq, data); in int3496_remove()
163 cancel_delayed_work_sync(&data->work); in int3496_remove()
176 .name = "intel-int3496",