[PATCH 2/6] extcon-gpio: If the gpio driver/chip supports debounce, use it

From: Guenter Roeck
Date: Fri Aug 30 2013 - 00:31:37 EST


Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>
---
drivers/extcon/extcon-gpio.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c
index 77d35a7..973600e 100644
--- a/drivers/extcon/extcon-gpio.c
+++ b/drivers/extcon/extcon-gpio.c
@@ -111,6 +111,11 @@ static int gpio_extcon_probe(struct platform_device *pdev)
if (ret < 0)
goto err;

+ /* Use gpio debounce if available. If so, don't debounce in software. */
+ if (pdata->debounce &&
+ !gpio_set_debounce(extcon_data->gpio, pdata->debounce * 1000))
+ extcon_data->debounce_jiffies = 0;
+
INIT_DELAYED_WORK(&extcon_data->work, gpio_extcon_work);

extcon_data->irq = gpio_to_irq(extcon_data->gpio);
--
1.7.9.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/