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