Padmanabhan Komanduru | bccbcdc | 2015-06-30 16:19:24 +0530 | [diff] [blame] | 1 | /* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved. |
Casey Piper | 98e94f1 | 2013-09-09 20:42:15 -0700 | [diff] [blame] | 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> |
vijay kumar | 32856d5 | 2014-08-06 16:18:03 +0530 | [diff] [blame] | 36 | #include <string.h> |
| 37 | #include <target/display.h> |
Casey Piper | 98e94f1 | 2013-09-09 20:42:15 -0700 | [diff] [blame] | 38 | |
| 39 | #include "include/panel.h" |
| 40 | #include "panel_display.h" |
| 41 | |
| 42 | /*---------------------------------------------------------------------------*/ |
| 43 | /* GCDB Panel Database */ |
| 44 | /*---------------------------------------------------------------------------*/ |
| 45 | #include "include/panel_toshiba_720p_video.h" |
| 46 | #include "include/panel_sharp_qhd_video.h" |
Casey Piper | ce3a4b1 | 2013-08-28 14:31:46 -0700 | [diff] [blame] | 47 | #include "include/panel_jdi_1080p_video.h" |
Casey Piper | 78a9ad5 | 2013-11-14 13:27:48 -0800 | [diff] [blame] | 48 | #include "include/panel_generic_720p_cmd.h" |
Kuogee Hsieh | 54b452b | 2013-12-18 14:58:41 -0800 | [diff] [blame] | 49 | #include "include/panel_jdi_qhd_dualdsi_video.h" |
| 50 | #include "include/panel_jdi_qhd_dualdsi_cmd.h" |
Casey Piper | 98e94f1 | 2013-09-09 20:42:15 -0700 | [diff] [blame] | 51 | |
Casey Piper | 78a9ad5 | 2013-11-14 13:27:48 -0800 | [diff] [blame] | 52 | #define DISPLAY_MAX_PANEL_DETECTION 3 |
Casey Piper | 74f8e5c | 2013-09-05 15:00:30 -0700 | [diff] [blame] | 53 | |
Casey Piper | 98e94f1 | 2013-09-09 20:42:15 -0700 | [diff] [blame] | 54 | /*---------------------------------------------------------------------------*/ |
| 55 | /* static panel selection variable */ |
| 56 | /*---------------------------------------------------------------------------*/ |
| 57 | enum { |
Casey Piper | 74f8e5c | 2013-09-05 15:00:30 -0700 | [diff] [blame] | 58 | JDI_1080P_VIDEO_PANEL, |
Casey Piper | 98e94f1 | 2013-09-09 20:42:15 -0700 | [diff] [blame] | 59 | TOSHIBA_720P_VIDEO_PANEL, |
Casey Piper | ce3a4b1 | 2013-08-28 14:31:46 -0700 | [diff] [blame] | 60 | SHARP_QHD_VIDEO_PANEL, |
Casey Piper | 78a9ad5 | 2013-11-14 13:27:48 -0800 | [diff] [blame] | 61 | GENERIC_720P_CMD_PANEL, |
Kuogee Hsieh | 54b452b | 2013-12-18 14:58:41 -0800 | [diff] [blame] | 62 | JDI_QHD_DUALDSI_VIDEO_PANEL, |
| 63 | JDI_QHD_DUALDSI_CMD_PANEL, |
Casey Piper | 74f8e5c | 2013-09-05 15:00:30 -0700 | [diff] [blame] | 64 | UNKNOWN_PANEL |
Casey Piper | 98e94f1 | 2013-09-09 20:42:15 -0700 | [diff] [blame] | 65 | }; |
| 66 | |
Dhaval Patel | 6181923 | 2014-05-23 12:32:39 -0700 | [diff] [blame] | 67 | /* |
| 68 | * The list of panels that are supported on this target. |
| 69 | * Any panel in this list can be selected using fastboot oem command. |
| 70 | */ |
| 71 | static struct panel_list supp_panels[] = { |
| 72 | {"jdi_1080p_video", JDI_1080P_VIDEO_PANEL}, |
| 73 | {"toshiba_720p_video", TOSHIBA_720P_VIDEO_PANEL}, |
| 74 | {"sharp_qhd_video", SHARP_QHD_VIDEO_PANEL}, |
| 75 | {"generic_720p_cmd", GENERIC_720P_CMD_PANEL}, |
| 76 | {"jdi_qhd_dualdsi_video", JDI_QHD_DUALDSI_VIDEO_PANEL}, |
| 77 | {"jdi_qhd_dualdsi_cmd", JDI_QHD_DUALDSI_CMD_PANEL}, |
| 78 | }; |
| 79 | |
Casey Piper | 98e94f1 | 2013-09-09 20:42:15 -0700 | [diff] [blame] | 80 | static uint32_t panel_id; |
| 81 | |
| 82 | int oem_panel_rotation() |
| 83 | { |
| 84 | /* OEM can keep there panel spefic on instructions in this |
| 85 | function */ |
| 86 | return NO_ERROR; |
| 87 | } |
| 88 | |
| 89 | |
| 90 | int oem_panel_on() |
| 91 | { |
| 92 | /* OEM can keep there panel spefic on instructions in this |
| 93 | function */ |
| 94 | return NO_ERROR; |
| 95 | } |
| 96 | |
| 97 | int oem_panel_off() |
| 98 | { |
| 99 | /* OEM can keep there panel spefic off instructions in this |
| 100 | function */ |
| 101 | return NO_ERROR; |
| 102 | } |
| 103 | |
Kuogee Hsieh | 80b8a6c | 2014-06-09 17:25:38 -0700 | [diff] [blame] | 104 | static int init_panel_data(struct panel_struct *panelstruct, |
Casey Piper | 98e94f1 | 2013-09-09 20:42:15 -0700 | [diff] [blame] | 105 | struct msm_panel_info *pinfo, |
| 106 | struct mdss_dsi_phy_ctrl *phy_db) |
| 107 | { |
Kuogee Hsieh | 80b8a6c | 2014-06-09 17:25:38 -0700 | [diff] [blame] | 108 | int pan_type = PANEL_TYPE_DSI; |
| 109 | |
Casey Piper | 98e94f1 | 2013-09-09 20:42:15 -0700 | [diff] [blame] | 110 | switch (panel_id) { |
| 111 | case TOSHIBA_720P_VIDEO_PANEL: |
| 112 | panelstruct->paneldata = &toshiba_720p_video_panel_data; |
| 113 | panelstruct->panelres = &toshiba_720p_video_panel_res; |
| 114 | panelstruct->color = &toshiba_720p_video_color; |
| 115 | panelstruct->videopanel = &toshiba_720p_video_video_panel; |
| 116 | panelstruct->commandpanel = &toshiba_720p_video_command_panel; |
| 117 | panelstruct->state = &toshiba_720p_video_state; |
| 118 | panelstruct->laneconfig = &toshiba_720p_video_lane_config; |
| 119 | panelstruct->paneltiminginfo |
| 120 | = &toshiba_720p_video_timing_info; |
| 121 | panelstruct->panelresetseq |
| 122 | = &toshiba_720p_video_panel_reset_seq; |
| 123 | panelstruct->backlightinfo = &toshiba_720p_video_backlight; |
Padmanabhan Komanduru | b3d3184 | 2014-11-04 15:47:53 +0530 | [diff] [blame] | 124 | pinfo->mipi.panel_on_cmds |
Casey Piper | 98e94f1 | 2013-09-09 20:42:15 -0700 | [diff] [blame] | 125 | = toshiba_720p_video_on_command; |
Padmanabhan Komanduru | b3d3184 | 2014-11-04 15:47:53 +0530 | [diff] [blame] | 126 | pinfo->mipi.num_of_panel_on_cmds |
Casey Piper | 98e94f1 | 2013-09-09 20:42:15 -0700 | [diff] [blame] | 127 | = TOSHIBA_720P_VIDEO_ON_COMMAND; |
Padmanabhan Komanduru | b3d3184 | 2014-11-04 15:47:53 +0530 | [diff] [blame] | 128 | pinfo->mipi.panel_off_cmds |
| 129 | = toshiba_720p_video_off_command; |
| 130 | pinfo->mipi.num_of_panel_off_cmds |
| 131 | = TOSHIBA_720P_VIDEO_OFF_COMMAND; |
Casey Piper | 98e94f1 | 2013-09-09 20:42:15 -0700 | [diff] [blame] | 132 | memcpy(phy_db->timing, |
| 133 | toshiba_720p_video_timings, TIMING_SIZE); |
Casey Piper | 74f8e5c | 2013-09-05 15:00:30 -0700 | [diff] [blame] | 134 | pinfo->mipi.signature = TOSHIBA_720P_VIDEO_SIGNATURE; |
Casey Piper | 98e94f1 | 2013-09-09 20:42:15 -0700 | [diff] [blame] | 135 | break; |
| 136 | case SHARP_QHD_VIDEO_PANEL: |
| 137 | panelstruct->paneldata = &sharp_qhd_video_panel_data; |
| 138 | panelstruct->panelres = &sharp_qhd_video_panel_res; |
| 139 | panelstruct->color = &sharp_qhd_video_color; |
| 140 | panelstruct->videopanel = &sharp_qhd_video_video_panel; |
| 141 | panelstruct->commandpanel = &sharp_qhd_video_command_panel; |
| 142 | panelstruct->state = &sharp_qhd_video_state; |
| 143 | panelstruct->laneconfig = &sharp_qhd_video_lane_config; |
| 144 | panelstruct->paneltiminginfo |
| 145 | = &sharp_qhd_video_timing_info; |
| 146 | panelstruct->panelresetseq |
| 147 | = &sharp_qhd_video_panel_reset_seq; |
| 148 | panelstruct->backlightinfo = &sharp_qhd_video_backlight; |
Padmanabhan Komanduru | b3d3184 | 2014-11-04 15:47:53 +0530 | [diff] [blame] | 149 | pinfo->mipi.panel_on_cmds |
Casey Piper | 98e94f1 | 2013-09-09 20:42:15 -0700 | [diff] [blame] | 150 | = sharp_qhd_video_on_command; |
Padmanabhan Komanduru | b3d3184 | 2014-11-04 15:47:53 +0530 | [diff] [blame] | 151 | pinfo->mipi.num_of_panel_on_cmds |
Casey Piper | 98e94f1 | 2013-09-09 20:42:15 -0700 | [diff] [blame] | 152 | = SHARP_QHD_VIDEO_ON_COMMAND; |
Padmanabhan Komanduru | b3d3184 | 2014-11-04 15:47:53 +0530 | [diff] [blame] | 153 | pinfo->mipi.panel_off_cmds |
| 154 | = sharp_qhd_video_off_command; |
| 155 | pinfo->mipi.num_of_panel_off_cmds |
| 156 | = SHARP_QHD_VIDEO_OFF_COMMAND; |
Casey Piper | 98e94f1 | 2013-09-09 20:42:15 -0700 | [diff] [blame] | 157 | memcpy(phy_db->timing, |
| 158 | sharp_qhd_video_timings, TIMING_SIZE); |
| 159 | break; |
Casey Piper | ce3a4b1 | 2013-08-28 14:31:46 -0700 | [diff] [blame] | 160 | case JDI_1080P_VIDEO_PANEL: |
| 161 | panelstruct->paneldata = &jdi_1080p_video_panel_data; |
| 162 | panelstruct->panelres = &jdi_1080p_video_panel_res; |
| 163 | panelstruct->color = &jdi_1080p_video_color; |
| 164 | panelstruct->videopanel = &jdi_1080p_video_video_panel; |
| 165 | panelstruct->commandpanel = &jdi_1080p_video_command_panel; |
| 166 | panelstruct->state = &jdi_1080p_video_state; |
| 167 | panelstruct->laneconfig = &jdi_1080p_video_lane_config; |
| 168 | panelstruct->paneltiminginfo |
| 169 | = &jdi_1080p_video_timing_info; |
| 170 | panelstruct->panelresetseq |
| 171 | = &jdi_1080p_video_panel_reset_seq; |
| 172 | panelstruct->backlightinfo = &jdi_1080p_video_backlight; |
Padmanabhan Komanduru | b3d3184 | 2014-11-04 15:47:53 +0530 | [diff] [blame] | 173 | pinfo->mipi.panel_on_cmds |
Casey Piper | ce3a4b1 | 2013-08-28 14:31:46 -0700 | [diff] [blame] | 174 | = jdi_1080p_video_on_command; |
Padmanabhan Komanduru | b3d3184 | 2014-11-04 15:47:53 +0530 | [diff] [blame] | 175 | pinfo->mipi.num_of_panel_on_cmds |
Casey Piper | ce3a4b1 | 2013-08-28 14:31:46 -0700 | [diff] [blame] | 176 | = JDI_1080P_VIDEO_ON_COMMAND; |
Padmanabhan Komanduru | b3d3184 | 2014-11-04 15:47:53 +0530 | [diff] [blame] | 177 | pinfo->mipi.panel_off_cmds |
| 178 | = jdi_1080p_video_off_command; |
| 179 | pinfo->mipi.num_of_panel_off_cmds |
| 180 | = JDI_1080P_VIDEO_OFF_COMMAND; |
Casey Piper | ce3a4b1 | 2013-08-28 14:31:46 -0700 | [diff] [blame] | 181 | memcpy(phy_db->timing, |
| 182 | jdi_1080p_video_timings, TIMING_SIZE); |
Casey Piper | 74f8e5c | 2013-09-05 15:00:30 -0700 | [diff] [blame] | 183 | pinfo->mipi.signature = JDI_1080P_VIDEO_SIGNATURE; |
| 184 | break; |
Casey Piper | 78a9ad5 | 2013-11-14 13:27:48 -0800 | [diff] [blame] | 185 | case GENERIC_720P_CMD_PANEL: |
| 186 | panelstruct->paneldata = &generic_720p_cmd_panel_data; |
| 187 | panelstruct->panelres = &generic_720p_cmd_panel_res; |
| 188 | panelstruct->color = &generic_720p_cmd_color; |
| 189 | panelstruct->videopanel = &generic_720p_cmd_video_panel; |
| 190 | panelstruct->commandpanel = &generic_720p_cmd_command_panel; |
| 191 | panelstruct->state = &generic_720p_cmd_state; |
| 192 | panelstruct->laneconfig = &generic_720p_cmd_lane_config; |
| 193 | panelstruct->paneltiminginfo |
| 194 | = &generic_720p_cmd_timing_info; |
| 195 | panelstruct->panelresetseq |
| 196 | = &generic_720p_cmd_reset_seq; |
| 197 | panelstruct->backlightinfo = &generic_720p_cmd_backlight; |
Padmanabhan Komanduru | b3d3184 | 2014-11-04 15:47:53 +0530 | [diff] [blame] | 198 | pinfo->mipi.panel_on_cmds |
Casey Piper | 78a9ad5 | 2013-11-14 13:27:48 -0800 | [diff] [blame] | 199 | = generic_720p_cmd_on_command; |
Padmanabhan Komanduru | b3d3184 | 2014-11-04 15:47:53 +0530 | [diff] [blame] | 200 | pinfo->mipi.num_of_panel_on_cmds |
Casey Piper | 78a9ad5 | 2013-11-14 13:27:48 -0800 | [diff] [blame] | 201 | = GENERIC_720P_CMD_ON_COMMAND; |
Padmanabhan Komanduru | b3d3184 | 2014-11-04 15:47:53 +0530 | [diff] [blame] | 202 | pinfo->mipi.panel_off_cmds |
| 203 | = generic_720p_cmd_off_command; |
| 204 | pinfo->mipi.num_of_panel_off_cmds |
| 205 | = GENERIC_720P_CMD_OFF_COMMAND; |
Casey Piper | 78a9ad5 | 2013-11-14 13:27:48 -0800 | [diff] [blame] | 206 | memcpy(phy_db->timing, |
| 207 | generic_720p_cmd_timings, TIMING_SIZE); |
| 208 | pinfo->mipi.signature = GENERIC_720P_CMD_SIGNATURE; |
| 209 | break; |
Kuogee Hsieh | 54b452b | 2013-12-18 14:58:41 -0800 | [diff] [blame] | 210 | case JDI_QHD_DUALDSI_VIDEO_PANEL: |
| 211 | panelstruct->paneldata = &jdi_qhd_dualdsi_video_panel_data; |
| 212 | panelstruct->panelres = &jdi_qhd_dualdsi_video_panel_res; |
| 213 | panelstruct->color = &jdi_qhd_dualdsi_video_color; |
| 214 | panelstruct->videopanel = &jdi_qhd_dualdsi_video_video_panel; |
| 215 | panelstruct->commandpanel = &jdi_qhd_dualdsi_video_command_panel; |
| 216 | panelstruct->state = &jdi_qhd_dualdsi_video_state; |
| 217 | panelstruct->laneconfig = &jdi_qhd_dualdsi_video_lane_config; |
| 218 | panelstruct->paneltiminginfo |
| 219 | = &jdi_qhd_dualdsi_video_timing_info; |
| 220 | panelstruct->panelresetseq |
| 221 | = &jdi_qhd_dualdsi_video_reset_seq; |
| 222 | panelstruct->backlightinfo = &jdi_qhd_dualdsi_video_backlight; |
Padmanabhan Komanduru | b3d3184 | 2014-11-04 15:47:53 +0530 | [diff] [blame] | 223 | pinfo->mipi.panel_on_cmds |
Kuogee Hsieh | 54b452b | 2013-12-18 14:58:41 -0800 | [diff] [blame] | 224 | = jdi_qhd_dualdsi_video_on_command; |
Padmanabhan Komanduru | b3d3184 | 2014-11-04 15:47:53 +0530 | [diff] [blame] | 225 | pinfo->mipi.num_of_panel_on_cmds |
Kuogee Hsieh | 54b452b | 2013-12-18 14:58:41 -0800 | [diff] [blame] | 226 | = JDI_QHD_DUALDSI_VIDEO_ON_COMMAND; |
Padmanabhan Komanduru | b3d3184 | 2014-11-04 15:47:53 +0530 | [diff] [blame] | 227 | pinfo->mipi.panel_off_cmds |
| 228 | = jdi_qhd_dualdsi_video_off_command; |
| 229 | pinfo->mipi.num_of_panel_off_cmds |
| 230 | = JDI_QHD_DUALDSI_VIDEO_OFF_COMMAND; |
Kuogee Hsieh | 54b452b | 2013-12-18 14:58:41 -0800 | [diff] [blame] | 231 | memcpy(phy_db->timing, |
| 232 | jdi_qhd_dualdsi_video_timings, TIMING_SIZE); |
| 233 | break; |
| 234 | case JDI_QHD_DUALDSI_CMD_PANEL: |
| 235 | panelstruct->paneldata = &jdi_qhd_dualdsi_cmd_panel_data; |
| 236 | panelstruct->panelres = &jdi_qhd_dualdsi_cmd_panel_res; |
| 237 | panelstruct->color = &jdi_qhd_dualdsi_cmd_color; |
| 238 | panelstruct->videopanel = &jdi_qhd_dualdsi_cmd_video_panel; |
| 239 | panelstruct->commandpanel = &jdi_qhd_dualdsi_cmd_command_panel; |
| 240 | panelstruct->state = &jdi_qhd_dualdsi_cmd_state; |
| 241 | panelstruct->laneconfig = &jdi_qhd_dualdsi_cmd_lane_config; |
| 242 | panelstruct->paneltiminginfo |
| 243 | = &jdi_qhd_dualdsi_cmd_timing_info; |
| 244 | panelstruct->panelresetseq |
| 245 | = &jdi_qhd_dualdsi_cmd_reset_seq; |
| 246 | panelstruct->backlightinfo = &jdi_qhd_dualdsi_cmd_backlight; |
Padmanabhan Komanduru | b3d3184 | 2014-11-04 15:47:53 +0530 | [diff] [blame] | 247 | pinfo->mipi.panel_on_cmds |
Kuogee Hsieh | 54b452b | 2013-12-18 14:58:41 -0800 | [diff] [blame] | 248 | = jdi_qhd_dualdsi_cmd_on_command; |
Padmanabhan Komanduru | b3d3184 | 2014-11-04 15:47:53 +0530 | [diff] [blame] | 249 | pinfo->mipi.num_of_panel_on_cmds |
Kuogee Hsieh | 54b452b | 2013-12-18 14:58:41 -0800 | [diff] [blame] | 250 | = JDI_QHD_DUALDSI_CMD_ON_COMMAND; |
Padmanabhan Komanduru | b3d3184 | 2014-11-04 15:47:53 +0530 | [diff] [blame] | 251 | pinfo->mipi.panel_off_cmds |
| 252 | = jdi_qhd_dualdsi_cmd_off_command; |
| 253 | pinfo->mipi.num_of_panel_off_cmds |
| 254 | = JDI_QHD_DUALDSI_CMD_OFF_COMMAND; |
Kuogee Hsieh | 54b452b | 2013-12-18 14:58:41 -0800 | [diff] [blame] | 255 | memcpy(phy_db->timing, |
| 256 | jdi_qhd_dualdsi_cmd_timings, TIMING_SIZE); |
| 257 | break; |
Casey Piper | 74f8e5c | 2013-09-05 15:00:30 -0700 | [diff] [blame] | 258 | case UNKNOWN_PANEL: |
| 259 | memset(panelstruct, 0, sizeof(struct panel_struct)); |
Padmanabhan Komanduru | b3d3184 | 2014-11-04 15:47:53 +0530 | [diff] [blame] | 260 | memset(pinfo->mipi.panel_on_cmds, 0, |
| 261 | sizeof(struct mipi_dsi_cmd)); |
| 262 | pinfo->mipi.num_of_panel_on_cmds = 0; |
| 263 | memset(pinfo->mipi.panel_off_cmds, 0, |
| 264 | sizeof(struct mipi_dsi_cmd)); |
| 265 | pinfo->mipi.num_of_panel_off_cmds = 0; |
Casey Piper | 74f8e5c | 2013-09-05 15:00:30 -0700 | [diff] [blame] | 266 | memset(phy_db->timing, 0, TIMING_SIZE); |
| 267 | pinfo->mipi.signature = 0; |
Kuogee Hsieh | 80b8a6c | 2014-06-09 17:25:38 -0700 | [diff] [blame] | 268 | pan_type = PANEL_TYPE_UNKNOWN; |
Casey Piper | ce3a4b1 | 2013-08-28 14:31:46 -0700 | [diff] [blame] | 269 | break; |
Casey Piper | 98e94f1 | 2013-09-09 20:42:15 -0700 | [diff] [blame] | 270 | } |
Kuogee Hsieh | 80b8a6c | 2014-06-09 17:25:38 -0700 | [diff] [blame] | 271 | |
| 272 | return pan_type; |
Casey Piper | 98e94f1 | 2013-09-09 20:42:15 -0700 | [diff] [blame] | 273 | } |
| 274 | |
Casey Piper | 74f8e5c | 2013-09-05 15:00:30 -0700 | [diff] [blame] | 275 | uint32_t oem_panel_max_auto_detect_panels() |
| 276 | { |
| 277 | return target_panel_auto_detect_enabled() ? |
| 278 | DISPLAY_MAX_PANEL_DETECTION : 0; |
| 279 | } |
| 280 | |
| 281 | static uint32_t auto_pan_loop = 0; |
| 282 | |
Kuogee Hsieh | 80b8a6c | 2014-06-09 17:25:38 -0700 | [diff] [blame] | 283 | int oem_panel_select(const char *panel_name, struct panel_struct *panelstruct, |
Casey Piper | 98e94f1 | 2013-09-09 20:42:15 -0700 | [diff] [blame] | 284 | struct msm_panel_info *pinfo, |
| 285 | struct mdss_dsi_phy_ctrl *phy_db) |
| 286 | { |
| 287 | uint32_t hw_id = board_hardware_id(); |
Dhaval Patel | 6181923 | 2014-05-23 12:32:39 -0700 | [diff] [blame] | 288 | int32_t panel_override_id; |
| 289 | |
| 290 | if (panel_name) { |
| 291 | panel_override_id = panel_name_to_id(supp_panels, |
| 292 | ARRAY_SIZE(supp_panels), panel_name); |
| 293 | |
| 294 | if (panel_override_id < 0) { |
| 295 | dprintf(CRITICAL, "Not able to search the panel:%s\n", |
Padmanabhan Komanduru | bccbcdc | 2015-06-30 16:19:24 +0530 | [diff] [blame] | 296 | panel_name); |
Dhaval Patel | 6181923 | 2014-05-23 12:32:39 -0700 | [diff] [blame] | 297 | } else if (panel_override_id < UNKNOWN_PANEL) { |
| 298 | /* panel override using fastboot oem command */ |
| 299 | panel_id = panel_override_id; |
| 300 | |
| 301 | dprintf(INFO, "OEM panel override:%s\n", |
Padmanabhan Komanduru | bccbcdc | 2015-06-30 16:19:24 +0530 | [diff] [blame] | 302 | panel_name); |
Dhaval Patel | 6181923 | 2014-05-23 12:32:39 -0700 | [diff] [blame] | 303 | goto panel_init; |
| 304 | } |
| 305 | } |
Casey Piper | 98e94f1 | 2013-09-09 20:42:15 -0700 | [diff] [blame] | 306 | |
| 307 | switch (hw_id) { |
| 308 | case HW_PLATFORM_MTP: |
| 309 | case HW_PLATFORM_FLUID: |
| 310 | case HW_PLATFORM_SURF: |
Casey Piper | 74f8e5c | 2013-09-05 15:00:30 -0700 | [diff] [blame] | 311 | switch (auto_pan_loop) { |
| 312 | case 0: |
| 313 | panel_id = JDI_1080P_VIDEO_PANEL; |
| 314 | break; |
| 315 | case 1: |
| 316 | panel_id = TOSHIBA_720P_VIDEO_PANEL; |
| 317 | break; |
Casey Piper | 78a9ad5 | 2013-11-14 13:27:48 -0800 | [diff] [blame] | 318 | case 2: |
| 319 | panel_id = GENERIC_720P_CMD_PANEL; |
| 320 | break; |
Casey Piper | 74f8e5c | 2013-09-05 15:00:30 -0700 | [diff] [blame] | 321 | default: |
| 322 | panel_id = UNKNOWN_PANEL; |
Casey Piper | 74f8e5c | 2013-09-05 15:00:30 -0700 | [diff] [blame] | 323 | break; |
| 324 | } |
| 325 | auto_pan_loop++; |
Casey Piper | 98e94f1 | 2013-09-09 20:42:15 -0700 | [diff] [blame] | 326 | break; |
| 327 | case HW_PLATFORM_DRAGON: |
| 328 | panel_id = SHARP_QHD_VIDEO_PANEL; |
| 329 | break; |
| 330 | default: |
| 331 | dprintf(CRITICAL, "Display not enabled for %d HW type\n" |
| 332 | , hw_id); |
Kuogee Hsieh | 80b8a6c | 2014-06-09 17:25:38 -0700 | [diff] [blame] | 333 | return PANEL_TYPE_UNKNOWN; |
Casey Piper | 98e94f1 | 2013-09-09 20:42:15 -0700 | [diff] [blame] | 334 | } |
| 335 | |
Dhaval Patel | 6181923 | 2014-05-23 12:32:39 -0700 | [diff] [blame] | 336 | panel_init: |
Kuogee Hsieh | 80b8a6c | 2014-06-09 17:25:38 -0700 | [diff] [blame] | 337 | return init_panel_data(panelstruct, pinfo, phy_db); |
Casey Piper | 98e94f1 | 2013-09-09 20:42:15 -0700 | [diff] [blame] | 338 | } |