diff mbox series

[1/4] ARM: dts: omap3-n900: fix LCD reset line polarity

Message ID 20221004213503.848262-1-dmitry.torokhov@gmail.com
State New
Headers show
Series [1/4] ARM: dts: omap3-n900: fix LCD reset line polarity | expand

Commit Message

Dmitry Torokhov Oct. 4, 2022, 9:35 p.m. UTC
The LCD driver (panel-sony-acx565akm), when probing, starts with line
driven low, and then toggles it to high and keeps it there. Also, the
line is driven low when powering off the device, and ls released when
powering it back on. This means that the reset line should be described
as "active low" in DTS. This will be important when the driver is
converted to gpiod API which respects the polarity declared in DTS.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 arch/arm/boot/dts/omap3-n900.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tony Lindgren Oct. 11, 2022, 5:45 a.m. UTC | #1
Hi,

* Dmitry Torokhov <dmitry.torokhov@gmail.com> [221004 21:26]:
> The LCD driver (panel-sony-acx565akm), when probing, starts with line
> driven low, and then toggles it to high and keeps it there. Also, the
> line is driven low when powering off the device, and ls released when
> powering it back on. This means that the reset line should be described
> as "active low" in DTS. This will be important when the driver is
> converted to gpiod API which respects the polarity declared in DTS.

We should ensure these patches get merged together with the driver
change to avoid breaking LCD for booting. Probably no need to have
the driver quirk handling for inverted polartity in this case.

It's probably easiest to have an immutable branch for the driver
changes I can base the dts changes on. Or I can ack the dts changes
if they get merged with the driver.

Regards,

Tony
Dmitry Torokhov Oct. 11, 2022, 2:38 p.m. UTC | #2
On Tue, Oct 11, 2022 at 05:30:12PM +0300, Tony Lindgren wrote:
> * Dmitry Torokhov <dmitry.torokhov@gmail.com> [221011 13:57]:
> > Hi Sebastian,
> > 
> > On Tue, Oct 11, 2022 at 02:37:26PM +0200, Sebastian Reichel wrote:
> > > Hi,
> > > 
> > > On Tue, Oct 11, 2022 at 08:45:54AM +0300, Tony Lindgren wrote:
> > > > * Dmitry Torokhov <dmitry.torokhov@gmail.com> [221004 21:26]:
> > > > > The LCD driver (panel-sony-acx565akm), when probing, starts with line
> > > > > driven low, and then toggles it to high and keeps it there. Also, the
> > > > > line is driven low when powering off the device, and ls released when
> > > > > powering it back on. This means that the reset line should be described
> > > > > as "active low" in DTS. This will be important when the driver is
> > > > > converted to gpiod API which respects the polarity declared in DTS.
> > > > 
> > > > We should ensure these patches get merged together with the driver
> > > > change to avoid breaking LCD for booting. Probably no need to have
> > > > the driver quirk handling for inverted polartity in this case.
> > > > 
> > > > It's probably easiest to have an immutable branch for the driver
> > > > changes I can base the dts changes on. Or I can ack the dts changes
> > > > if they get merged with the driver.
> > > 
> > > Both drivers are already using gpiod API:
> > > 
> > > drivers/gpu/drm/panel/panel-sony-acx565akm.c
> > > drivers/gpu/drm/panel/panel-dsi-cm.c
> > 
> > I was looking at
> > 
> > drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c
> > drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c
> 
> Ah OK that explains :)
> 
> > which are not using gpiod. Should they be retired?
> 
> Yes we should just get rid of them with omapdrm working just fine.

Will you be submitting such patches? I'd like to get rid of
of_get_named_gpio() and friends if I can...

> 
> > > So this just breaks things.
> > 
> > I missed the drivers in drivers/gpu/... and I see that they essentially
> > abuse gpiod API as gpiod_set_value() operates on logical level
> > (active/inactive) and not absolute (high/low). They should either use
> > the gpiod_*_raw() variants, or they should be adjusted to do the proper
> > thing together with the accompanying DTS change.
> > 
> > What are your preferences?
> 
> Seems like high/low at the connected device end is what we should use,
> right? Otherwise things will misbehave if the panel is connected to
> some other SoC possibly.

It is exactly because of this case the driver should use active/inactive
and follow polarity described in DTS. If the driver does:

	gpiod_set_value_cansleep(d->reset, 1);

then if DTS is saying that the reset line is active low, under the wraps
the line will be driven to "0", but if DTS is saying that the line is
active high, then the very same call will drive the line to "1".

This allows accommodating different designs without having to change the
driver code.
Tony Lindgren Oct. 11, 2022, 2:47 p.m. UTC | #3
* Dmitry Torokhov <dmitry.torokhov@gmail.com> [221011 14:30]:
> On Tue, Oct 11, 2022 at 05:30:12PM +0300, Tony Lindgren wrote:
> > * Dmitry Torokhov <dmitry.torokhov@gmail.com> [221011 13:57]:
> > > Hi Sebastian,
> > > 
> > > On Tue, Oct 11, 2022 at 02:37:26PM +0200, Sebastian Reichel wrote:
> > > > Hi,
> > > > 
> > > > On Tue, Oct 11, 2022 at 08:45:54AM +0300, Tony Lindgren wrote:
> > > > > * Dmitry Torokhov <dmitry.torokhov@gmail.com> [221004 21:26]:
> > > > > > The LCD driver (panel-sony-acx565akm), when probing, starts with line
> > > > > > driven low, and then toggles it to high and keeps it there. Also, the
> > > > > > line is driven low when powering off the device, and ls released when
> > > > > > powering it back on. This means that the reset line should be described
> > > > > > as "active low" in DTS. This will be important when the driver is
> > > > > > converted to gpiod API which respects the polarity declared in DTS.
> > > > > 
> > > > > We should ensure these patches get merged together with the driver
> > > > > change to avoid breaking LCD for booting. Probably no need to have
> > > > > the driver quirk handling for inverted polartity in this case.
> > > > > 
> > > > > It's probably easiest to have an immutable branch for the driver
> > > > > changes I can base the dts changes on. Or I can ack the dts changes
> > > > > if they get merged with the driver.
> > > > 
> > > > Both drivers are already using gpiod API:
> > > > 
> > > > drivers/gpu/drm/panel/panel-sony-acx565akm.c
> > > > drivers/gpu/drm/panel/panel-dsi-cm.c
> > > 
> > > I was looking at
> > > 
> > > drivers/video/fbdev/omap2/omapfb/displays/panel-sony-acx565akm.c
> > > drivers/video/fbdev/omap2/omapfb/displays/panel-dsi-cm.c
> > 
> > Ah OK that explains :)
> > 
> > > which are not using gpiod. Should they be retired?
> > 
> > Yes we should just get rid of them with omapdrm working just fine.
> 
> Will you be submitting such patches? I'd like to get rid of
> of_get_named_gpio() and friends if I can...

Adding Tomi to Cc, my guess is he already has such patches and knows
better which ones can go :)

> > > > So this just breaks things.
> > > 
> > > I missed the drivers in drivers/gpu/... and I see that they essentially
> > > abuse gpiod API as gpiod_set_value() operates on logical level
> > > (active/inactive) and not absolute (high/low). They should either use
> > > the gpiod_*_raw() variants, or they should be adjusted to do the proper
> > > thing together with the accompanying DTS change.
> > > 
> > > What are your preferences?
> > 
> > Seems like high/low at the connected device end is what we should use,
> > right? Otherwise things will misbehave if the panel is connected to
> > some other SoC possibly.
> 
> It is exactly because of this case the driver should use active/inactive
> and follow polarity described in DTS. If the driver does:
> 
> 	gpiod_set_value_cansleep(d->reset, 1);
> 
> then if DTS is saying that the reset line is active low, under the wraps
> the line will be driven to "0", but if DTS is saying that the line is
> active high, then the very same call will drive the line to "1".
> 
> This allows accommodating different designs without having to change the
> driver code.

OK

Thanks,

Tony
diff mbox series

Patch

diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts
index dd7971556449..c2e5bde19452 100644
--- a/arch/arm/boot/dts/omap3-n900.dts
+++ b/arch/arm/boot/dts/omap3-n900.dts
@@ -1038,7 +1038,7 @@  lcd: acx565akm@2 {
 		pinctrl-0 = <&acx565akm_pins>;
 
 		label = "lcd";
-		reset-gpios = <&gpio3 26 GPIO_ACTIVE_HIGH>; /* 90 */
+		reset-gpios = <&gpio3 26 GPIO_ACTIVE_LOW>; /* 90 */
 
 		port {
 			lcd_in: endpoint {