mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 09:31:14 +00:00
extcon: gpio: Add support for active-low presence to detect pins
This patch add 'gpio_active_low' field to 'struct gpio_extcon_data' to check whether gpio active state is 1(high) or 0(low). Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
This commit is contained in:
parent
7c0f6558f8
commit
5bfbdc9caa
2 changed files with 8 additions and 0 deletions
|
@ -34,6 +34,7 @@
|
|||
struct gpio_extcon_data {
|
||||
struct extcon_dev edev;
|
||||
unsigned gpio;
|
||||
bool gpio_active_low;
|
||||
const char *state_on;
|
||||
const char *state_off;
|
||||
int irq;
|
||||
|
@ -49,6 +50,8 @@ static void gpio_extcon_work(struct work_struct *work)
|
|||
work);
|
||||
|
||||
state = gpio_get_value(data->gpio);
|
||||
if (data->gpio_active_low)
|
||||
state = !state;
|
||||
extcon_set_state(&data->edev, state);
|
||||
}
|
||||
|
||||
|
@ -96,6 +99,7 @@ static int gpio_extcon_probe(struct platform_device *pdev)
|
|||
|
||||
extcon_data->edev.name = pdata->name;
|
||||
extcon_data->gpio = pdata->gpio;
|
||||
extcon_data->gpio_active_low = pdata->gpio_active_low;
|
||||
extcon_data->state_on = pdata->state_on;
|
||||
extcon_data->state_off = pdata->state_off;
|
||||
if (pdata->state_on && pdata->state_off)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue