blob: 56f30690db6276856734ed0773d8358a6f77557e [file] [log] [blame]
Casey Piper98e94f12013-09-09 20:42:15 -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_sharp_qhd_video.h"
Casey Piperce3a4b12013-08-28 14:31:46 -070045#include "include/panel_jdi_1080p_video.h"
Casey Piper98e94f12013-09-09 20:42:15 -070046
47/*---------------------------------------------------------------------------*/
48/* static panel selection variable */
49/*---------------------------------------------------------------------------*/
50enum {
51TOSHIBA_720P_VIDEO_PANEL,
Casey Piperce3a4b12013-08-28 14:31:46 -070052SHARP_QHD_VIDEO_PANEL,
53JDI_1080P_VIDEO_PANEL
Casey Piper98e94f12013-09-09 20:42:15 -070054};
55
56static uint32_t panel_id;
57
58int oem_panel_rotation()
59{
60 /* OEM can keep there panel spefic on instructions in this
61 function */
62 return NO_ERROR;
63}
64
65
66int oem_panel_on()
67{
68 /* OEM can keep there panel spefic on instructions in this
69 function */
70 return NO_ERROR;
71}
72
73int oem_panel_off()
74{
75 /* OEM can keep there panel spefic off instructions in this
76 function */
77 return NO_ERROR;
78}
79
80static void init_panel_data(struct panel_struct *panelstruct,
81 struct msm_panel_info *pinfo,
82 struct mdss_dsi_phy_ctrl *phy_db)
83{
84 switch (panel_id) {
85 case TOSHIBA_720P_VIDEO_PANEL:
86 panelstruct->paneldata = &toshiba_720p_video_panel_data;
87 panelstruct->panelres = &toshiba_720p_video_panel_res;
88 panelstruct->color = &toshiba_720p_video_color;
89 panelstruct->videopanel = &toshiba_720p_video_video_panel;
90 panelstruct->commandpanel = &toshiba_720p_video_command_panel;
91 panelstruct->state = &toshiba_720p_video_state;
92 panelstruct->laneconfig = &toshiba_720p_video_lane_config;
93 panelstruct->paneltiminginfo
94 = &toshiba_720p_video_timing_info;
95 panelstruct->panelresetseq
96 = &toshiba_720p_video_panel_reset_seq;
97 panelstruct->backlightinfo = &toshiba_720p_video_backlight;
98 pinfo->mipi.panel_cmds
99 = toshiba_720p_video_on_command;
100 pinfo->mipi.num_of_panel_cmds
101 = TOSHIBA_720P_VIDEO_ON_COMMAND;
102 memcpy(phy_db->timing,
103 toshiba_720p_video_timings, TIMING_SIZE);
104 break;
105 case SHARP_QHD_VIDEO_PANEL:
106 panelstruct->paneldata = &sharp_qhd_video_panel_data;
107 panelstruct->panelres = &sharp_qhd_video_panel_res;
108 panelstruct->color = &sharp_qhd_video_color;
109 panelstruct->videopanel = &sharp_qhd_video_video_panel;
110 panelstruct->commandpanel = &sharp_qhd_video_command_panel;
111 panelstruct->state = &sharp_qhd_video_state;
112 panelstruct->laneconfig = &sharp_qhd_video_lane_config;
113 panelstruct->paneltiminginfo
114 = &sharp_qhd_video_timing_info;
115 panelstruct->panelresetseq
116 = &sharp_qhd_video_panel_reset_seq;
117 panelstruct->backlightinfo = &sharp_qhd_video_backlight;
118 pinfo->mipi.panel_cmds
119 = sharp_qhd_video_on_command;
120 pinfo->mipi.num_of_panel_cmds
121 = SHARP_QHD_VIDEO_ON_COMMAND;
122 memcpy(phy_db->timing,
123 sharp_qhd_video_timings, TIMING_SIZE);
124 break;
Casey Piperce3a4b12013-08-28 14:31:46 -0700125 case JDI_1080P_VIDEO_PANEL:
126 panelstruct->paneldata = &jdi_1080p_video_panel_data;
127 panelstruct->panelres = &jdi_1080p_video_panel_res;
128 panelstruct->color = &jdi_1080p_video_color;
129 panelstruct->videopanel = &jdi_1080p_video_video_panel;
130 panelstruct->commandpanel = &jdi_1080p_video_command_panel;
131 panelstruct->state = &jdi_1080p_video_state;
132 panelstruct->laneconfig = &jdi_1080p_video_lane_config;
133 panelstruct->paneltiminginfo
134 = &jdi_1080p_video_timing_info;
135 panelstruct->panelresetseq
136 = &jdi_1080p_video_panel_reset_seq;
137 panelstruct->backlightinfo = &jdi_1080p_video_backlight;
138 pinfo->mipi.panel_cmds
139 = jdi_1080p_video_on_command;
140 pinfo->mipi.num_of_panel_cmds
141 = JDI_1080P_VIDEO_ON_COMMAND;
142 memcpy(phy_db->timing,
143 jdi_1080p_video_timings, TIMING_SIZE);
144 break;
Casey Piper98e94f12013-09-09 20:42:15 -0700145 }
146}
147
148bool oem_panel_select(struct panel_struct *panelstruct,
149 struct msm_panel_info *pinfo,
150 struct mdss_dsi_phy_ctrl *phy_db)
151{
152 uint32_t hw_id = board_hardware_id();
153 uint32_t target_id = board_target_id();
154
155 switch (hw_id) {
156 case HW_PLATFORM_MTP:
157 case HW_PLATFORM_FLUID:
158 case HW_PLATFORM_SURF:
159 panel_id = TOSHIBA_720P_VIDEO_PANEL;
160 break;
161 case HW_PLATFORM_DRAGON:
162 panel_id = SHARP_QHD_VIDEO_PANEL;
163 break;
164 default:
165 dprintf(CRITICAL, "Display not enabled for %d HW type\n"
166 , hw_id);
167 return false;
168 }
169
170 init_panel_data(panelstruct, pinfo, phy_db);
171
172 return true;
173}