blob: d099a98a31944dd1e0e05f4834edd4677d59c5af [file] [log] [blame]
Dhaval Patel25f686e2013-10-18 19:06:05 -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_jdi_1080p_video.h"
44
45/*---------------------------------------------------------------------------*/
46/* static panel selection variable */
47/*---------------------------------------------------------------------------*/
48enum {
49JDI_1080P_VIDEO_PANEL,
50UNKNOWN_PANEL
51};
52
53static uint32_t panel_id;
54
55int oem_panel_rotation()
56{
57 /* OEM can keep there panel spefic on instructions in this
58 function */
59 return NO_ERROR;
60}
61
62
63int oem_panel_on()
64{
65 /* OEM can keep there panel spefic on instructions in this
66 function */
67 return NO_ERROR;
68}
69
70int oem_panel_off()
71{
72 /* OEM can keep there panel spefic off instructions in this
73 function */
74 return NO_ERROR;
75}
76
77static bool init_panel_data(struct panel_struct *panelstruct,
78 struct msm_panel_info *pinfo,
79 struct mdss_dsi_phy_ctrl *phy_db)
80{
81 bool ret = true;
82
83 switch (panel_id) {
84 case JDI_1080P_VIDEO_PANEL:
85 panelstruct->paneldata = &jdi_1080p_video_panel_data;
86 panelstruct->panelres = &jdi_1080p_video_panel_res;
87 panelstruct->color = &jdi_1080p_video_color;
88 panelstruct->videopanel = &jdi_1080p_video_video_panel;
89 panelstruct->commandpanel = &jdi_1080p_video_command_panel;
90 panelstruct->state = &jdi_1080p_video_state;
91 panelstruct->laneconfig = &jdi_1080p_video_lane_config;
92 panelstruct->paneltiminginfo
93 = &jdi_1080p_video_timing_info;
94 panelstruct->panelresetseq
95 = &jdi_1080p_video_panel_reset_seq;
96 panelstruct->backlightinfo = &jdi_1080p_video_backlight;
97 pinfo->mipi.panel_cmds
98 = jdi_1080p_video_on_command;
99 pinfo->mipi.num_of_panel_cmds
100 = JDI_1080P_VIDEO_ON_COMMAND;
101 memcpy(phy_db->timing,
102 jdi_1080p_video_timings, TIMING_SIZE);
103 break;
104 default:
105 case UNKNOWN_PANEL:
106 ret = false;
107 break;
108 }
109 return ret;
110}
111
112bool oem_panel_select(struct panel_struct *panelstruct,
113 struct msm_panel_info *pinfo,
114 struct mdss_dsi_phy_ctrl *phy_db)
115{
116 uint32_t hw_id = board_hardware_id();
117 uint32_t target_id = board_target_id();
118 bool ret = true;
119
120 switch (hw_id) {
121 case HW_PLATFORM_MTP:
122 case HW_PLATFORM_FLUID:
123 case HW_PLATFORM_SURF:
124 panel_id = JDI_1080P_VIDEO_PANEL;
125 break;
126 default:
127 dprintf(CRITICAL, "Display not enabled for %d HW type\n"
128 , hw_id);
129 return false;
130 }
131
132 return init_panel_data(panelstruct, pinfo, phy_db);
133}