video: tegra: dsi: Config mipi cal block
Animesh Kishore [Tue, 23 Oct 2012 12:53:30 +0000 (17:53 +0530)]
Bug 1054040

Change-Id: Ib981d1eb6073d531d9a4b8d4bb0016e5bb3911f5
Signed-off-by: Animesh Kishore <ankishore@nvidia.com>
(cherry picked from commit 76c07f43c7b4d7dd3f7da4e656146c08e65fbf6b)
Signed-off-by: Gaurav Batra <gbatra@nvidia.com>
Reviewed-on: http://git-master/r/146946
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Thomas Cherry <tcherry@nvidia.com>

drivers/video/tegra/dc/dsi.c
drivers/video/tegra/dc/dsi.h
drivers/video/tegra/dc/mipi_cal.h

index 8864a9d..ab88905 100644 (file)
@@ -42,6 +42,7 @@
 #include "dev.h"
 #include "dsi_regs.h"
 #include "dsi.h"
+#include "mipi_cal.h"
 
 #define APB_MISC_GP_MIPI_PAD_CTRL_0    (TEGRA_APB_MISC_BASE + 0x820)
 #define DSIB_MODE_ENABLE               0x2
@@ -402,6 +403,7 @@ static inline void tegra_dsi_clk_enable(struct tegra_dc_dsi_data *dsi)
                clk_enable(dsi->dsi_clk);
                clk_enable(dsi->dsi_fixed_clk);
        }
+       tegra_mipi_cal_clk_enable(dsi->mipi_cal);
 }
 
 static inline void tegra_dsi_clk_disable(struct tegra_dc_dsi_data *dsi)
@@ -410,6 +412,7 @@ static inline void tegra_dsi_clk_disable(struct tegra_dc_dsi_data *dsi)
                clk_disable(dsi->dsi_clk);
                clk_disable(dsi->dsi_fixed_clk);
        }
+       tegra_mipi_cal_clk_disable(dsi->mipi_cal);
 }
 
 static void __maybe_unused tegra_dsi_syncpt_reset(
@@ -2020,6 +2023,13 @@ static int tegra_dsi_init_hw(struct tegra_dc *dc,
 
        tegra_dsi_pad_calibration(dsi);
 
+       tegra_mipi_cal_init_hw(dsi->mipi_cal);
+
+       tegra_mipi_cal_write(dsi->mipi_cal, MIPI_BIAS_PAD_E_VCLAMP_REF(0x1),
+                                       MIPI_CAL_MIPI_BIAS_PAD_CFG0_0);
+       tegra_mipi_cal_write(dsi->mipi_cal, PAD_PDVREG(0x0),
+                               MIPI_CAL_MIPI_BIAS_PAD_CFG2_0);
+
        tegra_dsi_writel(dsi,
                DSI_POWER_CONTROL_LEG_DSI_ENABLE(TEGRA_DSI_ENABLE),
                DSI_POWER_CONTROL);
@@ -3275,7 +3285,9 @@ static void __tegra_dc_dsi_init(struct tegra_dc *dc)
                dsi->out_ops->init(dsi);
 
        tegra_dsi_init_sw(dc, dsi);
-       /* TODO: Configure the CSI pad configuration */
+
+       if (!dsi->mipi_cal)
+               dsi->mipi_cal = tegra_mipi_cal_init_sw(dc);
 }
 
 static int tegra_dc_dsi_cp_p_cmd(struct tegra_dsi_cmd *src,
index d4f68c3..973ad9f 100644 (file)
@@ -73,6 +73,8 @@ struct tegra_dc_dsi_data {
        /* data from board info */
        struct tegra_dsi_out info;
 
+       struct tegra_mipi_cal *mipi_cal;
+
        struct dsi_status status;
 
        struct dsi_phy_timing_inclk phy_timing;
index 6253999..cb358cc 100644 (file)
@@ -17,6 +17,8 @@
 #ifndef __DRIVERS_VIDEO_TEGRA_DC_MIPI_CAL_H__
 #define __DRIVERS_VIDEO_TEGRA_DC_MIPI_CAL_H__
 
+#include "mipi_cal_regs.h"
+
 struct tegra_mipi_cal {
        struct tegra_dc *dc;
        struct resource *res;