{"id":818607,"url":"http://patchwork.ozlabs.org/api/patches/818607/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-gpio/patch/b950efcbb2f4d399812591cdf5dce11d0d35b42b.1506428208.git-series.quentin.schulz@free-electrons.com/","project":{"id":42,"url":"http://patchwork.ozlabs.org/api/projects/42/?format=json","name":"Linux GPIO development","link_name":"linux-gpio","list_id":"linux-gpio.vger.kernel.org","list_email":"linux-gpio@vger.kernel.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<b950efcbb2f4d399812591cdf5dce11d0d35b42b.1506428208.git-series.quentin.schulz@free-electrons.com>","list_archive_url":null,"date":"2017-09-26T12:17:16","name":"[v2,06/10] pinctrl: axp209: add support for AXP813 GPIOs","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"bcc224f30f95ac660d097d2110a15707ed9d9c8d","submitter":{"id":69366,"url":"http://patchwork.ozlabs.org/api/people/69366/?format=json","name":"Quentin Schulz","email":"quentin.schulz@free-electrons.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-gpio/patch/b950efcbb2f4d399812591cdf5dce11d0d35b42b.1506428208.git-series.quentin.schulz@free-electrons.com/mbox/","series":[{"id":5123,"url":"http://patchwork.ozlabs.org/api/series/5123/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-gpio/list/?series=5123","date":"2017-09-26T12:17:17","name":"add pinmuxing support for pins in AXP209 and AXP813 PMICs","version":2,"mbox":"http://patchwork.ozlabs.org/series/5123/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/818607/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/818607/checks/","tags":{},"related":[],"headers":{"Return-Path":"<linux-gpio-owner@vger.kernel.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-gpio-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y1g3R0932z9tXK\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 26 Sep 2017 22:18:43 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1030575AbdIZMSS (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tTue, 26 Sep 2017 08:18:18 -0400","from mail.free-electrons.com ([62.4.15.54]:52143 \"EHLO\n\tmail.free-electrons.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S968589AbdIZMSQ (ORCPT\n\t<rfc822; linux-gpio@vger.kernel.org>); Tue, 26 Sep 2017 08:18:16 -0400","by mail.free-electrons.com (Postfix, from userid 110)\n\tid 5579220933; Tue, 26 Sep 2017 14:18:14 +0200 (CEST)","from localhost.localdomain\n\t(LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87])\n\tby mail.free-electrons.com (Postfix) with ESMTPSA id D3F582088F;\n\tTue, 26 Sep 2017 14:17:55 +0200 (CEST)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on\n\tmail.free-electrons.com","X-Spam-Level":"","X-Spam-Status":"No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT,\n\tURIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0","From":"Quentin Schulz <quentin.schulz@free-electrons.com>","To":"linus.walleij@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com,\n\twens@csie.org, linux@armlinux.org.uk,\n\tmaxime.ripard@free-electrons.com, lee.jones@linaro.org","Cc":"linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org,\n\tlinux-sunxi@googlegroups.com, thomas.petazzoni@free-electrons.com,\n\tQuentin Schulz <quentin.schulz@free-electrons.com>","Subject":"[PATCH v2 06/10] pinctrl: axp209: add support for AXP813 GPIOs","Date":"Tue, 26 Sep 2017 14:17:16 +0200","Message-Id":"<b950efcbb2f4d399812591cdf5dce11d0d35b42b.1506428208.git-series.quentin.schulz@free-electrons.com>","X-Mailer":"git-send-email 2.11.0","In-Reply-To":["<cover.1c314f4154a6d27354625f03d0a5269eee55a9c5.1506428208.git-series.quentin.schulz@free-electrons.com>","<cover.1c314f4154a6d27354625f03d0a5269eee55a9c5.1506428208.git-series.quentin.schulz@free-electrons.com>"],"References":["<cover.1c314f4154a6d27354625f03d0a5269eee55a9c5.1506428208.git-series.quentin.schulz@free-electrons.com>","<cover.1c314f4154a6d27354625f03d0a5269eee55a9c5.1506428208.git-series.quentin.schulz@free-electrons.com>"],"Sender":"linux-gpio-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<linux-gpio.vger.kernel.org>","X-Mailing-List":"linux-gpio@vger.kernel.org"},"content":"The AXP813 has only two GPIOs. GPIO0 can either be used as a GPIO, an\nLDO regulator or an ADC. GPIO1 can be used either as a GPIO or an LDO\nregulator.\n\nMoreover, the status bit of the GPIOs when in input mode is not offset\nby 4 unlike the AXP209.\n\nSigned-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>\n---\n Documentation/devicetree/bindings/pinctrl/pinctrl-axp209.txt | 13 ++-\n drivers/pinctrl/pinctrl-axp209.c                             | 30 ++++++-\n 2 files changed, 39 insertions(+), 4 deletions(-)","diff":"diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-axp209.txt b/Documentation/devicetree/bindings/pinctrl/pinctrl-axp209.txt\nindex a5bfe87..a1d5dec 100644\n--- a/Documentation/devicetree/bindings/pinctrl/pinctrl-axp209.txt\n+++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-axp209.txt\n@@ -4,7 +4,9 @@ This driver follows the usual GPIO bindings found in\n Documentation/devicetree/bindings/gpio/gpio.txt\n \n Required properties:\n-- compatible: Should be \"x-powers,axp209-gpio\"\n+- compatible: Should be one of:\n+\t- \"x-powers,axp209-gpio\"\n+\t- \"x-powers,axp813-pctl\"\n - #gpio-cells: Should be two. The first cell is the pin number and the\n   second is the GPIO flags.\n - gpio-controller: Marks the device node as a GPIO controller.\n@@ -49,8 +51,17 @@ Example:\n GPIOs and their functions\n -------------------------\n \n+axp209\n+------\n GPIO\t|\tFunctions\n ------------------------\n GPIO0\t|\tgpio_in, gpio_out, ldo, adc\n GPIO1\t|\tgpio_in, gpio_out, ldo, adc\n GPIO2\t|\tgpio_in, gpio_out\n+\n+axp813\n+------\n+GPIO\t|\tFunctions\n+------------------------\n+GPIO0\t|\tgpio_in, gpio_out, ldo, adc\n+GPIO1\t|\tgpio_in, gpio_out, ldo\ndiff --git a/drivers/pinctrl/pinctrl-axp209.c b/drivers/pinctrl/pinctrl-axp209.c\nindex 11f871e..500862b 100644\n--- a/drivers/pinctrl/pinctrl-axp209.c\n+++ b/drivers/pinctrl/pinctrl-axp209.c\n@@ -108,11 +108,28 @@ static const struct axp20x_desc_pin axp209_pins[] = {\n \t\t   AXP20X_FUNCTION(0x2, \"gpio_in\")),\n };\n \n+static const struct axp20x_desc_pin axp813_pins[] = {\n+\tAXP20X_PIN(AXP20X_PINCTRL_PIN(0, \"GPIO0\", (void *)AXP20X_GPIO0_CTRL),\n+\t\t   AXP20X_FUNCTION(0x0, \"gpio_out\"),\n+\t\t   AXP20X_FUNCTION(0x2, \"gpio_in\"),\n+\t\t   AXP20X_FUNCTION(0x3, \"ldo\"),\n+\t\t   AXP20X_FUNCTION(0x4, \"adc\")),\n+\tAXP20X_PIN(AXP20X_PINCTRL_PIN(1, \"GPIO1\", (void *)AXP20X_GPIO1_CTRL),\n+\t\t   AXP20X_FUNCTION(0x0, \"gpio_out\"),\n+\t\t   AXP20X_FUNCTION(0x2, \"gpio_in\"),\n+\t\t   AXP20X_FUNCTION(0x3, \"ldo\")),\n+};\n+\n static const struct axp20x_pinctrl_desc axp20x_pinctrl_data = {\n \t.pins\t= axp209_pins,\n \t.npins\t= ARRAY_SIZE(axp209_pins),\n };\n \n+static const struct axp20x_pinctrl_desc axp813_pinctrl_data = {\n+\t.pins\t= axp813_pins,\n+\t.npins\t= ARRAY_SIZE(axp813_pins),\n+};\n+\n static int axp20x_gpio_input(struct gpio_chip *chip, unsigned offset)\n {\n \treturn pinctrl_gpio_direction_input(chip->base + offset);\n@@ -479,6 +496,7 @@ static int axp20x_pctl_probe(struct platform_device *pdev)\n \tstruct axp20x_pctl *pctl;\n \tstruct pinctrl_desc *pctrl_desc;\n \tstruct pinctrl_pin_desc *pins;\n+\tstruct device_node *np = pdev->dev.of_node;\n \tint ret, i;\n \n \tif (!of_device_is_available(pdev->dev.of_node))\n@@ -505,13 +523,18 @@ static int axp20x_pctl_probe(struct platform_device *pdev)\n \tpctl->chip.set\t\t\t= axp20x_gpio_set;\n \tpctl->chip.direction_input\t= axp20x_gpio_input;\n \tpctl->chip.direction_output\t= axp20x_gpio_output;\n-\tpctl->chip.ngpio\t\t= 3;\n \n \tpctl->regmap = axp20x->regmap;\n \n-\tpctl->desc = &axp20x_pinctrl_data;\n-\tpctl->gpio_status_offset = 4;\n+\tif (of_device_is_compatible(np, \"x-powers,axp209-gpio\")) {\n+\t\tpctl->desc = &axp20x_pinctrl_data;\n+\t\tpctl->gpio_status_offset = 4;\n+\t} else {\n+\t\tpctl->desc = &axp813_pinctrl_data;\n+\t\tpctl->gpio_status_offset = 0;\n+\t}\n \tpctl->dev = &pdev->dev;\n+\tpctl->chip.ngpio = pctl->desc->npins;\n \n \tplatform_set_drvdata(pdev, pctl);\n \n@@ -566,6 +589,7 @@ static int axp20x_pctl_probe(struct platform_device *pdev)\n \n static const struct of_device_id axp20x_pctl_match[] = {\n \t{ .compatible = \"x-powers,axp209-gpio\" },\n+\t{ .compatible = \"x-powers,axp813-pctl\" },\n \t{ }\n };\n MODULE_DEVICE_TABLE(of, axp20x_pctl_match);\n","prefixes":["v2","06/10"]}