[{"id":1775094,"web_url":"http://patchwork.ozlabs.org/comment/1775094/","msgid":"<59C9BA1D.9080900@samsung.com>","list_archive_url":null,"date":"2017-09-26T02:23:25","subject":"Re: [PATCH 6/8] extcon: gpio: Get debounce setting from device\n\tproperty","submitter":{"id":46832,"url":"http://patchwork.ozlabs.org/api/people/46832/","name":"Chanwoo Choi","email":"cw00.choi@samsung.com"},"content":"Hi Linus,\n\nOn 2017년 09월 24일 23:56, Linus Walleij wrote:\n> Look up the debouncing value using the device property that will\n> pick it from device tree or ACPI DSDT or whatever is available.\n> \n> Reintroduce the debounce handling previously deleted in the\n> series, setting the delayed worker to delay 0 ms if the GPIO\n> driver supports debouncing for us, else just delay the reading\n> of the value delayed by jiffies.\n> \n> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>\n> ---\n>  drivers/extcon/extcon-gpio.c | 13 +++++++++++--\n>  1 file changed, 11 insertions(+), 2 deletions(-)\n\nI checked the pinctrl-bindings.txt[1] in order to check\nthe property name of 'input-debounce'. It looks good to me.\n[1] Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt\n\nAcked-by: Chanwoo Choi <cw00.choi@samsung.com>\n\n> \n> diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c\n> index 6d9cb4ed11c2..8fc52631c8a2 100644\n> --- a/drivers/extcon/extcon-gpio.c\n> +++ b/drivers/extcon/extcon-gpio.c\n> @@ -24,6 +24,7 @@\n>  #include <linux/kernel.h>\n>  #include <linux/module.h>\n>  #include <linux/platform_device.h>\n> +#include <linux/property.h>\n>  #include <linux/slab.h>\n>  #include <linux/workqueue.h>\n>  \n> @@ -35,7 +36,6 @@\n>   *\t\t\tvalue.\n>   * @gpiod:\t\tGPIO descriptor for this external connector.\n>   * @extcon_id:\t\tThe unique id of specific external connector.\n> - * @debounce:\t\tDebounce time for GPIO IRQ in ms.\n>   * @check_on_resume:\tBoolean describing whether to check the state of gpio\n>   *\t\t\twhile resuming from sleep.\n>   */\n> @@ -45,7 +45,6 @@ struct gpio_extcon_data {\n>  \tunsigned long debounce_jiffies;\n>  \tstruct gpio_desc *gpiod;\n>  \tunsigned int extcon_id;\n> -\tunsigned long debounce;\n>  \tbool check_on_resume;\n>  };\n>  \n> @@ -74,6 +73,7 @@ static int gpio_extcon_probe(struct platform_device *pdev)\n>  \tstruct gpio_extcon_data *data;\n>  \tstruct device *dev = &pdev->dev;\n>  \tunsigned long irq_flags;\n> +\tu32 debounce_usecs;\n>  \tint irq;\n>  \tint ret;\n>  \n> @@ -109,6 +109,15 @@ static int gpio_extcon_probe(struct platform_device *pdev)\n>  \t\treturn -ENOMEM;\n>  \t}\n>  \n> +\tret = device_property_read_u32(dev, \"input-debounce\", &debounce_usecs);\n> +\tif (ret || !debounce_usecs) {\n> +\t\tdev_err(dev, \"illegal debounce value, set to 20 ms\\n\");\n> +\t\tdebounce_usecs = 20000;\n> +\t}\n> +\tret = gpiod_set_debounce(data->gpiod, debounce_usecs);\n> +\tif (ret)\n> +\t\tdata->debounce_jiffies = msecs_to_jiffies(debounce_usecs * 1000);\n> +\n>  \tret = devm_extcon_dev_register(dev, data->edev);\n>  \tif (ret < 0)\n>  \t\treturn ret;\n>","headers":{"Return-Path":"<linux-gpio-owner@vger.kernel.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-gpio-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y1Prd6kkZz9sPk\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 26 Sep 2017 12:23:29 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S965146AbdIZCX2 (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tMon, 25 Sep 2017 22:23:28 -0400","from mailout3.samsung.com ([203.254.224.33]:59134 \"EHLO\n\tmailout3.samsung.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S965067AbdIZCX1 (ORCPT\n\t<rfc822; linux-gpio@vger.kernel.org>); Mon, 25 Sep 2017 22:23:27 -0400","from epcas1p2.samsung.com (unknown [182.195.41.46])\n\tby mailout3.samsung.com (KnoxPortal) with ESMTP id\n\t20170926022325epoutp03714324f481cd11d8f60f8b21542970a8~nyBfnY7p-2501725017epoutp03h;\n\tTue, 26 Sep 2017 02:23:25 +0000 (GMT)","from epsmges1p5.samsung.com (unknown [182.195.40.69]) by\n\tepcas1p2.samsung.com (KnoxPortal) with ESMTP id\n\t20170926022324epcas1p2a796f08e29aaf3380583382c4a2e5366~nyBfPW2PB3106331063epcas1p2Y;\n\tTue, 26 Sep 2017 02:23:24 +0000 (GMT)","from epcas1p1.samsung.com ( [182.195.41.45]) by\n\tepsmges1p5.samsung.com (Symantec Messaging Gateway) with SMTP id\n\t54.8B.04255.C1AB9C95; Tue, 26 Sep 2017 11:23:24 +0900 (KST)","from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by\n\tepcas1p3.samsung.com (KnoxPortal) with ESMTP id\n\t20170926022324epcas1p351c5246d346f3b871c76a999c0c149b6~nyBewuQmb1519915199epcas1p3F;\n\tTue, 26 Sep 2017 02:23:24 +0000 (GMT)","from epmmp1.local.host ( [203.254.227.16]) by\n\tepsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id\n\tAB.D5.06995.C1AB9C95; Tue, 26 Sep 2017 11:23:24 +0900 (KST)","from [10.113.62.212] by mmp1.samsung.com (Oracle Communications\n\tMessaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id\n\t<0OWV00CJF7Z0LZ40@mmp1.samsung.com>;\n\tTue, 26 Sep 2017 11:23:24 +0900 (KST)"],"X-AuditID":"b6c32a39-a57ff7000000109f-11-59c9ba1cc600","MIME-version":"1.0","Content-transfer-encoding":"8BIT","Content-type":"text/plain; charset=\"UTF-8\"","Message-id":"<59C9BA1D.9080900@samsung.com>","Date":"Tue, 26 Sep 2017 11:23:25 +0900","From":"Chanwoo Choi <cw00.choi@samsung.com>","Organization":"Samsung Electronics","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101\n\tThunderbird/31.6.0","To":"Linus Walleij <linus.walleij@linaro.org>,\n\tMyungJoo Ham <myungjoo.ham@samsung.com>","Cc":"linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,\n\tJohn Stultz <john.stultz@linaro.org>, Guenter Roeck <linux@roeck-us.net>","Subject":"Re: [PATCH 6/8] extcon: gpio: Get debounce setting from device\n\tproperty","In-reply-to":"<20170924145622.4031-7-linus.walleij@linaro.org>","X-Brightmail-Tracker":["H4sIAAAAAAAAA+NgFvrIKsWRmVeSWpSXmKPExsWy7bCmrq7MrpORBk3HtSzO/Na1mPJnOZPF\n\t5vl/GC0u75rDZvFk4Rkmi9uNK9gc2DzuXNvD5rHzewO7R9+WVYwenzfJBbBEpdpkpCampBYp\n\tpOYl56dk5qXbKnkHxzvHm5oZGOoaWlqYKynkJeam2iq5+AToumXmAO1WUihLzCkFCgUkFhcr\n\t6dvZFOWXlqQqZOQXl9gqRRsaGukZGpjrGRkZ6ZkYx1oZmQKVJKRm7J56mqmgSbSi9/Yc1gbG\n\tNwJdjJwcEgImEtO65jGB2EICOxglTt8u6WLkArK/M0qc2LiYFaboypntLBCJ3YwSk1fcYwRJ\n\t8AoISvyYfA8owcHBLCAvceRSNkiYWUBTYuvu9ewQ9fcYJXoWP2ODqNeS+P3vD9hQFgFViZVX\n\tF4LNYQOK739xA6yGX0BR4uqPx2BxUYEIiZ3zv7GD2CIC4RL7jh1gBhnKLNDBKPFmB0RCWCBI\n\t4s2qa2A2p4CtxLtXv1lBiiQE9rBJnGl4BfWCi8T7tUuhbGGJV8e3sINcLSEgLX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SjEm5JYWZValB9fVJqTWnyIUZqDRUmc93besUghgfTEktTs1NSC1CKYLBMHp1QDo+W840/r\n\tFHQcVx3W2Pbj1vZqU21FoffNnbycy+LUVsYf2FC8bMn0XXobFSbPiFuTqVgoEydQ4K0Uzc+w\n\t5tT+hoe32bpDNsetnxEkGfCt8/KqXY6Ol/+q53RNTGC9ZPE/TJe1Ql71yQ0LTQWX/T3n+Bkq\n\tlIUnJX65/rLL50TS3oW5xQYfZyTsVWIpzkg01GIuKk4EAC0UYudmAgAA"],"X-CMS-MailID":"20170926022324epcas1p351c5246d346f3b871c76a999c0c149b6","X-Msg-Generator":"CA","X-Sender-IP":"182.195.42.142","X-Local-Sender":"=?utf-8?b?7LWc7LCs7JqwG1RpemVuIFBsYXRmb3JtIExhYihTL1c=?=\n\t=?utf-8?b?7IS87YSwKRvsgrzshLHsoITsnpAbU2VuaW9yIEVuZ2luZWVy?=","X-Global-Sender":"=?utf-8?q?Chanwoo_Choi=1BTizen_Platform_Lab=2E=1BSamsung?=\n\t=?utf-8?q?_Electronics=1BSenior_Engineer?=","X-Sender-Code":"=?utf-8?q?C10=1BTELE=1BC10V8111?=","CMS-TYPE":"101P","DLP-Filter":"Pass","X-CFilter-Loop":"Reflected","X-CMS-RootMailID":"20170924150129epcas3p4bf7c5e9e4b82efb1f6ceb1fd599203d1","X-RootMTR":"20170924150129epcas3p4bf7c5e9e4b82efb1f6ceb1fd599203d1","References":"<20170924145622.4031-1-linus.walleij@linaro.org>\n\t<CGME20170924150129epcas3p4bf7c5e9e4b82efb1f6ceb1fd599203d1@epcas3p4.samsung.com>\n\t<20170924145622.4031-7-linus.walleij@linaro.org>","Sender":"linux-gpio-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<linux-gpio.vger.kernel.org>","X-Mailing-List":"linux-gpio@vger.kernel.org"}}]