mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: <patrice.chotard@st.com>
To: <linux-kernel@vger.kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	<srinivas.kandagatla@linaro.com>,
	<linux-arm-kernel@lists.infradead.org>
Cc: <kernel@stlinux.com>, <patrice.chotard@st.com>,
	Maxime Coquelin <maxime.coquelin@st.com>
Subject: [PATCH 1/4] pinctrl: st: Use second parameter to gpio specifier
Date: Wed, 10 Aug 2016 15:12:58 +0200	[thread overview]
Message-ID: <1470834781-23232-2-git-send-email-patrice.chotard@st.com> (raw)
In-Reply-To: <1470834781-23232-1-git-send-email-patrice.chotard@st.com>

From: Patrice Chotard <patrice.chotard@st.com>

This patch allows to use the second parameter of gpio
specifier, which is used to specify whether the gpio is
active high or low.

Simply remove specific of_xlate callback() and of_gpio_n_cells
and use default one set by of_gpiochip_add() which allows
to use second parameter gpio specifier.

Signed-off-by: Maxime Coquelin <maxime.coquelin@st.com>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
---
 .../devicetree/bindings/pinctrl/pinctrl-st.txt          |  8 ++++++--
 drivers/pinctrl/pinctrl-st.c                            | 17 -----------------
 2 files changed, 6 insertions(+), 19 deletions(-)

diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-st.txt b/Documentation/devicetree/bindings/pinctrl/pinctrl-st.txt
index 26bcb18..e6cc5e8 100644
--- a/Documentation/devicetree/bindings/pinctrl/pinctrl-st.txt
+++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-st.txt
@@ -50,7 +50,11 @@ Optional properties:
 GPIO controller/bank node.
 Required properties:
 - gpio-controller : Indicates this device is a GPIO controller
-- #gpio-cells	  : Should be one. The first cell is the pin number.
+- #gpio-cells	  : Must be two.
+     - First cell: specifies the pin number inside the controller
+     - Second cell: specifies whether the pin is logically inverted.
+       - 0 = active high
+       - 1 = active low
 - st,bank-name	  : Should be a name string for this bank as specified in
   datasheet.
 
@@ -88,7 +92,7 @@ Example:
 
 		PIO0: gpio@fe610000 {
 			gpio-controller;
-			#gpio-cells	= <1>;
+			#gpio-cells	= <2>;
 			interrupt-controller;
 			#interrupt-cells = <2>;
 			reg		= <0 0x100>;
diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c
index 0de1c67..2e5c545 100644
--- a/drivers/pinctrl/pinctrl-st.c
+++ b/drivers/pinctrl/pinctrl-st.c
@@ -799,21 +799,6 @@ static int st_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
 	return (direction == ST_GPIO_DIRECTION_IN);
 }
 
-static int st_gpio_xlate(struct gpio_chip *gc,
-			const struct of_phandle_args *gpiospec, u32 *flags)
-{
-	if (WARN_ON(gc->of_gpio_n_cells < 1))
-		return -EINVAL;
-
-	if (WARN_ON(gpiospec->args_count < gc->of_gpio_n_cells))
-		return -EINVAL;
-
-	if (gpiospec->args[0] > gc->ngpio)
-		return -EINVAL;
-
-	return gpiospec->args[0];
-}
-
 /* Pinctrl Groups */
 static int st_pctl_get_groups_count(struct pinctrl_dev *pctldev)
 {
@@ -1486,8 +1471,6 @@ static struct gpio_chip st_gpio_template = {
 	.direction_output	= st_gpio_direction_output,
 	.get_direction		= st_gpio_get_direction,
 	.ngpio			= ST_GPIO_PINS_PER_BANK,
-	.of_gpio_n_cells	= 1,
-	.of_xlate		= st_gpio_xlate,
 };
 
 static struct irq_chip st_gpio_irqchip = {
-- 
1.9.1

  reply	other threads:[~2016-08-10 18:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-10 13:12 [PATCH 0/4] STi: Allow to use gpio specifier's second parameter patrice.chotard
2016-08-10 13:12 ` patrice.chotard [this message]
2016-08-11 14:07   ` [PATCH 1/4] pinctrl: st: Use second parameter to gpio specifier Linus Walleij
2016-08-10 13:12 ` [PATCH 2/4] ARM: dts: STiH407-pinctrl: Update gpio-cells to 2 patrice.chotard
2016-08-11 14:08   ` Linus Walleij
2016-08-10 13:13 ` [PATCH 3/4] ARM: dts: STiH418-B2199: Update gpio specifier patrice.chotard
2016-08-11 14:09   ` Linus Walleij
2016-08-10 13:13 ` [PATCH 4/4] ARM: dts: STiH41x-b2020: " patrice.chotard
2016-08-11 14:09   ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1470834781-23232-2-git-send-email-patrice.chotard@st.com \
    --to=patrice.chotard@st.com \
    --cc=kernel@stlinux.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.coquelin@st.com \
    --cc=srinivas.kandagatla@linaro.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®