{"id":817923,"url":"http://patchwork.ozlabs.org/api/patches/817923/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-gpio/patch/20170924145622.4031-7-linus.walleij@linaro.org/","project":{"id":42,"url":"http://patchwork.ozlabs.org/api/projects/42/?format=json","name":"Linux GPIO development","link_name":"linux-gpio","list_id":"linux-gpio.vger.kernel.org","list_email":"linux-gpio@vger.kernel.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170924145622.4031-7-linus.walleij@linaro.org>","list_archive_url":null,"date":"2017-09-24T14:56:20","name":"[6/8] extcon: gpio: Get debounce setting from device property","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"fb2605100315dad6ef4974d24d8e3ad983987d8f","submitter":{"id":7055,"url":"http://patchwork.ozlabs.org/api/people/7055/?format=json","name":"Linus Walleij","email":"linus.walleij@linaro.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-gpio/patch/20170924145622.4031-7-linus.walleij@linaro.org/mbox/","series":[{"id":4818,"url":"http://patchwork.ozlabs.org/api/series/4818/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-gpio/list/?series=4818","date":"2017-09-24T14:56:14","name":"GPIO extcon modernization","version":1,"mbox":"http://patchwork.ozlabs.org/series/4818/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/817923/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/817923/checks/","tags":{},"related":[],"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>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"GbGj0DDq\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y0Vm92G1sz9sRV\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 25 Sep 2017 01:01:29 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752510AbdIXPB2 (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tSun, 24 Sep 2017 11:01:28 -0400","from mail-pg0-f42.google.com ([74.125.83.42]:46449 \"EHLO\n\tmail-pg0-f42.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1752392AbdIXPB1 (ORCPT\n\t<rfc822; linux-gpio@vger.kernel.org>); Sun, 24 Sep 2017 11:01:27 -0400","by mail-pg0-f42.google.com with SMTP id i130so2732497pgc.3\n\tfor <linux-gpio@vger.kernel.org>;\n\tSun, 24 Sep 2017 08:01:27 -0700 (PDT)","from genomnajs.saswifi.com ([104.153.224.168])\n\tby smtp.gmail.com with ESMTPSA id\n\tn83sm7386805pfi.163.2017.09.24.08.00.56\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tSun, 24 Sep 2017 08:01:26 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=/9fxiD6ys0Hzzn3dJW1TOtNYjkdHftdU0/8lE6VRkvg=;\n\tb=GbGj0DDquQMc1XUW7vc+p3k4scsM8/AYScpVRpSlplm/UML60npVKMdgrcb8QyksSB\n\twQMo19A9tEN+3FD8ev0GMgjPx7t5DbI4SDWzJ6LZHg4HcVOPzn0tGa2vGqZ7KS46zcmj\n\tbdySTQ4YNj3BxX+ewwKPVk1Fcs/reSAVuVQ/U=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=/9fxiD6ys0Hzzn3dJW1TOtNYjkdHftdU0/8lE6VRkvg=;\n\tb=UkiX6FRjigzfp0/B69U3KNGxEj/Ur6yPGrohbWF09ndfB43PukZrJHOy98BJSdblfC\n\tXImuk/zLsgKmLDHSssBQ0E0HHmtZpYOMzZ3JMQe1qvAmZHS2LOQGHMykakwBoEnYdyAW\n\tACMhG8mwUxvvW+HVMQAmKVSHN8iBcDWaQbMmFC3wQCxOGTxZeBlm8qTPyCfFlrD8X/7g\n\t26Ka6fJjkn/cR8B279fCrhdfRjt3sVTaURjW0eaTYsYDUho70cPLM68vq0jQj+CxKhc+\n\tDCVwtc/mGw9WHpq0EXmVRmEqg1AKwTQOEGcNRda1guzwUCgq6gXvR0PWT6E8WoQ9oJ6W\n\tMthA==","X-Gm-Message-State":"AHPjjUiXW7cqQS17h8rBIis9BJwBAauUJ7ChYIfdg7d+i3rakw3xFnzl\n\t1sTVf4R+hhYhjHZvGuHiP8jSuA==","X-Google-Smtp-Source":"AOwi7QA+qWxXrWIN34W0uqFLcrJjKl3yGIKVrQJe5CsE7z3L75AdhvW6Z57eveWedQG+ltfh7mdfEA==","X-Received":"by 10.84.128.69 with SMTP id 63mr5025606pla.119.1506265286876;\n\tSun, 24 Sep 2017 08:01:26 -0700 (PDT)","From":"Linus Walleij <linus.walleij@linaro.org>","To":"MyungJoo Ham <myungjoo.ham@samsung.com>,\n\tChanwoo Choi <cw00.choi@samsung.com>","Cc":"linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,\n\tJohn Stultz <john.stultz@linaro.org>,\n\tMike Lockwood <lockwood@google.com>, Guenter Roeck <linux@roeck-us.net>,\n\tLinus Walleij <linus.walleij@linaro.org>","Subject":"[PATCH 6/8] extcon: gpio: Get debounce setting from device property","Date":"Sun, 24 Sep 2017 16:56:20 +0200","Message-Id":"<20170924145622.4031-7-linus.walleij@linaro.org>","X-Mailer":"git-send-email 2.13.5","In-Reply-To":"<20170924145622.4031-1-linus.walleij@linaro.org>","References":"<20170924145622.4031-1-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"},"content":"Look up the debouncing value using the device property that will\npick it from device tree or ACPI DSDT or whatever is available.\n\nReintroduce the debounce handling previously deleted in the\nseries, setting the delayed worker to delay 0 ms if the GPIO\ndriver supports debouncing for us, else just delay the reading\nof the value delayed by jiffies.\n\nSigned-off-by: Linus Walleij <linus.walleij@linaro.org>\n---\n drivers/extcon/extcon-gpio.c | 13 +++++++++++--\n 1 file changed, 11 insertions(+), 2 deletions(-)","diff":"diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c\nindex 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","prefixes":["6/8"]}