blob: e1fad7c9f8297b1a06febc4f57637eba90a00230 [file] [log] [blame]
Dhaval Patel8ae0bbd2013-08-15 15:45:01 -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_truly_wvga_cmd.h"
44#include "include/panel_truly_wvga_video.h"
shuoybca66752013-09-03 18:17:21 +080045#include "include/panel_hx8379a_wvga_video.h"
shuoye8ba46c2013-10-22 09:38:06 +080046#include "include/panel_hx8389b_qhd_video.h"
shuoybca66752013-09-03 18:17:21 +080047#include "include/panel_otm8018b_fwvga_video.h"
48#include "include/panel_nt35590_720p_video.h"
Dhaval Patel8ae0bbd2013-08-15 15:45:01 -070049
50/*---------------------------------------------------------------------------*/
51/* static panel selection variable */
52/*---------------------------------------------------------------------------*/
53enum {
54TRULY_WVGA_CMD_PANEL,
55TRULY_WVGA_VIDEO_PANEL,
shuoybca66752013-09-03 18:17:21 +080056HX8379A_WVGA_VIDEO_PANEL,
57OTM8018B_FWVGA_VIDEO_PANEL,
58NT35590_720P_VIDEO_PANEL,
shuoye8ba46c2013-10-22 09:38:06 +080059HX8389B_QHD_VIDEO_PANEL,
60};
61
62enum {
63QRD_DEF,
64QRD_SKUAA,
65QRD_SKUAB = 3,
Dhaval Patel8ae0bbd2013-08-15 15:45:01 -070066};
67
68static uint32_t panel_id;
69
70int oem_panel_rotation()
71{
72 /* OEM can keep there panel spefic on instructions in this
73 function */
74 return NO_ERROR;
75}
76
77
78int oem_panel_on()
79{
80 /* OEM can keep there panel spefic on instructions in this
81 function */
82 return NO_ERROR;
83}
84
85int oem_panel_off()
86{
87 /* OEM can keep there panel spefic off instructions in this
88 function */
89 return NO_ERROR;
90}
91
92static bool init_panel_data(struct panel_struct *panelstruct,
93 struct msm_panel_info *pinfo,
94 struct mdss_dsi_phy_ctrl *phy_db)
95{
96 switch (panel_id) {
97 case TRULY_WVGA_CMD_PANEL:
98 panelstruct->paneldata = &truly_wvga_cmd_panel_data;
99 panelstruct->panelres = &truly_wvga_cmd_panel_res;
100 panelstruct->color = &truly_wvga_cmd_color;
101 panelstruct->videopanel = &truly_wvga_cmd_video_panel;
102 panelstruct->commandpanel = &truly_wvga_cmd_command_panel;
103 panelstruct->state = &truly_wvga_cmd_state;
104 panelstruct->laneconfig = &truly_wvga_cmd_lane_config;
105 panelstruct->paneltiminginfo
106 = &truly_wvga_cmd_timing_info;
shuoybca66752013-09-03 18:17:21 +0800107 panelstruct->panelresetseq
108 = &truly_wvga_cmd_reset_seq;
Dhaval Patel8ae0bbd2013-08-15 15:45:01 -0700109 panelstruct->backlightinfo = &truly_wvga_cmd_backlight;
110 pinfo->mipi.panel_cmds
111 = truly_wvga_cmd_on_command;
112 pinfo->mipi.num_of_panel_cmds
113 = TRULY_WVGA_CMD_ON_COMMAND;
114 memcpy(phy_db->timing,
115 truly_wvga_cmd_timings, TIMING_SIZE);
116 break;
117 case TRULY_WVGA_VIDEO_PANEL:
118 panelstruct->paneldata = &truly_wvga_video_panel_data;
119 panelstruct->panelres = &truly_wvga_video_panel_res;
120 panelstruct->color = &truly_wvga_video_color;
121 panelstruct->videopanel = &truly_wvga_video_video_panel;
122 panelstruct->commandpanel = &truly_wvga_video_command_panel;
123 panelstruct->state = &truly_wvga_video_state;
124 panelstruct->laneconfig = &truly_wvga_video_lane_config;
125 panelstruct->paneltiminginfo
126 = &truly_wvga_video_timing_info;
shuoybca66752013-09-03 18:17:21 +0800127 panelstruct->panelresetseq
128 = &truly_wvga_video_reset_seq;
Dhaval Patel8ae0bbd2013-08-15 15:45:01 -0700129 panelstruct->backlightinfo = &truly_wvga_video_backlight;
130 pinfo->mipi.panel_cmds
131 = truly_wvga_video_on_command;
132 pinfo->mipi.num_of_panel_cmds
133 = TRULY_WVGA_VIDEO_ON_COMMAND;
134 memcpy(phy_db->timing,
135 truly_wvga_video_timings, TIMING_SIZE);
136 break;
shuoybca66752013-09-03 18:17:21 +0800137 case HX8379A_WVGA_VIDEO_PANEL:
138 panelstruct->paneldata = &hx8379a_wvga_video_panel_data;
139 panelstruct->panelres = &hx8379a_wvga_video_panel_res;
140 panelstruct->color = &hx8379a_wvga_video_color;
141 panelstruct->videopanel = &hx8379a_wvga_video_video_panel;
142 panelstruct->commandpanel = &hx8379a_wvga_video_command_panel;
143 panelstruct->state = &hx8379a_wvga_video_state;
144 panelstruct->laneconfig = &hx8379a_wvga_video_lane_config;
145 panelstruct->paneltiminginfo
146 = &hx8379a_wvga_video_timing_info;
147 panelstruct->panelresetseq
148 = &hx8379a_wvga_video_reset_seq;
149 panelstruct->backlightinfo = &hx8379a_wvga_video_backlight;
150 pinfo->mipi.panel_cmds
151 = hx8379a_wvga_video_on_command;
152 pinfo->mipi.num_of_panel_cmds
153 = HX8379A_WVGA_VIDEO_ON_COMMAND;
154 memcpy(phy_db->timing,
155 hx8379a_wvga_video_timings, TIMING_SIZE);
156 break;
157 case OTM8018B_FWVGA_VIDEO_PANEL:
158 panelstruct->paneldata = &otm8018b_fwvga_video_panel_data;
159 panelstruct->panelres = &otm8018b_fwvga_video_panel_res;
160 panelstruct->color = &otm8018b_fwvga_video_color;
161 panelstruct->videopanel = &otm8018b_fwvga_video_video_panel;
162 panelstruct->commandpanel = &otm8018b_fwvga_video_command_panel;
163 panelstruct->state = &otm8018b_fwvga_video_state;
164 panelstruct->laneconfig = &otm8018b_fwvga_video_lane_config;
165 panelstruct->paneltiminginfo
166 = &otm8018b_fwvga_video_timing_info;
167 panelstruct->panelresetseq
168 = &otm8018b_fwvga_video_reset_seq;
169 panelstruct->backlightinfo = &otm8018b_fwvga_video_backlight;
170 pinfo->mipi.panel_cmds
171 = otm8018b_fwvga_video_on_command;
172 pinfo->mipi.num_of_panel_cmds
173 = OTM8018B_FWVGA_VIDEO_ON_COMMAND;
174 memcpy(phy_db->timing,
175 otm8018b_fwvga_video_timings, TIMING_SIZE);
176 break;
177 case NT35590_720P_VIDEO_PANEL:
178 panelstruct->paneldata = &nt35590_720p_video_panel_data;
179 panelstruct->panelres = &nt35590_720p_video_panel_res;
180 panelstruct->color = &nt35590_720p_video_color;
181 panelstruct->videopanel = &nt35590_720p_video_video_panel;
182 panelstruct->commandpanel = &nt35590_720p_video_command_panel;
183 panelstruct->state = &nt35590_720p_video_state;
184 panelstruct->laneconfig = &nt35590_720p_video_lane_config;
185 panelstruct->paneltiminginfo
186 = &nt35590_720p_video_timing_info;
187 panelstruct->panelresetseq
188 = &nt35590_720p_video_panel_reset_seq;
189 panelstruct->backlightinfo = &nt35590_720p_video_backlight;
190 pinfo->mipi.panel_cmds
191 = nt35590_720p_video_on_command;
192 pinfo->mipi.num_of_panel_cmds
193 = NT35590_720P_VIDEO_ON_COMMAND;
194 memcpy(phy_db->timing,
195 nt35590_720p_video_timings, TIMING_SIZE);
196 break;
shuoye8ba46c2013-10-22 09:38:06 +0800197 case HX8389B_QHD_VIDEO_PANEL:
198 panelstruct->paneldata = &hx8389b_qhd_video_panel_data;
199 panelstruct->panelres = &hx8389b_qhd_video_panel_res;
200 panelstruct->color = &hx8389b_qhd_video_color;
201 panelstruct->videopanel = &hx8389b_qhd_video_video_panel;
202 panelstruct->commandpanel = &hx8389b_qhd_video_command_panel;
203 panelstruct->state = &hx8389b_qhd_video_state;
204 panelstruct->laneconfig = &hx8389b_qhd_video_lane_config;
205 panelstruct->paneltiminginfo
206 = &hx8389b_qhd_video_timing_info;
207 panelstruct->panelresetseq
208 = &hx8389b_qhd_video_reset_seq;
209 panelstruct->backlightinfo = &hx8389b_qhd_video_backlight;
210 pinfo->mipi.panel_cmds
211 = hx8389b_qhd_video_on_command;
212 pinfo->mipi.num_of_panel_cmds
213 = HX8389B_QHD_VIDEO_ON_COMMAND;
214 memcpy(phy_db->timing,
215 hx8389b_qhd_video_timings, TIMING_SIZE);
216 break;
Dhaval Patel8ae0bbd2013-08-15 15:45:01 -0700217 default:
218 dprintf(CRITICAL, "Panel ID not detected %d\n", panel_id);
219 return false;
220 }
221 return true;
222}
223
Aravind Venkateswaran927e9102014-02-25 17:16:49 -0800224bool oem_panel_select(const char *panel_name, struct panel_struct *panelstruct,
Dhaval Patel8ae0bbd2013-08-15 15:45:01 -0700225 struct msm_panel_info *pinfo,
226 struct mdss_dsi_phy_ctrl *phy_db)
227{
228 uint32_t hw_id = board_hardware_id();
shuoybca66752013-09-03 18:17:21 +0800229 uint32_t platform_subtype = board_hardware_subtype();
shuoye8ba46c2013-10-22 09:38:06 +0800230 uint32_t target_id = board_target_id();
231
232 target_id = (target_id >> 16) & 0xFF;
Dhaval Patel8ae0bbd2013-08-15 15:45:01 -0700233
234 switch (hw_id) {
235 case HW_PLATFORM_QRD:
shuoye8ba46c2013-10-22 09:38:06 +0800236 switch (platform_subtype) {
237 case QRD_DEF:
238 case QRD_SKUAA:
239 panel_id = HX8379A_WVGA_VIDEO_PANEL;
240 break;
241 case QRD_SKUAB:
242 if (target_id == 0x1) // 1st HW version
243 panel_id = OTM8018B_FWVGA_VIDEO_PANEL;
244 else if (target_id == 0x2) //2nd HW version
245 panel_id = HX8389B_QHD_VIDEO_PANEL;
246 else
247 dprintf(CRITICAL, "SKUAB Display not enabled for %d type\n",
248 target_id);
249 break;
250 default:
251 dprintf(CRITICAL, "QRD Display not enabled for %d type\n",
252 platform_subtype);
253 return false;
254 }
shuoybca66752013-09-03 18:17:21 +0800255 break;
Dhaval Patel8ae0bbd2013-08-15 15:45:01 -0700256 case HW_PLATFORM_MTP:
shuoybca66752013-09-03 18:17:21 +0800257 if (0 == platform_subtype)
258 panel_id = TRULY_WVGA_VIDEO_PANEL;
259 else
260 panel_id = NT35590_720P_VIDEO_PANEL;
261 break;
262
Dhaval Patel8ae0bbd2013-08-15 15:45:01 -0700263 case HW_PLATFORM_SURF:
264 panel_id = TRULY_WVGA_VIDEO_PANEL;
265 break;
266 default:
267 dprintf(CRITICAL, "Display not enabled for %d HW type\n", hw_id);
268 return false;
269 }
270
271 return init_panel_data(panelstruct, pinfo, phy_db);
272}