Lines Matching +full:usb +full:- +full:attach

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Maxim Integrated MAX3355 USB OTG chip extcon driver
5 * Copyright (C) 2014-2015 Cogent Embedded, Inc.
9 #include <linux/extcon-provider.h>
31 int id = gpiod_get_value_cansleep(data->id_gpiod); in max3355_id_irq()
35 * ID = 1 means USB HOST cable detached. in max3355_id_irq()
36 * As we don't have event for USB peripheral cable attached, in max3355_id_irq()
37 * we simulate USB peripheral attach here. in max3355_id_irq()
39 extcon_set_state_sync(data->edev, EXTCON_USB_HOST, false); in max3355_id_irq()
40 extcon_set_state_sync(data->edev, EXTCON_USB, true); in max3355_id_irq()
43 * ID = 0 means USB HOST cable attached. in max3355_id_irq()
44 * As we don't have event for USB peripheral cable detached, in max3355_id_irq()
45 * we simulate USB peripheral detach here. in max3355_id_irq()
47 extcon_set_state_sync(data->edev, EXTCON_USB, false); in max3355_id_irq()
48 extcon_set_state_sync(data->edev, EXTCON_USB_HOST, true); in max3355_id_irq()
60 data = devm_kzalloc(&pdev->dev, sizeof(struct max3355_data), in max3355_probe()
63 return -ENOMEM; in max3355_probe()
65 gpiod = devm_gpiod_get(&pdev->dev, "id", GPIOD_IN); in max3355_probe()
67 dev_err(&pdev->dev, "failed to get ID_OUT GPIO\n"); in max3355_probe()
70 data->id_gpiod = gpiod; in max3355_probe()
72 gpiod = devm_gpiod_get(&pdev->dev, "maxim,shdn", GPIOD_OUT_HIGH); in max3355_probe()
74 dev_err(&pdev->dev, "failed to get SHDN# GPIO\n"); in max3355_probe()
77 data->shdn_gpiod = gpiod; in max3355_probe()
79 data->edev = devm_extcon_dev_allocate(&pdev->dev, max3355_cable); in max3355_probe()
80 if (IS_ERR(data->edev)) { in max3355_probe()
81 dev_err(&pdev->dev, "failed to allocate extcon device\n"); in max3355_probe()
82 return PTR_ERR(data->edev); in max3355_probe()
85 err = devm_extcon_dev_register(&pdev->dev, data->edev); in max3355_probe()
87 dev_err(&pdev->dev, "failed to register extcon device\n"); in max3355_probe()
91 irq = gpiod_to_irq(data->id_gpiod); in max3355_probe()
93 dev_err(&pdev->dev, "failed to translate ID_OUT GPIO to IRQ\n"); in max3355_probe()
97 err = devm_request_threaded_irq(&pdev->dev, irq, NULL, max3355_id_irq, in max3355_probe()
101 pdev->name, data); in max3355_probe()
103 dev_err(&pdev->dev, "failed to request ID_OUT IRQ\n"); in max3355_probe()
119 gpiod_set_value_cansleep(data->shdn_gpiod, 0); in max3355_remove()
132 .name = "extcon-max3355",