]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drm/i2c: adv7511: Change DSI lanes dynamically
authorArchit Taneja <architt@codeaurora.org>
Mon, 7 Sep 2015 05:50:28 +0000 (11:20 +0530)
committerSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Mon, 11 Jan 2016 09:54:43 +0000 (09:54 +0000)
Lower modes on ADV7511 require lower number of lanes for correct
operation. Switch lanes to 3 when the target mode's pixel clock
is less than 80 Mhz.

Based on patch by Andy Green <andy.green@linaro.org>

Signed-off-by: Archit Taneja <architt@codeaurora.org>
drivers/gpu/drm/i2c/adv7511.c

index eec5885d6e9e86fe6ae8c3bc41f19d33eff42975..46c1d7d427e7eda0886ff4f8789ac03895128c5f 100644 (file)
@@ -856,6 +856,26 @@ static void adv7511_mode_set(struct adv7511 *adv7511,
        regmap_update_bits(adv7511->regmap, 0x17,
                0x60, (vsync_polarity << 6) | (hsync_polarity << 5));
 
+       if (adv7511->type == ADV7533 && adv7511->num_dsi_lanes == 4) {
+               struct mipi_dsi_device *dsi = adv7511->dsi;
+               int lanes, ret;
+
+               if (adj_mode->clock > 80000)
+                       lanes = 4;
+               else
+                       lanes = 3;
+
+               if (lanes != dsi->lanes) {
+                       mipi_dsi_detach(dsi);
+                       dsi->lanes = lanes;
+                       ret = mipi_dsi_attach(dsi);
+                       if (ret) {
+                               DRM_ERROR("Failed to change host lanes\n");
+                               return;
+                       }
+               }
+       }
+
        drm_mode_copy(&adv7511->curr_mode, adj_mode);
 
        /*