From: Guenter Roeck Date: Wed, 11 Sep 2013 02:16:18 +0000 (-0700) Subject: extcon: gpio: Use gpio driver/chip debounce if supported X-Git-Tag: next-20131017~18^2~24^2~6 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=338de0ca;p=karo-tx-linux.git 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 Signed-off-by: Chanwoo Choi --- 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)