From patchwork Thu Dec 6 10:18:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 13390 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 0450F23E1A for ; Thu, 6 Dec 2012 10:25:50 +0000 (UTC) Received: from mail-ie0-f172.google.com (mail-ie0-f172.google.com [209.85.223.172]) by fiordland.canonical.com (Postfix) with ESMTP id 9DBAEA195C7 for ; Thu, 6 Dec 2012 10:25:49 +0000 (UTC) Received: by mail-ie0-f172.google.com with SMTP id c13so10389041ieb.3 for ; Thu, 06 Dec 2012 02:25:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=IhVcniPNRNZYM+ujDMvCq857w2Az9aOGEVHBFbqjpmc=; b=ngE8MHDzbOceouId+P7HLS0pB7FIIUGHwgjFEL9s3LDibwvnvzE8K+GtvfVCW/ZPnr uim0HuJT2G9Jdh2f27jlNGxyh9eNUdVKZIn8PSDvLF5GJmQPXVeU5hgszdt6QgGAw/Xw bz5theXcrcKl/EvmdRyZOrYAnoIbhhuvUY6wHDhEnKuXn82YS4Do1HvSQcET48sLnYwr tgrBpY3/EzdYQF2GuBGfCvHVp9JH5Jrlyqtrm+aH9nzxTv2wL0WCnYTa7RWSqxX+oNwT 1b7U3x5W34SQKrPAfxXWbykoUx0lwConv8dhXcD4s3gfpxhflTieB3Y1s93Q00pvyG0Y 4Nmg== Received: by 10.50.36.164 with SMTP id r4mr850341igj.57.1354789549026; Thu, 06 Dec 2012 02:25:49 -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.50.67.148 with SMTP id n20csp400782igt; Thu, 6 Dec 2012 02:25:48 -0800 (PST) Received: by 10.68.223.131 with SMTP id qu3mr4754127pbc.89.1354789548443; Thu, 06 Dec 2012 02:25:48 -0800 (PST) Received: from mail-pa0-f51.google.com (mail-pa0-f51.google.com [209.85.220.51]) by mx.google.com with ESMTPS id j9si10605568pay.289.2012.12.06.02.25.47 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 06 Dec 2012 02:25:48 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.51 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.220.51; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.51 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) smtp.mail=sachin.kamat@linaro.org Received: by mail-pa0-f51.google.com with SMTP id fb11so3831018pad.10 for ; Thu, 06 Dec 2012 02:25:47 -0800 (PST) Received: by 10.68.136.163 with SMTP id qb3mr4652331pbb.129.1354789547854; Thu, 06 Dec 2012 02:25:47 -0800 (PST) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id ok3sm4578408pbb.11.2012.12.06.02.25.41 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 06 Dec 2012 02:25:47 -0800 (PST) From: Sachin Kamat To: linux-input@vger.kernel.org Cc: dmitry.torokhov@gmail.com, kgene.kim@samsung.com, sachin.kamat@linaro.org, linus.walleij@linaro.org, patches@linaro.org Subject: [PATCH 1/1] Input: samsung-keypad: Add support for pinctrl Date: Thu, 6 Dec 2012 15:48:46 +0530 Message-Id: <1354789126-28304-1-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.4.1 X-Gm-Message-State: ALoCoQm/dDwsoE5JaTD54UcANW76SejodANV0PSdHLwqvdhnVV0Ev08hWo8H2X2vh7PEUPDRrMOq Added support for pin configuration using pinctrl subsystem to the Samsung keypad driver. Signed-off-by: Sachin Kamat --- .../devicetree/bindings/input/samsung-keypad.txt | 12 ++++++++++++ drivers/input/keyboard/samsung-keypad.c | 7 ++++++- 2 files changed, 18 insertions(+), 1 deletions(-) diff --git a/Documentation/devicetree/bindings/input/samsung-keypad.txt b/Documentation/devicetree/bindings/input/samsung-keypad.txt index ce3e394..616cfeb 100644 --- a/Documentation/devicetree/bindings/input/samsung-keypad.txt +++ b/Documentation/devicetree/bindings/input/samsung-keypad.txt @@ -25,6 +25,7 @@ Required Board Specific Properties: - samsung,keypad-num-columns: Number of column lines connected to the keypad controller. +- Samsung GPIO variant (deprecated): - 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. @@ -33,6 +34,10 @@ Required Board Specific Properties: this property depends on the gpio controller to which these column lines are connected. +- Pinctrl variant (preferred, if available): + - pinctrl-0: Pin control group to be used for this controller. + - pinctrl-names: Should contain only one value - "default". + - 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. @@ -56,6 +61,7 @@ Example: linux,input-no-autorepeat; linux,input-wakeup; + /* Samsung GPIO variant begins here */ row-gpios = <&gpx2 0 3 3 0 &gpx2 1 3 3 0>; @@ -67,6 +73,12 @@ Example: &gpx1 5 3 0 0 &gpx1 6 3 0 0 &gpx1 7 3 0 0>; + /* Samsung GPIO variant ends here */ + + /* Pinctrl variant begins here */ + pinctrl-0 = <&keypad_row0 &keypad_col0>; + pinctrl-names = "default"; + /* Pinctrl variant ends here */ key_1 { keypad,row = <0>; diff --git a/drivers/input/keyboard/samsung-keypad.c b/drivers/input/keyboard/samsung-keypad.c index 22e357b..18770e4 100644 --- a/drivers/input/keyboard/samsung-keypad.c +++ b/drivers/input/keyboard/samsung-keypad.c @@ -27,6 +27,7 @@ #include #include #include +#include #define SAMSUNG_KEYIFCON 0x00 #define SAMSUNG_KEYIFSTSCLR 0x04 @@ -79,6 +80,7 @@ struct samsung_keypad { unsigned int rows; unsigned int cols; unsigned int row_state[SAMSUNG_MAX_COLS]; + struct pinctrl *pctrl; #ifdef CONFIG_OF int row_gpios[SAMSUNG_MAX_ROWS]; int col_gpios[SAMSUNG_MAX_COLS]; @@ -424,9 +426,12 @@ static int samsung_keypad_probe(struct platform_device *pdev) keypad->stopped = true; init_waitqueue_head(&keypad->wait); + keypad->pctrl = devm_pinctrl_get_select_default(&pdev->dev); + if (pdev->dev.of_node) { #ifdef CONFIG_OF - samsung_keypad_parse_dt_gpio(&pdev->dev, keypad); + if (IS_ERR(keypad->pctrl)) + samsung_keypad_parse_dt_gpio(&pdev->dev, keypad); keypad->type = of_device_is_compatible(pdev->dev.of_node, "samsung,s5pv210-keypad"); #endif