blob: c66e8b2d38cbacd4098de075ffe51ef7ab4c025b [file] [log] [blame]
Siddhartha Agrawal6c3f6f32013-01-22 17:56:36 -08001/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
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 The Linux Foundation 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 <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 <mdp4.h>
37
38int mipi_toshiba_video_720p_config(void *pdata)
39{
40 int ret = NO_ERROR;
41
42 /* 3 Lanes -- Enables Data Lane0, 1, 2 */
43 uint8_t lane_en = 0xf;
44 uint64_t low_pwr_stop_mode = 0;
45
Chandan Uddarajuc1497f12013-04-23 14:24:40 -070046 /* Needed or else will have blank line at top of display
47 Enable LP during EOF to send DCS commands during blanking */
48 uint8_t eof_bllp_pwr = 0x9;
Siddhartha Agrawal6c3f6f32013-01-22 17:56:36 -080049
50 uint8_t 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_720p_on()
81{
82 int ret = NO_ERROR;
83 return ret;
84}
85
86int mipi_toshiba_video_720p_off()
87{
88 int ret = NO_ERROR;
89 return ret;
90}
91
92static struct mdss_dsi_phy_ctrl dsi_video_mode_phy_db = {
93 /* 720x1280, RGB888, 4 Lane 60 fps video mode */
94 /* regulator */
Chandan Uddarajuaef2f6a2013-03-13 14:47:44 -070095 {0x07, 0x09, 0x03, 0x00, 0x20, 0x00, 0x01},
Siddhartha Agrawal6c3f6f32013-01-22 17:56:36 -080096 /* timing */
Chandan Uddarajuaef2f6a2013-03-13 14:47:44 -070097 {0xb0, 0x23, 0x1b, 0x00, 0x94, 0x93, 0x1e, 0x25,
98 0x15, 0x03, 0x04, 0x00},
Siddhartha Agrawal6c3f6f32013-01-22 17:56:36 -080099 /* phy ctrl */
100 {0x5f, 0x00, 0x00, 0x10},
101 /* strength */
Chandan Uddarajuaef2f6a2013-03-13 14:47:44 -0700102 {0xff, 0x06},
Siddhartha Agrawal6c3f6f32013-01-22 17:56:36 -0800103 /* bist control */
104 {0x00, 0x00, 0xb1, 0xff, 0x00, 0x00},
105 /* lanes config */
Chandan Uddarajuaef2f6a2013-03-13 14:47:44 -0700106 {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x97,
107 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x01, 0x97,
108 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x01, 0x97,
109 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x01, 0x97,
110 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xbb},
Siddhartha Agrawal6c3f6f32013-01-22 17:56:36 -0800111};
112
113void mipi_toshiba_video_720p_init(struct msm_panel_info *pinfo)
114{
115 if (!pinfo)
116 return;
117
118 pinfo->xres = 720;
119 pinfo->yres = 1280;
120 /*
121 *
122 * Panel's Horizontal input timing requirement is to
123 * include dummy(pad) data of 200 clk in addition to
124 * width and porch/sync width values
125 */
126
127 pinfo->type = MIPI_VIDEO_PANEL;
128 pinfo->wait_cycle = 0;
129 pinfo->bpp = 24;
130 pinfo->lcdc.h_back_porch = 32;
131 pinfo->lcdc.h_front_porch = 144;
132 pinfo->lcdc.h_pulse_width = 12;
133 pinfo->lcdc.v_back_porch = 3;
134 pinfo->lcdc.v_front_porch = 9;
135 pinfo->lcdc.v_pulse_width = 4;
136 pinfo->lcdc.border_clr = 0; /* blk */
137 pinfo->lcdc.underflow_clr = 0xff; /* blue */
138 pinfo->lcdc.hsync_skew = 0;
139 pinfo->clk_rate = 424000000;
140
141 pinfo->mipi.mode = DSI_VIDEO_MODE;
142 pinfo->mipi.pulse_mode_hsa_he = FALSE;
143 pinfo->mipi.hfp_power_stop = FALSE;
144 pinfo->mipi.hbp_power_stop = FALSE;
145 pinfo->mipi.hsa_power_stop = FALSE;
146 pinfo->mipi.eof_bllp_power_stop = FALSE;
147 pinfo->mipi.bllp_power_stop = FALSE;
148 pinfo->mipi.traffic_mode = DSI_NON_BURST_SYNCH_EVENT;
149 pinfo->mipi.dst_format = DSI_VIDEO_DST_FORMAT_RGB888;
150 pinfo->mipi.vc = 0;
151 pinfo->mipi.rgb_swap = DSI_RGB_SWAP_RGB;
152 pinfo->mipi.data_lane0 = TRUE;
153 pinfo->mipi.data_lane1 = TRUE;
154 pinfo->mipi.data_lane2 = TRUE;
155 pinfo->mipi.data_lane3 = TRUE;
156 pinfo->mipi.t_clk_post = 0x04;
157 pinfo->mipi.t_clk_pre = 0x1b;
158 pinfo->mipi.stream = 0; /* dma_p */
159 pinfo->mipi.mdp_trigger = 0;
160 pinfo->mipi.dma_trigger = DSI_CMD_TRIGGER_SW;
161 pinfo->mipi.frame_rate = 60;
162 pinfo->mipi.mdss_dsi_phy_db = &dsi_video_mode_phy_db;
163 pinfo->mipi.tx_eot_append = TRUE;
164
165 pinfo->mipi.num_of_lanes = 4;
166 pinfo->mipi.panel_cmds = toshiba_mdv24_video_mode_cmds;
167 pinfo->mipi.num_of_panel_cmds =
168 ARRAY_SIZE(toshiba_mdv24_video_mode_cmds);
169
170 pinfo->on = mipi_toshiba_video_720p_on;
171 pinfo->off = mipi_toshiba_video_720p_off;
172 pinfo->config = mipi_toshiba_video_720p_config;
173
174 return;
175}