From patchwork Fri Dec 1 13:44:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 120330 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1158392qgn; Fri, 1 Dec 2017 05:47:16 -0800 (PST) X-Google-Smtp-Source: AGs4zMaKtzUA6yy/mgsZlsqJNPHe4eXrgPibxatWkpQPNA4lWENMXHLQ/wFrUUwj/InVIef2I7Qj X-Received: by 10.99.126.6 with SMTP id z6mr5872946pgc.126.1512136036794; Fri, 01 Dec 2017 05:47:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512136036; cv=none; d=google.com; s=arc-20160816; b=GZ6AonLmsqZzZrGaaUczG4v+xJrWZ+6BjuOg+lZDln/IXUU9C7CLHkw16qKg/J/vjp UTYAe6C4mtwZYUiu43W0uw6U8VyJKk6e+SKLjRiXtdGKbqIun9MO+e4pDf113zTmP1eo uatHwPtQiKkVljK73A2yn+ZENdGPfE6pwH780ApKhG0MzZ3++7DMzcXRk0DADu+I70/h Q8lBL7YviJhLRpvonItmEA6Lli2kbkWsFbUTGDAqAVL0NB1oMT5hTUYuU+BJqmV4ZBqA 6O0hJZ+asfOk9d0IaSfGwEv0CCs7rmlnh+EcZLRRA8MJ96Bojtwm9cZH4v4X6OsGwyyj aZgA== 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:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=YnrdnvpkRysyX1AUHyKqV8uK+LGrEH3Qv7Q86ALdRsM=; b=P0bthfIhDUUn7Px6AEhXTxrRGtIBKmKO2wdIjLwV3v7trmc3JaMzrup/efa/gmEtmU UMVWQRWzrG/b2rCjAooQeOtVf4EXFsEQkFqAxFJRYvEP1rVV4Y60hpoyh/rGntOXPDxL A2X6IvcfJVbfeaWCyEGEjuH9B/SrNHSs3NXhtNGXe1oUWRRd9yasXaAfJDZBICqz6ofk rXPXlzXLEwyKkNApqESpH+UssHRHXyNj8UkmxkswlQFT5YzPQsVBl8XniKKfFEPwSap3 2y3RcPz5pj9w1H/+SO2dXkdHhaVbb62YIie415DZDSFOiBTrXAcrfIcKt+gMlkdQ6w2j JjgQ== 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 t19si5048738plj.431.2017.12.01.05.47.16; Fri, 01 Dec 2017 05:47:16 -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 S1752966AbdLANrP (ORCPT + 6 others); Fri, 1 Dec 2017 08:47:15 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:36275 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753027AbdLANpx (ORCPT ); Fri, 1 Dec 2017 08:45:53 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id A3C3C20C8E; Fri, 1 Dec 2017 14:45:50 +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 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 4443B20999; Fri, 1 Dec 2017 14:45:40 +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 v4 07/10] pinctrl: axp209: add support for AXP813 GPIOs Date: Fri, 1 Dec 2017 14:44:48 +0100 Message-Id: X-Mailer: git-send-email 2.14.1 In-Reply-To: References: In-Reply-To: References: 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 --- Documentation/devicetree/bindings/gpio/gpio-axp209.txt | 13 +++- drivers/pinctrl/pinctrl-axp209.c | 35 ++++++++--- 2 files changed, 39 insertions(+), 9 deletions(-) -- git-series 0.9.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 4705020..1bbf7ab 100644 --- a/Documentation/devicetree/bindings/gpio/gpio-axp209.txt +++ b/Documentation/devicetree/bindings/gpio/gpio-axp209.txt @@ -4,7 +4,9 @@ This driver follows the usual GPIO bindings found in Documentation/devicetree/bindings/gpio/gpio.txt 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. @@ -49,8 +51,17 @@ Example: GPIOs and their functions ------------------------- +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 504e96c..5f1278f 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 offset) { switch (offset) { @@ -358,10 +375,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; @@ -389,9 +414,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; @@ -436,12 +461,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 = { From patchwork Fri Dec 1 13:44:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Schulz X-Patchwork-Id: 120326 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1157057qgn; Fri, 1 Dec 2017 05:46:02 -0800 (PST) X-Google-Smtp-Source: AGs4zMZpuTcf4iaMdCRRlVuT47Y+Iv/wY8uXticUvJs9AWdpUZ6IEL014Mt0M9mvGX92LDgH9MYI X-Received: by 10.98.144.88 with SMTP id a85mr10440379pfe.127.1512135962786; Fri, 01 Dec 2017 05:46:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512135962; cv=none; d=google.com; s=arc-20160816; b=XgDclT2vHdYEyNOx1uPuk11pOc8R6Z3V22wSy8h6fejPJMIIzYMs263UaDfFf2304p gKbXzPGhjNXLTgWNewOn1qndsSZDMOBNLuKqttzuS+4AreNn9In53spdj6r8+LpSu09/ SH+Jq14EwJ3yb6+6R8ZhvRIko0rzG/mTmEXS+r40u3jgPQtUBWLtuP8gISprlMHRSTvg 02LnYe0kDXKCGG0WoRloN1y00tDveo5dDibEyXWS5y7iM4dD5X7rUCSqje/IBkrtTwps A1TpZiXt1Av4M8KZ+LtZKp9QYKWLli2FE9kGxpCSRdeu5Lc/5yHBWjWx+tNSEyjKJ+0B cfpg== 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:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=/T1/zd0KhRosnacW0ujOLgwNA7i+NHuRnJABbmmXqBo=; b=LCcGgVtcMoq/kCdwi/hGWZNha7pF0+EVnb33kW/CdYgNbzgmM82XHeuAUuUs3MCc8L pYIR4PkNfufr3kstOl94Qx68Jv7DU9jNG79GSKVoCHT/awyF8QUlY6/Yz35b8NUls2VU udtSQw22Iwt2iSQ+Xk1tlWFwJY9sKMuC0CYgMysu07aklqZMSEw1FBgw4D1DRTHkTklx x9VLhjZxUBZXcukWemRQ0WcQnyN7BRDdKQbdwsq/zlMzmv+J/u+KmXcqbYHZCpD2xB06 tFUGmKnOnWuYI0wlH6hb17Ug9JPaJHKJx8EN+n4GU87hnjwcSshEHWnvdaK/+uQiW47I VmBQ== 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 m68si4871503pgm.360.2017.12.01.05.46.02; Fri, 01 Dec 2017 05:46:02 -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 S1752937AbdLANqB (ORCPT + 6 others); Fri, 1 Dec 2017 08:46:01 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:36294 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752916AbdLANp7 (ORCPT ); Fri, 1 Dec 2017 08:45:59 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id 37915213DC; Fri, 1 Dec 2017 14:45:57 +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 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 45377209BB; Fri, 1 Dec 2017 14:45:41 +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 v4 10/10] ARM: dtsi: axp81x: set pinmux for GPIO0/1 when used as LDOs Date: Fri, 1 Dec 2017 14:44:51 +0100 Message-Id: X-Mailer: git-send-email 2.14.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org On AXP813/818, GPIO0 and GPIO1 can be used as LDO as (respectively) ldo_io0 and ldo_io1. Let's add the pinctrl properties to the said regulators. Signed-off-by: Quentin Schulz --- arch/arm/boot/dts/axp81x.dtsi | 14 ++++++++++++++ 1 file changed, 14 insertions(+) -- git-series 0.9.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/arch/arm/boot/dts/axp81x.dtsi b/arch/arm/boot/dts/axp81x.dtsi index 0ef959d..fd55b89 100644 --- a/arch/arm/boot/dts/axp81x.dtsi +++ b/arch/arm/boot/dts/axp81x.dtsi @@ -52,6 +52,16 @@ compatible = "x-powers,axp813-gpio"; gpio-controller; #gpio-cells = <2>; + + gpio0_ldo: gpio0-ldo { + pins = "GPIO0"; + function = "ldo"; + }; + + gpio1_ldo: gpio1-ldo { + pins = "GPIO1"; + function = "ldo"; + }; }; regulators { @@ -119,11 +129,15 @@ }; reg_ldo_io0: ldo-io0 { + pinctrl-names = "default"; + pinctrl-0 = <&gpio0_ldo>; /* Disable by default to avoid conflicts with GPIO */ status = "disabled"; }; reg_ldo_io1: ldo-io1 { + pinctrl-names = "default"; + pinctrl-0 = <&gpio1_ldo>; /* Disable by default to avoid conflicts with GPIO */ status = "disabled"; };