Lines Matching +full:vbus +full:- +full:gpios

1 // SPDX-License-Identifier: GPL-2.0
14 #include <linux/devm-helpers.h>
15 #include <linux/extcon-provider.h>
50 { "id-gpios", &id_gpios, 1, ACPI_GPIO_QUIRK_NO_IO_RESTRICTION },
51 { "vbus-gpios", &vbus_gpios, 1 },
52 { "mux-gpios", &mux_gpios, 1 },
60 int id = gpiod_get_value_cansleep(data->gpio_usb_id); in int3496_do_usb_id()
63 dev_dbg(data->dev, "Connected %s cable\n", id ? "PERIPHERAL" : "HOST"); in int3496_do_usb_id()
66 * Peripheral: set USB mux to peripheral and disable VBUS in int3496_do_usb_id()
67 * Host: set USB mux to host and enable VBUS in int3496_do_usb_id()
69 if (!IS_ERR(data->gpio_usb_mux)) in int3496_do_usb_id()
70 gpiod_direction_output(data->gpio_usb_mux, id); in int3496_do_usb_id()
72 if (!IS_ERR(data->gpio_vbus_en)) in int3496_do_usb_id()
73 gpiod_direction_output(data->gpio_vbus_en, !id); in int3496_do_usb_id()
75 extcon_set_state_sync(data->edev, EXTCON_USB_HOST, !id); in int3496_do_usb_id()
83 mod_delayed_work(system_wq, &data->work, DEBOUNCE_TIME); in int3496_thread_isr()
90 struct device *dev = &pdev->dev; in int3496_probe()
102 return -ENOMEM; in int3496_probe()
104 data->dev = dev; in int3496_probe()
105 ret = devm_delayed_work_autocancel(dev, &data->work, int3496_do_usb_id); in int3496_probe()
109 data->gpio_usb_id = devm_gpiod_get(dev, "id", GPIOD_IN); in int3496_probe()
110 if (IS_ERR(data->gpio_usb_id)) { in int3496_probe()
111 ret = PTR_ERR(data->gpio_usb_id); in int3496_probe()
116 data->usb_id_irq = gpiod_to_irq(data->gpio_usb_id); in int3496_probe()
117 if (data->usb_id_irq < 0) { in int3496_probe()
118 dev_err(dev, "can't get USB ID IRQ: %d\n", data->usb_id_irq); in int3496_probe()
119 return data->usb_id_irq; in int3496_probe()
122 data->gpio_vbus_en = devm_gpiod_get(dev, "vbus", GPIOD_ASIS); in int3496_probe()
123 if (IS_ERR(data->gpio_vbus_en)) in int3496_probe()
124 dev_info(dev, "can't request VBUS EN GPIO\n"); in int3496_probe()
126 data->gpio_usb_mux = devm_gpiod_get(dev, "mux", GPIOD_ASIS); in int3496_probe()
127 if (IS_ERR(data->gpio_usb_mux)) in int3496_probe()
131 data->edev = devm_extcon_dev_allocate(dev, int3496_cable); in int3496_probe()
132 if (IS_ERR(data->edev)) in int3496_probe()
133 return -ENOMEM; in int3496_probe()
135 ret = devm_extcon_dev_register(dev, data->edev); in int3496_probe()
141 ret = devm_request_threaded_irq(dev, data->usb_id_irq, in int3496_probe()
152 /* process id-pin so that we start with the right status */ in int3496_probe()
153 queue_delayed_work(system_wq, &data->work, 0); in int3496_probe()
154 flush_delayed_work(&data->work); in int3496_probe()
169 .name = "intel-int3496",