When using DCSS with NWL, overriding the mode flags to enforce active high
sync is preventing the use of active low with downstream bridges, such as
ti-sn65dsi83, which will not see such mode flags set by the panel.

Signed-off-by: Esben Haabendal <[email protected]>
---
 drivers/gpu/drm/bridge/nwl-dsi.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c b/drivers/gpu/drm/bridge/nwl-dsi.c
index 3c9ae93c4f67..915e1bdc73c8 100644
--- a/drivers/gpu/drm/bridge/nwl-dsi.c
+++ b/drivers/gpu/drm/bridge/nwl-dsi.c
@@ -110,6 +110,8 @@ struct nwl_dsi {
        int error;
 
        struct nwl_dsi_transfer *xfer;
+
+       unsigned int endpoint;
 };
 
 static const struct regmap_config nwl_dsi_regmap_config = {
@@ -821,10 +823,13 @@ static int nwl_dsi_bridge_atomic_check(struct drm_bridge 
*bridge,
                                       struct drm_connector_state *conn_state)
 {
        struct drm_display_mode *adjusted_mode = &crtc_state->adjusted_mode;
+       struct nwl_dsi *dsi = bridge_to_dsi(bridge);
 
        /* At least LCDIF + NWL needs active high sync */
-       adjusted_mode->flags |= (DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC);
-       adjusted_mode->flags &= ~(DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC);
+       if (dsi->endpoint == NWL_DSI_ENDPOINT_LCDIF) {
+               adjusted_mode->flags |= (DRM_MODE_FLAG_PHSYNC | 
DRM_MODE_FLAG_PVSYNC);
+               adjusted_mode->flags &= ~(DRM_MODE_FLAG_NHSYNC | 
DRM_MODE_FLAG_NVSYNC);
+       }
 
        /*
         * Do a full modeset if crtc_state->active is changed to be true.
@@ -1088,13 +1093,12 @@ static int nwl_dsi_parse_dt(struct nwl_dsi *dsi)
 static int nwl_dsi_select_input(struct nwl_dsi *dsi)
 {
        struct device_node *remote;
-       u32 use_dcss = 1;
        int ret;
 
        remote = of_graph_get_remote_node(dsi->dev->of_node, 0,
                                          NWL_DSI_ENDPOINT_LCDIF);
        if (remote) {
-               use_dcss = 0;
+               dsi->endpoint = NWL_DSI_ENDPOINT_LCDIF;
        } else {
                remote = of_graph_get_remote_node(dsi->dev->of_node, 0,
                                                  NWL_DSI_ENDPOINT_DCSS);
@@ -1103,11 +1107,12 @@ static int nwl_dsi_select_input(struct nwl_dsi *dsi)
                                      "No valid input endpoint found\n");
                        return -EINVAL;
                }
+               dsi->endpoint = NWL_DSI_ENDPOINT_DCSS;
        }
 
        DRM_DEV_INFO(dsi->dev, "Using %s as input source\n",
-                    (use_dcss) ? "DCSS" : "LCDIF");
-       ret = mux_control_try_select(dsi->mux, use_dcss);
+                    (dsi->endpoint == NWL_DSI_ENDPOINT_DCSS) ? "DCSS" : 
"LCDIF");
+       ret = mux_control_try_select(dsi->mux, dsi->endpoint == 
NWL_DSI_ENDPOINT_DCSS);
        if (ret < 0)
                DRM_DEV_ERROR(dsi->dev, "Failed to select input: %d\n", ret);
 

-- 
2.55.0

Reply via email to