video: tegra: dsi: Fix read in lp write config
Animesh Kishore [Mon, 14 Nov 2011 09:14:34 +0000 (14:14 +0530)]
Use separate freq for read and write operation.
Freq mentioned in board file.

Change-Id: I9d641679d975e18713e147f73960ba584755a663
Signed-off-by: Animesh Kishore <ankishore@nvidia.com>
Reviewed-on: http://git-master/r/66134
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>

Rebase-Id: Ra82e1506f68bd7c598b74b63beee822c9619e0ec

drivers/video/tegra/dc/dsi.c

index 08dd705..71bf5b7 100644 (file)
 #define DSI_LP_OP_WRITE                        0x1
 #define DSI_LP_OP_READ                 0x2
 
+static bool enable_read_debug;
+module_param(enable_read_debug, bool, 0644);
+MODULE_PARM_DESC(enable_read_debug,
+               "Enable to print read fifo and return packet type");
+
 struct dsi_status {
        unsigned init:2;
 
@@ -1083,7 +1088,7 @@ static void tegra_dsi_set_control_reg_hs(struct tegra_dc_dsi_data *dsi)
        tegra_dsi_writel(dsi, host_dsi_control, DSI_HOST_DSI_CONTROL);
 }
 
-static void tegra_dsi_pad_caliberation(struct tegra_dc_dsi_data *dsi)
+static void tegra_dsi_pad_calibration(struct tegra_dc_dsi_data *dsi)
 {
        u32 val;
 
@@ -1142,7 +1147,7 @@ static int tegra_dsi_init_hw(struct tegra_dc *dc,
 
        tegra_dsi_writel(dsi, dsi->dsi_control_val, DSI_CONTROL);
 
-       tegra_dsi_pad_caliberation(dsi);
+       tegra_dsi_pad_calibration(dsi);
 
        val = DSI_POWER_CONTROL_LEG_DSI_ENABLE(TEGRA_DSI_ENABLE);
        tegra_dsi_writel(dsi, val, DSI_POWER_CONTROL);
@@ -1197,9 +1202,9 @@ static int tegra_dsi_set_to_lp_mode(struct tegra_dc *dc,
                (dsi->info.enable_hs_clock_on_lp_cmd_mode))
                tegra_dsi_hs_clk_out_enable_in_lp(dsi);
 
-success:
        dsi->status.lphs = DSI_LPHS_IN_LP_MODE;
        dsi->status.lp_op = lp_op;
+success:
        err = 0;
 fail:
        return err;
@@ -1215,6 +1220,9 @@ static int tegra_dsi_set_to_hs_mode(struct tegra_dc *dc,
                goto fail;
        }
 
+       if (dsi->status.lphs == DSI_LPHS_IN_HS_MODE)
+               goto success;
+
        if (dsi->status.dc_stream == DSI_DC_STREAM_ENABLE)
                tegra_dsi_stop_dc_stream_at_frame_end(dc, dsi);
 
@@ -1242,6 +1250,8 @@ static int tegra_dsi_set_to_hs_mode(struct tegra_dc *dc,
                tegra_dsi_hs_clk_out_enable(dsi);
 
        dsi->status.lphs = DSI_LPHS_IN_HS_MODE;
+success:
+       dsi->status.lp_op = DSI_LP_OP_NOT_INIT;
        err = 0;
 fail:
        return err;
@@ -1553,7 +1563,8 @@ static void tegra_dsi_read_fifo(struct tegra_dc *dc,
        /* Read data from FIFO */
        for (i = 0; i < rd_fifo_cnt; i++) {
                val = tegra_dsi_readl(dsi, DSI_RD_DATA);
-               printk(KERN_INFO "Read data[%d]: 0x%x\n", i, val);
+               if (enable_read_debug)
+                       printk(KERN_INFO "Read data[%d]: 0x%x\n", i, val);
                memcpy(read_fifo, &val, 4);
                read_fifo += 4;
        }
@@ -1633,8 +1644,7 @@ int tegra_dsi_read_data(struct tegra_dc *dc,
 
        if ((dsi->status.init != DSI_MODULE_INIT) ||
                (dsi->status.lphs == DSI_LPHS_NOT_INIT) ||
-               (dsi->status.driven == DSI_DRIVEN_MODE_NOT_INIT) ||
-               (dsi->status.lp_op == DSI_LP_OP_NOT_INIT)) {
+               (dsi->status.driven == DSI_DRIVEN_MODE_NOT_INIT)) {
                err = -EPERM;
                goto fail;
        }
@@ -1714,7 +1724,7 @@ int tegra_dsi_read_data(struct tegra_dc *dc,
                goto fail;
        }
 
-       if (switch_back_to_hs_mode) {
+       if (dsi->status.lp_op == DSI_LP_OP_WRITE) {
                err = tegra_dsi_set_to_lp_mode(dc, dsi, DSI_LP_OP_READ);
                if (err < 0) {
                        dev_err(&dc->ndev->dev,
@@ -1759,7 +1769,9 @@ int tegra_dsi_read_data(struct tegra_dc *dc,
 
        tegra_dsi_read_fifo(dc, dsi, rd_fifo_cnt, read_data);
 
-       err = tegra_dsi_parse_read_response(dc, rd_fifo_cnt, read_data);
+       if (enable_read_debug)
+               err = tegra_dsi_parse_read_response
+                               (dc, rd_fifo_cnt, read_data);
 fail:
        if (switch_back_to_dc_mode)
                dsi->driven_mode = TEGRA_DSI_DRIVEN_BY_DC;