blob: 3ea115ea193775e366d95301dc99923fb0f6c925 [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"
45
46/*---------------------------------------------------------------------------*/
47/* static panel selection variable */
48/*---------------------------------------------------------------------------*/
49enum {
50TOSHIBA_720P_VIDEO_PANEL,
51SHARP_QHD_VIDEO_PANEL
52};
53
54static uint32_t panel_id;
55
56int oem_panel_rotation()
57{
58 /* OEM can keep there panel spefic on instructions in this
59 function */
60 return NO_ERROR;
61}
62
63
64int oem_panel_on()
65{
66 /* OEM can keep there panel spefic on instructions in this
67 function */
68 return NO_ERROR;
69}
70
71int oem_panel_off()
72{
73 /* OEM can keep there panel spefic off instructions in this
74 function */
75 return NO_ERROR;
76}
77
78static void init_panel_data(struct panel_struct *panelstruct,
79 struct msm_panel_info *pinfo,
80 struct mdss_dsi_phy_ctrl *phy_db)
81{
82 switch (panel_id) {
83 case TOSHIBA_720P_VIDEO_PANEL:
84 panelstruct->paneldata = &toshiba_720p_video_panel_data;
85 panelstruct->panelres = &toshiba_720p_video_panel_res;
86 panelstruct->color = &toshiba_720p_video_color;
87 panelstruct->videopanel = &toshiba_720p_video_video_panel;
88 panelstruct->commandpanel = &toshiba_720p_video_command_panel;
89 panelstruct->state = &toshiba_720p_video_state;
90 panelstruct->laneconfig = &toshiba_720p_video_lane_config;
91 panelstruct->paneltiminginfo
92 = &toshiba_720p_video_timing_info;
93 panelstruct->panelresetseq
94 = &toshiba_720p_video_panel_reset_seq;
95 panelstruct->backlightinfo = &toshiba_720p_video_backlight;
96 pinfo->mipi.panel_cmds
97 = toshiba_720p_video_on_command;
98 pinfo->mipi.num_of_panel_cmds
99 = TOSHIBA_720P_VIDEO_ON_COMMAND;
100 memcpy(phy_db->timing,
101 toshiba_720p_video_timings, TIMING_SIZE);
102 break;
103 case SHARP_QHD_VIDEO_PANEL:
104 panelstruct->paneldata = &sharp_qhd_video_panel_data;
105 panelstruct->panelres = &sharp_qhd_video_panel_res;
106 panelstruct->color = &sharp_qhd_video_color;
107 panelstruct->videopanel = &sharp_qhd_video_video_panel;
108 panelstruct->commandpanel = &sharp_qhd_video_command_panel;
109 panelstruct->state = &sharp_qhd_video_state;
110 panelstruct->laneconfig = &sharp_qhd_video_lane_config;
111 panelstruct->paneltiminginfo
112 = &sharp_qhd_video_timing_info;
113 panelstruct->panelresetseq
114 = &sharp_qhd_video_panel_reset_seq;
115 panelstruct->backlightinfo = &sharp_qhd_video_backlight;
116 pinfo->mipi.panel_cmds
117 = sharp_qhd_video_on_command;
118 pinfo->mipi.num_of_panel_cmds
119 = SHARP_QHD_VIDEO_ON_COMMAND;
120 memcpy(phy_db->timing,
121 sharp_qhd_video_timings, TIMING_SIZE);
122 break;
123 }
124}
125
126bool oem_panel_select(struct panel_struct *panelstruct,
127 struct msm_panel_info *pinfo,
128 struct mdss_dsi_phy_ctrl *phy_db)
129{
130 uint32_t hw_id = board_hardware_id();
131 uint32_t target_id = board_target_id();
132
133 switch (hw_id) {
134 case HW_PLATFORM_MTP:
135 case HW_PLATFORM_FLUID:
136 case HW_PLATFORM_SURF:
137 panel_id = TOSHIBA_720P_VIDEO_PANEL;
138 break;
139 case HW_PLATFORM_DRAGON:
140 panel_id = SHARP_QHD_VIDEO_PANEL;
141 break;
142 default:
143 dprintf(CRITICAL, "Display not enabled for %d HW type\n"
144 , hw_id);
145 return false;
146 }
147
148 init_panel_data(panelstruct, pinfo, phy_db);
149
150 return true;
151}