public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gpiolib: of: add polarity quirk for TSC2005
@ 2024-07-03 18:26 Dmitry Torokhov
  2024-07-05  8:52 ` Linus Walleij
  2024-07-05  9:01 ` Bartosz Golaszewski
  0 siblings, 2 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2024-07-03 18:26 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Linus Walleij, Sebastian Reichel, Pali Rohár, Pavel Machek,
	linux-gpio, linux-kernel

DTS for Nokia N900 incorrectly specifies "active high" polarity for
the reset line, while the chip documentation actually specifies it as
"active low".  In the past the driver fudged gpiod API and inverted
the logic internally, but it was changed in d0d89493bff8.

Fixes: d0d89493bff8 ("Input: tsc2004/5 - switch to using generic device properties")
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---

This was located purely by inspecting code and DTS, I have not tested
this on hardware, so copying folks who have been involved in n900 as far
as I know.

OTOH if this was indeed broken, then it was broken for ~7 years
(d0d89493bff8 went in 4.11-rc1), so maybe the best way is not to worry
about compatibility with old DTS, update
arch/arm/boot/dts/ti/omap/omap3-n900.dts in the tree and call it a day.

 drivers/gpio/gpiolib-of.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 38679cf1969f..89d5e64cf68b 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -212,6 +212,14 @@ static void of_gpio_try_fixup_polarity(const struct device_node *np,
 		 * for the property.
 		 */
 		{ "lantiq,pci-xway",	"gpio-reset",	false },
+#endif
+#if IS_ENABLED(CONFIG_TOUCHSCREEN_TSC2005)
+		/*
+		 * DTS for Nokia N900 incorrectly specified "active high"
+		 * polarity for the reset line, while the chip actually
+		 * treats it as "active low".
+		 */
+		{ "ti,tsc2005",		"reset-gpios",	false },
 #endif
 	};
 	unsigned int i;
-- 
2.45.2.803.g4e1b14247a-goog


-- 
Dmitry

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

* Re: [PATCH] gpiolib: of: add polarity quirk for TSC2005
  2024-07-03 18:26 [PATCH] gpiolib: of: add polarity quirk for TSC2005 Dmitry Torokhov
@ 2024-07-05  8:52 ` Linus Walleij
  2024-07-05  9:01 ` Bartosz Golaszewski
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2024-07-05  8:52 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Bartosz Golaszewski, Sebastian Reichel, Pali Rohár,
	Pavel Machek, linux-gpio, linux-kernel

On Wed, Jul 3, 2024 at 8:26 PM Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:


> DTS for Nokia N900 incorrectly specifies "active high" polarity for
> the reset line, while the chip documentation actually specifies it as
> "active low".  In the past the driver fudged gpiod API and inverted
> the logic internally, but it was changed in d0d89493bff8.
>
> Fixes: d0d89493bff8 ("Input: tsc2004/5 - switch to using generic device properties")
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Acked-by: Linus Walleij <linus.walleij@linaro.org>

> OTOH if this was indeed broken, then it was broken for ~7 years
> (d0d89493bff8 went in 4.11-rc1), so maybe the best way is not to worry
> about compatibility with old DTS, update
> arch/arm/boot/dts/ti/omap/omap3-n900.dts in the tree and call it a day.

I think anybody using the n900 wll be updating DTS and kernel in tandem
so yeah. But I think it's nice that we do both since you anyway made
the patch, it doesn't hurt.

Yours,
Linus Walleij

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

* Re: [PATCH] gpiolib: of: add polarity quirk for TSC2005
  2024-07-03 18:26 [PATCH] gpiolib: of: add polarity quirk for TSC2005 Dmitry Torokhov
  2024-07-05  8:52 ` Linus Walleij
@ 2024-07-05  9:01 ` Bartosz Golaszewski
  1 sibling, 0 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2024-07-05  9:01 UTC (permalink / raw)
  To: Bartosz Golaszewski, Dmitry Torokhov
  Cc: Bartosz Golaszewski, Linus Walleij, Sebastian Reichel,
	Pali Rohár, Pavel Machek, linux-gpio, linux-kernel

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>


On Wed, 03 Jul 2024 11:26:09 -0700, Dmitry Torokhov wrote:
> DTS for Nokia N900 incorrectly specifies "active high" polarity for
> the reset line, while the chip documentation actually specifies it as
> "active low".  In the past the driver fudged gpiod API and inverted
> the logic internally, but it was changed in d0d89493bff8.
> 
> 

Applied, thanks!

[1/1] gpiolib: of: add polarity quirk for TSC2005
      commit: f8d76c2c313c56d5cb894a243dff4550f048278d

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

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

end of thread, other threads:[~2024-07-05  9:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-03 18:26 [PATCH] gpiolib: of: add polarity quirk for TSC2005 Dmitry Torokhov
2024-07-05  8:52 ` Linus Walleij
2024-07-05  9:01 ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox