From patchwork Wed Mar 6 11:49:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: thomas.abraham@linaro.org X-Patchwork-Id: 15259 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 31AA823E67 for ; Wed, 6 Mar 2013 11:29:18 +0000 (UTC) Received: from mail-vb0-f52.google.com (mail-vb0-f52.google.com [209.85.212.52]) by fiordland.canonical.com (Postfix) with ESMTP id BCAF6A18166 for ; Wed, 6 Mar 2013 11:29:17 +0000 (UTC) Received: by mail-vb0-f52.google.com with SMTP id fa15so1623042vbb.39 for ; Wed, 06 Mar 2013 03:29:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-auditid:from:to:cc:subject:date:message-id:x-mailer :x-brightmail-tracker:x-gm-message-state; bh=f3uc8/3YywwQzpaK3V8456GIkMI344Wb0gEpaMDVrIM=; b=ePEOgK1JmCO+HwvhY4EfSynEpgtDckz48znPodD5Hla0aFZiXSFWZW9Ys8H7rRmfaj odJkSQP4nYLPrBA9F0af8OeSzAwmJSZsSvrWNCTW4B/FstvPEOhZzkKa/SLk100bKDZH WaEPMQQFWn8Am5EcbkHZky7BlyhcukD0DhU1a8wmzLrFcBfQO+UiaH2Gs3X5JGGwv/Lb HuZK0Sbf7zOBKwlVfjJ/cZtD7fTAg7Ryt8xAXWXjaEpXYJVpZIJHkqKz8DArLOKAQDFN vLPduQjePd2DAG3esa2SGWXVjVIEj1rEVcEjNMdevzCEL/S7sEiTT+dbpb2BFT95PC6P oq8g== X-Received: by 10.52.88.237 with SMTP id bj13mr9715787vdb.75.1362569357139; Wed, 06 Mar 2013 03:29:17 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp9867veb; Wed, 6 Mar 2013 03:29:16 -0800 (PST) X-Received: by 10.68.227.129 with SMTP id sa1mr45207184pbc.107.1362569356025; Wed, 06 Mar 2013 03:29:16 -0800 (PST) Received: from mailout2.samsung.com (mailout2.samsung.com. [203.254.224.25]) by mx.google.com with ESMTP id zz9si19465539pbc.329.2013.03.06.03.29.14; Wed, 06 Mar 2013 03:29:16 -0800 (PST) Received-SPF: neutral (google.com: 203.254.224.25 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) client-ip=203.254.224.25; Authentication-Results: mx.google.com; spf=neutral (google.com: 203.254.224.25 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) smtp.mail=thomas.abraham@linaro.org Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MJ800EONL8QOTV0@mailout2.samsung.com>; Wed, 06 Mar 2013 20:29:14 +0900 (KST) X-AuditID: cbfee61b-b7fb06d000000f28-71-51372889ffb8 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 84.8C.03880.98827315; Wed, 06 Mar 2013 20:29:14 +0900 (KST) Received: from localhost.localdomain ([107.108.73.37]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MJ800J9UL5G5190@mmp2.samsung.com>; Wed, 06 Mar 2013 20:29:13 +0900 (KST) From: Thomas Abraham To: linux-input@vger.kernel.org Cc: dmitry.torokhov@gmail.com, linus.walleij@linaro.org, linux-samsung-soc@vger.kernel.org, kgene.kim@samsung.com, t.figa@samsung.com, heiko@sntech.de, jy0922.shim@samsung.com, dh09.lee@samsung.com, patches@linaro.org Subject: [PATCH] input: samsung-keypad: let device core setup the default pin configuration Date: Wed, 06 Mar 2013 17:19:17 +0530 Message-id: <1362570557-14274-1-git-send-email-thomas.abraham@linaro.org> X-Mailer: git-send-email 1.6.6.rc2 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupkluLIzCtJLcpLzFFi42I5/e+xoG6XhnmgwZfXLBbXz9tZHF70gtHi /6PXrBYv7l1ksehdcJXNYsqf5UwWNz99Y7WYcX4fk8WUw19YLNbPeM3iwOWxc9Zddo871/aw efRtWcXosf3aPGaPz5vkAlijuGxSUnMyy1KL9O0SuDKmvu9iLFiqVvH51RTWBsbrcl2MnBwS AiYS189vYIewxSQu3FvP1sXIxSEkMJ1R4vS5OawQThuTxPMv35lBqtgEDCQeLXwH1MHBISIg L3HriClIDbPAfUaJL0/us4HUCAvESiyf9IMFxGYRUJX4sek8M0g9r4CnxMFLMhDLlCQ29B5l msDIvYCRYRWjaGpBckFxUnqukV5xYm5xaV66XnJ+7iZGcAA9k97BuKrB4hCjAAejEg/vBBWz QCHWxLLiytxDjBIczEoivFulzQOFeFMSK6tSi/Lji0pzUosPMUpzsCiJ8zKeehIgJJCeWJKa nZpakFoEk2Xi4JRqYFzMolQ1LdP0VWgn47KJxxzu9a/YOkd2Z7zfqeL3zl9lO8JmC1TFvugV lz10+uzeNpWQl///KymeVnIt3XdXbdOFl92HNPjv7lm9zvSi3aQXt4tzwtrDl/Hv85zDYTM9 LaHK03520cQ3n99PEJa3ffxAOHBnQNu6rdsWLHIyO3vrreAP/ZbpJ24osRRnJBpqMRcVJwIA hQo+4hwCAAA= X-Gm-Message-State: ALoCoQnqFrafd9k4RybW0oN5R+ZQPwGTTDZm6IdSW0OuijGDLva2RkTdzyldbaAO2d5aeUap4tcH With device core now able to setup the default pin configuration, the pin configuration code based on the deprecated Samsung specific gpio bindings is removed. Signed-off-by: Thomas Abraham Acked-by: Linus Walleij --- .../devicetree/bindings/input/samsung-keypad.txt | 25 ++-------- drivers/input/keyboard/samsung-keypad.c | 52 +------------------- 2 files changed, 7 insertions(+), 70 deletions(-) diff --git a/Documentation/devicetree/bindings/input/samsung-keypad.txt b/Documentation/devicetree/bindings/input/samsung-keypad.txt index ce3e394..73ad847 100644 --- a/Documentation/devicetree/bindings/input/samsung-keypad.txt +++ b/Documentation/devicetree/bindings/input/samsung-keypad.txt @@ -25,14 +25,6 @@ Required Board Specific Properties: - samsung,keypad-num-columns: Number of column lines connected to the keypad controller. -- row-gpios: List of gpios used as row lines. The gpio specifier for - this property depends on the gpio controller to which these row lines - are connected. - -- col-gpios: List of gpios used as column lines. The gpio specifier for - this property depends on the gpio controller to which these column - lines are connected. - - Keys represented as child nodes: Each key connected to the keypad controller is represented as a child node to the keypad controller device node and should include the following properties. @@ -41,6 +33,9 @@ Required Board Specific Properties: - linux,code: the key-code to be reported when the key is pressed and released. +- pinctrl-0: Should specify pin control groups used for this controller. +- pinctrl-names: Should contain only one value - "default". + Optional Properties specific to linux: - linux,keypad-no-autorepeat: do no enable autorepeat feature. - linux,keypad-wakeup: use any event on keypad as wakeup event. @@ -55,18 +50,8 @@ Example: samsung,keypad-num-columns = <8>; linux,input-no-autorepeat; linux,input-wakeup; - - row-gpios = <&gpx2 0 3 3 0 - &gpx2 1 3 3 0>; - - col-gpios = <&gpx1 0 3 0 0 - &gpx1 1 3 0 0 - &gpx1 2 3 0 0 - &gpx1 3 3 0 0 - &gpx1 4 3 0 0 - &gpx1 5 3 0 0 - &gpx1 6 3 0 0 - &gpx1 7 3 0 0>; + pinctrl-names = "default"; + pinctrl-0 = <&keypad_rows &keypad_columns>; key_1 { keypad,row = <0>; diff --git a/drivers/input/keyboard/samsung-keypad.c b/drivers/input/keyboard/samsung-keypad.c index 22e357b..03bdad7 100644 --- a/drivers/input/keyboard/samsung-keypad.c +++ b/drivers/input/keyboard/samsung-keypad.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include @@ -79,10 +78,6 @@ struct samsung_keypad { unsigned int rows; unsigned int cols; unsigned int row_state[SAMSUNG_MAX_COLS]; -#ifdef CONFIG_OF - int row_gpios[SAMSUNG_MAX_ROWS]; - int col_gpios[SAMSUNG_MAX_COLS]; -#endif unsigned short keycodes[]; }; @@ -304,45 +299,6 @@ static struct samsung_keypad_platdata *samsung_keypad_parse_dt( return pdata; } - -static void samsung_keypad_parse_dt_gpio(struct device *dev, - struct samsung_keypad *keypad) -{ - struct device_node *np = dev->of_node; - int gpio, error, row, col; - - for (row = 0; row < keypad->rows; row++) { - gpio = of_get_named_gpio(np, "row-gpios", row); - keypad->row_gpios[row] = gpio; - if (!gpio_is_valid(gpio)) { - dev_err(dev, "keypad row[%d]: invalid gpio %d\n", - row, gpio); - continue; - } - - error = devm_gpio_request(dev, gpio, "keypad-row"); - if (error) - dev_err(dev, - "keypad row[%d] gpio request failed: %d\n", - row, error); - } - - for (col = 0; col < keypad->cols; col++) { - gpio = of_get_named_gpio(np, "col-gpios", col); - keypad->col_gpios[col] = gpio; - if (!gpio_is_valid(gpio)) { - dev_err(dev, "keypad column[%d]: invalid gpio %d\n", - col, gpio); - continue; - } - - error = devm_gpio_request(dev, gpio, "keypad-col"); - if (error) - dev_err(dev, - "keypad column[%d] gpio request failed: %d\n", - col, error); - } -} #else static struct samsung_keypad_platdata *samsung_keypad_parse_dt(struct device *dev) @@ -424,15 +380,11 @@ static int samsung_keypad_probe(struct platform_device *pdev) keypad->stopped = true; init_waitqueue_head(&keypad->wait); - if (pdev->dev.of_node) { -#ifdef CONFIG_OF - samsung_keypad_parse_dt_gpio(&pdev->dev, keypad); + if (pdev->dev.of_node) keypad->type = of_device_is_compatible(pdev->dev.of_node, "samsung,s5pv210-keypad"); -#endif - } else { + else keypad->type = platform_get_device_id(pdev)->driver_data; - } input_dev->name = pdev->name; input_dev->id.bustype = BUS_HOST;