Aravind Venkateswaran | c26bb60 | 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 | e100ab6 | 2013-09-03 19:17:07 +0800 | [diff] [blame] | 49 | #include "include/panel_ssd2080m_720p_video.h" |
Aravind Venkateswaran | af24121 | 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 | feb1598 | 2013-10-29 13:08:51 +0530 | [diff] [blame] | 52 | #define DISPLAY_MAX_PANEL_DETECTION 2 |
| 53 | |
Ray Zhang | a6df18c | 2013-12-04 16:21:50 +0800 | [diff] [blame] | 54 | #define SSD2080M_720P_VIDEO_PANEL_ON_DELAY 200 |
Aravind Venkateswaran | 6bfb29e | 2014-02-12 12:31:44 -0800 | [diff] [blame] | 55 | #define MAX_PANEL_ID_LEN 64 |
Ray Zhang | a6df18c | 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 | e100ab6 | 2013-09-03 19:17:07 +0800 | [diff] [blame] | 66 | NT35521_720P_VIDEO_PANEL, |
Aravind Venkateswaran | af24121 | 2013-11-04 16:46:46 -0800 | [diff] [blame] | 67 | SSD2080M_720P_VIDEO_PANEL, |
Pradeep Jilagam | feb1598 | 2013-10-29 13:08:51 +0530 | [diff] [blame] | 68 | JDI_1080P_VIDEO_PANEL, |
| 69 | UNKNOWN_PANEL |
Aravind Venkateswaran | af24121 | 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 | c26bb60 | 2014-01-23 11:43:02 -0800 | [diff] [blame] | 78 | HW_PLATFORM_SUBTYPE_1080P_EXT_BUCK = 3, |
Aravind Venkateswaran | af24121 | 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 | 6bfb29e | 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 | a6df18c | 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 | |
| 138 | static void init_panel_data(struct panel_struct *panelstruct, |
| 139 | struct msm_panel_info *pinfo, |
| 140 | struct mdss_dsi_phy_ctrl *phy_db) |
| 141 | { |
| 142 | switch (panel_id) { |
| 143 | case TOSHIBA_720P_VIDEO_PANEL: |
| 144 | panelstruct->paneldata = &toshiba_720p_video_panel_data; |
| 145 | panelstruct->panelres = &toshiba_720p_video_panel_res; |
| 146 | panelstruct->color = &toshiba_720p_video_color; |
| 147 | panelstruct->videopanel = &toshiba_720p_video_video_panel; |
| 148 | panelstruct->commandpanel = &toshiba_720p_video_command_panel; |
| 149 | panelstruct->state = &toshiba_720p_video_state; |
| 150 | panelstruct->laneconfig = &toshiba_720p_video_lane_config; |
| 151 | panelstruct->paneltiminginfo |
| 152 | = &toshiba_720p_video_timing_info; |
Casey Piper | 5197f93 | 2013-08-14 17:27:29 -0700 | [diff] [blame] | 153 | panelstruct->panelresetseq |
| 154 | = &toshiba_720p_video_panel_reset_seq; |
Arpita Banerjee | 841fa06 | 2013-05-24 14:59:51 -0700 | [diff] [blame] | 155 | panelstruct->backlightinfo = &toshiba_720p_video_backlight; |
| 156 | pinfo->mipi.panel_cmds |
| 157 | = toshiba_720p_video_on_command; |
| 158 | pinfo->mipi.num_of_panel_cmds |
| 159 | = TOSHIBA_720P_VIDEO_ON_COMMAND; |
| 160 | memcpy(phy_db->timing, |
| 161 | toshiba_720p_video_timings, TIMING_SIZE); |
| 162 | break; |
| 163 | case NT35590_720P_VIDEO_PANEL: |
| 164 | panelstruct->paneldata = &nt35590_720p_video_panel_data; |
| 165 | panelstruct->panelres = &nt35590_720p_video_panel_res; |
| 166 | panelstruct->color = &nt35590_720p_video_color; |
| 167 | panelstruct->videopanel = &nt35590_720p_video_video_panel; |
| 168 | panelstruct->commandpanel = &nt35590_720p_video_command_panel; |
| 169 | panelstruct->state = &nt35590_720p_video_state; |
| 170 | panelstruct->laneconfig = &nt35590_720p_video_lane_config; |
| 171 | panelstruct->paneltiminginfo |
| 172 | = &nt35590_720p_video_timing_info; |
Casey Piper | 5197f93 | 2013-08-14 17:27:29 -0700 | [diff] [blame] | 173 | panelstruct->panelresetseq |
| 174 | = &nt35590_720p_video_panel_reset_seq; |
Arpita Banerjee | 841fa06 | 2013-05-24 14:59:51 -0700 | [diff] [blame] | 175 | panelstruct->backlightinfo = &nt35590_720p_video_backlight; |
| 176 | pinfo->mipi.panel_cmds |
| 177 | = nt35590_720p_video_on_command; |
| 178 | pinfo->mipi.num_of_panel_cmds |
| 179 | = NT35590_720P_VIDEO_ON_COMMAND; |
| 180 | memcpy(phy_db->timing, |
| 181 | nt35590_720p_video_timings, TIMING_SIZE); |
| 182 | break; |
Ray Zhang | 53b0dce | 2013-07-08 19:35:48 +0800 | [diff] [blame] | 183 | case NT35521_720P_VIDEO_PANEL: |
| 184 | panelstruct->paneldata = &nt35521_720p_video_panel_data; |
| 185 | panelstruct->panelres = &nt35521_720p_video_panel_res; |
| 186 | panelstruct->color = &nt35521_720p_video_color; |
| 187 | panelstruct->videopanel = &nt35521_720p_video_video_panel; |
| 188 | panelstruct->commandpanel = &nt35521_720p_video_command_panel; |
| 189 | panelstruct->state = &nt35521_720p_video_state; |
| 190 | panelstruct->laneconfig = &nt35521_720p_video_lane_config; |
| 191 | panelstruct->paneltiminginfo |
| 192 | = &nt35521_720p_video_timing_info; |
Casey Piper | 5197f93 | 2013-08-14 17:27:29 -0700 | [diff] [blame] | 193 | panelstruct->panelresetseq |
| 194 | = &nt35521_720p_video_panel_reset_seq; |
Ray Zhang | 53b0dce | 2013-07-08 19:35:48 +0800 | [diff] [blame] | 195 | panelstruct->backlightinfo = &nt35521_720p_video_backlight; |
| 196 | pinfo->mipi.panel_cmds |
| 197 | = nt35521_720p_video_on_command; |
| 198 | pinfo->mipi.num_of_panel_cmds |
| 199 | = NT35521_720P_VIDEO_ON_COMMAND; |
| 200 | memcpy(phy_db->timing, |
| 201 | nt35521_720p_video_timings, TIMING_SIZE); |
| 202 | break; |
Ray Zhang | e100ab6 | 2013-09-03 19:17:07 +0800 | [diff] [blame] | 203 | case SSD2080M_720P_VIDEO_PANEL: |
| 204 | panelstruct->paneldata = &ssd2080m_720p_video_panel_data; |
| 205 | panelstruct->panelres = &ssd2080m_720p_video_panel_res; |
| 206 | panelstruct->color = &ssd2080m_720p_video_color; |
| 207 | panelstruct->videopanel = &ssd2080m_720p_video_video_panel; |
| 208 | panelstruct->commandpanel = &ssd2080m_720p_video_command_panel; |
| 209 | panelstruct->state = &ssd2080m_720p_video_state; |
| 210 | panelstruct->laneconfig = &ssd2080m_720p_video_lane_config; |
| 211 | panelstruct->paneltiminginfo |
| 212 | = &ssd2080m_720p_video_timing_info; |
| 213 | panelstruct->panelresetseq |
| 214 | = &ssd2080m_720p_video_panel_reset_seq; |
| 215 | panelstruct->backlightinfo = &ssd2080m_720p_video_backlight; |
| 216 | pinfo->mipi.panel_cmds |
| 217 | = ssd2080m_720p_video_on_command; |
| 218 | pinfo->mipi.num_of_panel_cmds |
| 219 | = SSD2080M_720P_VIDEO_ON_COMMAND; |
| 220 | memcpy(phy_db->timing, |
| 221 | ssd2080m_720p_video_timings, TIMING_SIZE); |
| 222 | break; |
Ray Zhang | 70abc54 | 2013-07-08 15:48:19 +0800 | [diff] [blame] | 223 | case HX8394A_720P_VIDEO_PANEL: |
| 224 | panelstruct->paneldata = &hx8394a_720p_video_panel_data; |
| 225 | panelstruct->panelres = &hx8394a_720p_video_panel_res; |
| 226 | panelstruct->color = &hx8394a_720p_video_color; |
| 227 | panelstruct->videopanel = &hx8394a_720p_video_video_panel; |
| 228 | panelstruct->commandpanel = &hx8394a_720p_video_command_panel; |
| 229 | panelstruct->state = &hx8394a_720p_video_state; |
| 230 | panelstruct->laneconfig = &hx8394a_720p_video_lane_config; |
| 231 | panelstruct->paneltiminginfo |
| 232 | = &hx8394a_720p_video_timing_info; |
Casey Piper | 5197f93 | 2013-08-14 17:27:29 -0700 | [diff] [blame] | 233 | panelstruct->panelresetseq |
| 234 | = &hx8394a_720p_video_panel_reset_seq; |
Ray Zhang | 70abc54 | 2013-07-08 15:48:19 +0800 | [diff] [blame] | 235 | panelstruct->backlightinfo = &hx8394a_720p_video_backlight; |
| 236 | pinfo->mipi.panel_cmds |
| 237 | = hx8394a_720p_video_on_command; |
| 238 | pinfo->mipi.num_of_panel_cmds |
| 239 | = HX8394A_720P_VIDEO_ON_COMMAND; |
| 240 | memcpy(phy_db->timing, |
| 241 | hx8394a_720p_video_timings, TIMING_SIZE); |
Pradeep Jilagam | feb1598 | 2013-10-29 13:08:51 +0530 | [diff] [blame] | 242 | pinfo->mipi.signature = HX8394A_720P_VIDEO_SIGNATURE; |
Ray Zhang | 70abc54 | 2013-07-08 15:48:19 +0800 | [diff] [blame] | 243 | break; |
| 244 | |
Arpita Banerjee | 841fa06 | 2013-05-24 14:59:51 -0700 | [diff] [blame] | 245 | case NT35590_720P_CMD_PANEL: |
| 246 | panelstruct->paneldata = &nt35590_720p_cmd_panel_data; |
| 247 | panelstruct->panelres = &nt35590_720p_cmd_panel_res; |
| 248 | panelstruct->color = &nt35590_720p_cmd_color; |
| 249 | panelstruct->videopanel = &nt35590_720p_cmd_video_panel; |
| 250 | panelstruct->commandpanel = &nt35590_720p_cmd_command_panel; |
| 251 | panelstruct->state = &nt35590_720p_cmd_state; |
| 252 | panelstruct->laneconfig = &nt35590_720p_cmd_lane_config; |
| 253 | panelstruct->paneltiminginfo = &nt35590_720p_cmd_timing_info; |
Casey Piper | 5197f93 | 2013-08-14 17:27:29 -0700 | [diff] [blame] | 254 | panelstruct->panelresetseq |
| 255 | = &nt35590_720p_cmd_panel_reset_seq; |
Arpita Banerjee | 841fa06 | 2013-05-24 14:59:51 -0700 | [diff] [blame] | 256 | panelstruct->backlightinfo = &nt35590_720p_cmd_backlight; |
| 257 | pinfo->mipi.panel_cmds |
| 258 | = nt35590_720p_cmd_on_command; |
| 259 | pinfo->mipi.num_of_panel_cmds |
| 260 | = NT35590_720P_CMD_ON_COMMAND; |
| 261 | memcpy(phy_db->timing, |
| 262 | nt35590_720p_cmd_timings, TIMING_SIZE); |
| 263 | break; |
Arpita Banerjee | f04ae4b | 2013-06-14 11:32:20 -0700 | [diff] [blame] | 264 | case NT35596_1080P_VIDEO_PANEL: |
| 265 | panelstruct->paneldata = &nt35596_1080p_video_panel_data; |
| 266 | panelstruct->panelres = &nt35596_1080p_video_panel_res; |
| 267 | panelstruct->color = &nt35596_1080p_video_color; |
| 268 | panelstruct->videopanel = &nt35596_1080p_video_video_panel; |
| 269 | panelstruct->commandpanel = &nt35596_1080p_video_command_panel; |
| 270 | panelstruct->state = &nt35596_1080p_video_state; |
| 271 | panelstruct->laneconfig = &nt35596_1080p_video_lane_config; |
| 272 | panelstruct->paneltiminginfo |
| 273 | = &nt35596_1080p_video_timing_info; |
Casey Piper | 5197f93 | 2013-08-14 17:27:29 -0700 | [diff] [blame] | 274 | panelstruct->panelresetseq |
| 275 | = &nt35596_1080p_video_panel_reset_seq; |
Arpita Banerjee | f04ae4b | 2013-06-14 11:32:20 -0700 | [diff] [blame] | 276 | panelstruct->backlightinfo |
| 277 | = &nt35596_1080p_video_backlight; |
| 278 | pinfo->mipi.panel_cmds |
| 279 | = nt35596_1080p_video_on_command; |
| 280 | pinfo->mipi.num_of_panel_cmds |
| 281 | = NT35596_1080P_VIDEO_ON_COMMAND; |
| 282 | memcpy(phy_db->timing, |
| 283 | nt35596_1080p_video_timings, TIMING_SIZE); |
Pradeep Jilagam | feb1598 | 2013-10-29 13:08:51 +0530 | [diff] [blame] | 284 | pinfo->mipi.signature = NT35596_1080P_VIDEO_SIGNATURE; |
Jayant Shekhar | 24be5e6 | 2013-11-18 19:59:50 +0530 | [diff] [blame] | 285 | break; |
Aravind Venkateswaran | af24121 | 2013-11-04 16:46:46 -0800 | [diff] [blame] | 286 | case JDI_1080P_VIDEO_PANEL: |
| 287 | panelstruct->paneldata = &jdi_1080p_video_panel_data; |
| 288 | panelstruct->paneldata->panel_with_enable_gpio = 1; |
| 289 | panelstruct->panelres = &jdi_1080p_video_panel_res; |
| 290 | panelstruct->color = &jdi_1080p_video_color; |
| 291 | panelstruct->videopanel = &jdi_1080p_video_video_panel; |
| 292 | panelstruct->commandpanel = &jdi_1080p_video_command_panel; |
| 293 | panelstruct->state = &jdi_1080p_video_state; |
| 294 | panelstruct->laneconfig = &jdi_1080p_video_lane_config; |
| 295 | panelstruct->paneltiminginfo |
| 296 | = &jdi_1080p_video_timing_info; |
| 297 | panelstruct->panelresetseq |
| 298 | = &jdi_1080p_video_panel_reset_seq; |
| 299 | panelstruct->backlightinfo = &jdi_1080p_video_backlight; |
| 300 | pinfo->mipi.panel_cmds |
| 301 | = jdi_1080p_video_on_command; |
| 302 | pinfo->mipi.num_of_panel_cmds |
| 303 | = JDI_1080P_VIDEO_ON_COMMAND; |
| 304 | memcpy(phy_db->timing, |
| 305 | jdi_1080p_video_timings, TIMING_SIZE); |
Arpita Banerjee | f04ae4b | 2013-06-14 11:32:20 -0700 | [diff] [blame] | 306 | break; |
Pradeep Jilagam | feb1598 | 2013-10-29 13:08:51 +0530 | [diff] [blame] | 307 | case UNKNOWN_PANEL: |
| 308 | memset(panelstruct, 0, sizeof(struct panel_struct)); |
| 309 | memset(pinfo->mipi.panel_cmds, 0, sizeof(struct mipi_dsi_cmd)); |
| 310 | pinfo->mipi.num_of_panel_cmds = 0; |
| 311 | memset(phy_db->timing, 0, TIMING_SIZE); |
| 312 | pinfo->mipi.signature = 0; |
| 313 | break; |
Arpita Banerjee | 841fa06 | 2013-05-24 14:59:51 -0700 | [diff] [blame] | 314 | } |
| 315 | } |
| 316 | |
Pradeep Jilagam | feb1598 | 2013-10-29 13:08:51 +0530 | [diff] [blame] | 317 | uint32_t oem_panel_max_auto_detect_panels() |
| 318 | { |
| 319 | return target_panel_auto_detect_enabled() ? |
| 320 | DISPLAY_MAX_PANEL_DETECTION : 0; |
| 321 | } |
| 322 | |
| 323 | static uint32_t auto_pan_loop = 0; |
| 324 | |
Aravind Venkateswaran | d494f96 | 2014-02-25 17:16:49 -0800 | [diff] [blame] | 325 | bool oem_panel_select(const char *panel_name, struct panel_struct *panelstruct, |
Arpita Banerjee | 841fa06 | 2013-05-24 14:59:51 -0700 | [diff] [blame] | 326 | struct msm_panel_info *pinfo, |
| 327 | struct mdss_dsi_phy_ctrl *phy_db) |
| 328 | { |
| 329 | uint32_t hw_id = board_hardware_id(); |
Ray Zhang | 70abc54 | 2013-07-08 15:48:19 +0800 | [diff] [blame] | 330 | uint32_t target_id = board_target_id(); |
Aravind Venkateswaran | 9ae369b | 2013-07-23 22:57:47 -0700 | [diff] [blame] | 331 | uint32_t nt35590_panel_id = NT35590_720P_VIDEO_PANEL; |
Aravind Venkateswaran | af24121 | 2013-11-04 16:46:46 -0800 | [diff] [blame] | 332 | uint32_t hw_subtype = board_hardware_subtype(); |
Pradeep Jilagam | feb1598 | 2013-10-29 13:08:51 +0530 | [diff] [blame] | 333 | bool ret = true; |
Dhaval Patel | f6dd577 | 2014-02-18 17:10:16 -0800 | [diff] [blame^] | 334 | int32_t panel_override_id; |
Aravind Venkateswaran | 9ae369b | 2013-07-23 22:57:47 -0700 | [diff] [blame] | 335 | |
Aravind Venkateswaran | 6bfb29e | 2014-02-12 12:31:44 -0800 | [diff] [blame] | 336 | if (panel_name) { |
Dhaval Patel | f6dd577 | 2014-02-18 17:10:16 -0800 | [diff] [blame^] | 337 | panel_override_id = panel_name_to_id(supp_panels, |
| 338 | ARRAY_SIZE(supp_panels), panel_name); |
Aravind Venkateswaran | 6bfb29e | 2014-02-12 12:31:44 -0800 | [diff] [blame] | 339 | |
Dhaval Patel | f6dd577 | 2014-02-18 17:10:16 -0800 | [diff] [blame^] | 340 | if (panel_override_id < 0) { |
| 341 | dprintf(CRITICAL, "Not able to search the panel:%s\n", |
| 342 | panel_name + strspn(panel_name, " ")); |
| 343 | } else if (panel_override_id < UNKNOWN_PANEL) { |
| 344 | /* panel override using fastboot oem command */ |
| 345 | panel_id = panel_override_id; |
| 346 | |
| 347 | dprintf(INFO, "OEM panel override:%s\n", |
| 348 | panel_name + strspn(panel_name, " ")); |
| 349 | goto panel_init; |
| 350 | } |
Aravind Venkateswaran | 6bfb29e | 2014-02-12 12:31:44 -0800 | [diff] [blame] | 351 | } |
Arpita Banerjee | 841fa06 | 2013-05-24 14:59:51 -0700 | [diff] [blame] | 352 | |
Dhaval Patel | fa5d587 | 2013-08-08 10:52:16 -0700 | [diff] [blame] | 353 | switch (hw_id) { |
| 354 | case HW_PLATFORM_QRD: |
Aravind Venkateswaran | af24121 | 2013-11-04 16:46:46 -0800 | [diff] [blame] | 355 | if (hw_subtype == HW_PLATFORM_SUBTYPE_SKUF) { |
Dhaval Patel | fa5d587 | 2013-08-08 10:52:16 -0700 | [diff] [blame] | 356 | panel_id = NT35521_720P_VIDEO_PANEL; |
Aravind Venkateswaran | af24121 | 2013-11-04 16:46:46 -0800 | [diff] [blame] | 357 | } else if (hw_subtype == HW_PLATFORM_SUBTYPE_SKUG) { |
Ray Zhang | e100ab6 | 2013-09-03 19:17:07 +0800 | [diff] [blame] | 358 | panel_id = SSD2080M_720P_VIDEO_PANEL; |
Dhaval Patel | fa5d587 | 2013-08-08 10:52:16 -0700 | [diff] [blame] | 359 | } else { |
Kun Liang | 6bff57d | 2013-09-29 18:27:23 +0800 | [diff] [blame] | 360 | 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] | 361 | panel_id = nt35590_panel_id; |
Pradeep Jilagam | feb1598 | 2013-10-29 13:08:51 +0530 | [diff] [blame] | 362 | else if (((target_id >> 16) & 0xFF) == 0x2) { //DVT |
Dhaval Patel | fa5d587 | 2013-08-08 10:52:16 -0700 | [diff] [blame] | 363 | panel_id = HX8394A_720P_VIDEO_PANEL; |
Pradeep Jilagam | feb1598 | 2013-10-29 13:08:51 +0530 | [diff] [blame] | 364 | switch (auto_pan_loop) { |
| 365 | case 0: |
| 366 | panel_id = HX8394A_720P_VIDEO_PANEL; |
| 367 | break; |
| 368 | case 1: |
| 369 | panel_id = NT35596_1080P_VIDEO_PANEL; |
| 370 | break; |
| 371 | default: |
| 372 | panel_id = UNKNOWN_PANEL; |
| 373 | ret = false; |
| 374 | dprintf(CRITICAL, "Unknown panel\n"); |
| 375 | return ret; |
| 376 | } |
| 377 | auto_pan_loop++; |
| 378 | } |
Dhaval Patel | fa5d587 | 2013-08-08 10:52:16 -0700 | [diff] [blame] | 379 | else { |
| 380 | dprintf(CRITICAL, "Not supported device, target_id=%x\n" |
| 381 | , target_id); |
| 382 | return false; |
| 383 | } |
Arpita Banerjee | 841fa06 | 2013-05-24 14:59:51 -0700 | [diff] [blame] | 384 | } |
| 385 | break; |
Dhaval Patel | fa5d587 | 2013-08-08 10:52:16 -0700 | [diff] [blame] | 386 | case HW_PLATFORM_MTP: |
| 387 | case HW_PLATFORM_SURF: |
Aravind Venkateswaran | c26bb60 | 2014-01-23 11:43:02 -0800 | [diff] [blame] | 388 | if ((hw_subtype == HW_PLATFORM_SUBTYPE_1080P) || |
| 389 | (hw_subtype == HW_PLATFORM_SUBTYPE_1080P_EXT_BUCK)) |
Aravind Venkateswaran | af24121 | 2013-11-04 16:46:46 -0800 | [diff] [blame] | 390 | panel_id = JDI_1080P_VIDEO_PANEL; |
Aravind Venkateswaran | c26bb60 | 2014-01-23 11:43:02 -0800 | [diff] [blame] | 391 | else |
Jayant Shekhar | eb6e087 | 2013-12-23 22:39:35 +0530 | [diff] [blame] | 392 | panel_id = nt35590_panel_id; |
Arpita Banerjee | 841fa06 | 2013-05-24 14:59:51 -0700 | [diff] [blame] | 393 | break; |
Dhaval Patel | e4ef944 | 2013-07-16 12:35:56 -0700 | [diff] [blame] | 394 | default: |
Dhaval Patel | fa5d587 | 2013-08-08 10:52:16 -0700 | [diff] [blame] | 395 | dprintf(CRITICAL, "Display not enabled for %d HW type\n" |
| 396 | , hw_id); |
Dhaval Patel | e4ef944 | 2013-07-16 12:35:56 -0700 | [diff] [blame] | 397 | return false; |
Arpita Banerjee | 841fa06 | 2013-05-24 14:59:51 -0700 | [diff] [blame] | 398 | } |
| 399 | |
Aravind Venkateswaran | 6bfb29e | 2014-02-12 12:31:44 -0800 | [diff] [blame] | 400 | panel_init: |
Arpita Banerjee | 841fa06 | 2013-05-24 14:59:51 -0700 | [diff] [blame] | 401 | init_panel_data(panelstruct, pinfo, phy_db); |
| 402 | |
Pradeep Jilagam | feb1598 | 2013-10-29 13:08:51 +0530 | [diff] [blame] | 403 | return ret; |
Arpita Banerjee | 841fa06 | 2013-05-24 14:59:51 -0700 | [diff] [blame] | 404 | } |