From patchwork Tue Sep 26 12:17:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 9971937 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C589E6037E for ; Tue, 26 Sep 2017 12:48:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B832428A6A for ; Tue, 26 Sep 2017 12:48:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC79028A78; Tue, 26 Sep 2017 12:48:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4E41128A00 for ; Tue, 26 Sep 2017 12:48:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=9+XFiSj5/EzZK+eUL0wtjCXxsWE/Nm617I1yCtqC8e8=; b=K18QlWMyBek7aG5XAJGnmEVTyq m91KQLmz012kX4bFtII35ogWAfFBwk3Enjb9RzQag+Fbawz151iMT9gT1omOzvIuFzGLKjtXAupsO jI/Y5rIQ/DrFS+DAJ3val4GmQ/ozSi7JqB+F+zJsa7wRGkOkA820faioh27yFNodK82Xs7kF3zF9n 505tQHk7Z/VpcXwYM7L+gme3BkOy/A0PxDZDA7UONpyqhxQME2hjEnZCh5PsjODK/MGR6Ius0qO6Y emnrhvm2XMSAy+5ZN7757c9H+hIVqEWkReZNi5e2wWYJ+lMLBo274U4P5oDzev+vpRWQMBBEeyRGT 3xZb2a7A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dwpHi-0003ph-4b; Tue, 26 Sep 2017 12:48:22 +0000 Received: from mail.free-electrons.com ([62.4.15.54]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dwop7-0006Rr-Tn for linux-arm-kernel@lists.infradead.org; Tue, 26 Sep 2017 12:18:56 +0000 Received: by mail.free-electrons.com (Postfix, from userid 110) id 50CBB20934; Tue, 26 Sep 2017 14:18:14 +0200 (CEST) Received: from localhost.localdomain (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 8777E2088C; Tue, 26 Sep 2017 14:17:55 +0200 (CEST) From: Quentin Schulz To: linus.walleij@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, wens@csie.org, linux@armlinux.org.uk, maxime.ripard@free-electrons.com, lee.jones@linaro.org Subject: [PATCH v2 05/10] pinctrl: axp209: add programmable gpio_status_offset Date: Tue, 26 Sep 2017 14:17:15 +0200 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170926_051850_682561_1973B0EA X-CRM114-Status: GOOD ( 11.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: thomas.petazzoni@free-electrons.com, devicetree@vger.kernel.org, Quentin Schulz , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-sunxi@googlegroups.com, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP To prepare for patches that will add support for a new PMIC that has a different GPIO input status register, add a gpio_status_offset within axp20x_pctl structure and use it. Signed-off-by: Quentin Schulz --- drivers/pinctrl/pinctrl-axp209.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/pinctrl-axp209.c b/drivers/pinctrl/pinctrl-axp209.c index 4be1aca..11f871e 100644 --- a/drivers/pinctrl/pinctrl-axp209.c +++ b/drivers/pinctrl/pinctrl-axp209.c @@ -89,6 +89,7 @@ struct axp20x_pctl { unsigned int ngroups; struct axp20x_pinctrl_function *functions; unsigned int nfunctions; + unsigned int gpio_status_offset; }; static const struct axp20x_desc_pin axp209_pins[] = { @@ -127,7 +128,7 @@ static int axp20x_gpio_get(struct gpio_chip *chip, unsigned offset) if (ret) return ret; - return !!(val & BIT(offset + 4)); + return !!(val & BIT(offset + pctl->gpio_status_offset)); } static int axp20x_gpio_get_direction(struct gpio_chip *chip, unsigned offset) @@ -509,6 +510,7 @@ static int axp20x_pctl_probe(struct platform_device *pdev) pctl->regmap = axp20x->regmap; pctl->desc = &axp20x_pinctrl_data; + pctl->gpio_status_offset = 4; pctl->dev = &pdev->dev; platform_set_drvdata(pdev, pctl);