blob: 12b5454711979b816dd5f0917298741d0cca9ca0 [file] [log] [blame]
Arpita Banerjee841fa062013-05-24 14:59:51 -07001/* Copyright (c) 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
5 * are 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 copyright
9 * notice, this list of conditions and the following disclaimer in
10 * the documentation and/or other materials provided with the
11 * 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
19 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
20 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
22 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
23 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <debug.h>
31#include <err.h>
32#include <smem.h>
33#include <msm_panel.h>
34#include <board.h>
35#include <mipi_dsi.h>
36
37#include "include/panel.h"
38#include "panel_display.h"
39
40/*---------------------------------------------------------------------------*/
41/* GCDB Panel Database */
42/*---------------------------------------------------------------------------*/
43#include "include/panel_toshiba_720p_video.h"
44#include "include/panel_nt35590_720p_video.h"
45#include "include/panel_nt35590_720p_cmd.h"
Ray Zhang70abc542013-07-08 15:48:19 +080046#include "include/panel_hx8394a_720p_video.h"
Arpita Banerjeef04ae4b2013-06-14 11:32:20 -070047#include "include/panel_nt35596_1080p_video.h"
Ray Zhang53b0dce2013-07-08 19:35:48 +080048#include "include/panel_nt35521_720p_video.h"
Arpita Banerjee841fa062013-05-24 14:59:51 -070049
50/*---------------------------------------------------------------------------*/
51/* static panel selection variable */
52/*---------------------------------------------------------------------------*/
53enum {
54TOSHIBA_720P_VIDEO_PANEL,
55NT35590_720P_CMD_PANEL,
Arpita Banerjeef04ae4b2013-06-14 11:32:20 -070056NT35590_720P_VIDEO_PANEL,
Ray Zhang70abc542013-07-08 15:48:19 +080057NT35596_1080P_VIDEO_PANEL,
Ray Zhang53b0dce2013-07-08 19:35:48 +080058HX8394A_720P_VIDEO_PANEL,
59NT35521_720P_VIDEO_PANEL
Arpita Banerjee841fa062013-05-24 14:59:51 -070060};
61
62static uint32_t panel_id;
63
64int oem_panel_rotation()
65{
66 int ret = NO_ERROR;
67 switch (panel_id) {
68 case TOSHIBA_720P_VIDEO_PANEL:
69 ret = mipi_dsi_cmds_tx(toshiba_720p_video_rotation,
70 TOSHIBA_720P_VIDEO_ROTATION);
71 break;
72 case NT35590_720P_CMD_PANEL:
73 ret = mipi_dsi_cmds_tx(nt35590_720p_cmd_rotation,
74 NT35590_720P_CMD_ROTATION);
75 break;
76 case NT35590_720P_VIDEO_PANEL:
77 ret = mipi_dsi_cmds_tx(nt35590_720p_video_rotation,
78 NT35590_720P_VIDEO_ROTATION);
79 break;
80 }
81
82 return ret;
83}
84
85
86int oem_panel_on()
87{
88 /* OEM can keep there panel spefic on instructions in this
89 function */
90 return NO_ERROR;
91}
92
93int oem_panel_off()
94{
95 /* OEM can keep there panel spefic off instructions in this
96 function */
97 return NO_ERROR;
98}
99
100static void init_panel_data(struct panel_struct *panelstruct,
101 struct msm_panel_info *pinfo,
102 struct mdss_dsi_phy_ctrl *phy_db)
103{
104 switch (panel_id) {
105 case TOSHIBA_720P_VIDEO_PANEL:
106 panelstruct->paneldata = &toshiba_720p_video_panel_data;
107 panelstruct->panelres = &toshiba_720p_video_panel_res;
108 panelstruct->color = &toshiba_720p_video_color;
109 panelstruct->videopanel = &toshiba_720p_video_video_panel;
110 panelstruct->commandpanel = &toshiba_720p_video_command_panel;
111 panelstruct->state = &toshiba_720p_video_state;
112 panelstruct->laneconfig = &toshiba_720p_video_lane_config;
113 panelstruct->paneltiminginfo
114 = &toshiba_720p_video_timing_info;
115 panelstruct->backlightinfo = &toshiba_720p_video_backlight;
116 pinfo->mipi.panel_cmds
117 = toshiba_720p_video_on_command;
118 pinfo->mipi.num_of_panel_cmds
119 = TOSHIBA_720P_VIDEO_ON_COMMAND;
120 memcpy(phy_db->timing,
121 toshiba_720p_video_timings, TIMING_SIZE);
122 break;
123 case NT35590_720P_VIDEO_PANEL:
124 panelstruct->paneldata = &nt35590_720p_video_panel_data;
125 panelstruct->panelres = &nt35590_720p_video_panel_res;
126 panelstruct->color = &nt35590_720p_video_color;
127 panelstruct->videopanel = &nt35590_720p_video_video_panel;
128 panelstruct->commandpanel = &nt35590_720p_video_command_panel;
129 panelstruct->state = &nt35590_720p_video_state;
130 panelstruct->laneconfig = &nt35590_720p_video_lane_config;
131 panelstruct->paneltiminginfo
132 = &nt35590_720p_video_timing_info;
133 panelstruct->backlightinfo = &nt35590_720p_video_backlight;
134 pinfo->mipi.panel_cmds
135 = nt35590_720p_video_on_command;
136 pinfo->mipi.num_of_panel_cmds
137 = NT35590_720P_VIDEO_ON_COMMAND;
138 memcpy(phy_db->timing,
139 nt35590_720p_video_timings, TIMING_SIZE);
140 break;
Ray Zhang53b0dce2013-07-08 19:35:48 +0800141 case NT35521_720P_VIDEO_PANEL:
142 panelstruct->paneldata = &nt35521_720p_video_panel_data;
143 panelstruct->panelres = &nt35521_720p_video_panel_res;
144 panelstruct->color = &nt35521_720p_video_color;
145 panelstruct->videopanel = &nt35521_720p_video_video_panel;
146 panelstruct->commandpanel = &nt35521_720p_video_command_panel;
147 panelstruct->state = &nt35521_720p_video_state;
148 panelstruct->laneconfig = &nt35521_720p_video_lane_config;
149 panelstruct->paneltiminginfo
150 = &nt35521_720p_video_timing_info;
151 panelstruct->backlightinfo = &nt35521_720p_video_backlight;
152 pinfo->mipi.panel_cmds
153 = nt35521_720p_video_on_command;
154 pinfo->mipi.num_of_panel_cmds
155 = NT35521_720P_VIDEO_ON_COMMAND;
156 memcpy(phy_db->timing,
157 nt35521_720p_video_timings, TIMING_SIZE);
158 break;
Ray Zhang70abc542013-07-08 15:48:19 +0800159 case HX8394A_720P_VIDEO_PANEL:
160 panelstruct->paneldata = &hx8394a_720p_video_panel_data;
161 panelstruct->panelres = &hx8394a_720p_video_panel_res;
162 panelstruct->color = &hx8394a_720p_video_color;
163 panelstruct->videopanel = &hx8394a_720p_video_video_panel;
164 panelstruct->commandpanel = &hx8394a_720p_video_command_panel;
165 panelstruct->state = &hx8394a_720p_video_state;
166 panelstruct->laneconfig = &hx8394a_720p_video_lane_config;
167 panelstruct->paneltiminginfo
168 = &hx8394a_720p_video_timing_info;
169 panelstruct->backlightinfo = &hx8394a_720p_video_backlight;
170 pinfo->mipi.panel_cmds
171 = hx8394a_720p_video_on_command;
172 pinfo->mipi.num_of_panel_cmds
173 = HX8394A_720P_VIDEO_ON_COMMAND;
174 memcpy(phy_db->timing,
175 hx8394a_720p_video_timings, TIMING_SIZE);
176 break;
177
Arpita Banerjee841fa062013-05-24 14:59:51 -0700178 case NT35590_720P_CMD_PANEL:
179 panelstruct->paneldata = &nt35590_720p_cmd_panel_data;
180 panelstruct->panelres = &nt35590_720p_cmd_panel_res;
181 panelstruct->color = &nt35590_720p_cmd_color;
182 panelstruct->videopanel = &nt35590_720p_cmd_video_panel;
183 panelstruct->commandpanel = &nt35590_720p_cmd_command_panel;
184 panelstruct->state = &nt35590_720p_cmd_state;
185 panelstruct->laneconfig = &nt35590_720p_cmd_lane_config;
186 panelstruct->paneltiminginfo = &nt35590_720p_cmd_timing_info;
187 panelstruct->backlightinfo = &nt35590_720p_cmd_backlight;
188 pinfo->mipi.panel_cmds
189 = nt35590_720p_cmd_on_command;
190 pinfo->mipi.num_of_panel_cmds
191 = NT35590_720P_CMD_ON_COMMAND;
192 memcpy(phy_db->timing,
193 nt35590_720p_cmd_timings, TIMING_SIZE);
194 break;
Arpita Banerjeef04ae4b2013-06-14 11:32:20 -0700195 case NT35596_1080P_VIDEO_PANEL:
196 panelstruct->paneldata = &nt35596_1080p_video_panel_data;
197 panelstruct->panelres = &nt35596_1080p_video_panel_res;
198 panelstruct->color = &nt35596_1080p_video_color;
199 panelstruct->videopanel = &nt35596_1080p_video_video_panel;
200 panelstruct->commandpanel = &nt35596_1080p_video_command_panel;
201 panelstruct->state = &nt35596_1080p_video_state;
202 panelstruct->laneconfig = &nt35596_1080p_video_lane_config;
203 panelstruct->paneltiminginfo
204 = &nt35596_1080p_video_timing_info;
205 panelstruct->backlightinfo
206 = &nt35596_1080p_video_backlight;
207 pinfo->mipi.panel_cmds
208 = nt35596_1080p_video_on_command;
209 pinfo->mipi.num_of_panel_cmds
210 = NT35596_1080P_VIDEO_ON_COMMAND;
211 memcpy(phy_db->timing,
212 nt35596_1080p_video_timings, TIMING_SIZE);
213 break;
Arpita Banerjee841fa062013-05-24 14:59:51 -0700214 }
215}
216
217bool oem_panel_select(struct panel_struct *panelstruct,
218 struct msm_panel_info *pinfo,
219 struct mdss_dsi_phy_ctrl *phy_db)
220{
221 uint32_t hw_id = board_hardware_id();
222 uint32_t platformid = board_platform_id();
Ray Zhang70abc542013-07-08 15:48:19 +0800223 uint32_t target_id = board_target_id();
Arpita Banerjee841fa062013-05-24 14:59:51 -0700224
225 switch (platformid) {
226 case MSM8974:
227 switch (hw_id) {
228 case HW_PLATFORM_FLUID:
229 case HW_PLATFORM_MTP:
230 case HW_PLATFORM_SURF:
231 panel_id = TOSHIBA_720P_VIDEO_PANEL;
232 break;
233 default:
234 dprintf(CRITICAL, "Display not enabled for %d HW type\n"
235 , hw_id);
236 return false;
237 }
238 break;
239 case MSM8226:
240 case MSM8626:
241 switch (hw_id) {
242 case HW_PLATFORM_QRD:
Ray Zhang53b0dce2013-07-08 19:35:48 +0800243 if (board_hardware_subtype() == 2) {
244 panel_id = NT35521_720P_VIDEO_PANEL;
245 } else {
246 if (((target_id >> 16) & 0xFF) == 0x1) //EVT
247 panel_id = NT35590_720P_VIDEO_PANEL;
248 else if (((target_id >> 16) & 0xFF) == 0x2) //DVT
249 panel_id = HX8394A_720P_VIDEO_PANEL;
250 else {
251 dprintf(CRITICAL, "Not supported device, target_id=%x\n"
252 , target_id);
253 return false;
254 }
Ray Zhang70abc542013-07-08 15:48:19 +0800255 }
256 break;
Arpita Banerjee841fa062013-05-24 14:59:51 -0700257 case HW_PLATFORM_MTP:
258 case HW_PLATFORM_SURF:
259 panel_id = NT35590_720P_VIDEO_PANEL;
260 break;
261 default:
262 dprintf(CRITICAL, "Display not enabled for %d HW type\n"
263 , hw_id);
264 return false;
265 }
266 break;
267 }
268
269 init_panel_data(panelstruct, pinfo, phy_db);
270
271 return true;
272}