The tidss driver doesn't really implement anything with encoders, it
just relies on simple encoders, bridges and drm_bridge_connector.

In order to figure out the CRTC -> connector association from the
hardware state, we do need encoder support though, through the
get_current_crtc callback.

Since the tidss encoders are always connected to a single CRTC, we don't
really need to read the hardware state though, we can simply return the
one we know we are always connected to.

Signed-off-by: Maxime Ripard <[email protected]>
---
 drivers/gpu/drm/tidss/tidss_encoder.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/tidss/tidss_encoder.c 
b/drivers/gpu/drm/tidss/tidss_encoder.c
index cb4b8feb90d2..ec995335953b 100644
--- a/drivers/gpu/drm/tidss/tidss_encoder.c
+++ b/drivers/gpu/drm/tidss/tidss_encoder.c
@@ -121,11 +121,26 @@ static const struct drm_bridge_funcs tidss_bridge_funcs = 
{
        .atomic_destroy_state           = 
drm_atomic_helper_bridge_destroy_state,
        .atomic_sro_readout_state       = tidss_readout_state,
        .atomic_sro_compare_state       = 
drm_atomic_helper_bridge_compare_state,
 };
 
+static struct drm_crtc *tidss_encoder_get_current_crtc(struct drm_encoder 
*encoder)
+{
+       struct drm_crtc *crtc;
+
+       WARN_ON(hweight32(encoder->possible_crtcs) > 1);
+
+       drm_for_each_crtc(crtc, encoder->dev) {
+               if (encoder->possible_crtcs == (1 << drm_crtc_index(crtc)))
+                       return crtc;
+       }
+
+       return NULL;
+}
+
 static const struct drm_encoder_funcs tidss_encoder_funcs = {
+       .atomic_sro_get_current_crtc = tidss_encoder_get_current_crtc,
        .destroy = drm_encoder_cleanup,
 };
 
 int tidss_encoder_create(struct tidss_device *tidss,
                         struct drm_bridge *next_bridge,

-- 
2.55.0

Reply via email to