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: 1844451 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id B8F2E3FCA5 for ; Thu, 6 Dec 2012 10:25:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423056Ab2LFKZt (ORCPT ); Thu, 6 Dec 2012 05:25:49 -0500 Received: from mail-pa0-f46.google.com ([209.85.220.46]:56672 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422997Ab2LFKZs (ORCPT ); Thu, 6 Dec 2012 05:25:48 -0500 Received: by mail-pa0-f46.google.com with SMTP id bh2so4338301pad.19 for ; Thu, 06 Dec 2012 02:25:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=IhVcniPNRNZYM+ujDMvCq857w2Az9aOGEVHBFbqjpmc=; b=CuAvGP9jBQqkhHZLjoAQwo3ScK93UWbpJ68LF7nQtWW/vbtZBhs5w9nrH/wHDJZXpP 9YlkblhuDNnXgkHhnXDsg+YZV7b3tMuga7DT93F6oZX83/wKGvldVlxwIBvbQbxN1sdz PsfJ9kDlBl4sDZRDLRhsh4R5vfvQyOqsd8v+N7Rp3eFmL6puia3pmpmWDhAsy027WoZo Y3hXoW2U/2MlBx3efqxHU8nPnZR5LZL8amy7YFcF2nf0ON2IGYYmcJTD6q2raJTtCoQX HPEmx8o7Tp+RvDNhwvDEQgNRvWDvkrZ+b+O7XVZoEFiasgp3BbBW3MufRwCMxUkQU9UK JF8Q== 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: ALoCoQmMzC5bA+oMtiZ055jekUFUaVKR24rCywFNMsy+2Y20qF1GcpP6HrnYey7KvJpyBxTFYO+L Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org 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