blob: 3774bd4584497e5951926575c8c5677d9f683612 [file] [log] [blame]
Padmanabhan Komandurucd5645e2014-03-25 20:34:18 +05301/* Copyright (c) 2013-2014, 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_jdi_1080p_video.h"
44
45/*---------------------------------------------------------------------------*/
46/* static panel selection variable */
47/*---------------------------------------------------------------------------*/
48enum {
49JDI_1080P_VIDEO_PANEL,
50UNKNOWN_PANEL
51};
52
53/*
54 * The list of panels that are supported on this target.
55 * Any panel in this list can be selected using fastboot oem command.
56 */
57static struct panel_list supp_panels[] = {
58 {"jdi_1080p_video", JDI_1080P_VIDEO_PANEL},
59};
60
61static uint32_t panel_id;
62
63int oem_panel_rotation()
64{
65 return NO_ERROR;
66}
67
68int oem_panel_on()
69{
70 return NO_ERROR;
71}
72
73int oem_panel_off()
74{
75 /* OEM can keep their panel specific off instructions
76 * in this function
77 */
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->paneldata->panel_with_enable_gpio = 1;
91 panelstruct->panelres = &jdi_1080p_video_panel_res;
92 panelstruct->color = &jdi_1080p_video_color;
93 panelstruct->videopanel = &jdi_1080p_video_video_panel;
94 panelstruct->commandpanel = &jdi_1080p_video_command_panel;
95 panelstruct->state = &jdi_1080p_video_state;
96 panelstruct->laneconfig = &jdi_1080p_video_lane_config;
97 panelstruct->paneltiminginfo
98 = &jdi_1080p_video_timing_info;
99 panelstruct->panelresetseq
100 = &jdi_1080p_video_panel_reset_seq;
101 panelstruct->backlightinfo = &jdi_1080p_video_backlight;
102 pinfo->mipi.panel_cmds
103 = jdi_1080p_video_on_command;
104 pinfo->mipi.num_of_panel_cmds
105 = JDI_1080P_VIDEO_ON_COMMAND;
106 memcpy(phy_db->timing,
107 jdi_1080p_video_timings, TIMING_SIZE);
108 break;
109 default:
110 case UNKNOWN_PANEL:
111 memset(panelstruct, 0, sizeof(struct panel_struct));
112 memset(pinfo->mipi.panel_cmds, 0, sizeof(struct mipi_dsi_cmd));
113 pinfo->mipi.num_of_panel_cmds = 0;
114 memset(phy_db->timing, 0, TIMING_SIZE);
115 ret = false;
116 break;
117 }
118 return ret;
119}
120
121bool oem_panel_select(const char *panel_name, struct panel_struct *panelstruct,
122 struct msm_panel_info *pinfo,
123 struct mdss_dsi_phy_ctrl *phy_db)
124{
125 uint32_t hw_id = board_hardware_id();
126 int32_t panel_override_id;
127
128 if (panel_name) {
129 panel_override_id = panel_name_to_id(supp_panels,
130 ARRAY_SIZE(supp_panels), panel_name);
131
132 if (panel_override_id < 0) {
133 dprintf(CRITICAL, "Not able to search the panel:%s\n",
134 panel_name + strspn(panel_name, " "));
135 } else if (panel_override_id < UNKNOWN_PANEL) {
136 /* panel override using fastboot oem command */
137 panel_id = panel_override_id;
138
139 dprintf(INFO, "OEM panel override:%s\n",
140 panel_name + strspn(panel_name, " "));
141 goto panel_init;
142 }
143 }
144
145 switch (hw_id) {
146 case HW_PLATFORM_MTP:
147 case HW_PLATFORM_SURF:
148 panel_id = JDI_1080P_VIDEO_PANEL;
149 break;
150 default:
151 dprintf(CRITICAL, "Display not enabled for %d HW type\n",
152 hw_id);
153 return false;
154 }
155
156panel_init:
157 return init_panel_data(panelstruct, pinfo, phy_db);
158}