mbox series

[v3,0/3] Fix up Nokia 770 regression

Message ID 20230430-nokia770-regression-v3-0-a6d0a89ffa8b@linaro.org
Headers show
Series Fix up Nokia 770 regression | expand

Message

Linus Walleij May 5, 2023, 11:16 a.m. UTC
A recent change to use dynamic GPIO base allocation in the
OMAP GPIO driver caused a regression in some OMAP1 boards.
This series fixes up the Nokia 770 board from 2005:
https://en.wikipedia.org/wiki/Nokia_770_Internet_Tablet

I don't know how urgent the fix is, you decide. For me,
it is fair if fringe systems get fixed in due time, as
they are hardly anyones main development laptop.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
Changes in v3:
- Fix a compile error in the ADS7846 driver by dropping some
  leftover OF ifdeffery.
- Link to v2: https://lore.kernel.org/r/20230430-nokia770-regression-v2-0-984ed3ca5444@linaro.org

Changes in v2:
- Thoroughly rewrote the approach taken for the ADS7846 touchscreen
  following Dmitry's ambition to go a step further and take a swnode
  approach to this conversion: I'm fine with that, the patch just
  get a bit bigger.
- Picked up Ulf's ACK on the MMC patch.
- Link to v1: https://lore.kernel.org/r/20230430-nokia770-regression-v1-0-97704e36b094@linaro.org

---
Linus Walleij (3):
      Input: ads7846 - Convert to use software nodes
      ARM/mmc: Convert old mmci-omap to GPIO descriptors
      ARM: omap1: Fix up the Nokia 770 board device IRQs

 arch/arm/mach-omap1/board-nokia770.c    | 198 +++++++++++++++++++-------------
 arch/arm/mach-omap1/board-sx1-mmc.c     |   1 -
 arch/arm/mach-omap2/board-n8x0.c        |  85 +++++---------
 arch/arm/mach-pxa/spitz.c               |  11 +-
 arch/mips/alchemy/devboards/db1000.c    |  11 +-
 drivers/input/touchscreen/ads7846.c     | 113 +++++++-----------
 drivers/mmc/host/omap.c                 |  46 +++++++-
 drivers/video/fbdev/omap/lcd_mipid.c    |  10 ++
 include/linux/platform_data/lcd-mipid.h |   2 -
 include/linux/platform_data/mmc-omap.h  |   2 -
 include/linux/spi/ads7846.h             |   2 -
 11 files changed, 262 insertions(+), 219 deletions(-)
---
base-commit: 348551ddaf311c76b01cdcbaf61b6fef06a49144
change-id: 20230430-nokia770-regression-2b5a07497ec9

Best regards,

Comments

Andy Shevchenko May 8, 2023, 3:17 p.m. UTC | #1
Fri, May 05, 2023 at 01:16:57PM +0200, Linus Walleij kirjoitti:
> The platform devices on the Nokia 770 is using some
> board-specific IRQs that get statically assigned to platform
> devices in the boardfile.
> 
> This does not work with dynamic IRQ chip bases.
> 
> Utilize the NULL device to define some board-specific
> GPIO lookups and use these to immediately look up the
> same GPIOs, convert to IRQ numbers and pass as resources
> to the devices. This is ugly but should work.

...

> +static struct gpiod_lookup_table nokia770_irq_gpio_table = {
> +	.dev_id = NULL,
> +	.table = {
> +		/* GPIO used by SPI device 1 */
> +		GPIO_LOOKUP("gpio-0-15", 15, "ads7846_irq",
> +			    GPIO_ACTIVE_HIGH),
> +		/* GPIO used for retu IRQ */
> +		GPIO_LOOKUP("gpio-48-63", 15, "retu_irq",
> +			    GPIO_ACTIVE_HIGH),
> +		/* GPIO used for tahvo IRQ */
> +		GPIO_LOOKUP("gpio-32-47", 8, "tahvo_irq",
> +			    GPIO_ACTIVE_HIGH),

Missing terminator.

> +	},
> +};
Linus Walleij May 8, 2023, 8:54 p.m. UTC | #2
On Mon, May 8, 2023 at 5:16 PM <andy.shevchenko@gmail.com> wrote:
> Fri, May 05, 2023 at 01:16:55PM +0200, Linus Walleij kirjoitti:

> > The Nokia 770 is using GPIOs from the global numberspace on the
> > CBUS node to pass down to the LCD controller. This regresses when we
> > let the OMAP GPIO driver use dynamic GPIO base.
(...)

> >  #include <linux/gpio.h>
>
> Do we need it after this patch?

Yes, but it is finally removed in patch 3/3!

Fixed the rest, thanks!

Yours,
Linus Walleij
Linus Walleij May 8, 2023, 9:23 p.m. UTC | #3
On Fri, May 5, 2023 at 8:08 PM Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:

> > -     return !gpio_get_value(ts->gpio_pendown);
> > +     return !gpiod_get_value(ts->gpio_pendown);
>
> This needs to be
>
>         return !gpiod_get_value_raw(ts->gpio_pendown);

There is no such function. The gpio descriptor runpath simply assumes that
device trees can be trusted.

> I looked at various DTSes we have and they use a mix of active high and
> active low annotations, so we have to go with the "raw" variant for now,
> and then update to normal one once we update bad DTSes.

I just sighed and fixed all the device trees :D

Yours,
Linus Walleij
Dmitry Torokhov May 8, 2023, 9:28 p.m. UTC | #4
On Mon, May 08, 2023 at 11:23:44PM +0200, Linus Walleij wrote:
> On Fri, May 5, 2023 at 8:08 PM Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
> 
> > > -     return !gpio_get_value(ts->gpio_pendown);
> > > +     return !gpiod_get_value(ts->gpio_pendown);
> >
> > This needs to be
> >
> >         return !gpiod_get_value_raw(ts->gpio_pendown);
> 
> There is no such function. The gpio descriptor runpath simply assumes that
> device trees can be trusted.

Sorry, this was supposed to be gpiod_get_raw_value():

https://elixir.bootlin.com/linux/latest/source/drivers/gpio/gpiolib.c#L2854

> 
> > I looked at various DTSes we have and they use a mix of active high and
> > active low annotations, so we have to go with the "raw" variant for now,
> > and then update to normal one once we update bad DTSes.
> 
> I just sighed and fixed all the device trees :D

Yeah, we we can land the DT fixes ahead of the driver change that would
be great. Otherwise we need a temporary application of
gpiod_get_raw_value().

> 
> Yours,
> Linus Walleij
Linus Walleij May 8, 2023, 9:28 p.m. UTC | #5
On Mon, May 8, 2023 at 5:17 PM <andy.shevchenko@gmail.com> wrote:

> > +             GPIO_LOOKUP("gpio-32-47", 8, "tahvo_irq",
> > +                         GPIO_ACTIVE_HIGH),
>
> Missing terminator.

Darn I missed this comment in v4, I have fixed it in my tree, I will see if
there are more comments for v4 before I resend.

Yours,
Linus Walleij
Linus Walleij May 8, 2023, 9:31 p.m. UTC | #6
On Mon, May 8, 2023 at 11:28 PM Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> On Mon, May 08, 2023 at 11:23:44PM +0200, Linus Walleij wrote:

> > > This needs to be
> > >
> > >         return !gpiod_get_value_raw(ts->gpio_pendown);
> >
> > There is no such function. The gpio descriptor runpath simply assumes that
> > device trees can be trusted.
>
> Sorry, this was supposed to be gpiod_get_raw_value():
>
> https://elixir.bootlin.com/linux/latest/source/drivers/gpio/gpiolib.c#L2854

I missed it, I should have very well understood you meant that one...
I just read the file too sloppily.

> Yeah, we we can land the DT fixes ahead of the driver change that would
> be great. Otherwise we need a temporary application of
> gpiod_get_raw_value().

If the patch is fine I will send it to the SoC tree and ask for it to be
applied as a fix.

Yours,
Linus Walleij