Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1201748

Re: [PATCH v2 2/3] pinctrl: tegra: Only set the gpio range if needed

Path csiph.com!goblin2!goblin.stu.neva.ru!aioe.org!bofh.it!news.nic.it!robomod
From Tomeu Vizoso <tomeu.vizoso@collabora.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 2/3] pinctrl: tegra: Only set the gpio range if needed
Date Thu, 06 Aug 2015 15:50:03 +0200
Message-ID <pUtIv-271-33@gated-at.bofh.it> (permalink)
References <pM3UR-8kr-1@gated-at.bofh.it> <pM3UT-8kr-55@gated-at.bofh.it>
X-Original-To "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=EMrMHi5R7sOMqIiZgdvqOgsCOwaXAmXZ7MwDDa9UtKg=; b=EwIG2ADQEVazlheeGkA5SOSVfCeIqAhvw4FlOl4ihLCidEpatzuNhMuq6iWh76hR03 +YdIqB46KCXCbQEv9lvtVabAzE/RzdjacPwzFmv90cR1U86QJL97o9XPfr8zLGI4WcUv +ZaVSF8iAUORQRG+9GnAdglO3GnfH8dAlTAGmEj7VZ1AhXe2Ca1jBag8WI8pYtOeD/1Q wvNxnDjdvqBNxjbZYJzAIj6poSB95g9vRyeNgY7c3isqPFUnl6fZd7JqXOAL5SmfaJgi 9WIMZ5fZjo+Mso1mqIuyfb1zm6paoOr90jl7rf8z9lyUYI5n66zRvbuPt3bTZCNj+zY0 murw==
X-Received by 10.180.9.38 with SMTP id w6mr6281245wia.57.1438868451712; Thu, 06 Aug 2015 06:40:51 -0700 (PDT)
MIME-Version 1.0
X-Google-Sender-Auth aMdhv0OdIeh5N--n3z-8CxhlWTM
Content-Type text/plain; charset=UTF-8
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 74
Organization linux.* mail to news gateway
X-Original-Cc linux-gpio@vger.kernel.org, "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>, "linux-tegra@vger.kernel.org" <linux-tegra@vger.kernel.org>, Tomeu Vizoso <tomeu.vizoso@collabora.com>, Thierry Reding <thierry.reding@gmail.com>, Linus Walleij <linus.walleij@linaro.org>, Stephen Warren <swarren@wwwdotorg.org>, Alexandre Courbot <gnurou@gmail.com>
X-Original-Date Thu, 6 Aug 2015 15:40:32 +0200
X-Original-Message-ID <CAAObsKBk54ZAhGVmpONeBtX1AJv0woq7sp3cCGZ1FeDtTst_DA@mail.gmail.com>
X-Original-References <1436862596-27730-1-git-send-email-tomeu.vizoso@collabora.com> <1436862596-27730-3-git-send-email-tomeu.vizoso@collabora.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1201748

Show key headers only | View raw


On 14 July 2015 at 10:29, Tomeu Vizoso <tomeu.vizoso@collabora.com> wrote:
> If the gpio DT node has the gpio-ranges property, the range will be
> added by the gpio core and doesn't need to be added by the pinctrl
> driver.
>
> By having the gpio-ranges property, we have an explicit dependency from
> the gpio node to the pinctrl node and we can stop using the deprecated
> pinctrl_add_gpio_range() function.
>
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
> Acked-by: Stephen Warren <swarren@nvidia.com>

Hi Linus,

do you mind if this goes through the Tegra tree? It would be best if
it went together with 3/3 ("ARM: tegra: Add gpio-ranges property"), to
avoid duplicated GPIO ranges.

Thanks,

Tomeu

> ---
>
> Changes in v2: None
>
>  drivers/pinctrl/pinctrl-tegra.c | 19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/pinctrl-tegra.c b/drivers/pinctrl/pinctrl-tegra.c
> index 0f982b829be1..0fd7fd2b0f72 100644
> --- a/drivers/pinctrl/pinctrl-tegra.c
> +++ b/drivers/pinctrl/pinctrl-tegra.c
> @@ -624,6 +624,22 @@ static struct pinctrl_desc tegra_pinctrl_desc = {
>         .owner = THIS_MODULE,
>  };
>
> +static bool gpio_node_has_range(void)
> +{
> +       struct device_node *np;
> +       bool has_prop = false;
> +
> +       np = of_find_compatible_node(NULL, NULL, "nvidia,tegra30-gpio");
> +       if (!np)
> +               return has_prop;
> +
> +       has_prop = of_find_property(np, "gpio-ranges", NULL);
> +
> +       of_node_put(np);
> +
> +       return has_prop;
> +}
> +
>  int tegra_pinctrl_probe(struct platform_device *pdev,
>                         const struct tegra_pinctrl_soc_data *soc_data)
>  {
> @@ -708,7 +724,8 @@ int tegra_pinctrl_probe(struct platform_device *pdev,
>                 return PTR_ERR(pmx->pctl);
>         }
>
> -       pinctrl_add_gpio_range(pmx->pctl, &tegra_pinctrl_gpio_range);
> +       if (!gpio_node_has_range())
> +               pinctrl_add_gpio_range(pmx->pctl, &tegra_pinctrl_gpio_range);
>
>         platform_set_drvdata(pdev, pmx);
>
> --
> 2.4.3
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: [PATCH v2 2/3] pinctrl: tegra: Only set the gpio range if needed Tomeu Vizoso <tomeu.vizoso@collabora.com> - 2015-08-06 15:50 +0200
  Re: [PATCH v2 2/3] pinctrl: tegra: Only set the gpio range if needed Linus Walleij <linus.walleij@linaro.org> - 2015-08-13 15:00 +0200

csiph-web