Skip to contentSkip to conversation

drm/sun4i: rgb: add missing calls to drm_panel_{prepare,unprepare}

PATCH In review Jonathan Liu 3 participants 3 messages Aug 30, 2016

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/sun4i: rgb: add missing calls to drm_panel_{prepare,unprepare}

If the enable-gpios property of a simple panel in device tree is set, the GPIO is not toggled on/off because of missing calls to drm_panel_prepare and drm_panel_unprepare.

---
 drivers/gpu/drm/sun4i/sun4i_rgb.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/sun4i/sun4i_rgb.c +2 -0
index f5bbac6..d6943e9 100644
@@ -151,6 +151,7 @@ static void sun4i_rgb_encoder_enable(struct drm_encoder *encoder)
 
 	DRM_DEBUG_DRIVER("Enabling RGB output\n");
 
+	drm_panel_prepare(tcon->panel);
 	drm_panel_enable(tcon->panel);
 	sun4i_tcon_channel_enable(tcon, 0);
 }
@@ -165,6 +166,7 @@ static void sun4i_rgb_encoder_disable(struct drm_encoder *encoder)
 
 	sun4i_tcon_channel_disable(tcon, 0);
 	drm_panel_disable(tcon->panel);
+	drm_panel_unprepare(tcon->panel);
 }
 
 static void sun4i_rgb_encoder_mode_set(struct drm_encoder *encoder,
Signature · 1 line
2.9.3
#1 lore raw

Hi,

Quoted 5 lines · Jonathan Liu

If the enable-gpios property of a simple panel in device tree is set, the GPIO is not toggled on/off because of missing calls to drm_panel_prepare and drm_panel_unprepare.

This was not applying properly, but I merged it.

Please make sure that it applies on top of the current next branch.

Good catch, thanks!
Maxime

Signature · 3 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#2 lore raw

Re: [PATCH] drm/sun4i: rgb: add missing calls to drm_panel_{prepare, unprepare}

In reply to Jonathan Liu
Quoted 14 lines · Jonathan Liu

If the enable-gpios property of a simple panel in device tree is set, the GPIO is not toggled on/off because of missing calls to drm_panel_prepare and drm_panel_unprepare.

---
 drivers/gpu/drm/sun4i/sun4i_rgb.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/sun4i/sun4i_rgb.c +0 -0
index f5bbac6..d6943e9 100644

drivers/gpu/drm/sun4i/sun4i_rgb.c static void sun4i_rgb_encoder_enable(struct drm_encoder *encoder) · line 155

Quoted 5 lines
drivers/gpu/drm/sun4i/sun4i_rgb.c +1 -0
@@ -151,6 +151,7 @@ static void sun4i_rgb_encoder_enable(struct drm_encoder *encoder)
 
        DRM_DEBUG_DRIVER("Enabling RGB output\n");
 
+       drm_panel_prepare(tcon->panel);
        drm_panel_enable(tcon->panel);

IMHO it's worth having a _prepare_enable, and alike on the dtor side, similar to clk. The clk helper attributes when .enable() fails, which is a good idea. Looking on the drm side - all the users of such helper(s) don't bother checking neither .prepare or .enable. So updating that alongside the introduction would be a great move ;-)

Just an idea about another small task.
Emil

P.S. Skimming through v4.7 mediatek (mtk) driver looks a bit assymetrical wrt using the drm_panel API. Worth checking if things have improved with later versions ?