mirror of https://lore.kernel.org/linux-amlogic/
 help / color / mirror / Atom feed
From: jbrunet@baylibre.com (Jerome Brunet)
To: linus-amlogic@lists.infradead.org
Subject: [PATCH 1/8] pinctrl: meson: remove offset from pinctrl
Date: Wed, 20 Sep 2017 15:39:20 +0200	[thread overview]
Message-ID: <20170920133927.17390-2-jbrunet@baylibre.com> (raw)
In-Reply-To: <20170920133927.17390-1-jbrunet@baylibre.com>

Offset on meson pinctrl and gpios is something that was carried from the
vendor driver, where there is a weird link between the 2
controllers. Since these 2 controllers are independent, this offset adds
an unnecessary complexity.

This patch remove this manually set offset and rely on pinctrl to figure
out the gpio base offset

Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
 drivers/pinctrl/meson/pinctrl-meson.c | 18 +++---------------
 drivers/pinctrl/meson/pinctrl-meson.h |  8 +++-----
 2 files changed, 6 insertions(+), 20 deletions(-)

diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c
index 66ed70c12733..247208150b19 100644
--- a/drivers/pinctrl/meson/pinctrl-meson.c
+++ b/drivers/pinctrl/meson/pinctrl-meson.c
@@ -410,18 +410,6 @@ static const struct pinconf_ops meson_pinconf_ops = {
 	.is_generic		= true,
 };
 
-static int meson_gpio_request(struct gpio_chip *chip, unsigned gpio)
-{
-	return pinctrl_request_gpio(chip->base + gpio);
-}
-
-static void meson_gpio_free(struct gpio_chip *chip, unsigned gpio)
-{
-	struct meson_pinctrl *pc = gpiochip_get_data(chip);
-
-	pinctrl_free_gpio(pc->data->pin_base + gpio);
-}
-
 static int meson_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
 {
 	struct meson_pinctrl *pc = gpiochip_get_data(chip);
@@ -539,13 +527,13 @@ static int meson_gpiolib_register(struct meson_pinctrl *pc)
 
 	pc->chip.label = pc->data->name;
 	pc->chip.parent = pc->dev;
-	pc->chip.request = meson_gpio_request;
-	pc->chip.free = meson_gpio_free;
+	pc->chip.request = gpiochip_generic_request;
+	pc->chip.free = gpiochip_generic_free;
 	pc->chip.direction_input = meson_gpio_direction_input;
 	pc->chip.direction_output = meson_gpio_direction_output;
 	pc->chip.get = meson_gpio_get;
 	pc->chip.set = meson_gpio_set;
-	pc->chip.base = pc->data->pin_base;
+	pc->chip.base = -1;
 	pc->chip.ngpio = pc->data->num_pins;
 	pc->chip.can_sleep = false;
 	pc->chip.of_node = pc->of_node;
diff --git a/drivers/pinctrl/meson/pinctrl-meson.h b/drivers/pinctrl/meson/pinctrl-meson.h
index 890f296f5840..227b72a60c22 100644
--- a/drivers/pinctrl/meson/pinctrl-meson.h
+++ b/drivers/pinctrl/meson/pinctrl-meson.h
@@ -124,8 +124,6 @@ struct meson_pinctrl {
 	struct device_node *of_node;
 };
 
-#define PIN(x, b)	(b + x)
-
 #define GROUP(grp, r, b)						\
 	{								\
 		.name = #grp,						\
@@ -135,10 +133,10 @@ struct meson_pinctrl {
 		.bit = b,						\
 	 }
 
-#define GPIO_GROUP(gpio, b)						\
+#define GPIO_GROUP(gpio)						\
 	{								\
 		.name = #gpio,						\
-		.pins = (const unsigned int[]){ PIN(gpio, b) },		\
+		.pins = (const unsigned int[]){ gpio },			\
 		.num_pins = 1,						\
 		.is_gpio = true,					\
 	 }
@@ -166,7 +164,7 @@ struct meson_pinctrl {
 		},							\
 	 }
 
-#define MESON_PIN(x, b) PINCTRL_PIN(PIN(x, b), #x)
+#define MESON_PIN(x) PINCTRL_PIN(x, #x)
 
 extern struct meson_pinctrl_data meson8_cbus_pinctrl_data;
 extern struct meson_pinctrl_data meson8_aobus_pinctrl_data;
-- 
2.13.5

  reply	other threads:[~2017-09-20 13:39 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-20 13:39 [PATCH 0/8] pinctrl: meson: clean pin offsets Jerome Brunet
2017-09-20 13:39 ` Jerome Brunet [this message]
2017-10-05 11:22   ` [PATCH 1/8] pinctrl: meson: remove offset from pinctrl Linus Walleij
2017-10-05 11:47     ` Jerome Brunet
2017-09-20 13:39 ` [PATCH 2/8] pinctrl: meson: remove offset continued - gxbb Jerome Brunet
2017-10-05 11:24   ` Linus Walleij
2017-09-20 13:39 ` [PATCH 3/8] pinctrl: meson: remove offset continued - gxl Jerome Brunet
2017-10-05 11:25   ` Linus Walleij
2017-09-20 13:39 ` [PATCH 4/8] pinctrl: meson: remove offset continued - meson8 Jerome Brunet
2017-10-05 11:26   ` Linus Walleij
2017-09-20 13:39 ` [PATCH 5/8] pinctrl: meson: remove offset continued - meson8b Jerome Brunet
2017-10-05 11:29   ` Linus Walleij
2017-09-20 13:39 ` [PATCH 6/8] pinctrl: meson: get rid of pin_base Jerome Brunet
2017-10-05 11:43   ` Linus Walleij
2017-09-20 13:39 ` [PATCH 7/8] pinctrl: meson-gx: TEST_N belongs to the AO controller Jerome Brunet
2017-10-05 11:44   ` Linus Walleij
2017-09-20 13:39 ` [PATCH 8/8] pinctrl: meson-gxbb: add missing GPIOX_22 pin Jerome Brunet
2017-10-05 11:45   ` Linus Walleij
2017-09-21 12:21 ` [PATCH 0/8] pinctrl: meson: clean pin offsets Linus Walleij
2017-09-21 15:00   ` Jerome Brunet
2017-09-22  8:47     ` Linus Walleij
2017-09-30 20:33 ` Kevin Hilman
2017-09-30 20:35 ` Kevin Hilman

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=20170920133927.17390-2-jbrunet@baylibre.com \
    --to=jbrunet@baylibre.com \
    --cc=linus-amlogic@lists.infradead.org \
    /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®