linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] gpio: sprd: Fix the incorrect data register
@ 2019-01-15  7:52 Baolin Wang
  2019-01-15  7:52 ` [PATCH 2/2] gpio: sprd: Fix incorrect irq type setting for the async EIC Baolin Wang
  2019-01-15 10:47 ` [PATCH 1/2] gpio: sprd: Fix the incorrect data register Bartosz Golaszewski
  0 siblings, 2 replies; 4+ messages in thread
From: Baolin Wang @ 2019-01-15  7:52 UTC (permalink / raw)
  To: linus.walleij, bgolaszewski, orsonzhai, zhang.lyra
  Cc: baolin.wang, neo.hou, broonie, linux-gpio, linux-kernel

From: Neo Hou <neo.hou@unisoc.com>

Since differnt type EICs have its own data register to read, thus fix the
incorrect data register.

Signed-off-by: Neo Hou <neo.hou@unisoc.com>
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
---
 drivers/gpio/gpio-eic-sprd.c |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-eic-sprd.c b/drivers/gpio/gpio-eic-sprd.c
index e0d6a0a..257df59 100644
--- a/drivers/gpio/gpio-eic-sprd.c
+++ b/drivers/gpio/gpio-eic-sprd.c
@@ -180,7 +180,18 @@ static void sprd_eic_free(struct gpio_chip *chip, unsigned int offset)
 
 static int sprd_eic_get(struct gpio_chip *chip, unsigned int offset)
 {
-	return sprd_eic_read(chip, offset, SPRD_EIC_DBNC_DATA);
+	struct sprd_eic *sprd_eic = gpiochip_get_data(chip);
+
+	switch (sprd_eic->type) {
+	case SPRD_EIC_DEBOUNCE:
+		return sprd_eic_read(chip, offset, SPRD_EIC_DBNC_DATA);
+	case SPRD_EIC_ASYNC:
+		return sprd_eic_read(chip, offset, SPRD_EIC_ASYNC_DATA);
+	case SPRD_EIC_SYNC:
+		return sprd_eic_read(chip, offset, SPRD_EIC_SYNC_DATA);
+	default:
+		return -ENOTSUPP;
+	}
 }
 
 static int sprd_eic_direction_input(struct gpio_chip *chip, unsigned int offset)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] gpio: sprd: Fix incorrect irq type setting for the async EIC
  2019-01-15  7:52 [PATCH 1/2] gpio: sprd: Fix the incorrect data register Baolin Wang
@ 2019-01-15  7:52 ` Baolin Wang
  2019-01-15 10:47 ` [PATCH 1/2] gpio: sprd: Fix the incorrect data register Bartosz Golaszewski
  1 sibling, 0 replies; 4+ messages in thread
From: Baolin Wang @ 2019-01-15  7:52 UTC (permalink / raw)
  To: linus.walleij, bgolaszewski, orsonzhai, zhang.lyra
  Cc: baolin.wang, neo.hou, broonie, linux-gpio, linux-kernel

From: Neo Hou <neo.hou@unisoc.com>

When setting async EIC as IRQ_TYPE_EDGE_BOTH type, we missed to set the
SPRD_EIC_ASYNC_INTMODE register to 0, which means detecting edge signals.

Thus this patch fixes the issue.

Signed-off-by: Neo Hou <neo.hou@unisoc.com>
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
---
 drivers/gpio/gpio-eic-sprd.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpio/gpio-eic-sprd.c b/drivers/gpio/gpio-eic-sprd.c
index 257df59..e41223c 100644
--- a/drivers/gpio/gpio-eic-sprd.c
+++ b/drivers/gpio/gpio-eic-sprd.c
@@ -379,6 +379,7 @@ static int sprd_eic_irq_set_type(struct irq_data *data, unsigned int flow_type)
 			irq_set_handler_locked(data, handle_edge_irq);
 			break;
 		case IRQ_TYPE_EDGE_BOTH:
+			sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTMODE, 0);
 			sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTBOTH, 1);
 			irq_set_handler_locked(data, handle_edge_irq);
 			break;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] gpio: sprd: Fix the incorrect data register
  2019-01-15  7:52 [PATCH 1/2] gpio: sprd: Fix the incorrect data register Baolin Wang
  2019-01-15  7:52 ` [PATCH 2/2] gpio: sprd: Fix incorrect irq type setting for the async EIC Baolin Wang
@ 2019-01-15 10:47 ` Bartosz Golaszewski
  2019-01-15 12:00   ` Baolin Wang
  1 sibling, 1 reply; 4+ messages in thread
From: Bartosz Golaszewski @ 2019-01-15 10:47 UTC (permalink / raw)
  To: Baolin Wang
  Cc: Linus Walleij, orsonzhai, zhang.lyra, neo.hou, Mark Brown,
	linux-gpio, LKML

wt., 15 sty 2019 o 08:53 Baolin Wang <baolin.wang@linaro.org> napisał(a):
>
> From: Neo Hou <neo.hou@unisoc.com>
>
> Since differnt type EICs have its own data register to read, thus fix the
> incorrect data register.
>
> Signed-off-by: Neo Hou <neo.hou@unisoc.com>
> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
> ---
>  drivers/gpio/gpio-eic-sprd.c |   13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-eic-sprd.c b/drivers/gpio/gpio-eic-sprd.c
> index e0d6a0a..257df59 100644
> --- a/drivers/gpio/gpio-eic-sprd.c
> +++ b/drivers/gpio/gpio-eic-sprd.c
> @@ -180,7 +180,18 @@ static void sprd_eic_free(struct gpio_chip *chip, unsigned int offset)
>
>  static int sprd_eic_get(struct gpio_chip *chip, unsigned int offset)
>  {
> -       return sprd_eic_read(chip, offset, SPRD_EIC_DBNC_DATA);
> +       struct sprd_eic *sprd_eic = gpiochip_get_data(chip);
> +
> +       switch (sprd_eic->type) {
> +       case SPRD_EIC_DEBOUNCE:
> +               return sprd_eic_read(chip, offset, SPRD_EIC_DBNC_DATA);
> +       case SPRD_EIC_ASYNC:
> +               return sprd_eic_read(chip, offset, SPRD_EIC_ASYNC_DATA);
> +       case SPRD_EIC_SYNC:
> +               return sprd_eic_read(chip, offset, SPRD_EIC_SYNC_DATA);
> +       default:
> +               return -ENOTSUPP;
> +       }
>  }
>
>  static int sprd_eic_direction_input(struct gpio_chip *chip, unsigned int offset)
> --
> 1.7.9.5
>

I guess both this and the second patch should go into stable and have
a Fixes: tag?

Bart

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] gpio: sprd: Fix the incorrect data register
  2019-01-15 10:47 ` [PATCH 1/2] gpio: sprd: Fix the incorrect data register Bartosz Golaszewski
@ 2019-01-15 12:00   ` Baolin Wang
  0 siblings, 0 replies; 4+ messages in thread
From: Baolin Wang @ 2019-01-15 12:00 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Linus Walleij, Orson Zhai, Chunyan Zhang, neo.hou, Mark Brown,
	linux-gpio, LKML

On Tue, 15 Jan 2019 at 18:47, Bartosz Golaszewski
<bgolaszewski@baylibre.com> wrote:
>
> wt., 15 sty 2019 o 08:53 Baolin Wang <baolin.wang@linaro.org> napisał(a):
> >
> > From: Neo Hou <neo.hou@unisoc.com>
> >
> > Since differnt type EICs have its own data register to read, thus fix the
> > incorrect data register.
> >
> > Signed-off-by: Neo Hou <neo.hou@unisoc.com>
> > Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
> > ---
> >  drivers/gpio/gpio-eic-sprd.c |   13 ++++++++++++-
> >  1 file changed, 12 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpio/gpio-eic-sprd.c b/drivers/gpio/gpio-eic-sprd.c
> > index e0d6a0a..257df59 100644
> > --- a/drivers/gpio/gpio-eic-sprd.c
> > +++ b/drivers/gpio/gpio-eic-sprd.c
> > @@ -180,7 +180,18 @@ static void sprd_eic_free(struct gpio_chip *chip, unsigned int offset)
> >
> >  static int sprd_eic_get(struct gpio_chip *chip, unsigned int offset)
> >  {
> > -       return sprd_eic_read(chip, offset, SPRD_EIC_DBNC_DATA);
> > +       struct sprd_eic *sprd_eic = gpiochip_get_data(chip);
> > +
> > +       switch (sprd_eic->type) {
> > +       case SPRD_EIC_DEBOUNCE:
> > +               return sprd_eic_read(chip, offset, SPRD_EIC_DBNC_DATA);
> > +       case SPRD_EIC_ASYNC:
> > +               return sprd_eic_read(chip, offset, SPRD_EIC_ASYNC_DATA);
> > +       case SPRD_EIC_SYNC:
> > +               return sprd_eic_read(chip, offset, SPRD_EIC_SYNC_DATA);
> > +       default:
> > +               return -ENOTSUPP;
> > +       }
> >  }
> >
> >  static int sprd_eic_direction_input(struct gpio_chip *chip, unsigned int offset)
> > --
> > 1.7.9.5
> >
>
> I guess both this and the second patch should go into stable and have
> a Fixes: tag?

Sure. I will send out v2 with a fix tag if no other issues.

-- 
Baolin Wang
Best Regards

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-01-15 12:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-15  7:52 [PATCH 1/2] gpio: sprd: Fix the incorrect data register Baolin Wang
2019-01-15  7:52 ` [PATCH 2/2] gpio: sprd: Fix incorrect irq type setting for the async EIC Baolin Wang
2019-01-15 10:47 ` [PATCH 1/2] gpio: sprd: Fix the incorrect data register Bartosz Golaszewski
2019-01-15 12:00   ` Baolin Wang

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).