From patchwork Tue Dec 5 14:46:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 120656 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5836535qgn; Tue, 5 Dec 2017 06:48:38 -0800 (PST) X-Google-Smtp-Source: AGs4zMbJgXuDvbS42YLffESw+5NmXaW3T9Rjn2cU8VUj5zMrWf/5j73u3Sk7s1lRhjNFTF6vpKz8 X-Received: by 10.98.41.197 with SMTP id p188mr23484696pfp.9.1512485318778; Tue, 05 Dec 2017 06:48:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512485318; cv=none; d=google.com; s=arc-20160816; b=Zc+965sjOarXa0846nHayXIpEKU8eVQr7yYUPLxt2y/O8keGiBEh5c8MpYSr+aATMx ICI3ymw8uryxUzAkKlv3fxrNR0H0HdDg5/aqqRvsGbpKfLqMhM1nqswr3cB7ztaBJmjU eQf83geayPkkCoS8nN6SmmttqsV6YgXeF97L6ywUawP/ifVO6EfXlsEw+v07Yp3I0gXn ssDNeesJyFlirtVacEn8ThiAqGk2svreoaHjohRPNHlItutgOks5Ti4/4FXkqP+k2Fy0 Rz9svUh6rMxeTLZBPQBHCBzHicC1lBoWOUO8md4ehxxOipvymAxPBm3oe1GFdOfhuxSW eZRQ== 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=mWnUMrSEGz91o4cX4dK5A+GMA7/s5ynYugLQ5Dx1LQM=; b=JFoVccdFqSchri2bBkdNZ90izd4I5UX3rHUyWnH1Q8Iy8Ebnr4MKgHERHfHhZvalt+ 2zsPvuYu1WPZ6sdLM2g/s7wgnCZix0FJtGAWH2J/Sb0OeG4KmsrZ8ZvIB88MZ++ec88S C9WJWrERUTbYOb82NOHjSLLHkLo1ElVvtGy/MAHq88VMCZij3NEjjGpqFUSFzp6X4LKu dM94AfPLb4WBkg8pMcM4Lh90SCtzHCCxSqPZoAjyJw/JeJyLksruPoa58xRXJTPE3gxi iiQ+pMa+wR7QpFwYs6tlHqYXTPuGatOf2pif6xdgQxpgpbvfDhaymsAI1IQzg9Hq7wxd jTMQ== 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 q15si198459pfl.112.2017.12.05.06.48.38; Tue, 05 Dec 2017 06:48:38 -0800 (PST) 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 S1752687AbdLEOsg (ORCPT + 6 others); Tue, 5 Dec 2017 09:48:36 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:54769 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752466AbdLEOsf (ORCPT ); Tue, 5 Dec 2017 09:48:35 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id 98CBC20741; Tue, 5 Dec 2017 15:48:33 +0100 (CET) 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 45333206F1; Tue, 5 Dec 2017 15:48:33 +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 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 v5 1/9] gpio: axp209: switch unsigned variables to unsigned int Date: Tue, 5 Dec 2017 15:46:39 +0100 Message-Id: <20171205144647.17594-2-quentin.schulz@free-electrons.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171205144647.17594-1-quentin.schulz@free-electrons.com> References: <20171205144647.17594-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 Checkpatch complains with the following message: WARNING: Prefer 'unsigned int' to bare use of 'unsigned' Let's make it happy by switching over to unsigned int. Signed-off-by: Quentin Schulz --- drivers/gpio/gpio-axp209.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) -- 2.14.1 -- 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 diff --git a/drivers/gpio/gpio-axp209.c b/drivers/gpio/gpio-axp209.c index 4a346b7b4172..6ee7dc1418fa 100644 --- a/drivers/gpio/gpio-axp209.c +++ b/drivers/gpio/gpio-axp209.c @@ -32,7 +32,7 @@ struct axp20x_gpio { struct regmap *regmap; }; -static int axp20x_gpio_get_reg(unsigned offset) +static int axp20x_gpio_get_reg(unsigned int offset) { switch (offset) { case 0: @@ -46,7 +46,7 @@ static int axp20x_gpio_get_reg(unsigned offset) return -EINVAL; } -static int axp20x_gpio_input(struct gpio_chip *chip, unsigned offset) +static int axp20x_gpio_input(struct gpio_chip *chip, unsigned int offset) { struct axp20x_gpio *gpio = gpiochip_get_data(chip); int reg; @@ -60,7 +60,7 @@ static int axp20x_gpio_input(struct gpio_chip *chip, unsigned offset) AXP20X_GPIO_FUNCTION_INPUT); } -static int axp20x_gpio_get(struct gpio_chip *chip, unsigned offset) +static int axp20x_gpio_get(struct gpio_chip *chip, unsigned int offset) { struct axp20x_gpio *gpio = gpiochip_get_data(chip); unsigned int val; @@ -73,7 +73,8 @@ static int axp20x_gpio_get(struct gpio_chip *chip, unsigned offset) return !!(val & BIT(offset + 4)); } -static int axp20x_gpio_get_direction(struct gpio_chip *chip, unsigned offset) +static int axp20x_gpio_get_direction(struct gpio_chip *chip, + unsigned int offset) { struct axp20x_gpio *gpio = gpiochip_get_data(chip); unsigned int val; @@ -102,7 +103,7 @@ static int axp20x_gpio_get_direction(struct gpio_chip *chip, unsigned offset) return val & 2; } -static int axp20x_gpio_output(struct gpio_chip *chip, unsigned offset, +static int axp20x_gpio_output(struct gpio_chip *chip, unsigned int offset, int value) { struct axp20x_gpio *gpio = gpiochip_get_data(chip); @@ -118,7 +119,7 @@ static int axp20x_gpio_output(struct gpio_chip *chip, unsigned offset, : AXP20X_GPIO_FUNCTION_OUT_LOW); } -static void axp20x_gpio_set(struct gpio_chip *chip, unsigned offset, +static void axp20x_gpio_set(struct gpio_chip *chip, unsigned int offset, int value) { axp20x_gpio_output(chip, offset, value); From patchwork Tue Dec 5 14:46:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 120657 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5836592qgn; Tue, 5 Dec 2017 06:48:41 -0800 (PST) X-Google-Smtp-Source: AGs4zMb2RDnqL/88Ala1mtYdj3+BmVmv7t53RClByghET0Apijfb/SIqN5uX3pcGcRe+DKO9Tx9y X-Received: by 10.84.171.193 with SMTP id l59mr18888087plb.33.1512485321463; Tue, 05 Dec 2017 06:48:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512485321; cv=none; d=google.com; s=arc-20160816; b=X/9LOaYe30oyGUuJTDhXbejR0sULZiGTBtti2afmR/Zrg9RyJkE+l2gHnfvJujmR14 vEXW/FvAZ7kx+06ctp80ccyGteTE/LLBVYcCPtIF2I8o7NOwxKyZGXOqwW2O8RdbrqMh pru07zahn43MPp3duVCsXX6otCK2S07iMX9dD8m7ct3m+pUYPLINuMG2l2bfGfdUksT/ k7K7BwG4vx8c4Xjdsn2L2GD8E+VYMA5TfIeFp2yXyiGlX1l8B6oifNNi/FZ5E6j6oXOa nY6zkGrGusqL5lYpoTe4VN2hIVuXUKGEVEg707BD1zYhNiI2i9MwjadRnCtAQXkuBnMS cKGA== 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=TyEFM61cI2csmiN83aGoF6pMlHM0IXfLzn/f6bpN2V0=; b=a1A0JvQTAtcYyrh1Nt5miihdrVmfsZhP/FSW0Qfzx3xvZ+EO6SI7QMrIR+Rj+JgNn9 ozUKEirxkJ8FRR1H1yKLy73sjJavJnk24P/2cowRUF740cpGX8Mj8cEE7zELvf+SoDcD U5UUlaoFS3r18PL2ntzu4p2Gxk1BbpMjKIGlw7sKLitqUEhIYnwHYDR9mg6iq9Q7jlaB 3fjFLoH+lYF4djdkV39hCwyG9h5CylVWnWI3FdQwzZ6598iwt3wkzCGM2sC1aMwvOF3Z VwFWKrt1OyoWs9mrniz1rB6/M2T5a86m1EogSa8sUEAl4KstqQePYI0kS6VyGkO8T7Ny pjBw== 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 h1si168887pld.629.2017.12.05.06.48.41; Tue, 05 Dec 2017 06:48:41 -0800 (PST) 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 S1752235AbdLEOsj (ORCPT + 6 others); Tue, 5 Dec 2017 09:48:39 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:54777 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752587AbdLEOsf (ORCPT ); Tue, 5 Dec 2017 09:48:35 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id E0CB220744; Tue, 5 Dec 2017 15:48:33 +0100 (CET) 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 8EF812055D; Tue, 5 Dec 2017 15:48:33 +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 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 v5 2/9] pinctrl: move gpio-axp209 to pinctrl Date: Tue, 5 Dec 2017 15:46:40 +0100 Message-Id: <20171205144647.17594-3-quentin.schulz@free-electrons.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171205144647.17594-1-quentin.schulz@free-electrons.com> References: <20171205144647.17594-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 the driver for the upcoming pinctrl features, move the GPIO driver AXP209 from GPIO to pinctrl subsystem. Signed-off-by: Quentin Schulz Acked-by: Maxime Ripard Acked-by: Chen-Yu Tsai --- drivers/gpio/Kconfig | 6 ------ drivers/gpio/Makefile | 1 - drivers/pinctrl/Kconfig | 10 ++++++++++ drivers/pinctrl/Makefile | 1 + drivers/{gpio/gpio-axp209.c => pinctrl/pinctrl-axp209.c} | 0 5 files changed, 11 insertions(+), 7 deletions(-) rename drivers/{gpio/gpio-axp209.c => pinctrl/pinctrl-axp209.c} (100%) -- 2.14.1 -- 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 diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index d6a8e851ad13..395669bfcc26 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -122,12 +122,6 @@ config GPIO_ATH79 Select this option to enable GPIO driver for Atheros AR71XX/AR724X/AR913X SoC devices. -config GPIO_AXP209 - tristate "X-Powers AXP209 PMIC GPIO Support" - depends on MFD_AXP20X - help - Say yes to enable GPIO support for the AXP209 PMIC - config GPIO_BCM_KONA bool "Broadcom Kona GPIO" depends on OF_GPIO && (ARCH_BCM_MOBILE || COMPILE_TEST) diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index 4bc24febb889..bc5dd673fa11 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile @@ -32,7 +32,6 @@ obj-$(CONFIG_GPIO_AMDPT) += gpio-amdpt.o obj-$(CONFIG_GPIO_ARIZONA) += gpio-arizona.o obj-$(CONFIG_GPIO_ATH79) += gpio-ath79.o obj-$(CONFIG_GPIO_ASPEED) += gpio-aspeed.o -obj-$(CONFIG_GPIO_AXP209) += gpio-axp209.o obj-$(CONFIG_GPIO_BCM_KONA) += gpio-bcm-kona.o obj-$(CONFIG_GPIO_BD9571MWV) += gpio-bd9571mwv.o obj-$(CONFIG_GPIO_BRCMSTB) += gpio-brcmstb.o diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig index 4571cc098b76..ce126955212c 100644 --- a/drivers/pinctrl/Kconfig +++ b/drivers/pinctrl/Kconfig @@ -63,6 +63,16 @@ config PINCTRL_AS3722 open drain configuration for the GPIO pins of AS3722 devices. It also supports the GPIO functionality through gpiolib. +config PINCTRL_AXP209 + tristate "X-Powers AXP209 PMIC pinctrl and GPIO Support" + depends on MFD_AXP20X + help + AXP PMICs provides multiple GPIOs that can be muxed for different + functions. This driver bundles a pinctrl driver to select the function + muxing and a GPIO driver to handle the GPIO when the GPIO function is + selected. + Say yes to enable pinctrl and GPIO support for the AXP209 PMIC + config PINCTRL_BF54x def_bool y if BF54x select PINCTRL_ADI2 diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile index d0d4844f8022..4777f1595ce2 100644 --- a/drivers/pinctrl/Makefile +++ b/drivers/pinctrl/Makefile @@ -11,6 +11,7 @@ obj-$(CONFIG_GENERIC_PINCONF) += pinconf-generic.o obj-$(CONFIG_PINCTRL_ADI2) += pinctrl-adi2.o obj-$(CONFIG_PINCTRL_ARTPEC6) += pinctrl-artpec6.o obj-$(CONFIG_PINCTRL_AS3722) += pinctrl-as3722.o +obj-$(CONFIG_PINCTRL_AXP209) += pinctrl-axp209.o obj-$(CONFIG_PINCTRL_BF54x) += pinctrl-adi2-bf54x.o obj-$(CONFIG_PINCTRL_BF60x) += pinctrl-adi2-bf60x.o obj-$(CONFIG_PINCTRL_AT91) += pinctrl-at91.o diff --git a/drivers/gpio/gpio-axp209.c b/drivers/pinctrl/pinctrl-axp209.c similarity index 100% rename from drivers/gpio/gpio-axp209.c rename to drivers/pinctrl/pinctrl-axp209.c From patchwork Tue Dec 5 14:46:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 120661 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5838432qgn; Tue, 5 Dec 2017 06:50:23 -0800 (PST) X-Google-Smtp-Source: AGs4zMZka4ZiU5AdvwHkuOFrWvk4X5LHUorHrXFHhcrZWtyHRgu/BAeY+9Yn0V8rIWLsAEbb5MSr X-Received: by 10.101.74.8 with SMTP id s8mr5055126pgq.259.1512485423418; Tue, 05 Dec 2017 06:50:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512485423; cv=none; d=google.com; s=arc-20160816; b=u2X87oSNr96Awi2MNnNoEvm93EmZn6wo6dDUlmhbtOAyTbuXnZ6ucfslYUiUIFrt9i qjJJ1I/sVf3iEJTwIGj6geU5FY0yv16FRZyUiSS067FGBPjCPo7skj+4NvuKoOwWuBt9 fLe36Em4P3ijNGDRvjIMflrx6uzmL/ZxzHbSvviYvlNoGOO89GfkcZm1CDxx8Cug8oug VFOG6l45nD7RcZF5KRVkxxbRUC30edtWeyU18nbKjSSMzDUKerAOqWRxQxi5GmlTIW3/ yq3peK8A91eS+MvNGsEgm98Zpl2Q6gTDJz8euMK8mlP4jCcF37RBzPPZDl10d9dX7S5h Vd7Q== 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=Zyx+ziPd/LAjcGY8mm1nkdXTTcWPL32Z7KkAYhAFqXo=; b=CnfsL2kHfKZ5vCsIXxxhWEJDNfHTrHIZ9ZqZEanp8V0M8KgUdHe283CLS7iNY9Smo2 ItFieYlPMUVWkawViiHkV7r7YMzrG2vEjHGNpADs4VU0vJou+pvYx+PPiCBv3+HMYrmN bfWX6rRcOAfg9sxR/TUQuPWJzzTtXiTWcjg4olFR8EHtsIgrRPns/+64aypye3eHVEhJ CAauvLNCMPClKVSJKTcPeysqdq9jJY0EzFvEueKodX1aFGSQg0JFZ1O9yuM5MmEMrXM7 ujGSLSH+1qMGkHi+MYZeapf39T7bpUQAYmvO0ezP39x10LUxLq2hp2ssjliHH6JRhpbZ phJw== 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 h9si172512pgs.461.2017.12.05.06.50.23; Tue, 05 Dec 2017 06:50:23 -0800 (PST) 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 S1752971AbdLEOuW (ORCPT + 6 others); Tue, 5 Dec 2017 09:50:22 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:54850 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752699AbdLEOsi (ORCPT ); Tue, 5 Dec 2017 09:48:38 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id B46B720B52; Tue, 5 Dec 2017 15:48:36 +0100 (CET) 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 1EA9820411; Tue, 5 Dec 2017 15:48:35 +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 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 v5 7/9] pinctrl: axp209: add programmable ADC muxing value Date: Tue, 5 Dec 2017 15:46:45 +0100 Message-Id: <20171205144647.17594-8-quentin.schulz@free-electrons.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171205144647.17594-1-quentin.schulz@free-electrons.com> References: <20171205144647.17594-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 adc muxing value, add an adc_mux within axp20x_pctl structure and use it. Signed-off-by: Quentin Schulz Acked-by: Maxime Ripard --- drivers/pinctrl/pinctrl-axp209.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.14.1 -- 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 diff --git a/drivers/pinctrl/pinctrl-axp209.c b/drivers/pinctrl/pinctrl-axp209.c index db8e319b6e11..9bb8722ba90f 100644 --- a/drivers/pinctrl/pinctrl-axp209.c +++ b/drivers/pinctrl/pinctrl-axp209.c @@ -49,6 +49,7 @@ struct axp20x_pctrl_desc { /* Stores the pins supporting ADC function. Bit offset is pin number. */ u8 adc_mask; u8 gpio_status_offset; + u8 adc_mux; }; struct axp20x_pinctrl_function { @@ -79,6 +80,7 @@ static const struct axp20x_pctrl_desc axp20x_data = { .ldo_mask = BIT(0) | BIT(1), .adc_mask = BIT(0) | BIT(1), .gpio_status_offset = 4, + .adc_mux = AXP20X_MUX_ADC, }; static int axp20x_gpio_get_reg(unsigned int offset) @@ -334,7 +336,7 @@ static void axp20x_build_funcs_groups(struct platform_device *pdev) * See comment in axp20x_pmx_set_mux. */ pctl->funcs[AXP20X_FUNC_ADC].name = "adc"; - pctl->funcs[AXP20X_FUNC_ADC].muxval = AXP20X_MUX_ADC; + pctl->funcs[AXP20X_FUNC_ADC].muxval = pctl->desc->adc_mux; /* Every pin supports GPIO_OUT and GPIO_IN functions */ for (i = 0; i <= AXP20X_FUNC_GPIO_IN; i++) { From patchwork Tue Dec 5 14:46: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: 120658 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5836698qgn; Tue, 5 Dec 2017 06:48:47 -0800 (PST) X-Google-Smtp-Source: AGs4zMZd/ye6Z4AKgUHS8LWSDe3APqkWS+nIAxGLzFjCNOflLyOKTmgjZSx3STaJsb2cDaRzccU0 X-Received: by 10.99.114.30 with SMTP id n30mr18221692pgc.271.1512485326993; Tue, 05 Dec 2017 06:48:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512485326; cv=none; d=google.com; s=arc-20160816; b=ezyypLDDMCe3B5PyJG1vIU5TlfySnBtEFkO5H+4Z4Ert9mivxIx4pMw3B43+uiHQFC vcA1a7/8z0K10s8kGMEysG8sOGc00oK+ML1emt/8r1jLgtBMeY0TolqSRNb3w33lG0ib 9oT9ESU324eI1DG7xKmtuMlHuIS9dDUzWJjRBtSmAl6WoOaRGjzFFR4qJS/HxHd0ztRR t7GAwYtKls5Gr13iDZv1Vsjrq6eMISVnZqVhhR/fB+jkgXGTl2ggfuymrhxWC0m5BJ8D REKryNAxbAosDQMwIGB7sfh0SPZYOn9yJjWYOD/95T2gF6W90g69yto7uQ7VQJCtr9cD fzAQ== 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=cE79JNRyXPFQCnaq/+aVFBIO7cKHlKgH9GmyxoUyAe8=; b=CJt7MYloV8K0B69bmDD53KTHvpQ3NQX+5EWWP0lEwGuQB1eYzAtsWNfvpwelDV4BtQ oSQA6C9BFlL0OdL5jWboV6ukrM2OSQF6SXufDgSL0YfTozLilAV9ohr/3SgqSy9/HxjT zCZf+vZ4NrxUHtlInBe+lhuMRFExfXCiYZp4OHqUs2c2zLqZcNcRoiXhdeFBCCGXebfE hdr+sZzHeGUYcEE83gR/6/uFOSMJSHFWTSAkGJNfWyufLV4knAd6DDgbmTjPT3E0lJnz G67KU953sps0BLtkTtS3s7f1wgdcPsRrP5KBo0aJ9Sl4tiCaypFd44Uqu7Q4mNnaNXKi 4YLg== 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 s4si180502plj.0.2017.12.05.06.48.46; Tue, 05 Dec 2017 06:48:46 -0800 (PST) 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 S1752785AbdLEOsp (ORCPT + 6 others); Tue, 5 Dec 2017 09:48:45 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:54865 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752701AbdLEOsj (ORCPT ); Tue, 5 Dec 2017 09:48:39 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id E710220731; Tue, 5 Dec 2017 15:48:36 +0100 (CET) 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 6FB1E209F0; Tue, 5 Dec 2017 15:48:35 +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 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 v5 8/9] pinctrl: axp209: add support for AXP813 GPIOs Date: Tue, 5 Dec 2017 15:46:46 +0100 Message-Id: <20171205144647.17594-9-quentin.schulz@free-electrons.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171205144647.17594-1-quentin.schulz@free-electrons.com> References: <20171205144647.17594-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 The AXP813 has only two GPIOs. GPIO0 can either be used as a GPIO, an LDO regulator or an ADC. GPIO1 can be used either as a GPIO or an LDO regulator. Moreover, the status bit of the GPIOs when in input mode is not offset by 4 unlike the AXP209. Signed-off-by: Quentin Schulz Acked-by: Maxime Ripard Acked-by: Rob Herring --- .../devicetree/bindings/gpio/gpio-axp209.txt | 13 +++++++- drivers/pinctrl/pinctrl-axp209.c | 35 +++++++++++++++++----- 2 files changed, 39 insertions(+), 9 deletions(-) -- 2.14.1 -- 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 diff --git a/Documentation/devicetree/bindings/gpio/gpio-axp209.txt b/Documentation/devicetree/bindings/gpio/gpio-axp209.txt index 0d77597c3f92..fc42b2caa06d 100644 --- a/Documentation/devicetree/bindings/gpio/gpio-axp209.txt +++ b/Documentation/devicetree/bindings/gpio/gpio-axp209.txt @@ -9,7 +9,9 @@ Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt This driver employs the per-pin muxing pattern. Required properties: -- compatible: Should be "x-powers,axp209-gpio" +- compatible: Should be one of: + - "x-powers,axp209-gpio" + - "x-powers,axp813-gpio" - #gpio-cells: Should be two. The first cell is the pin number and the second is the GPIO flags. - gpio-controller: Marks the device node as a GPIO controller. @@ -57,8 +59,17 @@ GPIOs and their functions Each GPIO is independent from the other (i.e. GPIO0 in gpio_in function does not force GPIO1 and GPIO2 to be in gpio_in function as well). +axp209 +------ GPIO | Functions ------------------------ GPIO0 | gpio_in, gpio_out, ldo, adc GPIO1 | gpio_in, gpio_out, ldo, adc GPIO2 | gpio_in, gpio_out + +axp813 +------ +GPIO | Functions +------------------------ +GPIO0 | gpio_in, gpio_out, ldo, adc +GPIO1 | gpio_in, gpio_out, ldo diff --git a/drivers/pinctrl/pinctrl-axp209.c b/drivers/pinctrl/pinctrl-axp209.c index 9bb8722ba90f..22d3bb0bf927 100644 --- a/drivers/pinctrl/pinctrl-axp209.c +++ b/drivers/pinctrl/pinctrl-axp209.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -41,6 +42,8 @@ #define AXP20X_MUX_GPIO_IN BIT(1) #define AXP20X_MUX_ADC BIT(2) +#define AXP813_MUX_ADC (BIT(2) | BIT(0)) + struct axp20x_pctrl_desc { const struct pinctrl_pin_desc *pins; unsigned int npins; @@ -74,6 +77,11 @@ static const struct pinctrl_pin_desc axp209_pins[] = { PINCTRL_PIN(2, "GPIO2"), }; +static const struct pinctrl_pin_desc axp813_pins[] = { + PINCTRL_PIN(0, "GPIO0"), + PINCTRL_PIN(1, "GPIO1"), +}; + static const struct axp20x_pctrl_desc axp20x_data = { .pins = axp209_pins, .npins = ARRAY_SIZE(axp209_pins), @@ -83,6 +91,15 @@ static const struct axp20x_pctrl_desc axp20x_data = { .adc_mux = AXP20X_MUX_ADC, }; +static const struct axp20x_pctrl_desc axp813_data = { + .pins = axp813_pins, + .npins = ARRAY_SIZE(axp813_pins), + .ldo_mask = BIT(0) | BIT(1), + .adc_mask = BIT(0), + .gpio_status_offset = 0, + .adc_mux = AXP813_MUX_ADC, +}; + static int axp20x_gpio_get_reg(unsigned int offset) { switch (offset) { @@ -357,10 +374,18 @@ static void axp20x_build_funcs_groups(struct platform_device *pdev) pctl->desc->pins); } +static const struct of_device_id axp20x_pctl_match[] = { + { .compatible = "x-powers,axp209-gpio", .data = &axp20x_data, }, + { .compatible = "x-powers,axp813-gpio", .data = &axp813_data, }, + { } +}; +MODULE_DEVICE_TABLE(of, axp20x_pctl_match); + static int axp20x_pctl_probe(struct platform_device *pdev) { struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent); struct axp20x_pctl *pctl; + struct device *dev = &pdev->dev; struct pinctrl_desc *pctrl_desc; int ret; @@ -388,9 +413,9 @@ static int axp20x_pctl_probe(struct platform_device *pdev) pctl->chip.set = axp20x_gpio_set; pctl->chip.direction_input = axp20x_gpio_input; pctl->chip.direction_output = axp20x_gpio_output; - pctl->chip.ngpio = 3; + pctl->chip.ngpio = pctl->desc->npins; - pctl->desc = &axp20x_data; + pctl->desc = (struct axp20x_pctrl_desc *)of_device_get_match_data(dev); pctl->regmap = axp20x->regmap; pctl->dev = &pdev->dev; @@ -435,12 +460,6 @@ static int axp20x_pctl_probe(struct platform_device *pdev) return 0; } -static const struct of_device_id axp20x_pctl_match[] = { - { .compatible = "x-powers,axp209-gpio" }, - { } -}; -MODULE_DEVICE_TABLE(of, axp20x_pctl_match); - static struct platform_driver axp20x_pctl_driver = { .probe = axp20x_pctl_probe, .driver = {