Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753171AbbDBNOV (ORCPT ); Thu, 2 Apr 2015 09:14:21 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:33037 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752746AbbDBNNl (ORCPT ); Thu, 2 Apr 2015 09:13:41 -0400 X-AuditID: cbfee61b-f79d76d0000024d6-a0-551d4083134a From: Robert Baldyga To: cw00.choi@samsung.com Cc: myungjoo.ham@samsung.com, rogerq@ti.com, linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, m.szyprowski@samsung.com, Robert Baldyga Subject: [PATCH v3 3/4] extcon: usb-gpio: make debounce value configurable in devicetree Date: Thu, 02 Apr 2015 15:13:04 +0200 Message-id: <1427980385-21285-4-git-send-email-r.baldyga@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1427980385-21285-1-git-send-email-r.baldyga@samsung.com> References: <1427980385-21285-1-git-send-email-r.baldyga@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplluLIzCtJLcpLzFFi42I5/e+xoG6zg2yowal/EhbXvzxntZh/5Byr xeVdc9gsFi1rZbZYe+Quu8XtxhVsFg8O72S36Hmk5cDh0bdlFaPH8RvbmTw+b5ILYI7isklJ zcksSy3St0vgyrg96zVzQQN/xbGPD1gaGA/wdDFycEgImEhs2WHfxcgJZIpJXLi3nq2LkYtD SGA6o8SdV1uZIZyfjBLv19xmA6liE9CR2PJ9AiNIs4iApETLPjOQGmaBY4wSb34/ZwGpERaI kvg/7RYTiM0ioCrxcEEfI4jNK+Aq8XHxfjaIbXISJ49NZgWxOQXcJO5u2Q7WKwRUc3DlLbYJ jLwLGBlWMYqmFiQXFCel5xrpFSfmFpfmpesl5+duYgQH0jPpHYyrGiwOMQpwMCrx8GbskQkV Yk0sK67MPcQowcGsJML7QFs2VIg3JbGyKrUoP76oNCe1+BCjNAeLkjivkn1biJBAemJJanZq akFqEUyWiYNTqoFR4GCV0/t3U5XTo6ovSJ1ZkPj9MFfZyW6jJxfX6LSa2memaFieO7t/W+g5 rRlnzr+wWRzBIdLTNqeyfvmCsOKCuQ9mbeeQ/6Hg1uTO6LDHzvzNouTHjpP3SF/eEjZ7/76b ObmavM/Pxmia1vq/K82MuKg2563oTWe1rqlVYvWa9/eevca5ZX6yEktxRqKhFnNRcSIAQ8jF wCACAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2108 Lines: 62 This patch adds devicetree property for setting debounce value. It allows to set debounce time shorter or longer depending on the needs of given platform. Signed-off-by: Robert Baldyga Acked-by: Roger Quadros --- drivers/extcon/extcon-usb-gpio.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/extcon/extcon-usb-gpio.c b/drivers/extcon/extcon-usb-gpio.c index baf7add..fe223bf 100644 --- a/drivers/extcon/extcon-usb-gpio.c +++ b/drivers/extcon/extcon-usb-gpio.c @@ -116,6 +116,7 @@ static int usb_extcon_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; struct usb_extcon_info *info; + u32 debounce; int ret; if (!np) @@ -126,6 +127,11 @@ static int usb_extcon_probe(struct platform_device *pdev) return -ENOMEM; info->dev = dev; + + ret = of_property_read_u32(np, "debounce", &debounce); + if (ret < 0) + debounce = USB_GPIO_DEBOUNCE_MS; + info->id_gpiod = devm_gpiod_get_optional(&pdev->dev, "id"); info->vbus_gpiod = devm_gpiod_get_optional(&pdev->dev, "vbus"); @@ -147,16 +153,14 @@ static int usb_extcon_probe(struct platform_device *pdev) } if (info->id_gpiod) - ret = gpiod_set_debounce(info->id_gpiod, - USB_GPIO_DEBOUNCE_MS * 1000); + ret = gpiod_set_debounce(info->id_gpiod, debounce * 1000); if (!ret && info->vbus_gpiod) { - ret = gpiod_set_debounce(info->vbus_gpiod, - USB_GPIO_DEBOUNCE_MS * 1000); + ret = gpiod_set_debounce(info->vbus_gpiod, debounce * 1000); if (ret < 0 && info->id_gpiod) gpiod_set_debounce(info->vbus_gpiod, 0); } if (ret < 0) - info->debounce_jiffies = msecs_to_jiffies(USB_GPIO_DEBOUNCE_MS); + info->debounce_jiffies = msecs_to_jiffies(debounce); INIT_DELAYED_WORK(&info->wq_detcable, usb_extcon_detect_cable); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/