]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
extcon: gpio: Use gpio driver/chip debounce if supported
authorGuenter Roeck <linux@roeck-us.net>
Wed, 11 Sep 2013 02:16:18 +0000 (19:16 -0700)
committerChanwoo Choi <cw00.choi@samsung.com>
Fri, 27 Sep 2013 00:37:00 +0000 (09:37 +0900)
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>
drivers/extcon/extcon-gpio.c

index 6368a0f3ae6dc43748ab7b3295ee274123bdbd07..862743bc825f84ccce954d0edfde2d4df8403208 100644 (file)
@@ -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)