From patchwork Mon Oct 2 12:08: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: 114590 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp608553qgn; Mon, 2 Oct 2017 05:13:01 -0700 (PDT) X-Google-Smtp-Source: AOwi7QBQPWOnTZBGVtTmlIGMyi8JJzmOsjUAZh2LwzkAHx7/KOBE/q1WS7+ckjhS1dL2bCqkMCyi X-Received: by 10.98.55.5 with SMTP id e5mr5030826pfa.21.1506946380910; Mon, 02 Oct 2017 05:13:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506946380; cv=none; d=google.com; s=arc-20160816; b=jAzQ4R/Y6zyw2XwADVCoSc4Ocmu7i+/2RstOREnXVY+QUQkSItvvZsUMhRxfcs62li +RFgncODtyAgEXCVrOETL1QtRprGW4eQUxfCu3c0Cre90y+/SP9LLKXXHyW5vgyzCBBp FTQJyt7tSiTnjm54OAyxdvR2RNoznePkghEbxvikEKhd1btFCt7O5/P40K+qQYLANj0O OG1sAC49NqL1uSZBq7lMBC/HD6RF+/gLT99V4kXODbGYMJyQcSZT6J3Np2CPkaD7Ik4x 9t1IKvsumDNuHvobbrph/v6osT8G8i8SZ8//CkyYZnjfQ6brl9q4qY9bveM/NUQGXF53 V6GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=wjX2hyY9gE/oBM540TLjhpXbuIpLnmdojAyFryJ5k6A=; b=BrDFvN6iob+gaUnwsGUIMaeq6j2U56ueJFHUiHq3Ck2KJzj7JfNhofol7bKXeiWW5m C8fM+lAHAUGSszPZFaZ/1KKiQwq8H+s8PW3WTDA3CBc2DqKz9EWLHGtdY86A2I3bP1rQ n19MUo9HcRSg2qrZEdmMCooERhgBSkA3HW5x7t5s0lWVpnI0UWIRWpN/Iia8kNf/Bco2 qSM6/+sLm2h9nj4K1jX/gFKM6pgaMqAwSZQptI5nFkflasGjeIb3SEZC5S0WInu/L2hf 1w69n+P6Jm2CUbKxOYq7hqT3/6UBmBm5fiLSjA/spjKRCWaxRP8Y0J05PxNBDMMfCTuz nxZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l7si7538000pgs.767.2017.10.02.05.13.00; Mon, 02 Oct 2017 05:13:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750957AbdJBMM7 (ORCPT + 5 others); Mon, 2 Oct 2017 08:12:59 -0400 Received: from mail.free-electrons.com ([62.4.15.54]:45551 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751195AbdJBMKE (ORCPT ); Mon, 2 Oct 2017 08:10:04 -0400 Received: by mail.free-electrons.com (Postfix, from userid 110) id 4DA7720A16; Mon, 2 Oct 2017 14:10:02 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 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 EF61A20A16; Mon, 2 Oct 2017 14:10:01 +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 Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, thomas.petazzoni@free-electrons.com, linux-sunxi@googlegroups.com, Quentin Schulz Subject: [PATCH v3 04/12] pinctrl: axp209: add programmable gpio_status_offset Date: Mon, 2 Oct 2017 14:08:46 +0200 Message-Id: <20171002120854.5212-5-quentin.schulz@free-electrons.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171002120854.5212-1-quentin.schulz@free-electrons.com> References: <20171002120854.5212-1-quentin.schulz@free-electrons.com> Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org 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(-) -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Acked-by: Maxime Ripard diff --git a/drivers/pinctrl/pinctrl-axp209.c b/drivers/pinctrl/pinctrl-axp209.c index 3ddeba45feed..17146496b22a 100644 --- a/drivers/pinctrl/pinctrl-axp209.c +++ b/drivers/pinctrl/pinctrl-axp209.c @@ -45,6 +45,7 @@ struct axp20x_pctrl_desc { unsigned int ldo_mask; /* Stores the pins supporting ADC function. Bit offset is pin number. */ unsigned int adc_mask; + unsigned int gpio_status_offset; }; struct axp20x_pinctrl_function { @@ -74,6 +75,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) @@ -105,7 +107,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)