From: Hector Palacios <hector.palacios@digi.com>
To: bartosz.golaszewski@linaro.org, linus.walleij@linaro.org
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
haibo.chen@nxp.com, peng.fan@nxp.com, hector.palacios@digi.com
Subject: [PATCH 1/2] gpio: vf610: add support to DT 'ngpios' property
Date: Thu, 11 Jan 2024 14:19:03 +0100 [thread overview]
Message-ID: <20240111131904.1491496-2-hector.palacios@digi.com> (raw)
In-Reply-To: <20240111131904.1491496-1-hector.palacios@digi.com>
Default to hardcoded VF610_GPIO_PER_PORT (32 pins) but allow optional
generic 'ngpios' property to be specified from the device tree.
Signed-off-by: Hector Palacios <hector.palacios@digi.com>
---
drivers/gpio/gpio-vf610.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c
index 07e5e6323e86..4abdf75e9a0a 100644
--- a/drivers/gpio/gpio-vf610.c
+++ b/drivers/gpio/gpio-vf610.c
@@ -276,6 +276,7 @@ static int vf610_gpio_probe(struct platform_device *pdev)
struct vf610_gpio_port *port;
struct gpio_chip *gc;
struct gpio_irq_chip *girq;
+ u32 ngpios;
int i;
int ret;
bool dual_base;
@@ -353,7 +354,11 @@ static int vf610_gpio_probe(struct platform_device *pdev)
gc = &port->gc;
gc->parent = dev;
gc->label = dev_name(dev);
- gc->ngpio = VF610_GPIO_PER_PORT;
+ ret = device_property_read_u32(dev, "ngpios", &ngpios);
+ if (ret || ngpios > VF610_GPIO_PER_PORT)
+ gc->ngpio = VF610_GPIO_PER_PORT;
+ else
+ gc->ngpio = (u16)ngpios;
gc->base = -1;
gc->request = gpiochip_generic_request;
next prev parent reply other threads:[~2024-01-11 13:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-11 13:19 [PATCH 0/2] support i.MX93 truly available GPIO pins Hector Palacios
2024-01-11 13:19 ` Hector Palacios [this message]
2024-01-11 14:22 ` [PATCH 1/2] gpio: vf610: add support to DT 'ngpios' property Linus Walleij
2024-01-11 13:19 ` [PATCH 2/2] arm64: dts: imx93: specify available 'ngpios' per GPIO port Hector Palacios
2024-01-11 14:26 ` Alexander Stein
2024-01-11 13:53 ` [PATCH 0/2] support i.MX93 truly available GPIO pins Bartosz Golaszewski
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=20240111131904.1491496-2-hector.palacios@digi.com \
--to=hector.palacios@digi.com \
--cc=bartosz.golaszewski@linaro.org \
--cc=haibo.chen@nxp.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peng.fan@nxp.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®