[2/2] drm: sun4i: tie DSI PHY Poweron/off to crtc enable/disable

Message ID 20230410084750.164016-3-fusibrandon13@gmail.com
State New
Headers show
Series
  • drm: sun4i/dsi: allow modeset helpers to manage display
Related show

Commit Message

Brandon Cheo Fusi April 10, 2023, 8:47 a.m. UTC
Poweron/off the DSI PHY when the crtc is enabled/disabled. This allows the modeset
helpers to manage the DSI sink while preserving the old drm_panel_<prepare,enable>
and drm_panel_<disable,unprepare> sequences.

Signed-off-by: Brandon Cheo Fusi <fusibrandon13@gmail.com>
---
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Patch

diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index 523a6d787..6f50dc66a 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -190,7 +190,7 @@  void sun4i_tcon_set_status(struct sun4i_tcon *tcon,
 			   const struct drm_encoder *encoder,
 			   bool enabled)
 {
-	bool is_lvds = false;
+	bool is_lvds = false, is_dsi = false;
 	int channel;
 
 	switch (encoder->encoder_type) {
@@ -198,6 +198,8 @@  void sun4i_tcon_set_status(struct sun4i_tcon *tcon,
 		is_lvds = true;
 		fallthrough;
 	case DRM_MODE_ENCODER_DSI:
+		is_dsi = true;
+		fallthrough;
 	case DRM_MODE_ENCODER_NONE:
 		channel = 0;
 		break;
@@ -221,6 +223,12 @@  void sun4i_tcon_set_status(struct sun4i_tcon *tcon,
 		sun4i_tcon_lvds_set_status(tcon, encoder, true);
 
 	sun4i_tcon_channel_set_status(tcon, channel, enabled);
+
+	if (is_dsi) {
+		/* turn DSI phy on or off */
+		(enabled) ? sun6i_dsi_phy_power_on(encoder)
+				  : sun6i_dsi_phy_power_off(encoder);
+	}
 }
 
 void sun4i_tcon_enable_vblank(struct sun4i_tcon *tcon, bool enable)