Lines Matching +full:external +full:- +full:falling

1 // SPDX-License-Identifier: GPL-2.0-only
3 * extcon_gpio.c - Single-state GPIO extcon driver based on extcon class
12 #include <linux/devm-helpers.h>
13 #include <linux/extcon-provider.h>
24 * struct gpio_extcon_data - A simple GPIO-controlled extcon device state container.
29 * @gpiod: GPIO descriptor for this external connector.
30 * @extcon_id: The unique id of specific external connector.
52 state = gpiod_get_value_cansleep(data->gpiod); in gpio_extcon_work()
53 extcon_set_state_sync(data->edev, data->extcon_id, state); in gpio_extcon_work()
60 queue_delayed_work(system_power_efficient_wq, &data->work, in gpio_irq_handler()
61 data->debounce_jiffies); in gpio_irq_handler()
68 struct device *dev = &pdev->dev; in gpio_extcon_probe()
75 return -ENOMEM; in gpio_extcon_probe()
78 * FIXME: extcon_id represents the unique identifier of external in gpio_extcon_probe()
81 * developed to get the extcon id from device-tree or others. in gpio_extcon_probe()
84 if (data->extcon_id > EXTCON_NONE) in gpio_extcon_probe()
85 return -EINVAL; in gpio_extcon_probe()
87 data->gpiod = devm_gpiod_get(dev, "extcon", GPIOD_IN); in gpio_extcon_probe()
88 if (IS_ERR(data->gpiod)) in gpio_extcon_probe()
89 return PTR_ERR(data->gpiod); in gpio_extcon_probe()
90 irq = gpiod_to_irq(data->gpiod); in gpio_extcon_probe()
96 * away after handling, what we are looking for are falling edges in gpio_extcon_probe()
100 if (gpiod_is_active_low(data->gpiod)) in gpio_extcon_probe()
106 data->edev = devm_extcon_dev_allocate(dev, &data->extcon_id); in gpio_extcon_probe()
107 if (IS_ERR(data->edev)) { in gpio_extcon_probe()
109 return -ENOMEM; in gpio_extcon_probe()
112 ret = devm_extcon_dev_register(dev, data->edev); in gpio_extcon_probe()
116 ret = devm_delayed_work_autocancel(dev, &data->work, gpio_extcon_work); in gpio_extcon_probe()
121 * Request the interrupt of gpio to detect whether external connector in gpio_extcon_probe()
126 pdev->name, data); in gpio_extcon_probe()
132 gpio_extcon_work(&data->work.work); in gpio_extcon_probe()
143 if (data->check_on_resume) in gpio_extcon_resume()
145 &data->work, data->debounce_jiffies); in gpio_extcon_resume()
156 .name = "extcon-gpio",