blob: 3fb985f70106357dffc40f0dc488776667b659de [file] [log] [blame]
Duy Truongf3ac7b32013-02-13 01:07:28 -08001/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
Shashank Mittal4bfb2e32012-04-16 10:56:27 -07002 *
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.
Duy Truongf3ac7b32013-02-13 01:07:28 -080012 * * Neither the name of The Linux Foundation nor the names of its
Shashank Mittal4bfb2e32012-04-16 10:56:27 -070013 * 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 <stdint.h>
31#include <msm_panel.h>
32#include <mipi_dsi.h>
33#include <sys/types.h>
34#include <err.h>
35#include <reg.h>
36#include <platform/iomap.h>
37#include <mdp4.h>
38
39int mipi_toshiba_video_wsvga_config(void *pdata)
40{
41 int ret = NO_ERROR;
42
43 /* 3 Lanes -- Enables Data Lane0, 1, 2 */
44 unsigned char lane_en = 7;
45 unsigned long low_pwr_stop_mode = 0;
46
47 /* Needed or else will have blank line at top of display */
48 unsigned char eof_bllp_pwr = 0x8;
49
50 unsigned char interleav = 0;
51 struct lcdc_panel_info *lcdc = NULL;
52 struct msm_panel_info *pinfo = (struct msm_panel_info *)pdata;
53
54 if (pinfo == NULL)
55 return ERR_INVALID_ARGS;
56
57 lcdc = &(pinfo->lcdc);
58 if (lcdc == NULL)
59 return ERR_INVALID_ARGS;
60
61 ret = mipi_dsi_video_mode_config((pinfo->xres + lcdc->xres_pad),
62 (pinfo->yres + lcdc->yres_pad),
63 (pinfo->xres),
64 (pinfo->yres),
65 (lcdc->h_front_porch),
66 (lcdc->h_back_porch + lcdc->h_pulse_width),
67 (lcdc->v_front_porch),
68 (lcdc->v_back_porch + lcdc->v_pulse_width),
69 (lcdc->h_pulse_width),
70 (lcdc->v_pulse_width),
71 pinfo->mipi.dst_format,
72 pinfo->mipi.traffic_mode,
73 lane_en,
74 low_pwr_stop_mode,
75 eof_bllp_pwr,
76 interleav);
77 return ret;
78}
79
80int mipi_toshiba_video_wsvga_on()
81{
82 int ret = NO_ERROR;
83 return ret;
84}
85
86int mipi_toshiba_video_wsvga_off()
87{
88 int ret = NO_ERROR;
89 return ret;
90}
91
92static struct mipi_dsi_phy_ctrl dsi_video_mode_phy_db = {
93 /* 600*1024, RGB888, 3 Lane 55 fps video mode */
94 /* regulator */
95 {0x03, 0x0a, 0x04, 0x00, 0x20},
96 /* timing */
97 {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c,
98 0x0c, 0x03, 0x04, 0xa0},
99 /* phy ctrl */
100 {0x5f, 0x00, 0x00, 0x10},
101 /* strength */
102 {0xff, 0x00, 0x06, 0x00},
103 /* pll control */
104 {0x0, 0x7f, 0x31, 0xda, 0x00, 0x50, 0x48, 0x63,
105 0x41, 0x0f, 0x01,
106 0x00, 0x14, 0x03, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01 },
107};
108
109void mipi_toshiba_video_wsvga_init(struct msm_panel_info *pinfo)
110{
111 if (!pinfo)
112 return;
113
114 pinfo->xres = 600;
115 pinfo->yres = 1024;
116 /*
117 *
118 * Panel's Horizontal input timing requirement is to
119 * include dummy(pad) data of 200 clk in addition to
120 * width and porch/sync width values
121 */
122 pinfo->lcdc.xres_pad = 200;
123 pinfo->lcdc.yres_pad = 0;
124
125 pinfo->type = MIPI_VIDEO_PANEL;
126 pinfo->wait_cycle = 0;
127 pinfo->bpp = 24;
128 pinfo->lcdc.h_back_porch = 16;
129 pinfo->lcdc.h_front_porch = 23;
130 pinfo->lcdc.h_pulse_width = 8;
131 pinfo->lcdc.v_back_porch = 2;
132 pinfo->lcdc.v_front_porch = 7;
133 pinfo->lcdc.v_pulse_width = 2;
134 pinfo->lcdc.border_clr = 0; /* blk */
135 pinfo->lcdc.underflow_clr = 0xff; /* blue */
136 pinfo->lcdc.hsync_skew = 0;
137 pinfo->clk_rate = 384000000;
138
139 pinfo->mipi.mode = DSI_VIDEO_MODE;
140 pinfo->mipi.pulse_mode_hsa_he = FALSE;
141 pinfo->mipi.hfp_power_stop = FALSE;
142 pinfo->mipi.hbp_power_stop = FALSE;
143 pinfo->mipi.hsa_power_stop = FALSE;
144 pinfo->mipi.eof_bllp_power_stop = FALSE;
145 pinfo->mipi.bllp_power_stop = FALSE;
146 pinfo->mipi.traffic_mode = DSI_NON_BURST_SYNCH_EVENT;
147 pinfo->mipi.dst_format = DSI_VIDEO_DST_FORMAT_RGB888;
148 pinfo->mipi.vc = 0;
149 pinfo->mipi.rgb_swap = DSI_RGB_SWAP_RGB;
150 pinfo->mipi.data_lane0 = TRUE;
151 pinfo->mipi.data_lane1 = TRUE;
152 pinfo->mipi.data_lane2 = TRUE;
153 pinfo->mipi.t_clk_post = 0x20;
154 pinfo->mipi.t_clk_pre = 0x2d;
155 pinfo->mipi.stream = 0; /* dma_p */
156 pinfo->mipi.mdp_trigger = 0;
157 pinfo->mipi.dma_trigger = DSI_CMD_TRIGGER_SW;
158 pinfo->mipi.frame_rate = 55;
159 pinfo->mipi.dsi_phy_db = &dsi_video_mode_phy_db;
160 pinfo->mipi.tx_eot_append = TRUE;
161
162 pinfo->mipi.num_of_lanes = 3;
163 pinfo->mipi.panel_cmds = toshiba_mdt61_video_mode_cmds;
164 pinfo->mipi.num_of_panel_cmds =
165 ARRAY_SIZE(toshiba_mdt61_video_mode_cmds);
166
167 pinfo->on = mipi_toshiba_video_wsvga_on;
168 pinfo->off = mipi_toshiba_video_wsvga_off;
169 pinfo->config = mipi_toshiba_video_wsvga_config;
170
171 return;
172}