From: Chunyan Zhang <zhang.lyra@gmail.com>
To: Wenhua Lin <Wenhua.Lin@unisoc.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Andy Shevchenko <andy@kernel.org>,
Bartosz Golaszewski <brgl@bgdev.pl>,
Orson Zhai <orsonzhai@gmail.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
wenhua lin <wenhua.lin1994@gmail.com>,
Xiongpeng Wu <xiongpeng.wu@unisoc.com>
Subject: Re: [PATCH V4 2/2] gpio: eic-sprd: Optimize the calculation method of eic number
Date: Mon, 22 Jan 2024 18:02:14 +0800 [thread overview]
Message-ID: <CAAfSe-uTZx9Be8NCWqyTXb7GDU73--N0VmRCeh24G_-5-yL5qw@mail.gmail.com> (raw)
In-Reply-To: <20240109073849.10791-3-Wenhua.Lin@unisoc.com>
On Tue, 9 Jan 2024 at 15:39, Wenhua Lin <Wenhua.Lin@unisoc.com> wrote:
>
> The num_eics is a default value, but some SoCs support more than 8.
> In order to adapt to all projects, the total number of eics is
> automatically calculated through dts.
>
> Signed-off-by: Wenhua Lin <Wenhua.Lin@unisoc.com>
Acked-by: Chunyan Zhang <zhang.lyra@gmail.com>
Thanks,
Chunyan
> ---
> drivers/gpio/gpio-eic-sprd.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpio/gpio-eic-sprd.c b/drivers/gpio/gpio-eic-sprd.c
> index 806b88d8dfb7..2dd0e46c42ad 100644
> --- a/drivers/gpio/gpio-eic-sprd.c
> +++ b/drivers/gpio/gpio-eic-sprd.c
> @@ -108,7 +108,6 @@ static struct sprd_eic *to_sprd_eic(struct notifier_block *nb)
>
> struct sprd_eic_variant_data {
> enum sprd_eic_type type;
> - u32 num_eics;
> };
>
> static const char *sprd_eic_label_name[SPRD_EIC_MAX] = {
> @@ -118,22 +117,18 @@ static const char *sprd_eic_label_name[SPRD_EIC_MAX] = {
>
> static const struct sprd_eic_variant_data sc9860_eic_dbnc_data = {
> .type = SPRD_EIC_DEBOUNCE,
> - .num_eics = 8,
> };
>
> static const struct sprd_eic_variant_data sc9860_eic_latch_data = {
> .type = SPRD_EIC_LATCH,
> - .num_eics = 8,
> };
>
> static const struct sprd_eic_variant_data sc9860_eic_async_data = {
> .type = SPRD_EIC_ASYNC,
> - .num_eics = 8,
> };
>
> static const struct sprd_eic_variant_data sc9860_eic_sync_data = {
> .type = SPRD_EIC_SYNC,
> - .num_eics = 8,
> };
>
> static inline void __iomem *sprd_eic_offset_base(struct sprd_eic *sprd_eic,
> @@ -619,6 +614,7 @@ static int sprd_eic_probe(struct platform_device *pdev)
> struct gpio_irq_chip *irq;
> struct sprd_eic *sprd_eic;
> struct resource *res;
> + u16 num_banks = 0;
> int ret, i;
>
> pdata = of_device_get_match_data(dev);
> @@ -652,10 +648,12 @@ static int sprd_eic_probe(struct platform_device *pdev)
> sprd_eic->base[i] = devm_ioremap_resource(dev, res);
> if (IS_ERR(sprd_eic->base[i]))
> return PTR_ERR(sprd_eic->base[i]);
> +
> + num_banks++;
> }
>
> sprd_eic->chip.label = sprd_eic_label_name[sprd_eic->type];
> - sprd_eic->chip.ngpio = pdata->num_eics;
> + sprd_eic->chip.ngpio = num_banks * SPRD_EIC_PER_BANK_NR;
> sprd_eic->chip.base = -1;
> sprd_eic->chip.parent = dev;
> sprd_eic->chip.direction_input = sprd_eic_direction_input;
> --
> 2.17.1
>
next prev parent reply other threads:[~2024-01-22 10:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-09 7:38 [PATCH V4 0/2] gpio: sprd: Modification of UNISOC Platform EIC Driver Wenhua Lin
2024-01-09 7:38 ` [PATCH V4 1/2] gpio: eic-sprd: Clear interrupt after set the interrupt type Wenhua Lin
2024-01-22 10:00 ` Chunyan Zhang
2024-01-09 7:38 ` [PATCH V4 2/2] gpio: eic-sprd: Optimize the calculation method of eic number Wenhua Lin
2024-01-22 10:02 ` Chunyan Zhang [this message]
2024-01-22 9:33 ` [PATCH V4 0/2] gpio: sprd: Modification of UNISOC Platform EIC Driver Bartosz Golaszewski
2024-01-22 10:42 ` 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=CAAfSe-uTZx9Be8NCWqyTXb7GDU73--N0VmRCeh24G_-5-yL5qw@mail.gmail.com \
--to=zhang.lyra@gmail.com \
--cc=Wenhua.Lin@unisoc.com \
--cc=andy@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=brgl@bgdev.pl \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=orsonzhai@gmail.com \
--cc=wenhua.lin1994@gmail.com \
--cc=xiongpeng.wu@unisoc.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;
as well as URLs for NNTP newsgroup(s).