blob: 3b487c62ec2ac235249ca68c3683e739d493ceae [file] [log] [blame]
Dhaval Patel307026a2014-01-06 16:08:16 -08001/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
Dhaval Patel25f686e2013-10-18 19:06:05 -07002 *
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_jdi_1080p_video.h"
Dhaval Patel3577e0d2013-10-25 10:15:21 -070044#include "include/panel_jdi_qhd_dualdsi_video.h"
Dhaval Patel307026a2014-01-06 16:08:16 -080045#include "include/panel_jdi_qhd_dualdsi_cmd.h"
Dhaval Patel25f686e2013-10-18 19:06:05 -070046
47/*---------------------------------------------------------------------------*/
48/* static panel selection variable */
49/*---------------------------------------------------------------------------*/
50enum {
51JDI_1080P_VIDEO_PANEL,
Dhaval Patel3577e0d2013-10-25 10:15:21 -070052JDI_QHD_DUALDSI_VIDEO_PANEL,
Dhaval Patel307026a2014-01-06 16:08:16 -080053JDI_QHD_DUALDSI_CMD_PANEL,
Dhaval Patel25f686e2013-10-18 19:06:05 -070054UNKNOWN_PANEL
55};
56
57static uint32_t panel_id;
58
59int oem_panel_rotation()
60{
61 /* OEM can keep there panel spefic on instructions in this
62 function */
63 return NO_ERROR;
64}
65
66
67int oem_panel_on()
68{
69 /* OEM can keep there panel spefic on instructions in this
70 function */
71 return NO_ERROR;
72}
73
74int oem_panel_off()
75{
76 /* OEM can keep there panel spefic off instructions in this
77 function */
78 return NO_ERROR;
79}
80
81static bool init_panel_data(struct panel_struct *panelstruct,
82 struct msm_panel_info *pinfo,
83 struct mdss_dsi_phy_ctrl *phy_db)
84{
85 bool ret = true;
86
87 switch (panel_id) {
88 case JDI_1080P_VIDEO_PANEL:
89 panelstruct->paneldata = &jdi_1080p_video_panel_data;
90 panelstruct->panelres = &jdi_1080p_video_panel_res;
91 panelstruct->color = &jdi_1080p_video_color;
92 panelstruct->videopanel = &jdi_1080p_video_video_panel;
93 panelstruct->commandpanel = &jdi_1080p_video_command_panel;
94 panelstruct->state = &jdi_1080p_video_state;
95 panelstruct->laneconfig = &jdi_1080p_video_lane_config;
96 panelstruct->paneltiminginfo
97 = &jdi_1080p_video_timing_info;
98 panelstruct->panelresetseq
99 = &jdi_1080p_video_panel_reset_seq;
100 panelstruct->backlightinfo = &jdi_1080p_video_backlight;
101 pinfo->mipi.panel_cmds
102 = jdi_1080p_video_on_command;
103 pinfo->mipi.num_of_panel_cmds
104 = JDI_1080P_VIDEO_ON_COMMAND;
105 memcpy(phy_db->timing,
106 jdi_1080p_video_timings, TIMING_SIZE);
107 break;
Dhaval Patel3577e0d2013-10-25 10:15:21 -0700108 case JDI_QHD_DUALDSI_VIDEO_PANEL:
109 panelstruct->paneldata = &jdi_qhd_dualdsi_video_panel_data;
110 panelstruct->panelres = &jdi_qhd_dualdsi_video_panel_res;
111 panelstruct->color = &jdi_qhd_dualdsi_video_color;
112 panelstruct->videopanel = &jdi_qhd_dualdsi_video_video_panel;
113 panelstruct->commandpanel = &jdi_qhd_dualdsi_video_command_panel;
114 panelstruct->state = &jdi_qhd_dualdsi_video_state;
115 panelstruct->laneconfig = &jdi_qhd_dualdsi_video_lane_config;
116 panelstruct->paneltiminginfo
117 = &jdi_qhd_dualdsi_video_timing_info;
118 panelstruct->panelresetseq
119 = &jdi_qhd_dualdsi_video_reset_seq;
120 panelstruct->backlightinfo = &jdi_qhd_dualdsi_video_backlight;
121 pinfo->mipi.panel_cmds
122 = jdi_qhd_dualdsi_video_on_command;
123 pinfo->mipi.num_of_panel_cmds
124 = JDI_QHD_DUALDSI_VIDEO_ON_COMMAND;
125 memcpy(phy_db->timing,
126 jdi_qhd_dualdsi_video_timings, TIMING_SIZE);
127 break;
Dhaval Patel307026a2014-01-06 16:08:16 -0800128 case JDI_QHD_DUALDSI_CMD_PANEL:
129 panelstruct->paneldata = &jdi_qhd_dualdsi_cmd_panel_data;
130 panelstruct->panelres = &jdi_qhd_dualdsi_cmd_panel_res;
131 panelstruct->color = &jdi_qhd_dualdsi_cmd_color;
132 panelstruct->videopanel = &jdi_qhd_dualdsi_cmd_video_panel;
133 panelstruct->commandpanel = &jdi_qhd_dualdsi_cmd_command_panel;
134 panelstruct->state = &jdi_qhd_dualdsi_cmd_state;
135 panelstruct->laneconfig = &jdi_qhd_dualdsi_cmd_lane_config;
136 panelstruct->paneltiminginfo
137 = &jdi_qhd_dualdsi_cmd_timing_info;
138 panelstruct->panelresetseq
139 = &jdi_qhd_dualdsi_cmd_reset_seq;
140 panelstruct->backlightinfo = &jdi_qhd_dualdsi_cmd_backlight;
141 pinfo->mipi.panel_cmds
142 = jdi_qhd_dualdsi_cmd_on_command;
143 pinfo->mipi.num_of_panel_cmds
144 = JDI_QHD_DUALDSI_CMD_ON_COMMAND;
145 memcpy(phy_db->timing,
146 jdi_qhd_dualdsi_cmd_timings, TIMING_SIZE);
147 break;
Dhaval Patel25f686e2013-10-18 19:06:05 -0700148 default:
149 case UNKNOWN_PANEL:
150 ret = false;
151 break;
152 }
153 return ret;
154}
155
Aravind Venkateswaran927e9102014-02-25 17:16:49 -0800156bool oem_panel_select(const char *panel_name, struct panel_struct *panelstruct,
Dhaval Patel25f686e2013-10-18 19:06:05 -0700157 struct msm_panel_info *pinfo,
158 struct mdss_dsi_phy_ctrl *phy_db)
159{
160 uint32_t hw_id = board_hardware_id();
161 uint32_t target_id = board_target_id();
162 bool ret = true;
163
164 switch (hw_id) {
165 case HW_PLATFORM_MTP:
166 case HW_PLATFORM_FLUID:
167 case HW_PLATFORM_SURF:
168 panel_id = JDI_1080P_VIDEO_PANEL;
169 break;
Dhaval Patel3577e0d2013-10-25 10:15:21 -0700170 case HW_PLATFORM_LIQUID:
171 panel_id = JDI_QHD_DUALDSI_VIDEO_PANEL;
172 break;
Dhaval Patel25f686e2013-10-18 19:06:05 -0700173 default:
174 dprintf(CRITICAL, "Display not enabled for %d HW type\n"
175 , hw_id);
176 return false;
177 }
178
179 return init_panel_data(panelstruct, pinfo, phy_db);
180}