Greg Grisco | d625055 | 2011-06-29 14:40:23 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 2 | * |
| 3 | * Redistribution and use in source and binary forms, with or without |
| 4 | * modification, are permitted provided that the following conditions are |
| 5 | * met: |
| 6 | * * Redistributions of source code must retain the above copyright |
| 7 | * notice, this list of conditions and the following disclaimer. |
| 8 | * * Redistributions in binary form must reproduce the above |
| 9 | * copyright notice, this list of conditions and the following |
| 10 | * disclaimer in the documentation and/or other materials provided |
| 11 | * with the distribution. |
| 12 | * * Neither the name of Code Aurora Forum, Inc. nor the names of its |
| 13 | * contributors may be used to endorse or promote products derived |
| 14 | * from this software without specific prior written permission. |
| 15 | * |
| 16 | * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED |
| 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS |
| 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
| 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 26 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | * |
| 28 | */ |
| 29 | |
| 30 | #include <reg.h> |
Shashank Mittal | cbd271d | 2011-01-14 15:18:33 -0800 | [diff] [blame] | 31 | #include <endian.h> |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 32 | #include <mipi_dsi.h> |
| 33 | #include <dev/fbcon.h> |
Greg Grisco | d625055 | 2011-06-29 14:40:23 -0700 | [diff] [blame] | 34 | #include <stdlib.h> |
Kinson Chik | e5c9343 | 2011-06-17 09:10:29 -0700 | [diff] [blame] | 35 | #include <debug.h> |
Kinson Chik | fe93103 | 2011-07-21 10:01:34 -0700 | [diff] [blame] | 36 | #include <target/display.h> |
| 37 | #include <platform/iomap.h> |
| 38 | #include <platform/clock.h> |
| 39 | |
| 40 | extern void mdp_disable(void); |
| 41 | extern int mipi_dsi_cmd_config(struct fbcon_config mipi_fb_cfg, unsigned short num_of_lanes); |
| 42 | extern void mdp_shutdown(void); |
| 43 | extern void mdp_start_dma(void); |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 44 | |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 45 | #if DISPLAY_MIPI_PANEL_TOSHIBA |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 46 | static struct fbcon_config mipi_fb_cfg = { |
| 47 | .height = TSH_MIPI_FB_HEIGHT, |
| 48 | .width = TSH_MIPI_FB_WIDTH, |
| 49 | .stride = TSH_MIPI_FB_WIDTH, |
| 50 | .format = FB_FORMAT_RGB888, |
| 51 | .bpp = 24, |
| 52 | .update_start = NULL, |
| 53 | .update_done = NULL, |
| 54 | }; |
Kinson Chik | e5c9343 | 2011-06-17 09:10:29 -0700 | [diff] [blame] | 55 | struct mipi_dsi_panel_config toshiba_panel_info = { |
| 56 | .mode = MIPI_VIDEO_MODE, |
| 57 | .num_of_lanes = 1, |
| 58 | .dsi_phy_config = &mipi_dsi_toshiba_panel_phy_ctrl, |
| 59 | .panel_cmds = toshiba_panel_video_mode_cmds, |
| 60 | .num_of_panel_cmds = ARRAY_SIZE(toshiba_panel_video_mode_cmds), |
| 61 | }; |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 62 | #elif DISPLAY_MIPI_PANEL_NOVATEK_BLUE |
| 63 | static struct fbcon_config mipi_fb_cfg = { |
| 64 | .height = NOV_MIPI_FB_HEIGHT, |
| 65 | .width = NOV_MIPI_FB_WIDTH, |
| 66 | .stride = NOV_MIPI_FB_WIDTH, |
| 67 | .format = FB_FORMAT_RGB888, |
| 68 | .bpp = 24, |
| 69 | .update_start = NULL, |
| 70 | .update_done = NULL, |
| 71 | }; |
Kinson Chik | e5c9343 | 2011-06-17 09:10:29 -0700 | [diff] [blame] | 72 | struct mipi_dsi_panel_config novatek_panel_info = { |
| 73 | .mode = MIPI_CMD_MODE, |
| 74 | .num_of_lanes = 2, |
| 75 | .dsi_phy_config = &mipi_dsi_novatek_panel_phy_ctrl, |
| 76 | .panel_cmds = novatek_panel_cmd_mode_cmds, |
| 77 | .num_of_panel_cmds = ARRAY_SIZE(novatek_panel_cmd_mode_cmds), |
| 78 | }; |
| 79 | #elif DISPLAY_MIPI_PANEL_TOSHIBA_MDT61 |
| 80 | static struct fbcon_config mipi_fb_cfg = { |
| 81 | .height = TSH_MDT61_MIPI_FB_HEIGHT, |
| 82 | .width = TSH_MDT61_MIPI_FB_WIDTH, |
| 83 | .stride = TSH_MDT61_MIPI_FB_WIDTH, |
| 84 | .format = FB_FORMAT_RGB888, |
| 85 | .bpp = 24, |
| 86 | .update_start = NULL, |
| 87 | .update_done = NULL, |
| 88 | }; |
| 89 | struct mipi_dsi_panel_config toshiba_mdt61_panel_info = { |
| 90 | .mode = MIPI_VIDEO_MODE, |
| 91 | .num_of_lanes = 3, |
| 92 | .dsi_phy_config = &mipi_dsi_toshiba_mdt61_panel_phy_ctrl, |
| 93 | .panel_cmds = toshiba_mdt61_video_mode_cmds, |
| 94 | .num_of_panel_cmds = ARRAY_SIZE(toshiba_mdt61_video_mode_cmds), |
| 95 | }; |
Aparna Mallavarapu | f712f5e | 2011-08-04 21:11:00 +0530 | [diff] [blame^] | 96 | #elif DISPLAY_MIPI_PANEL_RENESAS |
| 97 | static struct fbcon_config mipi_fb_cfg = { |
| 98 | .height = REN_MIPI_FB_HEIGHT, |
| 99 | .width = REN_MIPI_FB_WIDTH, |
| 100 | .stride = REN_MIPI_FB_WIDTH, |
| 101 | .format = FB_FORMAT_RGB888, |
| 102 | .bpp = 24, |
| 103 | .update_start = NULL, |
| 104 | .update_done = NULL, |
| 105 | }; |
| 106 | struct mipi_dsi_panel_config renesas_panel_info = { |
| 107 | .mode = MIPI_VIDEO_MODE, |
| 108 | .num_of_lanes = 2, |
| 109 | .dsi_phy_config = &mipi_dsi_renesas_panel_phy_ctrl, |
| 110 | .panel_cmds = renesas_panel_video_mode_cmds, |
| 111 | .num_of_panel_cmds = ARRAY_SIZE(renesas_panel_video_mode_cmds), |
| 112 | .lane_swap = 1, |
| 113 | }; |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 114 | #else |
| 115 | static struct fbcon_config mipi_fb_cfg = { |
| 116 | .height = 0, |
| 117 | .width = 0, |
| 118 | .stride = 0, |
| 119 | .format = 0, |
| 120 | .bpp = 0, |
| 121 | .update_start = NULL, |
| 122 | .update_done = NULL, |
| 123 | }; |
| 124 | #endif |
| 125 | |
| 126 | static int cmd_mode_status = 0; |
Greg Grisco | d625055 | 2011-06-29 14:40:23 -0700 | [diff] [blame] | 127 | void secure_writel(uint32_t, uint32_t); |
| 128 | uint32_t secure_readl(uint32_t); |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 129 | |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 130 | int mipi_dsi_phy_ctrl_config(struct mipi_dsi_panel_config *pinfo) |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 131 | { |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 132 | unsigned i; |
| 133 | unsigned off = 0; |
| 134 | struct mipi_dsi_phy_ctrl *pd; |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 135 | |
Kinson Chik | fe93103 | 2011-07-21 10:01:34 -0700 | [diff] [blame] | 136 | writel(0x00000001, DSIPHY_SW_RESET); |
| 137 | writel(0x00000000, DSIPHY_SW_RESET); |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 138 | |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 139 | pd = (pinfo->dsi_phy_config); |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 140 | |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 141 | off = 0x02cc; /* regulator ctrl 0 */ |
| 142 | for (i = 0; i < 4; i++) { |
| 143 | writel(pd->regulator[i], MIPI_DSI_BASE + off); |
| 144 | off += 4; |
| 145 | } |
| 146 | |
| 147 | off = 0x0260; /* phy timig ctrl 0 */ |
| 148 | for (i = 0; i < 11; i++) { |
| 149 | writel(pd->timing[i], MIPI_DSI_BASE + off); |
| 150 | off += 4; |
| 151 | } |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 152 | |
| 153 | // T_CLK_POST, T_CLK_PRE for CLK lane P/N HS 200 mV timing length should > |
| 154 | // data lane HS timing length |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 155 | writel(0xa1e, DSI_CLKOUT_TIMING_CTRL); |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 156 | |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 157 | off = 0x0290; /* ctrl 0 */ |
| 158 | for (i = 0; i < 4; i++) { |
| 159 | writel(pd->ctrl[i], MIPI_DSI_BASE + off); |
| 160 | off += 4; |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 161 | } |
| 162 | |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 163 | off = 0x02a0; /* strength 0 */ |
| 164 | for (i = 0; i < 4; i++) { |
| 165 | writel(pd->strength[i], MIPI_DSI_BASE + off); |
| 166 | off += 4; |
| 167 | } |
| 168 | |
| 169 | off = 0x0204; /* pll ctrl 1, skip 0 */ |
| 170 | for (i = 1; i < 21; i++) { |
| 171 | writel(pd->pll[i], MIPI_DSI_BASE + off); |
| 172 | off += 4; |
| 173 | } |
| 174 | |
| 175 | /* pll ctrl 0 */ |
| 176 | writel(pd->pll[0], MIPI_DSI_BASE + 0x200); |
| 177 | writel((pd->pll[0] | 0x01), MIPI_DSI_BASE + 0x200); |
Aparna Mallavarapu | f712f5e | 2011-08-04 21:11:00 +0530 | [diff] [blame^] | 178 | /* lane swp ctrol */ |
| 179 | if (pinfo->lane_swap) |
| 180 | writel(pinfo->lane_swap, MIPI_DSI_BASE + 0xac); |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 181 | return (0); |
| 182 | } |
| 183 | |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 184 | struct mipi_dsi_panel_config *get_panel_info(void) |
| 185 | { |
| 186 | #if DISPLAY_MIPI_PANEL_TOSHIBA |
| 187 | return &toshiba_panel_info; |
| 188 | #elif DISPLAY_MIPI_PANEL_NOVATEK_BLUE |
| 189 | return &novatek_panel_info; |
Kinson Chik | e5c9343 | 2011-06-17 09:10:29 -0700 | [diff] [blame] | 190 | #elif DISPLAY_MIPI_PANEL_TOSHIBA_MDT61 |
| 191 | return &toshiba_mdt61_panel_info; |
Aparna Mallavarapu | f712f5e | 2011-08-04 21:11:00 +0530 | [diff] [blame^] | 192 | #elif DISPLAY_MIPI_PANEL_RENESAS |
| 193 | return &renesas_panel_info; |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 194 | #endif |
| 195 | return NULL; |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 196 | } |
| 197 | |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 198 | int dsi_cmd_dma_trigger_for_panel() |
| 199 | { |
| 200 | unsigned long ReadValue; |
| 201 | unsigned long count = 0; |
| 202 | int status = 0; |
| 203 | |
| 204 | writel(0x03030303, DSI_INT_CTRL); |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 205 | writel(0x1, DSI_CMD_MODE_DMA_SW_TRIGGER); |
| 206 | ReadValue = readl(DSI_INT_CTRL) & 0x00000001; |
| 207 | while (ReadValue != 0x00000001) { |
| 208 | ReadValue = readl(DSI_INT_CTRL) & 0x00000001; |
| 209 | count++; |
| 210 | if (count > 0xffff) { |
| 211 | status = FAIL; |
Kinson Chik | e5c9343 | 2011-06-17 09:10:29 -0700 | [diff] [blame] | 212 | dprintf(CRITICAL, "Panel CMD: command mode dma test failed\n"); |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 213 | return status; |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | writel((readl(DSI_INT_CTRL) | 0x01000001), DSI_INT_CTRL); |
Kinson Chik | e5c9343 | 2011-06-17 09:10:29 -0700 | [diff] [blame] | 218 | dprintf |
| 219 | (SPEW, "Panel CMD: command mode dma tested successfully\n"); |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 220 | return status; |
| 221 | } |
| 222 | |
Chandan Uddaraju | c1df565 | 2011-03-03 21:15:51 -0800 | [diff] [blame] | 223 | |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 224 | int mipi_dsi_cmds_tx(struct mipi_dsi_cmd *cmds, int count) |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 225 | { |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 226 | int ret = 0; |
| 227 | struct mipi_dsi_cmd *cm; |
| 228 | int i = 0; |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 229 | |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 230 | cm = cmds; |
| 231 | for (i = 0; i < count; i++) { |
| 232 | memcpy(DSI_CMD_DMA_MEM_START_ADDR_PANEL, (cm->payload), cm->size); |
| 233 | writel(DSI_CMD_DMA_MEM_START_ADDR_PANEL, DSI_DMA_CMD_OFFSET); |
| 234 | writel(cm->size, DSI_DMA_CMD_LENGTH); // reg 0x48 for this build |
| 235 | ret += dsi_cmd_dma_trigger_for_panel(); |
Kinson Chik | f91907f | 2011-07-15 10:06:48 -0700 | [diff] [blame] | 236 | udelay(80); |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 237 | cm++; |
| 238 | } |
| 239 | return ret; |
| 240 | } |
| 241 | |
Shashank Mittal | cbd271d | 2011-01-14 15:18:33 -0800 | [diff] [blame] | 242 | /* |
| 243 | * mipi_dsi_cmd_rx: can receive at most 16 bytes |
| 244 | * per transaction since it only have 4 32bits reigsters |
| 245 | * to hold data. |
| 246 | * therefore Maximum Return Packet Size need to be set to 16. |
| 247 | * any return data more than MRPS need to be break down |
| 248 | * to multiple transactions. |
| 249 | */ |
| 250 | int mipi_dsi_cmds_rx(char **rp, int len) |
| 251 | { |
| 252 | uint32_t *lp, data; |
| 253 | char * dp; |
| 254 | int i, off, cnt; |
| 255 | int rlen, res; |
| 256 | |
| 257 | if(len <= 2) |
| 258 | rlen = 4; /* short read */ |
| 259 | else |
| 260 | rlen = MIPI_DSI_MRPS + 6; /* 4 bytes header + 2 bytes crc */ |
| 261 | |
| 262 | if (rlen > MIPI_DSI_REG_LEN) { |
| 263 | return 0; |
| 264 | } |
| 265 | |
| 266 | res = rlen & 0x03; |
| 267 | |
| 268 | rlen += res; /* 4 byte align */ |
| 269 | lp = (uint32_t *)(*rp); |
| 270 | |
| 271 | cnt = rlen; |
| 272 | cnt += 3; |
| 273 | cnt >>=2; |
| 274 | |
| 275 | if (cnt > 4) |
| 276 | cnt = 4; /* 4 x 32 bits registers only */ |
| 277 | |
| 278 | off = 0x068; /* DSI_RDBK_DATA0 */ |
| 279 | off += ((cnt - 1) * 4); |
| 280 | |
| 281 | for (i = 0; i < cnt; i++) { |
| 282 | data = (uint32_t)readl(MIPI_DSI_BASE + off); |
| 283 | *lp++ = ntohl(data); /* to network byte order */ |
| 284 | off -= 4; |
| 285 | } |
| 286 | |
| 287 | if(len > 2) |
| 288 | { |
| 289 | /*First 4 bytes + paded bytes will be header next len bytes would be payload*/ |
| 290 | for(i = 0; i < len; i++) |
| 291 | { |
| 292 | dp = *rp; |
| 293 | dp[i] = dp[4 + res + i]; |
| 294 | } |
| 295 | } |
| 296 | |
| 297 | return len; |
| 298 | } |
| 299 | |
| 300 | static int mipi_dsi_cmd_bta_sw_trigger(void) |
| 301 | { |
| 302 | uint32_t data; |
| 303 | int cnt = 0; |
| 304 | int err = 0; |
| 305 | |
| 306 | writel(0x01, MIPI_DSI_BASE + 0x094); /* trigger */ |
| 307 | while (cnt < 10000) { |
| 308 | data = readl(MIPI_DSI_BASE + 0x0004); /*DSI_STATUS*/ |
| 309 | if ((data & 0x0010) == 0) |
| 310 | break; |
| 311 | cnt++; |
| 312 | } |
| 313 | if(cnt == 10000) |
| 314 | err = 1; |
| 315 | return err; |
| 316 | } |
| 317 | |
| 318 | static uint32_t mipi_novatek_manufacture_id(void) |
| 319 | { |
| 320 | char rec_buf[24]; |
| 321 | char *rp = rec_buf; |
| 322 | uint32_t *lp, data; |
| 323 | |
| 324 | mipi_dsi_cmds_tx(&novatek_panel_manufacture_id_cmd, 1); |
| 325 | mipi_dsi_cmds_rx(&rp, 3); |
| 326 | |
| 327 | lp = (uint32_t *)rp; |
| 328 | data = (uint32_t)*lp; |
| 329 | data = ntohl(data); |
| 330 | data = data >> 8; |
| 331 | return data; |
| 332 | } |
| 333 | |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 334 | int mipi_dsi_panel_initialize(struct mipi_dsi_panel_config *pinfo) |
| 335 | { |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 336 | unsigned char DMA_STREAM1 = 0; // for mdp display processor path |
| 337 | unsigned char EMBED_MODE1 = 1; // from frame buffer |
| 338 | unsigned char POWER_MODE2 = 1; // from frame buffer |
| 339 | unsigned char PACK_TYPE1 = 1; // long packet |
| 340 | unsigned char VC1 = 0; |
| 341 | unsigned char DT1 = 0; // non embedded mode |
| 342 | unsigned short WC1 = 0; // for non embedded mode only |
| 343 | int status = 0; |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 344 | unsigned char DLNx_EN; |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 345 | |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 346 | switch (pinfo->num_of_lanes) { |
| 347 | default: |
| 348 | case 1: |
| 349 | DLNx_EN = 1; // 1 lane |
| 350 | break; |
| 351 | case 2: |
| 352 | DLNx_EN = 3; // 2 lane |
| 353 | break; |
| 354 | case 3: |
| 355 | DLNx_EN = 7; // 3 lane |
| 356 | break; |
| 357 | } |
| 358 | |
| 359 | writel(0x0001, DSI_SOFT_RESET); |
| 360 | writel(0x0000, DSI_SOFT_RESET); |
| 361 | |
Kinson Chik | e5c9343 | 2011-06-17 09:10:29 -0700 | [diff] [blame] | 362 | writel((0 << 16) | 0x3f, DSI_CLK_CTRL); /* Turn on all DSI Clks */ |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 363 | writel(DMA_STREAM1 << 8 | 0x04, DSI_TRIG_CTRL); // reg 0x80 dma trigger: sw |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 364 | // trigger 0x4; dma stream1 |
Kinson Chik | e5c9343 | 2011-06-17 09:10:29 -0700 | [diff] [blame] | 365 | |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 366 | writel(0 << 30 | DLNx_EN << 4 | 0x105, DSI_CTRL); // reg 0x00 for this |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 367 | // build |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 368 | writel(EMBED_MODE1 << 28 | POWER_MODE2 << 26 |
| 369 | | PACK_TYPE1 << 24 | VC1 << 22 | DT1 << 16 | WC1, |
| 370 | DSI_COMMAND_MODE_DMA_CTRL); |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 371 | |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 372 | status = mipi_dsi_cmds_tx(pinfo->panel_cmds, pinfo->num_of_panel_cmds); |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 373 | |
| 374 | return status; |
| 375 | } |
| 376 | |
Kinson Chik | e5c9343 | 2011-06-17 09:10:29 -0700 | [diff] [blame] | 377 | //TODO: Clean up arguments being passed in not being used |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 378 | int config_dsi_video_mode(unsigned short disp_width, unsigned short disp_height, |
| 379 | unsigned short img_width, unsigned short img_height, |
| 380 | unsigned short hsync_porch0_fp, |
| 381 | unsigned short hsync_porch0_bp, |
| 382 | unsigned short vsync_porch0_fp, |
| 383 | unsigned short vsync_porch0_bp, |
| 384 | unsigned short hsync_width, |
| 385 | unsigned short vsync_width, unsigned short dst_format, |
| 386 | unsigned short traffic_mode, |
| 387 | unsigned short datalane_num) |
| 388 | { |
| 389 | |
| 390 | unsigned char DST_FORMAT; |
| 391 | unsigned char TRAFIC_MODE; |
| 392 | unsigned char DLNx_EN; |
| 393 | // video mode data ctrl |
| 394 | int status = 0; |
| 395 | unsigned long low_pwr_stop_mode = 0; |
| 396 | unsigned char eof_bllp_pwr = 0x9; |
| 397 | unsigned char interleav = 0; |
| 398 | |
| 399 | // disable mdp first |
Kinson Chik | fe93103 | 2011-07-21 10:01:34 -0700 | [diff] [blame] | 400 | mdp_disable(); |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 401 | |
| 402 | writel(0x00000000, DSI_CLK_CTRL); |
| 403 | writel(0x00000000, DSI_CLK_CTRL); |
| 404 | writel(0x00000000, DSI_CLK_CTRL); |
| 405 | writel(0x00000000, DSI_CLK_CTRL); |
| 406 | writel(0x00000002, DSI_CLK_CTRL); |
| 407 | writel(0x00000006, DSI_CLK_CTRL); |
| 408 | writel(0x0000000e, DSI_CLK_CTRL); |
| 409 | writel(0x0000001e, DSI_CLK_CTRL); |
| 410 | writel(0x0000003e, DSI_CLK_CTRL); |
| 411 | |
| 412 | writel(0, DSI_CTRL); |
| 413 | |
| 414 | writel(0, DSI_ERR_INT_MASK0); |
| 415 | |
| 416 | DST_FORMAT = 0; // RGB565 |
Kinson Chik | e5c9343 | 2011-06-17 09:10:29 -0700 | [diff] [blame] | 417 | dprintf(SPEW, "DSI_Video_Mode - Dst Format: RGB565\n"); |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 418 | |
| 419 | DLNx_EN = 1; // 1 lane with clk programming |
Kinson Chik | e5c9343 | 2011-06-17 09:10:29 -0700 | [diff] [blame] | 420 | dprintf(SPEW, "Data Lane: 1 lane\n"); |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 421 | |
| 422 | TRAFIC_MODE = 0; // non burst mode with sync pulses |
Kinson Chik | e5c9343 | 2011-06-17 09:10:29 -0700 | [diff] [blame] | 423 | dprintf(SPEW, "Traffic mode: non burst mode with sync pulses\n"); |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 424 | |
| 425 | writel(0x02020202, DSI_INT_CTRL); |
| 426 | |
| 427 | writel(((img_width + hsync_porch0_bp) << 16) | hsync_porch0_bp, |
| 428 | DSI_VIDEO_MODE_ACTIVE_H); |
| 429 | |
| 430 | writel(((img_height + vsync_porch0_bp) << 16) | (vsync_porch0_bp), |
| 431 | DSI_VIDEO_MODE_ACTIVE_V); |
| 432 | |
| 433 | writel(((img_height + vsync_porch0_fp + vsync_porch0_bp) << 16) |
| 434 | | img_width + hsync_porch0_fp + hsync_porch0_bp, |
| 435 | DSI_VIDEO_MODE_TOTAL); |
| 436 | |
| 437 | writel((hsync_width << 16) | 0, DSI_VIDEO_MODE_HSYNC); |
| 438 | |
| 439 | writel(0 << 16 | 0, DSI_VIDEO_MODE_VSYNC); |
| 440 | |
| 441 | writel(vsync_width << 16 | 0, DSI_VIDEO_MODE_VSYNC_VPOS); |
| 442 | |
| 443 | writel(1, DSI_EOT_PACKET_CTRL); |
| 444 | |
| 445 | writel(0x00000100, DSI_MISR_VIDEO_CTRL); |
| 446 | |
| 447 | writel(low_pwr_stop_mode << 16 | eof_bllp_pwr << 12 | TRAFIC_MODE << 8 |
| 448 | | DST_FORMAT << 4 | 0x0, DSI_VIDEO_MODE_CTRL); |
| 449 | |
| 450 | writel(0x67, DSI_CAL_STRENGTH_CTRL); |
| 451 | |
| 452 | writel(0x80006711, DSI_CAL_CTRL); |
| 453 | |
| 454 | writel(0x00010100, DSI_MISR_VIDEO_CTRL); |
| 455 | |
| 456 | writel(0x00010100, DSI_INT_CTRL); |
| 457 | writel(0x02010202, DSI_INT_CTRL); |
| 458 | |
| 459 | writel(0x02030303, DSI_INT_CTRL); |
| 460 | |
| 461 | writel(interleav << 30 | 0 << 24 | 0 << 20 | DLNx_EN << 4 |
| 462 | | 0x103, DSI_CTRL); |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 463 | mdelay(10); |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 464 | |
| 465 | return status; |
| 466 | } |
| 467 | |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 468 | int config_dsi_cmd_mode(unsigned short disp_width, unsigned short disp_height, |
| 469 | unsigned short img_width, unsigned short img_height, |
| 470 | unsigned short dst_format, |
| 471 | unsigned short traffic_mode, |
| 472 | unsigned short datalane_num) |
| 473 | { |
| 474 | unsigned char DST_FORMAT; |
| 475 | unsigned char TRAFIC_MODE; |
| 476 | unsigned char DLNx_EN; |
| 477 | // video mode data ctrl |
| 478 | int status = 0; |
Greg Grisco | d625055 | 2011-06-29 14:40:23 -0700 | [diff] [blame] | 479 | unsigned char interleav = 0; |
| 480 | unsigned char ystride = 0x03; |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 481 | // disable mdp first |
| 482 | |
| 483 | writel(0x00000000, DSI_CLK_CTRL); |
| 484 | writel(0x00000000, DSI_CLK_CTRL); |
| 485 | writel(0x00000000, DSI_CLK_CTRL); |
| 486 | writel(0x00000000, DSI_CLK_CTRL); |
| 487 | writel(0x00000002, DSI_CLK_CTRL); |
| 488 | writel(0x00000006, DSI_CLK_CTRL); |
| 489 | writel(0x0000000e, DSI_CLK_CTRL); |
| 490 | writel(0x0000001e, DSI_CLK_CTRL); |
| 491 | writel(0x0000003e, DSI_CLK_CTRL); |
| 492 | |
| 493 | writel(0x10000000, DSI_ERR_INT_MASK0); |
| 494 | |
| 495 | // writel(0, DSI_CTRL); |
| 496 | |
| 497 | // writel(0, DSI_ERR_INT_MASK0); |
| 498 | |
| 499 | DST_FORMAT = 8; // RGB888 |
Kinson Chik | e5c9343 | 2011-06-17 09:10:29 -0700 | [diff] [blame] | 500 | dprintf(SPEW, "DSI_Cmd_Mode - Dst Format: RGB888\n"); |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 501 | |
| 502 | DLNx_EN = 3; // 2 lane with clk programming |
Kinson Chik | e5c9343 | 2011-06-17 09:10:29 -0700 | [diff] [blame] | 503 | dprintf(SPEW, "Data Lane: 2 lane\n"); |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 504 | |
| 505 | TRAFIC_MODE = 0; // non burst mode with sync pulses |
Kinson Chik | e5c9343 | 2011-06-17 09:10:29 -0700 | [diff] [blame] | 506 | dprintf(SPEW, "Traffic mode: non burst mode with sync pulses\n"); |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 507 | |
| 508 | writel(0x02020202, DSI_INT_CTRL); |
| 509 | |
| 510 | writel(0x00100000 | DST_FORMAT, DSI_COMMAND_MODE_MDP_CTRL); |
| 511 | writel((img_width * ystride + 1) << 16 | 0x0039, |
| 512 | DSI_COMMAND_MODE_MDP_STREAM0_CTRL); |
| 513 | writel((img_width * ystride + 1) << 16 | 0x0039, |
| 514 | DSI_COMMAND_MODE_MDP_STREAM1_CTRL); |
| 515 | writel(img_height << 16 | img_width, DSI_COMMAND_MODE_MDP_STREAM0_TOTAL); |
| 516 | writel(img_height << 16 | img_width, DSI_COMMAND_MODE_MDP_STREAM1_TOTAL); |
| 517 | writel(0xEE, DSI_CAL_STRENGTH_CTRL); |
| 518 | writel(0x80000000, DSI_CAL_CTRL); |
| 519 | writel(0x40, DSI_TRIG_CTRL); |
| 520 | writel(0x13c2c, DSI_COMMAND_MODE_MDP_DCS_CMD_CTRL); |
| 521 | writel(interleav << 30 | 0 << 24 | 0 << 20 | DLNx_EN << 4 | 0x105, |
| 522 | DSI_CTRL); |
| 523 | mdelay(10); |
| 524 | writel(0x10000000, DSI_COMMAND_MODE_DMA_CTRL); |
| 525 | writel(0x10000000, DSI_MISR_CMD_CTRL); |
| 526 | writel(0x00000040, DSI_ERR_INT_MASK0); |
| 527 | writel(0x1, DSI_EOT_PACKET_CTRL); |
| 528 | // writel(0x0, MDP_OVERLAYPROC0_START); |
Kinson Chik | fe93103 | 2011-07-21 10:01:34 -0700 | [diff] [blame] | 529 | mdp_start_dma(); |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 530 | mdelay(10); |
| 531 | writel(0x1, DSI_CMD_MODE_MDP_SW_TRIGGER); |
| 532 | |
| 533 | status = 1; |
| 534 | return status; |
| 535 | } |
| 536 | |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 537 | int mipi_dsi_video_config(unsigned short num_of_lanes) |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 538 | { |
| 539 | |
| 540 | int status = 0; |
| 541 | unsigned long ReadValue; |
| 542 | unsigned long count = 0; |
| 543 | unsigned long low_pwr_stop_mode = 0; // low power mode 0x1111 start from |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 544 | // bit16, high spd mode 0x0 |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 545 | unsigned char eof_bllp_pwr = 0x9; // bit 12, 15, 1:low power stop mode or |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 546 | // let cmd mode eng send packets in hs |
| 547 | // or lp mode |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 548 | unsigned short display_wd = mipi_fb_cfg.width; |
| 549 | unsigned short display_ht = mipi_fb_cfg.height; |
| 550 | unsigned short image_wd = mipi_fb_cfg.width; |
| 551 | unsigned short image_ht = mipi_fb_cfg.height; |
| 552 | unsigned short hsync_porch_fp = MIPI_HSYNC_FRONT_PORCH_DCLK; |
| 553 | unsigned short hsync_porch_bp = MIPI_HSYNC_BACK_PORCH_DCLK; |
| 554 | unsigned short vsync_porch_fp = MIPI_VSYNC_FRONT_PORCH_LINES; |
| 555 | unsigned short vsync_porch_bp = MIPI_VSYNC_BACK_PORCH_LINES; |
| 556 | unsigned short hsync_width = MIPI_HSYNC_PULSE_WIDTH; |
| 557 | unsigned short vsync_width = MIPI_VSYNC_PULSE_WIDTH; |
| 558 | unsigned short dst_format = 0; |
| 559 | unsigned short traffic_mode = 0; |
Kinson Chik | e5c9343 | 2011-06-17 09:10:29 -0700 | [diff] [blame] | 560 | unsigned short pack_pattern = 0x12; //BGR |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 561 | unsigned char ystride = 3; |
| 562 | |
| 563 | low_pwr_stop_mode = 0x1111; // low pwr mode bit16:HSA, bit20:HBA, |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 564 | // bit24:HFP, bit28:PULSE MODE, need enough |
| 565 | // time for swithc from LP to HS |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 566 | eof_bllp_pwr = 0x9; // low power stop mode or let cmd mode eng send |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 567 | // packets in hs or lp mode |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 568 | |
Kinson Chik | e5c9343 | 2011-06-17 09:10:29 -0700 | [diff] [blame] | 569 | #if DISPLAY_MIPI_PANEL_TOSHIBA_MDT61 |
| 570 | pack_pattern = 0x21; //RGB |
| 571 | config_mdt61_dsi_video_mode(); |
| 572 | |
| 573 | /* Two functions make up mdp_setup_dma_p_video_mode with mdt61 panel functions*/ |
| 574 | mdp_setup_dma_p_video_config(pack_pattern, image_wd, image_ht, MIPI_FB_ADDR, image_wd, ystride); |
| 575 | mdp_setup_mdt61_video_dsi_config(); |
Aparna Mallavarapu | f712f5e | 2011-08-04 21:11:00 +0530 | [diff] [blame^] | 576 | #elif DISPLAY_MIPI_PANEL_RENESAS |
| 577 | pack_pattern = 0x21; //RGB |
| 578 | config_renesas_dsi_video_mode(); |
| 579 | |
| 580 | status += |
| 581 | mdp_setup_dma_p_video_mode(display_wd, display_ht, image_wd, image_ht, |
| 582 | hsync_porch_fp, hsync_porch_bp, |
| 583 | vsync_porch_fp, vsync_porch_bp, hsync_width, |
| 584 | vsync_width, MIPI_FB_ADDR, image_wd, |
| 585 | pack_pattern, ystride); |
Kinson Chik | e5c9343 | 2011-06-17 09:10:29 -0700 | [diff] [blame] | 586 | #else |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 587 | status += config_dsi_video_mode(display_wd, display_ht, image_wd, image_ht, |
| 588 | hsync_porch_fp, hsync_porch_bp, |
| 589 | vsync_porch_fp, vsync_porch_bp, hsync_width, |
| 590 | vsync_width, dst_format, traffic_mode, |
| 591 | num_of_lanes); |
| 592 | |
| 593 | status += |
| 594 | mdp_setup_dma_p_video_mode(display_wd, display_ht, image_wd, image_ht, |
| 595 | hsync_porch_fp, hsync_porch_bp, |
| 596 | vsync_porch_fp, vsync_porch_bp, hsync_width, |
| 597 | vsync_width, MIPI_FB_ADDR, image_wd, |
| 598 | pack_pattern, ystride); |
Kinson Chik | e5c9343 | 2011-06-17 09:10:29 -0700 | [diff] [blame] | 599 | #endif |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 600 | |
| 601 | ReadValue = readl(DSI_INT_CTRL) & 0x00010000; |
| 602 | while (ReadValue != 0x00010000) { |
| 603 | ReadValue = readl(DSI_INT_CTRL) & 0x00010000; |
| 604 | count++; |
| 605 | if (count > 0xffff) { |
| 606 | status = FAIL; |
Aparna Mallavarapu | f712f5e | 2011-08-04 21:11:00 +0530 | [diff] [blame^] | 607 | dprintf(CRITICAL, "Video lane test failed\n"); |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 608 | return status; |
| 609 | } |
| 610 | } |
| 611 | |
Aparna Mallavarapu | f712f5e | 2011-08-04 21:11:00 +0530 | [diff] [blame^] | 612 | dprintf(SPEW, "Video lane tested successfully\n"); |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 613 | return status; |
| 614 | } |
| 615 | |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 616 | int is_cmd_mode_enabled(void) |
| 617 | { |
| 618 | return cmd_mode_status; |
| 619 | } |
| 620 | |
Kinson Chik | e5c9343 | 2011-06-17 09:10:29 -0700 | [diff] [blame] | 621 | #if DISPLAY_MIPI_PANEL_NOVATEK_BLUE |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 622 | void mipi_dsi_cmd_mode_trigger(void) |
| 623 | { |
| 624 | int status = 0; |
| 625 | unsigned short display_wd = mipi_fb_cfg.width; |
| 626 | unsigned short display_ht = mipi_fb_cfg.height; |
| 627 | unsigned short image_wd = mipi_fb_cfg.width; |
| 628 | unsigned short image_ht = mipi_fb_cfg.height; |
| 629 | unsigned short dst_format = 0; |
| 630 | unsigned short traffic_mode = 0; |
| 631 | struct mipi_dsi_panel_config *panel_info = &novatek_panel_info; |
Kinson Chik | fe93103 | 2011-07-21 10:01:34 -0700 | [diff] [blame] | 632 | status += mipi_dsi_cmd_config(mipi_fb_cfg, panel_info->num_of_lanes); |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 633 | mdelay(50); |
| 634 | config_dsi_cmd_mode(display_wd, display_ht, image_wd, image_ht, |
| 635 | dst_format, traffic_mode, |
| 636 | panel_info->num_of_lanes /* num_of_lanes */ ); |
| 637 | } |
Kinson Chik | e5c9343 | 2011-06-17 09:10:29 -0700 | [diff] [blame] | 638 | #endif |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 639 | |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 640 | void mipi_dsi_shutdown(void) |
| 641 | { |
Kinson Chik | fe93103 | 2011-07-21 10:01:34 -0700 | [diff] [blame] | 642 | mdp_shutdown(); |
Ajay Dudani | 8fb3609 | 2011-01-27 18:09:50 -0800 | [diff] [blame] | 643 | writel(0x01010101, DSI_INT_CTRL); |
Chandan Uddaraju | c1df565 | 2011-03-03 21:15:51 -0800 | [diff] [blame] | 644 | writel(0x13FF3BFF, DSI_ERR_INT_MASK0); |
Kinson Chik | fe93103 | 2011-07-21 10:01:34 -0700 | [diff] [blame] | 645 | writel(0, DSIPHY_PLL_CTRL(0)); |
Ajay Dudani | 8fb3609 | 2011-01-27 18:09:50 -0800 | [diff] [blame] | 646 | writel(0, DSI_CLK_CTRL); |
| 647 | writel(0, DSI_CTRL); |
Kinson Chik | e5c9343 | 2011-06-17 09:10:29 -0700 | [diff] [blame] | 648 | #if DISPLAY_MIPI_PANEL_TOSHIBA_MDT61 |
Kinson Chik | fe93103 | 2011-07-21 10:01:34 -0700 | [diff] [blame] | 649 | writel(0x0, DSI_CC_REG); |
| 650 | writel(0x0, PIXEL_CC_REG); |
Aparna Mallavarapu | f712f5e | 2011-08-04 21:11:00 +0530 | [diff] [blame^] | 651 | #elif (!DISPLAY_MIPI_PANEL_RENESAS) |
Kinson Chik | fe93103 | 2011-07-21 10:01:34 -0700 | [diff] [blame] | 652 | secure_writel(0x0, DSI_CC_REG); |
| 653 | secure_writel(0x0, PIXEL_CC_REG); |
Kinson Chik | e5c9343 | 2011-06-17 09:10:29 -0700 | [diff] [blame] | 654 | #endif |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 655 | } |
| 656 | |
| 657 | struct fbcon_config *mipi_init(void) |
| 658 | { |
| 659 | int status = 0; |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 660 | struct mipi_dsi_panel_config *panel_info = get_panel_info(); |
Kinson Chik | e5c9343 | 2011-06-17 09:10:29 -0700 | [diff] [blame] | 661 | /* Enable MMSS_AHB_ARB_MATER_PORT_E for arbiter master0 and master 1 request */ |
Aparna Mallavarapu | f712f5e | 2011-08-04 21:11:00 +0530 | [diff] [blame^] | 662 | #if (!DISPLAY_MIPI_PANEL_RENESAS) |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 663 | writel(0x00001800, MMSS_SFPB_GPREG); |
Aparna Mallavarapu | f712f5e | 2011-08-04 21:11:00 +0530 | [diff] [blame^] | 664 | #endif |
Kinson Chik | e5c9343 | 2011-06-17 09:10:29 -0700 | [diff] [blame] | 665 | |
| 666 | #if DISPLAY_MIPI_PANEL_TOSHIBA_MDT61 |
| 667 | mipi_dsi_phy_init(panel_info); |
| 668 | #else |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 669 | mipi_dsi_phy_ctrl_config(panel_info); |
Kinson Chik | e5c9343 | 2011-06-17 09:10:29 -0700 | [diff] [blame] | 670 | #endif |
| 671 | |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 672 | status += mipi_dsi_panel_initialize(panel_info); |
Kinson Chik | e5c9343 | 2011-06-17 09:10:29 -0700 | [diff] [blame] | 673 | |
Shashank Mittal | cbd271d | 2011-01-14 15:18:33 -0800 | [diff] [blame] | 674 | #if DISPLAY_MIPI_PANEL_NOVATEK_BLUE |
| 675 | mipi_dsi_cmd_bta_sw_trigger(); |
| 676 | mipi_novatek_manufacture_id(); |
| 677 | #endif |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 678 | mipi_fb_cfg.base = MIPI_FB_ADDR; |
| 679 | |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 680 | if (panel_info->mode == MIPI_VIDEO_MODE) |
| 681 | status += mipi_dsi_video_config(panel_info->num_of_lanes); |
| 682 | |
| 683 | if (panel_info->mode == MIPI_CMD_MODE) |
| 684 | cmd_mode_status = 1; |
| 685 | |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 686 | return &mipi_fb_cfg; |
| 687 | } |