summaryrefslogtreecommitdiff
path: root/drivers/extcon/extcon-gpio.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2013-09-11 06:16:18 +0400
committerChanwoo Choi <cw00.choi@samsung.com>2013-09-27 04:37:00 +0400
commit338de0ca682ca95d3f6185459e11540c37dd8a2a (patch)
tree68bf1fdd6a040e8838755449bbe7e0566e4af09f /drivers/extcon/extcon-gpio.c
parent1073514b11c221081c7c1f4a14b3eee5365385fa (diff)
downloadlinux-338de0ca682ca95d3f6185459e11540c37dd8a2a.tar.xz
extcon: gpio: Use gpio driver/chip debounce if supported
This patch use gpio_set_debounce() API provided from gpiolib if SoC or device driver with gpio support gpio_set_debounce() function. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Diffstat (limited to 'drivers/extcon/extcon-gpio.c')
-rw-r--r--drivers/extcon/extcon-gpio.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c
index 6368a0f3ae6d..862743bc825f 100644
--- a/drivers/extcon/extcon-gpio.c
+++ b/drivers/extcon/extcon-gpio.c
@@ -100,7 +100,13 @@ static int gpio_extcon_probe(struct platform_device *pdev)
extcon_data->state_off = pdata->state_off;
if (pdata->state_on && pdata->state_off)
extcon_data->edev.print_state = extcon_gpio_print_state;
- extcon_data->debounce_jiffies = msecs_to_jiffies(pdata->debounce);
+ if (pdata->debounce) {
+ ret = gpio_set_debounce(extcon_data->gpio,
+ pdata->debounce * 1000);
+ if (ret < 0)
+ extcon_data->debounce_jiffies =
+ msecs_to_jiffies(pdata->debounce);
+ }
ret = extcon_dev_register(&extcon_data->edev, &pdev->dev);
if (ret < 0)