Dhaval Patel | b95039c | 2015-03-16 11:14:06 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved. |
| 2 | * |
| 3 | * Redistribution and use in source and binary forms, with or without |
| 4 | * modification, are permitted provided that the following conditions |
| 5 | * are met: |
| 6 | * * Redistributions of source code must retain the above copyright |
| 7 | * notice, this list of conditions and the following disclaimer. |
| 8 | * * Redistributions in binary form must reproduce the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer in |
| 10 | * the documentation and/or other materials provided with the |
| 11 | * distribution. |
| 12 | * * Neither the name of The Linux Foundation nor the names of its |
| 13 | * contributors may be used to endorse or promote products derived |
| 14 | * from this software without specific prior written permission. |
| 15 | * |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 19 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
| 20 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
| 22 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS |
| 23 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
| 24 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 25 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
| 26 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 27 | * SUCH DAMAGE. |
| 28 | */ |
| 29 | |
| 30 | #include <debug.h> |
| 31 | #include <string.h> |
| 32 | #include <err.h> |
| 33 | #include <smem.h> |
| 34 | #include <msm_panel.h> |
| 35 | #include <board.h> |
| 36 | #include <mipi_dsi.h> |
| 37 | #include <qtimer.h> |
| 38 | #include <platform.h> |
| 39 | |
Ujwal Patel | 41a665a | 2015-07-17 13:51:30 -0700 | [diff] [blame] | 40 | #include "gcdb_display.h" |
Dhaval Patel | b95039c | 2015-03-16 11:14:06 -0700 | [diff] [blame] | 41 | #include "include/panel.h" |
| 42 | #include "target/display.h" |
| 43 | #include "panel_display.h" |
| 44 | #include <mipi_dsi.h> |
Kuogee Hsieh | 0b492c9 | 2015-07-08 13:02:36 -0700 | [diff] [blame] | 45 | #include <mdp5.h> |
Dhaval Patel | b95039c | 2015-03-16 11:14:06 -0700 | [diff] [blame] | 46 | |
| 47 | /*---------------------------------------------------------------------------*/ |
| 48 | /* GCDB Panel Database */ |
| 49 | /*---------------------------------------------------------------------------*/ |
Dhaval Patel | 989d4fc | 2015-04-01 19:04:46 -0700 | [diff] [blame] | 50 | #include "include/panel_nt35597_wqxga_dualdsi_video.h" |
Kuogee Hsieh | 9d7e714 | 2015-06-16 10:36:19 -0700 | [diff] [blame] | 51 | #include "include/panel_nt35597_wqxga_dualdsi_cmd.h" |
Kuogee Hsieh | 0b492c9 | 2015-07-08 13:02:36 -0700 | [diff] [blame] | 52 | #include "include/panel_nt35597_wqxga_dsc_video.h" |
| 53 | #include "include/panel_nt35597_wqxga_dsc_cmd.h" |
Dhaval Patel | b95039c | 2015-03-16 11:14:06 -0700 | [diff] [blame] | 54 | #include "include/panel_sharp_wqxga_dualdsi_video.h" |
| 55 | #include "include/panel_jdi_qhd_dualdsi_video.h" |
| 56 | #include "include/panel_jdi_qhd_dualdsi_cmd.h" |
feifanz | 76fe648 | 2015-09-02 15:25:16 +0800 | [diff] [blame] | 57 | #include "include/panel_r69007_wqxga_cmd.h" |
Kuogee Hsieh | b976dfc | 2015-08-28 13:21:30 -0700 | [diff] [blame] | 58 | #include "include/panel_jdi_4k_dualdsi_video_nofbc.h" |
Dhaval Patel | b95039c | 2015-03-16 11:14:06 -0700 | [diff] [blame] | 59 | |
| 60 | /*---------------------------------------------------------------------------*/ |
| 61 | /* static panel selection variable */ |
| 62 | /*---------------------------------------------------------------------------*/ |
| 63 | enum { |
Kuogee Hsieh | 0b492c9 | 2015-07-08 13:02:36 -0700 | [diff] [blame] | 64 | SHARP_WQXGA_DUALDSI_VIDEO_PANEL, |
Dhaval Patel | 989d4fc | 2015-04-01 19:04:46 -0700 | [diff] [blame] | 65 | NT35597_WQXGA_DUALDSI_VIDEO_PANEL, |
Kuogee Hsieh | 9d7e714 | 2015-06-16 10:36:19 -0700 | [diff] [blame] | 66 | NT35597_WQXGA_DUALDSI_CMD_PANEL, |
Kuogee Hsieh | 0b492c9 | 2015-07-08 13:02:36 -0700 | [diff] [blame] | 67 | NT35597_WQXGA_DSC_VIDEO_PANEL, |
| 68 | NT35597_WQXGA_DSC_CMD_PANEL, |
Dhaval Patel | b95039c | 2015-03-16 11:14:06 -0700 | [diff] [blame] | 69 | JDI_QHD_DUALDSI_VIDEO_PANEL, |
| 70 | JDI_QHD_DUALDSI_CMD_PANEL, |
feifanz | 76fe648 | 2015-09-02 15:25:16 +0800 | [diff] [blame] | 71 | R69007_WQXGA_CMD_PANEL, |
Kuogee Hsieh | b976dfc | 2015-08-28 13:21:30 -0700 | [diff] [blame] | 72 | JDI_4K_DUALDSI_VIDEO_NOFBC_PANEL, |
Dhaval Patel | b95039c | 2015-03-16 11:14:06 -0700 | [diff] [blame] | 73 | UNKNOWN_PANEL |
| 74 | }; |
| 75 | |
| 76 | /* |
| 77 | * The list of panels that are supported on this target. |
| 78 | * Any panel in this list can be selected using fastboot oem command. |
| 79 | */ |
| 80 | static struct panel_list supp_panels[] = { |
Kuogee Hsieh | 0b492c9 | 2015-07-08 13:02:36 -0700 | [diff] [blame] | 81 | {"sharp_wqxga_dualdsi_video", SHARP_WQXGA_DUALDSI_VIDEO_PANEL}, |
Dhaval Patel | 989d4fc | 2015-04-01 19:04:46 -0700 | [diff] [blame] | 82 | {"nt35597_wqxga_dualdsi_video", NT35597_WQXGA_DUALDSI_VIDEO_PANEL}, |
Kuogee Hsieh | 9d7e714 | 2015-06-16 10:36:19 -0700 | [diff] [blame] | 83 | {"nt35597_wqxga_dualdsi_cmd", NT35597_WQXGA_DUALDSI_CMD_PANEL}, |
Kuogee Hsieh | 0b492c9 | 2015-07-08 13:02:36 -0700 | [diff] [blame] | 84 | {"nt35597_wqxga_dsc_video", NT35597_WQXGA_DSC_VIDEO_PANEL}, |
| 85 | {"nt35597_wqxga_dsc_cmd", NT35597_WQXGA_DSC_CMD_PANEL}, |
Dhaval Patel | b95039c | 2015-03-16 11:14:06 -0700 | [diff] [blame] | 86 | {"jdi_qhd_dualdsi_video", JDI_QHD_DUALDSI_VIDEO_PANEL}, |
| 87 | {"jdi_qhd_dualdsi_cmd", JDI_QHD_DUALDSI_CMD_PANEL}, |
feifanz | 76fe648 | 2015-09-02 15:25:16 +0800 | [diff] [blame] | 88 | {"r69007_wqxga_cmd", R69007_WQXGA_CMD_PANEL}, |
Kuogee Hsieh | b976dfc | 2015-08-28 13:21:30 -0700 | [diff] [blame] | 89 | {"jdi_4k_dualdsi_video_nofbc", JDI_4K_DUALDSI_VIDEO_NOFBC_PANEL}, |
Dhaval Patel | b95039c | 2015-03-16 11:14:06 -0700 | [diff] [blame] | 90 | }; |
| 91 | |
| 92 | static uint32_t panel_id; |
| 93 | |
| 94 | int oem_panel_rotation() |
| 95 | { |
| 96 | return NO_ERROR; |
| 97 | } |
| 98 | |
| 99 | int oem_panel_on() |
| 100 | { |
| 101 | if (panel_id == JDI_QHD_DUALDSI_CMD_PANEL) { |
| 102 | /* needs extra delay to avoid unexpected artifacts */ |
| 103 | mdelay(JDI_QHD_DUALDSI_CMD_PANEL_ON_DELAY); |
feifanz | 5494bdb | 2015-10-21 15:45:03 +0800 | [diff] [blame] | 104 | } else if (panel_id == R69007_WQXGA_CMD_PANEL) { |
| 105 | /* needs extra delay to avoid unexpected artifacts */ |
| 106 | mdelay(R69007_WQXGA_CMD_PANEL_ON_DELAY); |
Dhaval Patel | b95039c | 2015-03-16 11:14:06 -0700 | [diff] [blame] | 107 | } |
feifanz | 5494bdb | 2015-10-21 15:45:03 +0800 | [diff] [blame] | 108 | |
Dhaval Patel | b95039c | 2015-03-16 11:14:06 -0700 | [diff] [blame] | 109 | return NO_ERROR; |
| 110 | } |
| 111 | |
| 112 | int oem_panel_off() |
| 113 | { |
| 114 | return NO_ERROR; |
| 115 | } |
| 116 | |
| 117 | static bool init_panel_data(struct panel_struct *panelstruct, |
| 118 | struct msm_panel_info *pinfo, |
| 119 | struct mdss_dsi_phy_ctrl *phy_db) |
| 120 | { |
| 121 | int pan_type; |
Ujwal Patel | 41a665a | 2015-07-17 13:51:30 -0700 | [diff] [blame] | 122 | struct oem_panel_data *oem_data = mdss_dsi_get_oem_data_ptr(); |
Dhaval Patel | b95039c | 2015-03-16 11:14:06 -0700 | [diff] [blame] | 123 | |
| 124 | switch (panel_id) { |
| 125 | case SHARP_WQXGA_DUALDSI_VIDEO_PANEL: |
| 126 | pan_type = PANEL_TYPE_DSI; |
| 127 | pinfo->lcd_reg_en = 0; |
| 128 | panelstruct->paneldata = &sharp_wqxga_dualdsi_video_panel_data; |
Dhaval Patel | b95039c | 2015-03-16 11:14:06 -0700 | [diff] [blame] | 129 | panelstruct->paneldata->panel_operating_mode = 11; |
| 130 | panelstruct->paneldata->panel_with_enable_gpio = 0; |
| 131 | |
| 132 | panelstruct->panelres = &sharp_wqxga_dualdsi_video_panel_res; |
| 133 | panelstruct->color = &sharp_wqxga_dualdsi_video_color; |
| 134 | panelstruct->videopanel = &sharp_wqxga_dualdsi_video_video_panel; |
| 135 | panelstruct->commandpanel = &sharp_wqxga_dualdsi_video_command_panel; |
| 136 | panelstruct->state = &sharp_wqxga_dualdsi_video_state; |
| 137 | panelstruct->laneconfig = &sharp_wqxga_dualdsi_video_lane_config; |
| 138 | panelstruct->paneltiminginfo |
| 139 | = &sharp_wqxga_dualdsi_video_timing_info; |
| 140 | panelstruct->panelresetseq |
| 141 | = &sharp_wqxga_dualdsi_video_reset_seq; |
| 142 | panelstruct->backlightinfo = &sharp_wqxga_dualdsi_video_backlight; |
| 143 | |
| 144 | pinfo->labibb = &sharp_wqxga_dualdsi_video_labibb; |
| 145 | |
| 146 | pinfo->mipi.panel_on_cmds |
| 147 | = sharp_wqxga_dualdsi_video_on_command; |
| 148 | pinfo->mipi.num_of_panel_on_cmds |
| 149 | = SHARP_WQXGA_DUALDSI_VIDEO_ON_COMMAND; |
| 150 | pinfo->mipi.panel_off_cmds |
| 151 | = sharp_wqxga_dualdsi_video_off_command; |
| 152 | pinfo->mipi.num_of_panel_off_cmds |
| 153 | = SHARP_WQXGA_DUALDSI_VIDEO_OFF_COMMAND; |
| 154 | memcpy(phy_db->timing, |
| 155 | sharp_wqxga_dualdsi_thulium_video_timings, |
| 156 | MAX_TIMING_CONFIG * sizeof(uint32_t)); |
Jeevan Shriram | a386009 | 2015-08-03 15:16:57 -0700 | [diff] [blame] | 157 | pinfo->dfps.panel_dfps = sharp_wqxga_dualdsi_video_dfps; |
Dhaval Patel | b95039c | 2015-03-16 11:14:06 -0700 | [diff] [blame] | 158 | pinfo->mipi.tx_eot_append = true; |
Ujwal Patel | f4c6d2d | 2015-08-12 14:48:02 -0700 | [diff] [blame] | 159 | |
| 160 | /* |
| 161 | * remove DUAL_PIPE_FLAG because on this target for this panel, |
| 162 | * it will be added based on one of the selected configurations. |
| 163 | */ |
| 164 | panelstruct->paneldata->panel_operating_mode &= ~DUAL_PIPE_FLAG; |
| 165 | panelstruct->config = &sharp_wqxga_dualdsi_video_config0; |
| 166 | if (oem_data) { |
| 167 | switch (oem_data->cfg_num[0]) { |
| 168 | case -1: /* default */ |
| 169 | case 0: |
| 170 | panelstruct->config = |
| 171 | &sharp_wqxga_dualdsi_video_config0; |
| 172 | break; |
| 173 | case 1: |
| 174 | panelstruct->config = |
| 175 | &sharp_wqxga_dualdsi_video_config1; |
| 176 | break; |
| 177 | default: |
| 178 | dprintf(CRITICAL, "topology config%d not supported. fallback to default config0\n", |
| 179 | oem_data->cfg_num[0]); |
| 180 | panelstruct->config = &sharp_wqxga_dualdsi_video_config0; |
| 181 | } |
| 182 | } |
| 183 | pinfo->lm_split[0] = panelstruct->config->lm_split[0]; |
| 184 | pinfo->lm_split[1] = panelstruct->config->lm_split[1]; |
Dhaval Patel | b95039c | 2015-03-16 11:14:06 -0700 | [diff] [blame] | 185 | break; |
Dhaval Patel | 989d4fc | 2015-04-01 19:04:46 -0700 | [diff] [blame] | 186 | case NT35597_WQXGA_DUALDSI_VIDEO_PANEL: |
| 187 | pan_type = PANEL_TYPE_DSI; |
| 188 | pinfo->lcd_reg_en = 0; |
| 189 | panelstruct->paneldata = &nt35597_wqxga_dualdsi_video_panel_data; |
Dhaval Patel | 989d4fc | 2015-04-01 19:04:46 -0700 | [diff] [blame] | 190 | panelstruct->panelres = &nt35597_wqxga_dualdsi_video_panel_res; |
| 191 | panelstruct->color = &nt35597_wqxga_dualdsi_video_color; |
| 192 | panelstruct->videopanel = &nt35597_wqxga_dualdsi_video_video_panel; |
| 193 | panelstruct->commandpanel = &nt35597_wqxga_dualdsi_video_command_panel; |
| 194 | panelstruct->state = &nt35597_wqxga_dualdsi_video_state; |
| 195 | panelstruct->laneconfig = &nt35597_wqxga_dualdsi_video_lane_config; |
| 196 | panelstruct->paneltiminginfo |
| 197 | = &nt35597_wqxga_dualdsi_video_timing_info; |
| 198 | panelstruct->panelresetseq |
| 199 | = &nt35597_wqxga_dualdsi_video_reset_seq; |
| 200 | panelstruct->backlightinfo = &nt35597_wqxga_dualdsi_video_backlight; |
| 201 | |
| 202 | pinfo->labibb = &nt35597_wqxga_dualdsi_video_labibb; |
| 203 | |
| 204 | pinfo->mipi.panel_on_cmds |
| 205 | = nt35597_wqxga_dualdsi_video_on_command; |
| 206 | pinfo->mipi.num_of_panel_on_cmds |
| 207 | = NT35597_WQXGA_DUALDSI_VIDEO_ON_COMMAND; |
| 208 | pinfo->mipi.panel_off_cmds |
| 209 | = nt35597_wqxga_dualdsi_video_off_command; |
| 210 | pinfo->mipi.num_of_panel_off_cmds |
| 211 | = NT35597_WQXGA_DUALDSI_VIDEO_OFF_COMMAND; |
| 212 | memcpy(phy_db->timing, |
| 213 | nt35597_wqxga_dualdsi_thulium_video_timings, |
| 214 | MAX_TIMING_CONFIG * sizeof(uint32_t)); |
| 215 | pinfo->mipi.tx_eot_append = true; |
Ujwal Patel | f4c6d2d | 2015-08-12 14:48:02 -0700 | [diff] [blame] | 216 | |
| 217 | /* |
| 218 | * remove DUAL_PIPE_FLAG because on this target for this panel, |
| 219 | * it will be added based on one of the selected configurations. |
| 220 | */ |
| 221 | panelstruct->paneldata->panel_operating_mode &= ~DUAL_PIPE_FLAG; |
| 222 | panelstruct->config = &nt35597_wqxga_dualdsi_video_config0; |
| 223 | if (oem_data) { |
| 224 | switch (oem_data->cfg_num[0]) { |
| 225 | case -1: /* default */ |
| 226 | case 0: |
| 227 | panelstruct->config = |
| 228 | &nt35597_wqxga_dualdsi_video_config0; |
| 229 | break; |
| 230 | case 1: |
| 231 | panelstruct->config = |
| 232 | &nt35597_wqxga_dualdsi_video_config1; |
| 233 | break; |
| 234 | default: |
| 235 | dprintf(CRITICAL, "topology config%d not supported. fallback to default config0\n", |
| 236 | oem_data->cfg_num[0]); |
| 237 | panelstruct->config = &nt35597_wqxga_dualdsi_video_config0; |
| 238 | } |
| 239 | } |
| 240 | pinfo->lm_split[0] = panelstruct->config->lm_split[0]; |
| 241 | pinfo->lm_split[1] = panelstruct->config->lm_split[1]; |
Dhaval Patel | 989d4fc | 2015-04-01 19:04:46 -0700 | [diff] [blame] | 242 | break; |
Kuogee Hsieh | 9d7e714 | 2015-06-16 10:36:19 -0700 | [diff] [blame] | 243 | case NT35597_WQXGA_DUALDSI_CMD_PANEL: |
| 244 | pan_type = PANEL_TYPE_DSI; |
| 245 | pinfo->lcd_reg_en = 0; |
| 246 | panelstruct->paneldata = &nt35597_wqxga_dualdsi_cmd_panel_data; |
| 247 | panelstruct->panelres = &nt35597_wqxga_dualdsi_cmd_panel_res; |
| 248 | panelstruct->color = &nt35597_wqxga_dualdsi_cmd_color; |
| 249 | panelstruct->videopanel = &nt35597_wqxga_dualdsi_cmd_video_panel; |
| 250 | panelstruct->commandpanel = &nt35597_wqxga_dualdsi_cmd_command_panel; |
| 251 | panelstruct->state = &nt35597_wqxga_dualdsi_cmd_state; |
| 252 | panelstruct->laneconfig = &nt35597_wqxga_dualdsi_cmd_lane_config; |
| 253 | panelstruct->paneltiminginfo |
| 254 | = &nt35597_wqxga_dualdsi_cmd_timing_info; |
| 255 | panelstruct->panelresetseq |
| 256 | = &nt35597_wqxga_dualdsi_cmd_reset_seq; |
| 257 | panelstruct->backlightinfo = &nt35597_wqxga_dualdsi_cmd_backlight; |
| 258 | |
| 259 | pinfo->labibb = &nt35597_wqxga_dualdsi_cmd_labibb; |
| 260 | |
| 261 | pinfo->mipi.panel_on_cmds |
| 262 | = nt35597_wqxga_dualdsi_cmd_on_command; |
| 263 | pinfo->mipi.num_of_panel_on_cmds |
| 264 | = NT35597_WQXGA_DUALDSI_CMD_ON_COMMAND; |
| 265 | pinfo->mipi.panel_off_cmds |
| 266 | = nt35597_wqxga_dualdsi_cmd_off_command; |
| 267 | pinfo->mipi.num_of_panel_off_cmds |
| 268 | = NT35597_WQXGA_DUALDSI_CMD_OFF_COMMAND; |
| 269 | memcpy(phy_db->timing, |
| 270 | nt35597_wqxga_dualdsi_thulium_cmd_timings, |
| 271 | MAX_TIMING_CONFIG * sizeof(uint32_t)); |
| 272 | pinfo->mipi.tx_eot_append = true; |
Ujwal Patel | f4c6d2d | 2015-08-12 14:48:02 -0700 | [diff] [blame] | 273 | |
| 274 | /* |
| 275 | * remove DUAL_PIPE_FLAG because on this target for this panel, |
| 276 | * it will be added based on one of the selected configurations. |
| 277 | */ |
| 278 | panelstruct->paneldata->panel_operating_mode &= ~DUAL_PIPE_FLAG; |
| 279 | panelstruct->config = &nt35597_wqxga_dualdsi_cmd_config0; |
| 280 | if (oem_data) { |
| 281 | switch (oem_data->cfg_num[0]) { |
| 282 | case -1: /* default */ |
| 283 | case 0: |
| 284 | panelstruct->config = |
| 285 | &nt35597_wqxga_dualdsi_cmd_config0; |
| 286 | break; |
| 287 | case 1: |
| 288 | panelstruct->config = |
| 289 | &nt35597_wqxga_dualdsi_cmd_config1; |
| 290 | break; |
| 291 | default: |
| 292 | dprintf(CRITICAL, "topology config%d not supported. fallback to default config0\n", |
| 293 | oem_data->cfg_num[0]); |
| 294 | panelstruct->config = &nt35597_wqxga_dualdsi_cmd_config0; |
| 295 | } |
| 296 | } |
| 297 | pinfo->lm_split[0] = panelstruct->config->lm_split[0]; |
| 298 | pinfo->lm_split[1] = panelstruct->config->lm_split[1]; |
Kuogee Hsieh | 9d7e714 | 2015-06-16 10:36:19 -0700 | [diff] [blame] | 299 | break; |
Kuogee Hsieh | 0b492c9 | 2015-07-08 13:02:36 -0700 | [diff] [blame] | 300 | case NT35597_WQXGA_DSC_VIDEO_PANEL: |
| 301 | pan_type = PANEL_TYPE_DSI; |
| 302 | pinfo->lcd_reg_en = 0; |
| 303 | panelstruct->paneldata = &nt35597_wqxga_dsc_video_panel_data; |
| 304 | panelstruct->panelres = &nt35597_wqxga_dsc_video_panel_res; |
| 305 | panelstruct->color = &nt35597_wqxga_dsc_video_color; |
| 306 | panelstruct->videopanel = &nt35597_wqxga_dsc_video_video_panel; |
| 307 | panelstruct->commandpanel = &nt35597_wqxga_dsc_video_command_panel; |
| 308 | panelstruct->state = &nt35597_wqxga_dsc_video_state; |
| 309 | panelstruct->laneconfig = &nt35597_wqxga_dsc_video_lane_config; |
| 310 | panelstruct->paneltiminginfo |
| 311 | = &nt35597_wqxga_dsc_video_timing_info; |
| 312 | panelstruct->panelresetseq |
| 313 | = &nt35597_wqxga_dsc_video_reset_seq; |
| 314 | panelstruct->backlightinfo = &nt35597_wqxga_dsc_video_backlight; |
| 315 | |
| 316 | pinfo->labibb = &nt35597_wqxga_dsc_video_labibb; |
| 317 | |
| 318 | pinfo->mipi.panel_on_cmds |
| 319 | = nt35597_wqxga_dsc_video_on_command; |
| 320 | pinfo->mipi.num_of_panel_on_cmds |
| 321 | = NT35597_WQXGA_DSC_VIDEO_ON_COMMAND; |
| 322 | pinfo->mipi.panel_off_cmds |
| 323 | = nt35597_wqxga_dsc_video_off_command; |
| 324 | pinfo->mipi.num_of_panel_off_cmds |
| 325 | = NT35597_WQXGA_DSC_VIDEO_OFF_COMMAND; |
| 326 | memcpy(phy_db->timing, |
| 327 | nt35597_wqxga_dsc_thulium_video_timings, |
| 328 | MAX_TIMING_CONFIG * sizeof(uint32_t)); |
| 329 | pinfo->mipi.tx_eot_append = true; |
| 330 | |
Ujwal Patel | 41a665a | 2015-07-17 13:51:30 -0700 | [diff] [blame] | 331 | /* |
| 332 | * remove DUAL_PIPE_FLAG because on this target for this panel, |
| 333 | * it will be added based on one of the selected configurations. |
| 334 | */ |
| 335 | panelstruct->paneldata->panel_operating_mode &= ~DUAL_PIPE_FLAG; |
| 336 | panelstruct->config = &nt35597_wqxga_dsc_video_config2; |
| 337 | if (oem_data) { |
| 338 | switch (oem_data->cfg_num[0]) { |
| 339 | case -1: /* default */ |
| 340 | case 0: |
| 341 | panelstruct->config = |
| 342 | &nt35597_wqxga_dsc_video_config0; |
| 343 | break; |
| 344 | case 1: |
| 345 | panelstruct->config = |
| 346 | &nt35597_wqxga_dsc_video_config1; |
| 347 | break; |
| 348 | case 2: |
| 349 | panelstruct->config = |
| 350 | &nt35597_wqxga_dsc_video_config2; |
| 351 | break; |
| 352 | default: |
| 353 | dprintf(CRITICAL, "topology config%d not supported. fallback to default config2\n", |
| 354 | oem_data->cfg_num[0]); |
| 355 | panelstruct->config = &nt35597_wqxga_dsc_video_config2; |
| 356 | } |
| 357 | } |
| 358 | pinfo->lm_split[0] = panelstruct->config->lm_split[0]; |
| 359 | pinfo->lm_split[1] = panelstruct->config->lm_split[1]; |
| 360 | pinfo->num_dsc_enc = panelstruct->config->num_dsc_enc; |
| 361 | |
Kuogee Hsieh | 0b492c9 | 2015-07-08 13:02:36 -0700 | [diff] [blame] | 362 | pinfo->compression_mode = COMPRESSION_DSC; |
Kuogee Hsieh | 0b492c9 | 2015-07-08 13:02:36 -0700 | [diff] [blame] | 363 | pinfo->dsc.parameter_calc = mdss_dsc_parameters_calc; |
| 364 | pinfo->dsc.dsc2buf = mdss_dsc_to_buf; |
| 365 | pinfo->dsc.dsi_dsc_config = mdss_dsc_dsi_config; |
| 366 | pinfo->dsc.mdp_dsc_config = mdss_dsc_mdp_config; |
| 367 | break; |
| 368 | case NT35597_WQXGA_DSC_CMD_PANEL: |
| 369 | pan_type = PANEL_TYPE_DSI; |
| 370 | pinfo->lcd_reg_en = 0; |
| 371 | panelstruct->paneldata = &nt35597_wqxga_dsc_cmd_panel_data; |
| 372 | panelstruct->panelres = &nt35597_wqxga_dsc_cmd_panel_res; |
| 373 | panelstruct->color = &nt35597_wqxga_dsc_cmd_color; |
| 374 | panelstruct->videopanel = &nt35597_wqxga_dsc_cmd_video_panel; |
| 375 | panelstruct->commandpanel = &nt35597_wqxga_dsc_cmd_command_panel; |
| 376 | panelstruct->state = &nt35597_wqxga_dsc_cmd_state; |
| 377 | panelstruct->laneconfig = &nt35597_wqxga_dsc_cmd_lane_config; |
| 378 | panelstruct->paneltiminginfo |
| 379 | = &nt35597_wqxga_dsc_cmd_timing_info; |
| 380 | panelstruct->panelresetseq |
| 381 | = &nt35597_wqxga_dsc_cmd_reset_seq; |
| 382 | panelstruct->backlightinfo = &nt35597_wqxga_dsc_cmd_backlight; |
| 383 | |
| 384 | pinfo->labibb = &nt35597_wqxga_dsc_cmd_labibb; |
| 385 | |
| 386 | pinfo->mipi.panel_on_cmds |
| 387 | = nt35597_wqxga_dsc_cmd_on_command; |
| 388 | pinfo->mipi.num_of_panel_on_cmds |
| 389 | = NT35597_WQXGA_DSC_CMD_ON_COMMAND; |
| 390 | pinfo->mipi.panel_off_cmds |
| 391 | = nt35597_wqxga_dsc_cmd_off_command; |
| 392 | pinfo->mipi.num_of_panel_off_cmds |
| 393 | = NT35597_WQXGA_DSC_CMD_OFF_COMMAND; |
| 394 | memcpy(phy_db->timing, |
| 395 | nt35597_wqxga_dsc_thulium_cmd_timings, |
| 396 | MAX_TIMING_CONFIG * sizeof(uint32_t)); |
| 397 | pinfo->mipi.tx_eot_append = true; |
| 398 | |
Ujwal Patel | 41a665a | 2015-07-17 13:51:30 -0700 | [diff] [blame] | 399 | /* |
| 400 | * remove DUAL_PIPE_FLAG because on this target for this panel, |
| 401 | * it will be added based on one of the selected configurations. |
| 402 | */ |
| 403 | panelstruct->paneldata->panel_operating_mode &= ~DUAL_PIPE_FLAG; |
| 404 | panelstruct->config = &nt35597_wqxga_dsc_cmd_config2; |
| 405 | if (oem_data) { |
| 406 | switch (oem_data->cfg_num[0]) { |
| 407 | case 0: |
| 408 | panelstruct->config = |
| 409 | &nt35597_wqxga_dsc_cmd_config0; |
| 410 | break; |
| 411 | case 1: |
| 412 | panelstruct->config = |
| 413 | &nt35597_wqxga_dsc_cmd_config1; |
| 414 | break; |
| 415 | case -1: /* default */ |
| 416 | case 2: |
| 417 | panelstruct->config = |
| 418 | &nt35597_wqxga_dsc_cmd_config2; |
| 419 | break; |
| 420 | default: |
| 421 | dprintf(CRITICAL, "topology config%d not supported. fallback to default config2\n", |
| 422 | oem_data->cfg_num[0]); |
| 423 | panelstruct->config = &nt35597_wqxga_dsc_cmd_config2; |
| 424 | } |
| 425 | } |
| 426 | |
| 427 | pinfo->lm_split[0] = panelstruct->config->lm_split[0]; |
| 428 | pinfo->lm_split[1] = panelstruct->config->lm_split[1]; |
| 429 | pinfo->num_dsc_enc = panelstruct->config->num_dsc_enc; |
| 430 | |
Kuogee Hsieh | 0b492c9 | 2015-07-08 13:02:36 -0700 | [diff] [blame] | 431 | pinfo->compression_mode = COMPRESSION_DSC; |
Kuogee Hsieh | 0b492c9 | 2015-07-08 13:02:36 -0700 | [diff] [blame] | 432 | pinfo->dsc.parameter_calc = mdss_dsc_parameters_calc; |
| 433 | pinfo->dsc.dsc2buf = mdss_dsc_to_buf; |
| 434 | pinfo->dsc.dsi_dsc_config = mdss_dsc_dsi_config; |
| 435 | pinfo->dsc.mdp_dsc_config = mdss_dsc_mdp_config; |
| 436 | break; |
Dhaval Patel | b95039c | 2015-03-16 11:14:06 -0700 | [diff] [blame] | 437 | case JDI_QHD_DUALDSI_VIDEO_PANEL: |
| 438 | pan_type = PANEL_TYPE_DSI; |
| 439 | pinfo->lcd_reg_en = 1; |
Dhaval Patel | b95039c | 2015-03-16 11:14:06 -0700 | [diff] [blame] | 440 | panelstruct->paneldata = &jdi_qhd_dualdsi_video_panel_data; |
| 441 | |
| 442 | panelstruct->panelres = &jdi_qhd_dualdsi_video_panel_res; |
| 443 | panelstruct->color = &jdi_qhd_dualdsi_video_color; |
| 444 | panelstruct->videopanel = &jdi_qhd_dualdsi_video_video_panel; |
| 445 | panelstruct->commandpanel = &jdi_qhd_dualdsi_video_command_panel; |
| 446 | panelstruct->state = &jdi_qhd_dualdsi_video_state; |
| 447 | panelstruct->laneconfig = &jdi_qhd_dualdsi_video_lane_config; |
| 448 | panelstruct->paneltiminginfo |
| 449 | = &jdi_qhd_dualdsi_video_timing_info; |
| 450 | panelstruct->panelresetseq |
| 451 | = &jdi_qhd_dualdsi_video_reset_seq; |
| 452 | panelstruct->backlightinfo = &jdi_qhd_dualdsi_video_backlight; |
| 453 | pinfo->mipi.panel_on_cmds |
| 454 | = jdi_qhd_dualdsi_video_on_command; |
| 455 | pinfo->mipi.num_of_panel_on_cmds |
| 456 | = JDI_QHD_DUALDSI_VIDEO_ON_COMMAND; |
| 457 | pinfo->mipi.panel_off_cmds |
| 458 | = jdi_qhd_dualdsi_video_off_command; |
| 459 | pinfo->mipi.num_of_panel_off_cmds |
| 460 | = JDI_QHD_DUALDSI_VIDEO_OFF_COMMAND; |
| 461 | memcpy(phy_db->timing, |
| 462 | jdi_qhd_dualdsi_thulium_cmd_timings, |
| 463 | MAX_TIMING_CONFIG * sizeof(uint32_t)); |
| 464 | break; |
| 465 | case JDI_QHD_DUALDSI_CMD_PANEL: |
| 466 | pan_type = PANEL_TYPE_DSI; |
| 467 | pinfo->lcd_reg_en = 1; |
| 468 | panelstruct->paneldata = &jdi_qhd_dualdsi_cmd_panel_data; |
Dhaval Patel | b95039c | 2015-03-16 11:14:06 -0700 | [diff] [blame] | 469 | |
| 470 | panelstruct->panelres = &jdi_qhd_dualdsi_cmd_panel_res; |
| 471 | panelstruct->color = &jdi_qhd_dualdsi_cmd_color; |
| 472 | panelstruct->videopanel = &jdi_qhd_dualdsi_cmd_video_panel; |
| 473 | panelstruct->commandpanel = &jdi_qhd_dualdsi_cmd_command_panel; |
| 474 | panelstruct->state = &jdi_qhd_dualdsi_cmd_state; |
| 475 | panelstruct->laneconfig = &jdi_qhd_dualdsi_cmd_lane_config; |
| 476 | panelstruct->paneltiminginfo |
| 477 | = &jdi_qhd_dualdsi_cmd_timing_info; |
| 478 | panelstruct->panelresetseq |
| 479 | = &jdi_qhd_dualdsi_cmd_reset_seq; |
| 480 | panelstruct->backlightinfo = &jdi_qhd_dualdsi_cmd_backlight; |
| 481 | pinfo->mipi.panel_on_cmds |
| 482 | = jdi_qhd_dualdsi_cmd_on_command; |
| 483 | pinfo->mipi.num_of_panel_on_cmds |
| 484 | = JDI_QHD_DUALDSI_CMD_ON_COMMAND; |
| 485 | pinfo->mipi.panel_off_cmds |
| 486 | = jdi_qhd_dualdsi_cmd_off_command; |
| 487 | pinfo->mipi.num_of_panel_off_cmds |
| 488 | = JDI_QHD_DUALDSI_CMD_OFF_COMMAND; |
| 489 | memcpy(phy_db->timing, |
| 490 | jdi_qhd_dualdsi_thulium_video_timings, |
| 491 | MAX_TIMING_CONFIG * sizeof(uint32_t)); |
| 492 | break; |
feifanz | 76fe648 | 2015-09-02 15:25:16 +0800 | [diff] [blame] | 493 | case R69007_WQXGA_CMD_PANEL: |
| 494 | pan_type = PANEL_TYPE_DSI; |
| 495 | pinfo->lcd_reg_en = 0; |
| 496 | panelstruct->paneldata = &r69007_wqxga_cmd_panel_data; |
| 497 | panelstruct->panelres = &r69007_wqxga_cmd_panel_res; |
| 498 | panelstruct->color = &r69007_wqxga_cmd_color; |
| 499 | panelstruct->videopanel = &r69007_wqxga_cmd_video_panel; |
| 500 | panelstruct->commandpanel = &r69007_wqxga_cmd_command_panel; |
| 501 | panelstruct->state = &r69007_wqxga_cmd_state; |
| 502 | panelstruct->laneconfig = &r69007_wqxga_cmd_lane_config; |
| 503 | panelstruct->paneltiminginfo |
| 504 | = &r69007_wqxga_cmd_timing_info; |
| 505 | panelstruct->panelresetseq |
| 506 | = &r69007_wqxga_cmd_reset_seq; |
| 507 | panelstruct->backlightinfo = &r69007_wqxga_cmd_backlight; |
| 508 | |
| 509 | pinfo->labibb = &r69007_wqxga_cmd_labibb; |
| 510 | |
| 511 | pinfo->mipi.panel_on_cmds |
| 512 | = r69007_wqxga_cmd_on_command; |
| 513 | pinfo->mipi.num_of_panel_on_cmds |
| 514 | = R69007_WQXGA_CMD_ON_COMMAND; |
| 515 | pinfo->mipi.panel_off_cmds |
| 516 | = r69007_wqxga_cmd_off_command; |
| 517 | pinfo->mipi.num_of_panel_off_cmds |
| 518 | = R69007_WQXGA_CMD_OFF_COMMAND; |
| 519 | memcpy(phy_db->timing, |
| 520 | r69007_wqxga_thulium_cmd_timings, |
| 521 | MAX_TIMING_CONFIG * sizeof(uint32_t)); |
| 522 | break; |
Kuogee Hsieh | b976dfc | 2015-08-28 13:21:30 -0700 | [diff] [blame] | 523 | case JDI_4K_DUALDSI_VIDEO_NOFBC_PANEL: |
| 524 | pan_type = PANEL_TYPE_DSI; |
| 525 | /* |
| 526 | * send on_cmds at HS mode by setting cmds_post_tg so that |
| 527 | * on_cmds are sent after timing generator on |
| 528 | */ |
| 529 | pinfo->mipi.cmds_post_tg = 1; |
| 530 | panelstruct->paneldata = &jdi_4k_dualdsi_video_nofbc_panel_data; |
| 531 | |
| 532 | panelstruct->panelres = &jdi_4k_dualdsi_video_nofbc_panel_res; |
| 533 | panelstruct->color = &jdi_4k_dualdsi_video_nofbc_color; |
| 534 | panelstruct->videopanel = &jdi_4k_dualdsi_video_nofbc_video_panel; |
| 535 | panelstruct->commandpanel = &jdi_4k_dualdsi_video_nofbc_command_panel; |
| 536 | panelstruct->state = &jdi_4k_dualdsi_video_nofbc_state; |
| 537 | panelstruct->laneconfig = &jdi_4k_dualdsi_video_nofbc_lane_config; |
| 538 | panelstruct->paneltiminginfo |
| 539 | = &jdi_4k_dualdsi_video_nofbc_timing_info; |
| 540 | panelstruct->panelresetseq |
| 541 | = &jdi_4k_dualdsi_video_nofbc_reset_seq; |
| 542 | panelstruct->backlightinfo = &jdi_4k_dualdsi_video_nofbc_backlight; |
| 543 | pinfo->labibb = &jdi_4k_dualdsi_video_nofbc_labibb; |
| 544 | |
| 545 | pinfo->mipi.panel_on_cmds |
| 546 | = jdi_4k_dualdsi_video_nofbc_on_command; |
| 547 | pinfo->mipi.num_of_panel_on_cmds |
| 548 | = JDI_4K_DUALDSI_VIDEO_NOFBC_ON_COMMAND; |
| 549 | pinfo->mipi.panel_off_cmds |
| 550 | = jdi_4k_dualdsi_video_nofbc_off_command; |
| 551 | pinfo->mipi.num_of_panel_off_cmds |
| 552 | = JDI_4K_DUALDSI_VIDEO_NOFBC_OFF_COMMAND; |
| 553 | memcpy(phy_db->timing, |
| 554 | jdi_4k_dualdsi_thulium_video_nofbc_timings, |
| 555 | MAX_TIMING_CONFIG * sizeof(uint32_t)); |
| 556 | break; |
Dhaval Patel | b95039c | 2015-03-16 11:14:06 -0700 | [diff] [blame] | 557 | default: |
| 558 | case UNKNOWN_PANEL: |
| 559 | pan_type = PANEL_TYPE_UNKNOWN; |
| 560 | break; |
| 561 | } |
Ujwal Patel | 41a665a | 2015-07-17 13:51:30 -0700 | [diff] [blame] | 562 | |
| 563 | dprintf(SPEW, "lm_split[0]=%d lm_split[1]=%d mode=0x%x\n", |
| 564 | pinfo->lm_split[0], pinfo->lm_split[1], |
| 565 | panelstruct->paneldata->panel_operating_mode); |
| 566 | |
Dhaval Patel | b95039c | 2015-03-16 11:14:06 -0700 | [diff] [blame] | 567 | return pan_type; |
| 568 | } |
| 569 | |
| 570 | int oem_panel_select(const char *panel_name, struct panel_struct *panelstruct, |
| 571 | struct msm_panel_info *pinfo, |
| 572 | struct mdss_dsi_phy_ctrl *phy_db) |
| 573 | { |
| 574 | uint32_t hw_id = board_hardware_id(); |
| 575 | int32_t panel_override_id; |
| 576 | |
| 577 | phy_db->pll_type = DSI_PLL_TYPE_THULIUM; |
| 578 | |
| 579 | if (panel_name) { |
| 580 | panel_override_id = panel_name_to_id(supp_panels, |
| 581 | ARRAY_SIZE(supp_panels), panel_name); |
| 582 | |
| 583 | if (panel_override_id < 0) { |
| 584 | dprintf(CRITICAL, "Not able to search the panel:%s\n", |
Padmanabhan Komanduru | bccbcdc | 2015-06-30 16:19:24 +0530 | [diff] [blame] | 585 | panel_name); |
Dhaval Patel | b95039c | 2015-03-16 11:14:06 -0700 | [diff] [blame] | 586 | } else if (panel_override_id < UNKNOWN_PANEL) { |
| 587 | /* panel override using fastboot oem command */ |
| 588 | panel_id = panel_override_id; |
| 589 | |
| 590 | dprintf(INFO, "OEM panel override:%s\n", |
Padmanabhan Komanduru | bccbcdc | 2015-06-30 16:19:24 +0530 | [diff] [blame] | 591 | panel_name); |
Dhaval Patel | b95039c | 2015-03-16 11:14:06 -0700 | [diff] [blame] | 592 | goto panel_init; |
| 593 | } |
| 594 | } |
| 595 | |
| 596 | switch (hw_id) { |
| 597 | case HW_PLATFORM_MTP: |
| 598 | case HW_PLATFORM_FLUID: |
| 599 | case HW_PLATFORM_SURF: |
| 600 | panel_id = SHARP_WQXGA_DUALDSI_VIDEO_PANEL; |
| 601 | break; |
feifanz | 76fe648 | 2015-09-02 15:25:16 +0800 | [diff] [blame] | 602 | case HW_PLATFORM_QRD: |
| 603 | panel_id = R69007_WQXGA_CMD_PANEL; |
| 604 | break; |
Kuogee Hsieh | b976dfc | 2015-08-28 13:21:30 -0700 | [diff] [blame] | 605 | case HW_PLATFORM_LIQUID: |
| 606 | panel_id = JDI_4K_DUALDSI_VIDEO_NOFBC_PANEL; |
| 607 | break; |
Dhaval Patel | b95039c | 2015-03-16 11:14:06 -0700 | [diff] [blame] | 608 | default: |
| 609 | dprintf(CRITICAL, "Display not enabled for %d HW type\n" |
| 610 | , hw_id); |
| 611 | return PANEL_TYPE_UNKNOWN; |
| 612 | } |
| 613 | |
| 614 | panel_init: |
| 615 | return init_panel_data(panelstruct, pinfo, phy_db); |
| 616 | } |