From patchwork Fri Dec 1 13:44:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 10087187 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 5D95D6035E for ; Fri, 1 Dec 2017 13:48:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6BF9229801 for ; Fri, 1 Dec 2017 13:48:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5F0982A148; Fri, 1 Dec 2017 13:48:32 +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 DFB4A29801 for ; Fri, 1 Dec 2017 13:48:31 +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=MN0YvByPzoBdvTx1N85nNQ/gtd8ssUgZT7IV59/be84=; b=b00VYyiRfQGbCGrizLfQU4U9Pq X9DeFRNPgrDknagq6X0tZMAHlysx96YlswgVMGwMnBoQHDGoTj00hRO4XoGy3e1Md/oExcYwWwVbi uk86OEaLSPk+YAJV7hY2/8Qc6K9QhMru0kegNd6NTHLOIlJt2PumPg8mH69PU1YweshOXPD2BEJCv Ice4qROxua5F66sC8Zbv/tScvps8wO3r8SscgwjLYIEggVCXrYQMCnLzhgE7KF/5Ztxn8sntgJYOm COClMR4f+Bcy9Z5i0uQKvEy0TaSPhGo/sXBvLgdrUtcen2XfMSV7aS85cFiKa9Jnxm3Kjy4diCAVV v8zAgJvA==; 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 1eKlg7-000460-4a; Fri, 01 Dec 2017 13:48:31 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eKlfl-0003Zl-Cy for linux-arm-kernel@bombadil.infradead.org; Fri, 01 Dec 2017 13:48:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=pXirMTqG7MoLtI6rt4seQ9oGkoELcfpEEp8eY+7ikxU=; b=P55FFpAsR9wS68GCZC3uiw1fN Gtfc1VD2/OyvM3p9kZnDEUUymEHuOFat/aTe2vk2M+72bGOmzoqbFI7X2Rqo2dnQ8AycCH+quf9NM xdxn3bWyCzLz39ynqLb6fpFiCh1J3tet2/tGI+lDOZZMlOGhn9X5hS2jDbF7+pDMwDyXz1lca0N4i 0CCmKOvVh1S/3nSiWplz7SpIWTKro6up0eYrccC+Zbj+O2CZXzrHdlruWKBjG20GkowqQ2PNI5sau ce+MTeaYx4Y+C1gWOHMblHq1Sgyp6Atq2gz4F6jbTXn5SIy4OuI5tM9n6pWRxNSxCk6cyUrIF9aek 9YhNdFw7A==; Received: from mail.free-electrons.com ([62.4.15.54]) by casper.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eKleF-0000Jp-M1 for linux-arm-kernel@lists.infradead.org; Fri, 01 Dec 2017 13:46:38 +0000 Received: by mail.free-electrons.com (Postfix, from userid 110) id 0478E209F0; Fri, 1 Dec 2017 14:45:50 +0100 (CET) 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 9CA1920986; Fri, 1 Dec 2017 14:45:39 +0100 (CET) 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 v4 05/10] pinctrl: axp209: add programmable gpio_status_offset Date: Fri, 1 Dec 2017 14:44:46 +0100 Message-Id: X-Mailer: git-send-email 2.14.1 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171201_134635_748350_A654D510 X-CRM114-Status: GOOD ( 13.28 ) 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 Acked-by: Maxime Ripard Acked-by: Chen-Yu Tsai --- 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 6201d2b..3fae81f 100644 --- a/drivers/pinctrl/pinctrl-axp209.c +++ b/drivers/pinctrl/pinctrl-axp209.c @@ -48,6 +48,7 @@ struct axp20x_pctrl_desc { u8 ldo_mask; /* Stores the pins supporting ADC function. Bit offset is pin number. */ u8 adc_mask; + u8 gpio_status_offset; }; struct axp20x_pinctrl_function { @@ -77,6 +78,7 @@ static const struct axp20x_pctrl_desc axp20x_data = { .npins = ARRAY_SIZE(axp209_pins), .ldo_mask = BIT(0) | BIT(1), .adc_mask = BIT(0) | BIT(1), + .gpio_status_offset = 4, }; static int axp20x_gpio_get_reg(unsigned offset) @@ -108,7 +110,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->desc->gpio_status_offset)); } static int axp20x_gpio_get_direction(struct gpio_chip *chip, unsigned offset)