Aravind Venkateswaran | bece438 | 2014-01-23 11:43:02 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. |
Arpita Banerjee | 841fa06 | 2013-05-24 14:59:51 -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> |
| 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_nt35590_720p_video.h" |
| 45 | #include "include/panel_nt35590_720p_cmd.h" |
Ray Zhang | 70abc54 | 2013-07-08 15:48:19 +0800 | [diff] [blame] | 46 | #include "include/panel_hx8394a_720p_video.h" |
Arpita Banerjee | f04ae4b | 2013-06-14 11:32:20 -0700 | [diff] [blame] | 47 | #include "include/panel_nt35596_1080p_video.h" |
Ray Zhang | 53b0dce | 2013-07-08 19:35:48 +0800 | [diff] [blame] | 48 | #include "include/panel_nt35521_720p_video.h" |
Ray Zhang | be67855 | 2013-09-03 19:17:07 +0800 | [diff] [blame] | 49 | #include "include/panel_ssd2080m_720p_video.h" |
Aravind Venkateswaran | d039850 | 2013-11-04 16:46:46 -0800 | [diff] [blame] | 50 | #include "include/panel_jdi_1080p_video.h" |
Arpita Banerjee | 841fa06 | 2013-05-24 14:59:51 -0700 | [diff] [blame] | 51 | |
Pradeep Jilagam | cd51b52 | 2013-10-29 13:08:51 +0530 | [diff] [blame] | 52 | #define DISPLAY_MAX_PANEL_DETECTION 2 |
| 53 | |
Ray Zhang | 2ea2279 | 2013-12-04 16:21:50 +0800 | [diff] [blame] | 54 | #define SSD2080M_720P_VIDEO_PANEL_ON_DELAY 200 |
Aravind Venkateswaran | c5863e3 | 2014-02-12 12:31:44 -0800 | [diff] [blame] | 55 | #define MAX_PANEL_ID_LEN 64 |
Ray Zhang | 2ea2279 | 2013-12-04 16:21:50 +0800 | [diff] [blame] | 56 | |
Arpita Banerjee | 841fa06 | 2013-05-24 14:59:51 -0700 | [diff] [blame] | 57 | /*---------------------------------------------------------------------------*/ |
| 58 | /* static panel selection variable */ |
| 59 | /*---------------------------------------------------------------------------*/ |
| 60 | enum { |
| 61 | TOSHIBA_720P_VIDEO_PANEL, |
| 62 | NT35590_720P_CMD_PANEL, |
Arpita Banerjee | f04ae4b | 2013-06-14 11:32:20 -0700 | [diff] [blame] | 63 | NT35590_720P_VIDEO_PANEL, |
Ray Zhang | 70abc54 | 2013-07-08 15:48:19 +0800 | [diff] [blame] | 64 | NT35596_1080P_VIDEO_PANEL, |
Ray Zhang | 53b0dce | 2013-07-08 19:35:48 +0800 | [diff] [blame] | 65 | HX8394A_720P_VIDEO_PANEL, |
Ray Zhang | be67855 | 2013-09-03 19:17:07 +0800 | [diff] [blame] | 66 | NT35521_720P_VIDEO_PANEL, |
Aravind Venkateswaran | d039850 | 2013-11-04 16:46:46 -0800 | [diff] [blame] | 67 | SSD2080M_720P_VIDEO_PANEL, |
Pradeep Jilagam | cd51b52 | 2013-10-29 13:08:51 +0530 | [diff] [blame] | 68 | JDI_1080P_VIDEO_PANEL, |
| 69 | UNKNOWN_PANEL |
Aravind Venkateswaran | d039850 | 2013-11-04 16:46:46 -0800 | [diff] [blame] | 70 | }; |
| 71 | |
| 72 | enum target_subtype { |
| 73 | HW_PLATFORM_SUBTYPE_720P = 0, |
| 74 | HW_PLATFORM_SUBTYPE_SKUAA = 1, |
| 75 | HW_PLATFORM_SUBTYPE_SKUF = 2, |
| 76 | HW_PLATFORM_SUBTYPE_1080P = 2, |
| 77 | HW_PLATFORM_SUBTYPE_SKUAB = 3, |
Aravind Venkateswaran | bece438 | 2014-01-23 11:43:02 -0800 | [diff] [blame] | 78 | HW_PLATFORM_SUBTYPE_1080P_EXT_BUCK = 3, |
Aravind Venkateswaran | d039850 | 2013-11-04 16:46:46 -0800 | [diff] [blame] | 79 | HW_PLATFORM_SUBTYPE_SKUG = 5, |
Arpita Banerjee | 841fa06 | 2013-05-24 14:59:51 -0700 | [diff] [blame] | 80 | }; |
| 81 | |
Aravind Venkateswaran | c5863e3 | 2014-02-12 12:31:44 -0800 | [diff] [blame] | 82 | /* |
| 83 | * The list of panels that are supported on this target. |
| 84 | * Any panel in this list can be selected using fastboot oem command. |
| 85 | */ |
| 86 | static struct panel_list supp_panels[] = { |
| 87 | {"toshiba_720p_video", TOSHIBA_720P_VIDEO_PANEL}, |
| 88 | {"nt35590_720p_cmd", NT35590_720P_CMD_PANEL}, |
| 89 | {"nt35590_720p_video", NT35590_720P_VIDEO_PANEL}, |
| 90 | {"nt35596_1080p_video", NT35596_1080P_VIDEO_PANEL}, |
| 91 | {"hx8394a_720p_video", HX8394A_720P_VIDEO_PANEL}, |
| 92 | {"nt35521_720p_video", NT35521_720P_VIDEO_PANEL}, |
| 93 | {"ssd2080m_720p_video", SSD2080M_720P_VIDEO_PANEL}, |
| 94 | {"jdi_1080p_video", JDI_1080P_VIDEO_PANEL}, |
| 95 | }; |
| 96 | |
Arpita Banerjee | 841fa06 | 2013-05-24 14:59:51 -0700 | [diff] [blame] | 97 | static uint32_t panel_id; |
| 98 | |
| 99 | int oem_panel_rotation() |
| 100 | { |
| 101 | int ret = NO_ERROR; |
| 102 | switch (panel_id) { |
| 103 | case TOSHIBA_720P_VIDEO_PANEL: |
| 104 | ret = mipi_dsi_cmds_tx(toshiba_720p_video_rotation, |
| 105 | TOSHIBA_720P_VIDEO_ROTATION); |
| 106 | break; |
| 107 | case NT35590_720P_CMD_PANEL: |
| 108 | ret = mipi_dsi_cmds_tx(nt35590_720p_cmd_rotation, |
| 109 | NT35590_720P_CMD_ROTATION); |
| 110 | break; |
| 111 | case NT35590_720P_VIDEO_PANEL: |
| 112 | ret = mipi_dsi_cmds_tx(nt35590_720p_video_rotation, |
| 113 | NT35590_720P_VIDEO_ROTATION); |
| 114 | break; |
| 115 | } |
| 116 | |
| 117 | return ret; |
| 118 | } |
| 119 | |
Arpita Banerjee | 841fa06 | 2013-05-24 14:59:51 -0700 | [diff] [blame] | 120 | int oem_panel_on() |
| 121 | { |
| 122 | /* OEM can keep there panel spefic on instructions in this |
| 123 | function */ |
Ray Zhang | 2ea2279 | 2013-12-04 16:21:50 +0800 | [diff] [blame] | 124 | if (panel_id == SSD2080M_720P_VIDEO_PANEL) { |
| 125 | /* SSD2080M needs extra delay to avoid unexpected artifacts */ |
| 126 | mdelay(SSD2080M_720P_VIDEO_PANEL_ON_DELAY); |
| 127 | } |
Arpita Banerjee | 841fa06 | 2013-05-24 14:59:51 -0700 | [diff] [blame] | 128 | return NO_ERROR; |
| 129 | } |
| 130 | |
| 131 | int oem_panel_off() |
| 132 | { |
| 133 | /* OEM can keep there panel spefic off instructions in this |
| 134 | function */ |
| 135 | return NO_ERROR; |
| 136 | } |
| 137 | |
Jayant Shekhar | 24bbf69 | 2014-03-26 15:43:41 +0530 | [diff] [blame] | 138 | static void mdss_source_pipe_select(struct msm_panel_info *pinfo) |
| 139 | { |
| 140 | /* Use DMA pipe for splash logo on 8x26 */ |
| 141 | pinfo->use_dma_pipe = 1; |
| 142 | } |
| 143 | |
Arpita Banerjee | 841fa06 | 2013-05-24 14:59:51 -0700 | [diff] [blame] | 144 | static void init_panel_data(struct panel_struct *panelstruct, |
| 145 | struct msm_panel_info *pinfo, |
| 146 | struct mdss_dsi_phy_ctrl *phy_db) |
| 147 | { |
| 148 | switch (panel_id) { |
| 149 | case TOSHIBA_720P_VIDEO_PANEL: |
| 150 | panelstruct->paneldata = &toshiba_720p_video_panel_data; |
| 151 | panelstruct->panelres = &toshiba_720p_video_panel_res; |
| 152 | panelstruct->color = &toshiba_720p_video_color; |
| 153 | panelstruct->videopanel = &toshiba_720p_video_video_panel; |
| 154 | panelstruct->commandpanel = &toshiba_720p_video_command_panel; |
| 155 | panelstruct->state = &toshiba_720p_video_state; |
| 156 | panelstruct->laneconfig = &toshiba_720p_video_lane_config; |
| 157 | panelstruct->paneltiminginfo |
| 158 | = &toshiba_720p_video_timing_info; |
Casey Piper | 5197f93 | 2013-08-14 17:27:29 -0700 | [diff] [blame] | 159 | panelstruct->panelresetseq |
| 160 | = &toshiba_720p_video_panel_reset_seq; |
Arpita Banerjee | 841fa06 | 2013-05-24 14:59:51 -0700 | [diff] [blame] | 161 | panelstruct->backlightinfo = &toshiba_720p_video_backlight; |
| 162 | pinfo->mipi.panel_cmds |
| 163 | = toshiba_720p_video_on_command; |
| 164 | pinfo->mipi.num_of_panel_cmds |
| 165 | = TOSHIBA_720P_VIDEO_ON_COMMAND; |
| 166 | memcpy(phy_db->timing, |
| 167 | toshiba_720p_video_timings, TIMING_SIZE); |
| 168 | break; |
| 169 | case NT35590_720P_VIDEO_PANEL: |
| 170 | panelstruct->paneldata = &nt35590_720p_video_panel_data; |
| 171 | panelstruct->panelres = &nt35590_720p_video_panel_res; |
| 172 | panelstruct->color = &nt35590_720p_video_color; |
| 173 | panelstruct->videopanel = &nt35590_720p_video_video_panel; |
| 174 | panelstruct->commandpanel = &nt35590_720p_video_command_panel; |
| 175 | panelstruct->state = &nt35590_720p_video_state; |
| 176 | panelstruct->laneconfig = &nt35590_720p_video_lane_config; |
| 177 | panelstruct->paneltiminginfo |
| 178 | = &nt35590_720p_video_timing_info; |
Casey Piper | 5197f93 | 2013-08-14 17:27:29 -0700 | [diff] [blame] | 179 | panelstruct->panelresetseq |
| 180 | = &nt35590_720p_video_panel_reset_seq; |
Arpita Banerjee | 841fa06 | 2013-05-24 14:59:51 -0700 | [diff] [blame] | 181 | panelstruct->backlightinfo = &nt35590_720p_video_backlight; |
| 182 | pinfo->mipi.panel_cmds |
| 183 | = nt35590_720p_video_on_command; |
| 184 | pinfo->mipi.num_of_panel_cmds |
| 185 | = NT35590_720P_VIDEO_ON_COMMAND; |
| 186 | memcpy(phy_db->timing, |
| 187 | nt35590_720p_video_timings, TIMING_SIZE); |
| 188 | break; |
Ray Zhang | 53b0dce | 2013-07-08 19:35:48 +0800 | [diff] [blame] | 189 | case NT35521_720P_VIDEO_PANEL: |
| 190 | panelstruct->paneldata = &nt35521_720p_video_panel_data; |
| 191 | panelstruct->panelres = &nt35521_720p_video_panel_res; |
| 192 | panelstruct->color = &nt35521_720p_video_color; |
| 193 | panelstruct->videopanel = &nt35521_720p_video_video_panel; |
| 194 | panelstruct->commandpanel = &nt35521_720p_video_command_panel; |
| 195 | panelstruct->state = &nt35521_720p_video_state; |
| 196 | panelstruct->laneconfig = &nt35521_720p_video_lane_config; |
| 197 | panelstruct->paneltiminginfo |
| 198 | = &nt35521_720p_video_timing_info; |
Casey Piper | 5197f93 | 2013-08-14 17:27:29 -0700 | [diff] [blame] | 199 | panelstruct->panelresetseq |
| 200 | = &nt35521_720p_video_panel_reset_seq; |
Ray Zhang | 53b0dce | 2013-07-08 19:35:48 +0800 | [diff] [blame] | 201 | panelstruct->backlightinfo = &nt35521_720p_video_backlight; |
| 202 | pinfo->mipi.panel_cmds |
| 203 | = nt35521_720p_video_on_command; |
| 204 | pinfo->mipi.num_of_panel_cmds |
| 205 | = NT35521_720P_VIDEO_ON_COMMAND; |
| 206 | memcpy(phy_db->timing, |
| 207 | nt35521_720p_video_timings, TIMING_SIZE); |
| 208 | break; |
Ray Zhang | be67855 | 2013-09-03 19:17:07 +0800 | [diff] [blame] | 209 | case SSD2080M_720P_VIDEO_PANEL: |
| 210 | panelstruct->paneldata = &ssd2080m_720p_video_panel_data; |
| 211 | panelstruct->panelres = &ssd2080m_720p_video_panel_res; |
| 212 | panelstruct->color = &ssd2080m_720p_video_color; |
| 213 | panelstruct->videopanel = &ssd2080m_720p_video_video_panel; |
| 214 | panelstruct->commandpanel = &ssd2080m_720p_video_command_panel; |
| 215 | panelstruct->state = &ssd2080m_720p_video_state; |
| 216 | panelstruct->laneconfig = &ssd2080m_720p_video_lane_config; |
| 217 | panelstruct->paneltiminginfo |
| 218 | = &ssd2080m_720p_video_timing_info; |
| 219 | panelstruct->panelresetseq |
| 220 | = &ssd2080m_720p_video_panel_reset_seq; |
| 221 | panelstruct->backlightinfo = &ssd2080m_720p_video_backlight; |
| 222 | pinfo->mipi.panel_cmds |
| 223 | = ssd2080m_720p_video_on_command; |
| 224 | pinfo->mipi.num_of_panel_cmds |
| 225 | = SSD2080M_720P_VIDEO_ON_COMMAND; |
| 226 | memcpy(phy_db->timing, |
| 227 | ssd2080m_720p_video_timings, TIMING_SIZE); |
| 228 | break; |
Ray Zhang | 70abc54 | 2013-07-08 15:48:19 +0800 | [diff] [blame] | 229 | case HX8394A_720P_VIDEO_PANEL: |
| 230 | panelstruct->paneldata = &hx8394a_720p_video_panel_data; |
| 231 | panelstruct->panelres = &hx8394a_720p_video_panel_res; |
| 232 | panelstruct->color = &hx8394a_720p_video_color; |
| 233 | panelstruct->videopanel = &hx8394a_720p_video_video_panel; |
| 234 | panelstruct->commandpanel = &hx8394a_720p_video_command_panel; |
| 235 | panelstruct->state = &hx8394a_720p_video_state; |
| 236 | panelstruct->laneconfig = &hx8394a_720p_video_lane_config; |
| 237 | panelstruct->paneltiminginfo |
| 238 | = &hx8394a_720p_video_timing_info; |
Casey Piper | 5197f93 | 2013-08-14 17:27:29 -0700 | [diff] [blame] | 239 | panelstruct->panelresetseq |
| 240 | = &hx8394a_720p_video_panel_reset_seq; |
Ray Zhang | 70abc54 | 2013-07-08 15:48:19 +0800 | [diff] [blame] | 241 | panelstruct->backlightinfo = &hx8394a_720p_video_backlight; |
| 242 | pinfo->mipi.panel_cmds |
| 243 | = hx8394a_720p_video_on_command; |
| 244 | pinfo->mipi.num_of_panel_cmds |
| 245 | = HX8394A_720P_VIDEO_ON_COMMAND; |
| 246 | memcpy(phy_db->timing, |
| 247 | hx8394a_720p_video_timings, TIMING_SIZE); |
Pradeep Jilagam | cd51b52 | 2013-10-29 13:08:51 +0530 | [diff] [blame] | 248 | pinfo->mipi.signature = HX8394A_720P_VIDEO_SIGNATURE; |
Ray Zhang | 70abc54 | 2013-07-08 15:48:19 +0800 | [diff] [blame] | 249 | break; |
| 250 | |
Arpita Banerjee | 841fa06 | 2013-05-24 14:59:51 -0700 | [diff] [blame] | 251 | case NT35590_720P_CMD_PANEL: |
| 252 | panelstruct->paneldata = &nt35590_720p_cmd_panel_data; |
| 253 | panelstruct->panelres = &nt35590_720p_cmd_panel_res; |
| 254 | panelstruct->color = &nt35590_720p_cmd_color; |
| 255 | panelstruct->videopanel = &nt35590_720p_cmd_video_panel; |
| 256 | panelstruct->commandpanel = &nt35590_720p_cmd_command_panel; |
| 257 | panelstruct->state = &nt35590_720p_cmd_state; |
| 258 | panelstruct->laneconfig = &nt35590_720p_cmd_lane_config; |
| 259 | panelstruct->paneltiminginfo = &nt35590_720p_cmd_timing_info; |
Casey Piper | 5197f93 | 2013-08-14 17:27:29 -0700 | [diff] [blame] | 260 | panelstruct->panelresetseq |
| 261 | = &nt35590_720p_cmd_panel_reset_seq; |
Arpita Banerjee | 841fa06 | 2013-05-24 14:59:51 -0700 | [diff] [blame] | 262 | panelstruct->backlightinfo = &nt35590_720p_cmd_backlight; |
| 263 | pinfo->mipi.panel_cmds |
| 264 | = nt35590_720p_cmd_on_command; |
| 265 | pinfo->mipi.num_of_panel_cmds |
| 266 | = NT35590_720P_CMD_ON_COMMAND; |
| 267 | memcpy(phy_db->timing, |
| 268 | nt35590_720p_cmd_timings, TIMING_SIZE); |
| 269 | break; |
Arpita Banerjee | f04ae4b | 2013-06-14 11:32:20 -0700 | [diff] [blame] | 270 | case NT35596_1080P_VIDEO_PANEL: |
| 271 | panelstruct->paneldata = &nt35596_1080p_video_panel_data; |
| 272 | panelstruct->panelres = &nt35596_1080p_video_panel_res; |
| 273 | panelstruct->color = &nt35596_1080p_video_color; |
| 274 | panelstruct->videopanel = &nt35596_1080p_video_video_panel; |
| 275 | panelstruct->commandpanel = &nt35596_1080p_video_command_panel; |
| 276 | panelstruct->state = &nt35596_1080p_video_state; |
| 277 | panelstruct->laneconfig = &nt35596_1080p_video_lane_config; |
| 278 | panelstruct->paneltiminginfo |
| 279 | = &nt35596_1080p_video_timing_info; |
Casey Piper | 5197f93 | 2013-08-14 17:27:29 -0700 | [diff] [blame] | 280 | panelstruct->panelresetseq |
| 281 | = &nt35596_1080p_video_panel_reset_seq; |
Arpita Banerjee | f04ae4b | 2013-06-14 11:32:20 -0700 | [diff] [blame] | 282 | panelstruct->backlightinfo |
| 283 | = &nt35596_1080p_video_backlight; |
| 284 | pinfo->mipi.panel_cmds |
| 285 | = nt35596_1080p_video_on_command; |
| 286 | pinfo->mipi.num_of_panel_cmds |
| 287 | = NT35596_1080P_VIDEO_ON_COMMAND; |
| 288 | memcpy(phy_db->timing, |
| 289 | nt35596_1080p_video_timings, TIMING_SIZE); |
Pradeep Jilagam | cd51b52 | 2013-10-29 13:08:51 +0530 | [diff] [blame] | 290 | pinfo->mipi.signature = NT35596_1080P_VIDEO_SIGNATURE; |
Jayant Shekhar | 93b1780 | 2013-11-18 19:59:50 +0530 | [diff] [blame] | 291 | break; |
Aravind Venkateswaran | d039850 | 2013-11-04 16:46:46 -0800 | [diff] [blame] | 292 | case JDI_1080P_VIDEO_PANEL: |
| 293 | panelstruct->paneldata = &jdi_1080p_video_panel_data; |
| 294 | panelstruct->paneldata->panel_with_enable_gpio = 1; |
| 295 | panelstruct->panelres = &jdi_1080p_video_panel_res; |
| 296 | panelstruct->color = &jdi_1080p_video_color; |
| 297 | panelstruct->videopanel = &jdi_1080p_video_video_panel; |
| 298 | panelstruct->commandpanel = &jdi_1080p_video_command_panel; |
| 299 | panelstruct->state = &jdi_1080p_video_state; |
| 300 | panelstruct->laneconfig = &jdi_1080p_video_lane_config; |
| 301 | panelstruct->paneltiminginfo |
| 302 | = &jdi_1080p_video_timing_info; |
| 303 | panelstruct->panelresetseq |
| 304 | = &jdi_1080p_video_panel_reset_seq; |
| 305 | panelstruct->backlightinfo = &jdi_1080p_video_backlight; |
| 306 | pinfo->mipi.panel_cmds |
| 307 | = jdi_1080p_video_on_command; |
| 308 | pinfo->mipi.num_of_panel_cmds |
| 309 | = JDI_1080P_VIDEO_ON_COMMAND; |
| 310 | memcpy(phy_db->timing, |
| 311 | jdi_1080p_video_timings, TIMING_SIZE); |
Arpita Banerjee | f04ae4b | 2013-06-14 11:32:20 -0700 | [diff] [blame] | 312 | break; |
Pradeep Jilagam | cd51b52 | 2013-10-29 13:08:51 +0530 | [diff] [blame] | 313 | case UNKNOWN_PANEL: |
| 314 | memset(panelstruct, 0, sizeof(struct panel_struct)); |
| 315 | memset(pinfo->mipi.panel_cmds, 0, sizeof(struct mipi_dsi_cmd)); |
| 316 | pinfo->mipi.num_of_panel_cmds = 0; |
| 317 | memset(phy_db->timing, 0, TIMING_SIZE); |
| 318 | pinfo->mipi.signature = 0; |
| 319 | break; |
Arpita Banerjee | 841fa06 | 2013-05-24 14:59:51 -0700 | [diff] [blame] | 320 | } |
| 321 | } |
| 322 | |
Pradeep Jilagam | cd51b52 | 2013-10-29 13:08:51 +0530 | [diff] [blame] | 323 | uint32_t oem_panel_max_auto_detect_panels() |
| 324 | { |
| 325 | return target_panel_auto_detect_enabled() ? |
| 326 | DISPLAY_MAX_PANEL_DETECTION : 0; |
| 327 | } |
| 328 | |
| 329 | static uint32_t auto_pan_loop = 0; |
| 330 | |
Aravind Venkateswaran | 927e910 | 2014-02-25 17:16:49 -0800 | [diff] [blame] | 331 | bool oem_panel_select(const char *panel_name, struct panel_struct *panelstruct, |
Arpita Banerjee | 841fa06 | 2013-05-24 14:59:51 -0700 | [diff] [blame] | 332 | struct msm_panel_info *pinfo, |
| 333 | struct mdss_dsi_phy_ctrl *phy_db) |
| 334 | { |
| 335 | uint32_t hw_id = board_hardware_id(); |
Ray Zhang | 70abc54 | 2013-07-08 15:48:19 +0800 | [diff] [blame] | 336 | uint32_t target_id = board_target_id(); |
Aravind Venkateswaran | 9ae369b | 2013-07-23 22:57:47 -0700 | [diff] [blame] | 337 | uint32_t nt35590_panel_id = NT35590_720P_VIDEO_PANEL; |
Aravind Venkateswaran | d039850 | 2013-11-04 16:46:46 -0800 | [diff] [blame] | 338 | uint32_t hw_subtype = board_hardware_subtype(); |
Pradeep Jilagam | cd51b52 | 2013-10-29 13:08:51 +0530 | [diff] [blame] | 339 | bool ret = true; |
Dhaval Patel | 11cd830 | 2014-02-18 17:10:16 -0800 | [diff] [blame] | 340 | int32_t panel_override_id; |
Aravind Venkateswaran | 9ae369b | 2013-07-23 22:57:47 -0700 | [diff] [blame] | 341 | |
Aravind Venkateswaran | c5863e3 | 2014-02-12 12:31:44 -0800 | [diff] [blame] | 342 | if (panel_name) { |
Dhaval Patel | 11cd830 | 2014-02-18 17:10:16 -0800 | [diff] [blame] | 343 | panel_override_id = panel_name_to_id(supp_panels, |
| 344 | ARRAY_SIZE(supp_panels), panel_name); |
Aravind Venkateswaran | c5863e3 | 2014-02-12 12:31:44 -0800 | [diff] [blame] | 345 | |
Dhaval Patel | 11cd830 | 2014-02-18 17:10:16 -0800 | [diff] [blame] | 346 | if (panel_override_id < 0) { |
| 347 | dprintf(CRITICAL, "Not able to search the panel:%s\n", |
| 348 | panel_name + strspn(panel_name, " ")); |
| 349 | } else if (panel_override_id < UNKNOWN_PANEL) { |
| 350 | /* panel override using fastboot oem command */ |
| 351 | panel_id = panel_override_id; |
| 352 | |
| 353 | dprintf(INFO, "OEM panel override:%s\n", |
| 354 | panel_name + strspn(panel_name, " ")); |
| 355 | goto panel_init; |
| 356 | } |
Aravind Venkateswaran | c5863e3 | 2014-02-12 12:31:44 -0800 | [diff] [blame] | 357 | } |
Arpita Banerjee | 841fa06 | 2013-05-24 14:59:51 -0700 | [diff] [blame] | 358 | |
Dhaval Patel | fa5d587 | 2013-08-08 10:52:16 -0700 | [diff] [blame] | 359 | switch (hw_id) { |
| 360 | case HW_PLATFORM_QRD: |
Aravind Venkateswaran | d039850 | 2013-11-04 16:46:46 -0800 | [diff] [blame] | 361 | if (hw_subtype == HW_PLATFORM_SUBTYPE_SKUF) { |
Dhaval Patel | fa5d587 | 2013-08-08 10:52:16 -0700 | [diff] [blame] | 362 | panel_id = NT35521_720P_VIDEO_PANEL; |
Aravind Venkateswaran | d039850 | 2013-11-04 16:46:46 -0800 | [diff] [blame] | 363 | } else if (hw_subtype == HW_PLATFORM_SUBTYPE_SKUG) { |
Ray Zhang | be67855 | 2013-09-03 19:17:07 +0800 | [diff] [blame] | 364 | panel_id = SSD2080M_720P_VIDEO_PANEL; |
Dhaval Patel | fa5d587 | 2013-08-08 10:52:16 -0700 | [diff] [blame] | 365 | } else { |
Kun Liang | 12945ab | 2013-09-29 18:27:23 +0800 | [diff] [blame] | 366 | if (((target_id >> 16) & 0xFF) == 0x1 || ((target_id >> 16) & 0xFF) == 0x3) //EVT || PVT |
Dhaval Patel | fa5d587 | 2013-08-08 10:52:16 -0700 | [diff] [blame] | 367 | panel_id = nt35590_panel_id; |
Pradeep Jilagam | cd51b52 | 2013-10-29 13:08:51 +0530 | [diff] [blame] | 368 | else if (((target_id >> 16) & 0xFF) == 0x2) { //DVT |
Dhaval Patel | fa5d587 | 2013-08-08 10:52:16 -0700 | [diff] [blame] | 369 | panel_id = HX8394A_720P_VIDEO_PANEL; |
Pradeep Jilagam | cd51b52 | 2013-10-29 13:08:51 +0530 | [diff] [blame] | 370 | switch (auto_pan_loop) { |
| 371 | case 0: |
| 372 | panel_id = HX8394A_720P_VIDEO_PANEL; |
| 373 | break; |
| 374 | case 1: |
| 375 | panel_id = NT35596_1080P_VIDEO_PANEL; |
| 376 | break; |
| 377 | default: |
| 378 | panel_id = UNKNOWN_PANEL; |
| 379 | ret = false; |
| 380 | dprintf(CRITICAL, "Unknown panel\n"); |
| 381 | return ret; |
| 382 | } |
| 383 | auto_pan_loop++; |
| 384 | } |
Dhaval Patel | fa5d587 | 2013-08-08 10:52:16 -0700 | [diff] [blame] | 385 | else { |
| 386 | dprintf(CRITICAL, "Not supported device, target_id=%x\n" |
| 387 | , target_id); |
| 388 | return false; |
| 389 | } |
Arpita Banerjee | 841fa06 | 2013-05-24 14:59:51 -0700 | [diff] [blame] | 390 | } |
| 391 | break; |
Dhaval Patel | fa5d587 | 2013-08-08 10:52:16 -0700 | [diff] [blame] | 392 | case HW_PLATFORM_MTP: |
| 393 | case HW_PLATFORM_SURF: |
Aravind Venkateswaran | bece438 | 2014-01-23 11:43:02 -0800 | [diff] [blame] | 394 | if ((hw_subtype == HW_PLATFORM_SUBTYPE_1080P) || |
| 395 | (hw_subtype == HW_PLATFORM_SUBTYPE_1080P_EXT_BUCK)) |
Aravind Venkateswaran | d039850 | 2013-11-04 16:46:46 -0800 | [diff] [blame] | 396 | panel_id = JDI_1080P_VIDEO_PANEL; |
Aravind Venkateswaran | bece438 | 2014-01-23 11:43:02 -0800 | [diff] [blame] | 397 | else |
Jayant Shekhar | cd300eb | 2013-12-23 22:39:35 +0530 | [diff] [blame] | 398 | panel_id = nt35590_panel_id; |
Arpita Banerjee | 841fa06 | 2013-05-24 14:59:51 -0700 | [diff] [blame] | 399 | break; |
Dhaval Patel | e4ef944 | 2013-07-16 12:35:56 -0700 | [diff] [blame] | 400 | default: |
Dhaval Patel | fa5d587 | 2013-08-08 10:52:16 -0700 | [diff] [blame] | 401 | dprintf(CRITICAL, "Display not enabled for %d HW type\n" |
| 402 | , hw_id); |
Dhaval Patel | e4ef944 | 2013-07-16 12:35:56 -0700 | [diff] [blame] | 403 | return false; |
Arpita Banerjee | 841fa06 | 2013-05-24 14:59:51 -0700 | [diff] [blame] | 404 | } |
| 405 | |
Aravind Venkateswaran | c5863e3 | 2014-02-12 12:31:44 -0800 | [diff] [blame] | 406 | panel_init: |
Arpita Banerjee | 841fa06 | 2013-05-24 14:59:51 -0700 | [diff] [blame] | 407 | init_panel_data(panelstruct, pinfo, phy_db); |
Jayant Shekhar | 24bbf69 | 2014-03-26 15:43:41 +0530 | [diff] [blame] | 408 | mdss_source_pipe_select(pinfo); |
Arpita Banerjee | 841fa06 | 2013-05-24 14:59:51 -0700 | [diff] [blame] | 409 | |
Pradeep Jilagam | cd51b52 | 2013-10-29 13:08:51 +0530 | [diff] [blame] | 410 | return ret; |
Arpita Banerjee | 841fa06 | 2013-05-24 14:59:51 -0700 | [diff] [blame] | 411 | } |