blob: 2e02edd3c1231ea6fc747306bfd43db1abba6b96 [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
46 /* Needed or else will have blank line at top of display */
47 uint8_t eof_bllp_pwr = 0x8;
48
49 uint8_t interleav = 0;
50 struct lcdc_panel_info *lcdc = NULL;
51 struct msm_panel_info *pinfo = (struct msm_panel_info *)pdata;
52
53 if (pinfo == NULL)
54 return ERR_INVALID_ARGS;
55
56 lcdc = &(pinfo->lcdc);
57 if (lcdc == NULL)
58 return ERR_INVALID_ARGS;
59
60 ret = mipi_dsi_video_mode_config((pinfo->xres + lcdc->xres_pad),
61 (pinfo->yres + lcdc->yres_pad),
62 (pinfo->xres),
63 (pinfo->yres),
64 (lcdc->h_front_porch),
65 (lcdc->h_back_porch + lcdc->h_pulse_width),
66 (lcdc->v_front_porch),
67 (lcdc->v_back_porch + lcdc->v_pulse_width),
68 (lcdc->h_pulse_width),
69 (lcdc->v_pulse_width),
70 pinfo->mipi.dst_format,
71 pinfo->mipi.traffic_mode,
72 lane_en,
73 low_pwr_stop_mode,
74 eof_bllp_pwr,
75 interleav);
76 return ret;
77}
78
79int mipi_toshiba_video_720p_on()
80{
81 int ret = NO_ERROR;
82 return ret;
83}
84
85int mipi_toshiba_video_720p_off()
86{
87 int ret = NO_ERROR;
88 return ret;
89}
90
91static struct mdss_dsi_phy_ctrl dsi_video_mode_phy_db = {
92 /* 720x1280, RGB888, 4 Lane 60 fps video mode */
93 /* regulator */
94 {0x03, 0x01, 0x01, 0x00, 0x20, 0x00, 0x01},
95 /* timing */
96 {0x69, 0x29, 0x1f, 0x00, 0x55, 0x55, 0x19, 0x2a,
97 0x2a, 0x03, 0x04, 0x00},
98 /* phy ctrl */
99 {0x5f, 0x00, 0x00, 0x10},
100 /* strength */
101 {0x77, 0x06},
102 /* bist control */
103 {0x00, 0x00, 0xb1, 0xff, 0x00, 0x00},
104 /* lanes config */
105 {0x00, 0xc2, 0x45, 0x00, 0x00, 0x00, 0x00, 0x01, 0x75,
106 0x00, 0xc2, 0x45, 0x00, 0x00, 0x00, 0x00, 0x01, 0x75,
107 0x00, 0xc2, 0x45, 0x00, 0x00, 0x00, 0x00, 0x01, 0x75,
108 0x00, 0xc2, 0x45, 0x00, 0x00, 0x00, 0x00, 0x01, 0x75,
109 0x00, 0x02, 0x45, 0x00, 0x00, 0x00, 0x00, 0x01, 0x97},
110};
111
112void mipi_toshiba_video_720p_init(struct msm_panel_info *pinfo)
113{
114 if (!pinfo)
115 return;
116
117 pinfo->xres = 720;
118 pinfo->yres = 1280;
119 /*
120 *
121 * Panel's Horizontal input timing requirement is to
122 * include dummy(pad) data of 200 clk in addition to
123 * width and porch/sync width values
124 */
125
126 pinfo->type = MIPI_VIDEO_PANEL;
127 pinfo->wait_cycle = 0;
128 pinfo->bpp = 24;
129 pinfo->lcdc.h_back_porch = 32;
130 pinfo->lcdc.h_front_porch = 144;
131 pinfo->lcdc.h_pulse_width = 12;
132 pinfo->lcdc.v_back_porch = 3;
133 pinfo->lcdc.v_front_porch = 9;
134 pinfo->lcdc.v_pulse_width = 4;
135 pinfo->lcdc.border_clr = 0; /* blk */
136 pinfo->lcdc.underflow_clr = 0xff; /* blue */
137 pinfo->lcdc.hsync_skew = 0;
138 pinfo->clk_rate = 424000000;
139
140 pinfo->mipi.mode = DSI_VIDEO_MODE;
141 pinfo->mipi.pulse_mode_hsa_he = FALSE;
142 pinfo->mipi.hfp_power_stop = FALSE;
143 pinfo->mipi.hbp_power_stop = FALSE;
144 pinfo->mipi.hsa_power_stop = FALSE;
145 pinfo->mipi.eof_bllp_power_stop = FALSE;
146 pinfo->mipi.bllp_power_stop = FALSE;
147 pinfo->mipi.traffic_mode = DSI_NON_BURST_SYNCH_EVENT;
148 pinfo->mipi.dst_format = DSI_VIDEO_DST_FORMAT_RGB888;
149 pinfo->mipi.vc = 0;
150 pinfo->mipi.rgb_swap = DSI_RGB_SWAP_RGB;
151 pinfo->mipi.data_lane0 = TRUE;
152 pinfo->mipi.data_lane1 = TRUE;
153 pinfo->mipi.data_lane2 = TRUE;
154 pinfo->mipi.data_lane3 = TRUE;
155 pinfo->mipi.t_clk_post = 0x04;
156 pinfo->mipi.t_clk_pre = 0x1b;
157 pinfo->mipi.stream = 0; /* dma_p */
158 pinfo->mipi.mdp_trigger = 0;
159 pinfo->mipi.dma_trigger = DSI_CMD_TRIGGER_SW;
160 pinfo->mipi.frame_rate = 60;
161 pinfo->mipi.mdss_dsi_phy_db = &dsi_video_mode_phy_db;
162 pinfo->mipi.tx_eot_append = TRUE;
163
164 pinfo->mipi.num_of_lanes = 4;
165 pinfo->mipi.panel_cmds = toshiba_mdv24_video_mode_cmds;
166 pinfo->mipi.num_of_panel_cmds =
167 ARRAY_SIZE(toshiba_mdv24_video_mode_cmds);
168
169 pinfo->on = mipi_toshiba_video_720p_on;
170 pinfo->off = mipi_toshiba_video_720p_off;
171 pinfo->config = mipi_toshiba_video_720p_config;
172
173 return;
174}