Umang Agrawal | d193994 | 2018-02-13 16:23:58 +0530 | [diff] [blame] | 1 | /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -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 <string.h> |
| 32 | #include <smem.h> |
| 33 | #include <err.h> |
| 34 | #include <msm_panel.h> |
| 35 | #include <mipi_dsi.h> |
| 36 | #include <pm8x41.h> |
| 37 | #include <pm8x41_wled.h> |
| 38 | #include <qpnp_wled.h> |
Umang Agrawal | d193994 | 2018-02-13 16:23:58 +0530 | [diff] [blame] | 39 | #include <qpnp_lcdb.h> |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 40 | #include <board.h> |
| 41 | #include <mdp5.h> |
| 42 | #include <scm.h> |
| 43 | #include <regulator.h> |
| 44 | #include <platform/clock.h> |
| 45 | #include <platform/gpio.h> |
| 46 | #include <platform/iomap.h> |
| 47 | #include <target/display.h> |
| 48 | #include <qtimer.h> |
Padmanabhan Komanduru | 3cb0766 | 2015-06-08 17:13:33 +0530 | [diff] [blame] | 49 | #include <platform.h> |
Umang Agrawal | d193994 | 2018-02-13 16:23:58 +0530 | [diff] [blame] | 50 | #include <target.h> |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 51 | |
| 52 | #include "include/panel.h" |
| 53 | #include "include/display_resource.h" |
| 54 | #include "gcdb_display.h" |
| 55 | |
Lei Chen | 2c11b46 | 2018-04-11 18:42:37 +0800 | [diff] [blame] | 56 | #define PWM_DUTY_US 13 |
| 57 | #define PWM_PERIOD_US 27 |
| 58 | |
Ashish Garg | 9cfd6ca | 2016-12-20 01:41:54 +0530 | [diff] [blame] | 59 | #define TRULY_720P_VID_PANEL "truly_720p_video" |
| 60 | #define TRULY_720P_CMD_PANEL "truly_720p_cmd" |
| 61 | |
| 62 | #define HDMI_ADV_PANEL_STRING "1:dsi:0:qcom,mdss_dsi_adv7533_1080p:1:none:cfg:single_dsi" |
| 63 | #define TRULY_VID_PANEL_STRING "1:dsi:0:qcom,mdss_dsi_truly_720p_video:1:none:cfg:single_dsi" |
| 64 | #define TRULY_CMD_PANEL_STRING "1:dsi:0:qcom,mdss_dsi_truly_720p_cmd:1:none:cfg:single_dsi" |
| 65 | |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 66 | /*---------------------------------------------------------------------------*/ |
| 67 | /* GPIO configuration */ |
| 68 | /*---------------------------------------------------------------------------*/ |
| 69 | static struct gpio_pin reset_gpio = { |
| 70 | "msmgpio", 0, 3, 1, 0, 1 |
| 71 | }; |
| 72 | |
| 73 | static struct gpio_pin enable_gpio = { |
| 74 | "msmgpio", 90, 3, 1, 0, 1 |
| 75 | }; |
| 76 | |
| 77 | static struct gpio_pin bkl_gpio = { |
| 78 | "msmgpio", 91, 3, 1, 0, 1 |
| 79 | }; |
| 80 | |
Padmanabhan Komanduru | 3cb0766 | 2015-06-08 17:13:33 +0530 | [diff] [blame] | 81 | static struct gpio_pin lcd_mode_gpio = { |
| 82 | "msmgpio", 107, 3, 1, 0, 1 |
| 83 | }; |
| 84 | |
Padmanabhan Komanduru | 2ab03a6 | 2018-05-17 14:38:59 +0530 | [diff] [blame] | 85 | static struct gpio_pin bkl_en_gpio = { |
| 86 | "pm8953", 4, 3, 1, 0, 1 |
| 87 | }; |
| 88 | |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 89 | #define VCO_DELAY_USEC 1000 |
| 90 | #define GPIO_STATE_LOW 0 |
| 91 | #define GPIO_STATE_HIGH 2 |
| 92 | #define RESET_GPIO_SEQ_LEN 3 |
| 93 | #define PMIC_WLED_SLAVE_ID 3 |
| 94 | |
Padmanabhan Komanduru | b338193 | 2015-06-15 22:14:02 +0530 | [diff] [blame] | 95 | #define DSI0_BASE_ADJUST -0x4000 |
| 96 | #define DSI0_PHY_BASE_ADJUST -0x4100 |
| 97 | #define DSI0_PHY_PLL_BASE_ADJUST -0x3900 |
Padmanabhan Komanduru | 2ab03a6 | 2018-05-17 14:38:59 +0530 | [diff] [blame] | 98 | #define DSI0_12NM_PHY_PLL_BASE_ADJUST -0x3F00 |
Padmanabhan Komanduru | b338193 | 2015-06-15 22:14:02 +0530 | [diff] [blame] | 99 | #define DSI0_PHY_REGULATOR_BASE_ADJUST -0x3C00 |
Padmanabhan Komanduru | 2ab03a6 | 2018-05-17 14:38:59 +0530 | [diff] [blame] | 100 | #define DSI1_12NM_PHY_PLL_BASE_ADJUST -0x600 |
Padmanabhan Komanduru | b338193 | 2015-06-15 22:14:02 +0530 | [diff] [blame] | 101 | |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 102 | static void mdss_dsi_uniphy_pll_sw_reset_8952(uint32_t pll_base) |
| 103 | { |
| 104 | writel(0x01, pll_base + 0x0068); /* PLL TEST CFG */ |
| 105 | mdelay(1); |
| 106 | writel(0x00, pll_base + 0x0068); /* PLL TEST CFG */ |
| 107 | mdelay(1); |
| 108 | } |
| 109 | |
| 110 | static void dsi_pll_toggle_lock_detect_8952(uint32_t pll_base) |
| 111 | { |
| 112 | writel(0x04, pll_base + 0x0064); /* LKDetect CFG2 */ |
| 113 | udelay(1); |
| 114 | writel(0x05, pll_base + 0x0064); /* LKDetect CFG2 */ |
| 115 | udelay(512); |
| 116 | } |
| 117 | |
| 118 | static void dsi_pll_sw_reset_8952(uint32_t pll_base) |
| 119 | { |
| 120 | writel(0x01, pll_base + 0x0068); /* PLL TEST CFG */ |
| 121 | udelay(1); |
| 122 | writel(0x00, pll_base + 0x0068); /* PLL TEST CFG */ |
Padmanabhan Komanduru | 6cf6352 | 2015-06-08 14:48:00 +0530 | [diff] [blame] | 123 | udelay(1); |
| 124 | } |
| 125 | |
| 126 | static uint32_t dsi_pll_lock_status_8956(uint32_t pll_base) |
| 127 | { |
| 128 | uint32_t counter, status; |
| 129 | |
| 130 | status = readl(pll_base + 0x00c0) & 0x01; |
| 131 | for (counter = 0; counter < 5 && !status; counter++) { |
| 132 | udelay(100); |
| 133 | status = readl(pll_base + 0x00c0) & 0x01; |
| 134 | } |
| 135 | |
| 136 | return status; |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 137 | } |
| 138 | |
| 139 | static uint32_t gf_1_dsi_pll_enable_sequence_8952(uint32_t pll_base) |
| 140 | { |
| 141 | uint32_t rc; |
| 142 | |
| 143 | dsi_pll_sw_reset_8952(pll_base); |
| 144 | |
| 145 | /* |
| 146 | * Add hardware recommended delays between register writes for |
| 147 | * the updates to take effect. These delays are necessary for the |
| 148 | * PLL to successfully lock |
| 149 | */ |
| 150 | writel(0x14, pll_base + 0x0070); /* CAL CFG1*/ |
| 151 | writel(0x01, pll_base + 0x0020); /* GLB CFG */ |
| 152 | writel(0x05, pll_base + 0x0020); /* GLB CFG */ |
| 153 | udelay(3); |
| 154 | writel(0x0f, pll_base + 0x0020); /* GLB CFG */ |
| 155 | udelay(500); |
| 156 | |
| 157 | dsi_pll_toggle_lock_detect_8952(pll_base); |
| 158 | rc = readl(pll_base + 0x00c0) & 0x01; |
| 159 | |
| 160 | return rc; |
| 161 | } |
| 162 | |
| 163 | static uint32_t gf_2_dsi_pll_enable_sequence_8952(uint32_t pll_base) |
| 164 | { |
| 165 | uint32_t rc; |
| 166 | |
| 167 | dsi_pll_sw_reset_8952(pll_base); |
| 168 | |
| 169 | /* |
| 170 | * Add hardware recommended delays between register writes for |
| 171 | * the updates to take effect. These delays are necessary for the |
| 172 | * PLL to successfully lock |
| 173 | */ |
| 174 | writel(0x04, pll_base + 0x0070); /* CAL CFG1*/ |
| 175 | writel(0x01, pll_base + 0x0020); /* GLB CFG */ |
| 176 | writel(0x05, pll_base + 0x0020); /* GLB CFG */ |
| 177 | udelay(3); |
| 178 | writel(0x0f, pll_base + 0x0020); /* GLB CFG */ |
| 179 | udelay(500); |
| 180 | |
| 181 | dsi_pll_toggle_lock_detect_8952(pll_base); |
| 182 | rc = readl(pll_base + 0x00c0) & 0x01; |
| 183 | |
| 184 | return rc; |
| 185 | } |
| 186 | |
| 187 | static uint32_t tsmc_dsi_pll_enable_sequence_8952(uint32_t pll_base) |
| 188 | { |
| 189 | uint32_t rc; |
| 190 | |
| 191 | dsi_pll_sw_reset_8952(pll_base); |
| 192 | /* |
| 193 | * Add hardware recommended delays between register writes for |
| 194 | * the updates to take effect. These delays are necessary for the |
| 195 | * PLL to successfully lock |
| 196 | */ |
| 197 | |
| 198 | writel(0x34, pll_base + 0x0070); /* CAL CFG1*/ |
| 199 | writel(0x01, pll_base + 0x0020); /* GLB CFG */ |
| 200 | writel(0x05, pll_base + 0x0020); /* GLB CFG */ |
| 201 | writel(0x0f, pll_base + 0x0020); /* GLB CFG */ |
| 202 | udelay(500); |
| 203 | |
| 204 | dsi_pll_toggle_lock_detect_8952(pll_base); |
| 205 | rc = readl(pll_base + 0x00c0) & 0x01; |
| 206 | |
| 207 | return rc; |
| 208 | } |
| 209 | |
| 210 | |
| 211 | static uint32_t dsi_pll_enable_seq_8952(uint32_t pll_base) |
| 212 | { |
| 213 | uint32_t pll_locked = 0; |
| 214 | uint32_t counter = 0; |
| 215 | |
| 216 | do { |
| 217 | pll_locked = tsmc_dsi_pll_enable_sequence_8952(pll_base); |
| 218 | |
| 219 | dprintf(SPEW, "TSMC pll locked status is %d\n", pll_locked); |
| 220 | ++counter; |
| 221 | } while (!pll_locked && (counter < 3)); |
| 222 | |
| 223 | if(!pll_locked) { |
| 224 | counter = 0; |
| 225 | do { |
| 226 | pll_locked = gf_1_dsi_pll_enable_sequence_8952(pll_base); |
| 227 | |
| 228 | dprintf(SPEW, "GF P1 pll locked status is %d\n", pll_locked); |
| 229 | ++counter; |
| 230 | } while (!pll_locked && (counter < 3)); |
| 231 | } |
| 232 | |
| 233 | if(!pll_locked) { |
| 234 | counter = 0; |
| 235 | do { |
| 236 | pll_locked = gf_2_dsi_pll_enable_sequence_8952(pll_base); |
| 237 | |
| 238 | dprintf(SPEW, "GF P2 pll locked status is %d\n", pll_locked); |
| 239 | ++counter; |
| 240 | } while (!pll_locked && (counter < 3)); |
| 241 | } |
| 242 | |
| 243 | return pll_locked; |
| 244 | } |
| 245 | |
Padmanabhan Komanduru | 6cf6352 | 2015-06-08 14:48:00 +0530 | [diff] [blame] | 246 | static uint32_t dsi_pll_enable_seq_8956(uint32_t pll_base) |
| 247 | { |
| 248 | /* |
| 249 | * PLL power up sequence |
| 250 | * Add necessary delays recommended by h/w team |
| 251 | */ |
| 252 | |
| 253 | /* Lock Detect setting */ |
| 254 | writel(0x0d, pll_base + 0x0064); /* LKDetect CFG2 */ |
| 255 | writel(0x34, pll_base + 0x0070); /* PLL CAL_CFG1 */ |
| 256 | writel(0x10, pll_base + 0x005c); /* LKDetect CFG0 */ |
| 257 | writel(0x1a, pll_base + 0x0060); /* LKDetect CFG1 */ |
| 258 | |
| 259 | writel(0x01, pll_base + 0x0020); /* GLB CFG */ |
| 260 | udelay(300); |
| 261 | writel(0x05, pll_base + 0x0020); /* GLB CFG */ |
| 262 | udelay(300); |
| 263 | writel(0x0f, pll_base + 0x0020); /* GLB CFG */ |
| 264 | udelay(300); |
| 265 | writel(0x07, pll_base + 0x0020); /* GLB CFG */ |
| 266 | udelay(300); |
| 267 | writel(0x0f, pll_base + 0x0020); /* GLB CFG */ |
| 268 | udelay(1000); |
| 269 | |
| 270 | return dsi_pll_lock_status_8956(pll_base); |
| 271 | } |
| 272 | |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 273 | static int msm8952_wled_backlight_ctrl(uint8_t enable) |
| 274 | { |
| 275 | uint8_t slave_id = PMIC_WLED_SLAVE_ID; /* pmi */ |
| 276 | |
| 277 | pm8x41_wled_config_slave_id(slave_id); |
Umang Agrawal | d193994 | 2018-02-13 16:23:58 +0530 | [diff] [blame] | 278 | if (target_get_pmic() == PMIC_IS_PMI632) { |
| 279 | qpnp_lcdb_enable(enable); |
| 280 | } |
| 281 | else { |
| 282 | qpnp_wled_enable_backlight(enable); |
| 283 | qpnp_ibb_enable(enable); |
| 284 | } |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 285 | return NO_ERROR; |
| 286 | } |
| 287 | |
Lei Chen | 2c11b46 | 2018-04-11 18:42:37 +0800 | [diff] [blame] | 288 | static int pwm_backlight_ctrl(uint8_t enable) |
| 289 | { |
| 290 | if (enable) { |
| 291 | pm_pwm_enable(false); |
| 292 | pm_pwm_config(PWM_DUTY_US, PWM_PERIOD_US); |
| 293 | pm_pwm_enable(true); |
| 294 | } else { |
| 295 | pm_pwm_enable(false); |
| 296 | } |
| 297 | |
| 298 | return NO_ERROR; |
| 299 | } |
| 300 | |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 301 | int target_backlight_ctrl(struct backlight *bl, uint8_t enable) |
| 302 | { |
| 303 | uint32_t ret = NO_ERROR; |
| 304 | |
| 305 | if (bl->bl_interface_type == BL_DCS) |
| 306 | return ret; |
| 307 | |
Lei Chen | 2c11b46 | 2018-04-11 18:42:37 +0800 | [diff] [blame] | 308 | if ((target_get_pmic() == PMIC_IS_PMI632) && |
| 309 | (bl->bl_interface_type == BL_PWM)) { |
| 310 | ret = pwm_backlight_ctrl(enable); |
| 311 | } else { |
| 312 | ret = msm8952_wled_backlight_ctrl(enable); |
| 313 | } |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 314 | return ret; |
| 315 | } |
| 316 | |
Padmanabhan Komanduru | 77a979a | 2015-06-15 15:03:23 +0530 | [diff] [blame] | 317 | static int32_t mdss_dsi_pll_config(uint32_t pll_base, uint32_t ctl_base, |
| 318 | struct mdss_dsi_pll_config *pll_data) |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 319 | { |
| 320 | int32_t ret = 0; |
Padmanabhan Komanduru | 77a979a | 2015-06-15 15:03:23 +0530 | [diff] [blame] | 321 | if (!platform_is_msm8956()) |
| 322 | mdss_dsi_uniphy_pll_sw_reset_8952(pll_base); |
| 323 | else |
| 324 | dsi_pll_sw_reset_8952(pll_base); |
| 325 | mdss_dsi_auto_pll_config(pll_base, ctl_base, pll_data); |
| 326 | if (platform_is_msm8956()) |
| 327 | ret = dsi_pll_enable_seq_8956(pll_base); |
| 328 | else |
| 329 | ret = dsi_pll_enable_seq_8952(pll_base); |
| 330 | |
| 331 | return ret; |
| 332 | } |
| 333 | |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 334 | int target_panel_clock(uint8_t enable, struct msm_panel_info *pinfo) |
| 335 | { |
Padmanabhan Komanduru | 82ae713 | 2015-06-08 15:46:33 +0530 | [diff] [blame] | 336 | int32_t ret = 0, flags; |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 337 | struct mdss_dsi_pll_config *pll_data; |
| 338 | dprintf(SPEW, "target_panel_clock\n"); |
| 339 | |
Padmanabhan Komanduru | 82ae713 | 2015-06-08 15:46:33 +0530 | [diff] [blame] | 340 | if (pinfo->dest == DISPLAY_2) { |
| 341 | flags = MMSS_DSI_CLKS_FLAG_DSI1; |
| 342 | if (pinfo->mipi.dual_dsi) |
| 343 | flags |= MMSS_DSI_CLKS_FLAG_DSI0; |
| 344 | } else { |
| 345 | flags = MMSS_DSI_CLKS_FLAG_DSI0; |
| 346 | if (pinfo->mipi.dual_dsi) |
| 347 | flags |= MMSS_DSI_CLKS_FLAG_DSI1; |
| 348 | } |
| 349 | |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 350 | pll_data = pinfo->mipi.dsi_pll_config; |
| 351 | pll_data->vco_delay = VCO_DELAY_USEC; |
| 352 | |
Padmanabhan Komanduru | f68f51b | 2015-12-21 18:32:12 +0530 | [diff] [blame] | 353 | /* SSC parameters */ |
Parth Dixit | 05f3c9f | 2016-03-18 17:14:57 +0530 | [diff] [blame] | 354 | if (platform_is_msm8937() || platform_is_msm8917()) { |
Padmanabhan Komanduru | f68f51b | 2015-12-21 18:32:12 +0530 | [diff] [blame] | 355 | pll_data->ssc_en = true; |
| 356 | pll_data->is_center_spread = false; |
| 357 | pll_data->ssc_freq = 30000; |
| 358 | pll_data->ssc_ppm = 5000; |
Padmanabhan Komanduru | e54f761 | 2018-05-03 09:29:50 +0530 | [diff] [blame] | 359 | } else if (platform_is_sdm439() || platform_is_sdm429()) { |
| 360 | pll_data->ssc_en = true; |
| 361 | pll_data->is_center_spread = false; |
| 362 | pll_data->ssc_freq = 31500; |
| 363 | pll_data->ssc_ppm = 5000; |
Padmanabhan Komanduru | f68f51b | 2015-12-21 18:32:12 +0530 | [diff] [blame] | 364 | } |
| 365 | |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 366 | if (enable) { |
| 367 | mdp_gdsc_ctrl(enable); |
| 368 | mdss_bus_clocks_enable(); |
| 369 | mdp_clock_enable(); |
| 370 | ret = restore_secure_cfg(SECURE_DEVICE_MDSS); |
| 371 | if (ret) { |
| 372 | dprintf(CRITICAL, |
| 373 | "%s: Failed to restore MDP security configs", |
| 374 | __func__); |
| 375 | mdp_clock_disable(); |
| 376 | mdss_bus_clocks_disable(); |
| 377 | mdp_gdsc_ctrl(0); |
| 378 | return ret; |
| 379 | } |
Padmanabhan Komanduru | 77a979a | 2015-06-15 15:03:23 +0530 | [diff] [blame] | 380 | |
Padmanabhan Komanduru | 62eec85 | 2018-05-14 12:27:30 +0530 | [diff] [blame] | 381 | gcc_dsi_lp_clock_enable(flags); |
| 382 | |
Padmanabhan Komanduru | 2ab03a6 | 2018-05-17 14:38:59 +0530 | [diff] [blame] | 383 | if (platform_is_sdm439() || platform_is_sdm429()) { |
| 384 | mdss_dsi_auto_pll_12nm_config(pinfo); |
| 385 | |
| 386 | /* |
| 387 | * enable clock/data lane in DSI controller |
| 388 | * before enabling DSI PLL for 12nm PHY |
| 389 | */ |
| 390 | if (pinfo->lane_config) |
| 391 | pinfo->lane_config(pinfo); |
| 392 | |
| 393 | ret = mdss_dsi_auto_pll_12nm_enable(pinfo); |
| 394 | if (!ret) |
| 395 | dprintf(CRITICAL, "unable to ON 12nm PLL\n"); |
| 396 | } else { |
| 397 | ret = mdss_dsi_pll_config(pinfo->mipi.pll_base, |
| 398 | pinfo->mipi.ctl_base, pll_data); |
| 399 | if (!ret) |
| 400 | dprintf(CRITICAL, "unable to ON master pll\n"); |
| 401 | } |
Padmanabhan Komanduru | 77a979a | 2015-06-15 15:03:23 +0530 | [diff] [blame] | 402 | |
Padmanabhan Komanduru | 2a6c345 | 2015-09-09 18:46:06 +0530 | [diff] [blame] | 403 | if (platform_is_msm8956() && pinfo->mipi.dual_dsi && |
| 404 | !platform_is_msm8976_v_1_1()) { |
Padmanabhan Komanduru | 77a979a | 2015-06-15 15:03:23 +0530 | [diff] [blame] | 405 | ret = mdss_dsi_pll_config(pinfo->mipi.spll_base, |
| 406 | pinfo->mipi.sctl_base, pll_data); |
| 407 | if (!ret) |
| 408 | dprintf(CRITICAL, "Not able to enable second pll\n"); |
| 409 | } |
| 410 | |
Padmanabhan Komanduru | 62eec85 | 2018-05-14 12:27:30 +0530 | [diff] [blame] | 411 | gcc_dsi_hs_clocks_enable(flags, pinfo->mipi.use_dsi1_pll, |
Padmanabhan Komanduru | 2a6c345 | 2015-09-09 18:46:06 +0530 | [diff] [blame] | 412 | pll_data->pclk_m, pll_data->pclk_n, pll_data->pclk_d); |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 413 | } else if(!target_cont_splash_screen()) { |
Padmanabhan Komanduru | 82ae713 | 2015-06-08 15:46:33 +0530 | [diff] [blame] | 414 | gcc_dsi_clocks_disable(flags); |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 415 | mdp_clock_disable(); |
| 416 | mdss_bus_clocks_disable(); |
| 417 | mdp_gdsc_ctrl(enable); |
| 418 | } |
| 419 | |
| 420 | return 0; |
| 421 | } |
| 422 | |
| 423 | int target_panel_reset(uint8_t enable, struct panel_reset_sequence *resetseq, |
| 424 | struct msm_panel_info *pinfo) |
| 425 | { |
| 426 | int ret = NO_ERROR; |
Sujeev Dias | 6bc9fa3 | 2015-08-03 23:13:44 -0700 | [diff] [blame] | 427 | uint32_t hw_id = board_hardware_id(); |
| 428 | uint32_t hw_subtype = board_hardware_subtype(); |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 429 | |
Padmanabhan Komanduru | 3cb0766 | 2015-06-08 17:13:33 +0530 | [diff] [blame] | 430 | if (platform_is_msm8956()) { |
| 431 | reset_gpio.pin_id = 25; |
| 432 | bkl_gpio.pin_id = 66; |
Padmanabhan Komanduru | b323132 | 2015-11-12 16:54:21 +0530 | [diff] [blame] | 433 | } else if (platform_is_msm8937()) { |
| 434 | reset_gpio.pin_id = 60; |
| 435 | bkl_gpio.pin_id = 98; |
| 436 | enable_gpio.pin_id = 99; |
Parth Dixit | 05f3c9f | 2016-03-18 17:14:57 +0530 | [diff] [blame] | 437 | } else if (platform_is_msm8917()) { |
Jayant Shekhar | 9c0533e | 2016-01-28 11:17:18 +0530 | [diff] [blame] | 438 | reset_gpio.pin_id = 60; |
| 439 | bkl_gpio.pin_id = 98; |
| 440 | pinfo->mipi.use_enable_gpio = 0; |
Padmanabhan Komanduru | 2ab03a6 | 2018-05-17 14:38:59 +0530 | [diff] [blame] | 441 | } else if (platform_is_sdm439() || platform_is_sdm429()) { |
| 442 | reset_gpio.pin_id = 60; |
Sujeev Dias | 6bc9fa3 | 2015-08-03 23:13:44 -0700 | [diff] [blame] | 443 | } else if ((hw_id == HW_PLATFORM_QRD) && |
| 444 | (hw_subtype == HW_PLATFORM_SUBTYPE_POLARIS)) { |
| 445 | enable_gpio.pin_id = 19; |
Padmanabhan Komanduru | 3cb0766 | 2015-06-08 17:13:33 +0530 | [diff] [blame] | 446 | } |
| 447 | |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 448 | if (enable) { |
Padmanabhan Komanduru | 3cb0766 | 2015-06-08 17:13:33 +0530 | [diff] [blame] | 449 | if (pinfo->mipi.use_enable_gpio && !platform_is_msm8956()) { |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 450 | gpio_tlmm_config(enable_gpio.pin_id, 0, |
| 451 | enable_gpio.pin_direction, enable_gpio.pin_pull, |
| 452 | enable_gpio.pin_strength, |
| 453 | enable_gpio.pin_state); |
| 454 | |
| 455 | gpio_set_dir(enable_gpio.pin_id, 2); |
| 456 | } |
| 457 | |
Padmanabhan Komanduru | 2ab03a6 | 2018-05-17 14:38:59 +0530 | [diff] [blame] | 458 | if (platform_is_sdm439() || platform_is_sdm429()) { |
| 459 | /* enable PM GPIO-4 for backlight enable */ |
| 460 | struct pm8x41_gpio gpio_param = { |
| 461 | .direction = PM_GPIO_DIR_OUT, |
| 462 | .function = PM_GPIO_FUNC_HIGH, |
| 463 | .vin_sel = 0, /* VIN_0 */ |
| 464 | .pull = PM_GPIO_NO_PULL, |
| 465 | .output_buffer = PM_GPIO_OUT_CMOS, |
| 466 | .out_strength = PM_GPIO_OUT_DRIVE_HIGH, |
| 467 | }; |
| 468 | |
| 469 | dprintf(SPEW, "%s: gpio=%d enable=%d\n", __func__, |
| 470 | bkl_en_gpio.pin_id, enable); |
| 471 | |
| 472 | pm8x41_gpio_config(bkl_en_gpio.pin_id, &gpio_param); |
| 473 | } else { |
| 474 | gpio_tlmm_config(bkl_gpio.pin_id, 0, |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 475 | bkl_gpio.pin_direction, bkl_gpio.pin_pull, |
| 476 | bkl_gpio.pin_strength, bkl_gpio.pin_state); |
| 477 | |
Padmanabhan Komanduru | 2ab03a6 | 2018-05-17 14:38:59 +0530 | [diff] [blame] | 478 | gpio_set_dir(bkl_gpio.pin_id, 2); |
| 479 | } |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 480 | |
| 481 | gpio_tlmm_config(reset_gpio.pin_id, 0, |
| 482 | reset_gpio.pin_direction, reset_gpio.pin_pull, |
| 483 | reset_gpio.pin_strength, reset_gpio.pin_state); |
| 484 | |
| 485 | gpio_set_dir(reset_gpio.pin_id, 2); |
| 486 | |
| 487 | /* reset */ |
| 488 | for (int i = 0; i < RESET_GPIO_SEQ_LEN; i++) { |
| 489 | if (resetseq->pin_state[i] == GPIO_STATE_LOW) |
| 490 | gpio_set_dir(reset_gpio.pin_id, GPIO_STATE_LOW); |
| 491 | else |
| 492 | gpio_set_dir(reset_gpio.pin_id, GPIO_STATE_HIGH); |
| 493 | mdelay(resetseq->sleep[i]); |
| 494 | } |
Padmanabhan Komanduru | 3cb0766 | 2015-06-08 17:13:33 +0530 | [diff] [blame] | 495 | |
| 496 | if (platform_is_msm8956()) { |
| 497 | gpio_tlmm_config(lcd_mode_gpio.pin_id, 0, |
| 498 | lcd_mode_gpio.pin_direction, lcd_mode_gpio.pin_pull, |
| 499 | lcd_mode_gpio.pin_strength, lcd_mode_gpio.pin_state); |
| 500 | |
| 501 | if (pinfo->lcdc.split_display || pinfo->lcdc.dst_split) |
| 502 | gpio_set_dir(lcd_mode_gpio.pin_id, GPIO_STATE_LOW); |
| 503 | else |
| 504 | gpio_set_dir(lcd_mode_gpio.pin_id, GPIO_STATE_HIGH); |
| 505 | } |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 506 | } else if(!target_cont_splash_screen()) { |
| 507 | gpio_set_dir(reset_gpio.pin_id, 0); |
Padmanabhan Komanduru | 3cb0766 | 2015-06-08 17:13:33 +0530 | [diff] [blame] | 508 | if (pinfo->mipi.use_enable_gpio && !platform_is_msm8956()) |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 509 | gpio_set_dir(enable_gpio.pin_id, 0); |
Padmanabhan Komanduru | 3cb0766 | 2015-06-08 17:13:33 +0530 | [diff] [blame] | 510 | if (platform_is_msm8956()) |
| 511 | gpio_set_dir(lcd_mode_gpio.pin_id, 0); |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 512 | } |
| 513 | |
| 514 | return ret; |
| 515 | } |
| 516 | |
Sandeep Panda | aa4ea2f | 2016-07-05 13:52:25 +0530 | [diff] [blame] | 517 | static int wled_init(struct msm_panel_info *pinfo) |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 518 | { |
| 519 | struct qpnp_wled_config_data config = {0}; |
| 520 | struct labibb_desc *labibb; |
| 521 | int display_type = 0; |
Vishnuvardhan Prodduturi | 4aa8dc4 | 2015-10-20 21:20:43 +0530 | [diff] [blame] | 522 | bool swire_control = 0; |
| 523 | bool wled_avdd_control = 0; |
Sandeep Panda | aa4ea2f | 2016-07-05 13:52:25 +0530 | [diff] [blame] | 524 | int rc = NO_ERROR; |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 525 | |
| 526 | labibb = pinfo->labibb; |
| 527 | |
| 528 | if (labibb) |
| 529 | display_type = labibb->amoled_panel; |
| 530 | |
Vishnuvardhan Prodduturi | 4aa8dc4 | 2015-10-20 21:20:43 +0530 | [diff] [blame] | 531 | if (display_type) { |
| 532 | swire_control = labibb->swire_control; |
| 533 | wled_avdd_control = true; |
| 534 | } else { |
| 535 | swire_control = false; |
| 536 | wled_avdd_control = false; |
| 537 | } |
| 538 | |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 539 | config.display_type = display_type; |
| 540 | config.lab_init_volt = 4600000; /* fixed, see pmi register */ |
| 541 | config.ibb_init_volt = 1400000; /* fixed, see pmi register */ |
Vishnuvardhan Prodduturi | 4aa8dc4 | 2015-10-20 21:20:43 +0530 | [diff] [blame] | 542 | config.lab_ibb_swire_control = swire_control; |
| 543 | config.wled_avdd_control = wled_avdd_control; |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 544 | |
Vishnuvardhan Prodduturi | 4aa8dc4 | 2015-10-20 21:20:43 +0530 | [diff] [blame] | 545 | if(!swire_control) { |
| 546 | if (labibb && labibb->force_config) { |
| 547 | config.lab_min_volt = labibb->lab_min_volt; |
| 548 | config.lab_max_volt = labibb->lab_max_volt; |
| 549 | config.ibb_min_volt = labibb->ibb_min_volt; |
| 550 | config.ibb_max_volt = labibb->ibb_max_volt; |
| 551 | config.pwr_up_delay = labibb->pwr_up_delay; |
| 552 | config.pwr_down_delay = labibb->pwr_down_delay; |
| 553 | config.ibb_discharge_en = labibb->ibb_discharge_en; |
| 554 | } else { |
| 555 | /* default */ |
| 556 | config.pwr_up_delay = 3; |
| 557 | config.pwr_down_delay = 3; |
| 558 | config.ibb_discharge_en = 1; |
| 559 | if (display_type) { /* amoled */ |
| 560 | config.lab_min_volt = 4600000; |
| 561 | config.lab_max_volt = 4600000; |
| 562 | config.ibb_min_volt = 4000000; |
| 563 | config.ibb_max_volt = 4000000; |
| 564 | } else { /* lcd */ |
| 565 | config.lab_min_volt = 5500000; |
| 566 | config.lab_max_volt = 5500000; |
| 567 | config.ibb_min_volt = 5500000; |
| 568 | config.ibb_max_volt = 5500000; |
| 569 | } |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 570 | } |
| 571 | } |
| 572 | |
| 573 | dprintf(SPEW, "%s: %d %d %d %d %d %d %d %d %d %d\n", __func__, |
| 574 | config.display_type, |
| 575 | config.lab_min_volt, config.lab_max_volt, |
| 576 | config.ibb_min_volt, config.ibb_max_volt, |
| 577 | config.lab_init_volt, config.ibb_init_volt, |
| 578 | config.pwr_up_delay, config.pwr_down_delay, |
| 579 | config.ibb_discharge_en); |
| 580 | |
| 581 | /* QPNP WLED init for display backlight */ |
| 582 | pm8x41_wled_config_slave_id(PMIC_WLED_SLAVE_ID); |
| 583 | |
Umang Agrawal | d193994 | 2018-02-13 16:23:58 +0530 | [diff] [blame] | 584 | if (target_get_pmic() == PMIC_IS_PMI632) |
| 585 | rc = qpnp_lcdb_init(&config); |
| 586 | else |
| 587 | rc = qpnp_wled_init(&config); |
Sandeep Panda | aa4ea2f | 2016-07-05 13:52:25 +0530 | [diff] [blame] | 588 | |
| 589 | return rc; |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 590 | } |
| 591 | |
Dhaval Patel | 7709c41 | 2015-05-12 10:09:41 -0700 | [diff] [blame] | 592 | int target_dsi_phy_config(struct mdss_dsi_phy_ctrl *phy_db) |
| 593 | { |
| 594 | memcpy(phy_db->regulator, panel_regulator_settings, REGULATOR_SIZE); |
| 595 | memcpy(phy_db->ctrl, panel_physical_ctrl, PHYSICAL_SIZE); |
| 596 | memcpy(phy_db->strength, panel_strength_ctrl, STRENGTH_SIZE); |
| 597 | memcpy(phy_db->bistCtrl, panel_bist_ctrl, BIST_SIZE); |
| 598 | memcpy(phy_db->laneCfg, panel_lane_config, LANE_SIZE); |
| 599 | return NO_ERROR; |
| 600 | } |
| 601 | |
Padmanabhan Komanduru | b338193 | 2015-06-15 22:14:02 +0530 | [diff] [blame] | 602 | int target_display_get_base_offset(uint32_t base) |
| 603 | { |
Padmanabhan Komanduru | 2ab03a6 | 2018-05-17 14:38:59 +0530 | [diff] [blame] | 604 | if (platform_is_sdm439() || platform_is_sdm429()) { |
| 605 | if (base == MIPI_DSI0_BASE) |
| 606 | return DSI0_BASE_ADJUST; |
| 607 | else if (base == DSI0_PHY_BASE) |
| 608 | return DSI0_PHY_BASE_ADJUST; |
| 609 | else if (base == DSI0_PLL_BASE) |
| 610 | return DSI0_12NM_PHY_PLL_BASE_ADJUST; |
| 611 | else if (base == DSI1_PLL_BASE) |
| 612 | return DSI1_12NM_PHY_PLL_BASE_ADJUST; |
| 613 | } else if (platform_is_msm8956() || platform_is_msm8937() || |
Parth Dixit | 05f3c9f | 2016-03-18 17:14:57 +0530 | [diff] [blame] | 614 | platform_is_msm8917()) { |
Padmanabhan Komanduru | b338193 | 2015-06-15 22:14:02 +0530 | [diff] [blame] | 615 | if (base == MIPI_DSI0_BASE) |
| 616 | return DSI0_BASE_ADJUST; |
| 617 | else if (base == DSI0_PHY_BASE) |
| 618 | return DSI0_PHY_BASE_ADJUST; |
| 619 | else if (base == DSI0_PLL_BASE) |
| 620 | return DSI0_PHY_PLL_BASE_ADJUST; |
| 621 | else if (base == DSI0_REGULATOR_BASE) |
| 622 | return DSI0_PHY_REGULATOR_BASE_ADJUST; |
| 623 | } |
| 624 | |
| 625 | return 0; |
| 626 | } |
| 627 | |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 628 | int target_ldo_ctrl(uint8_t enable, struct msm_panel_info *pinfo) |
| 629 | { |
Sandeep Panda | aa4ea2f | 2016-07-05 13:52:25 +0530 | [diff] [blame] | 630 | int rc = 0; |
Padmanabhan Komanduru | 3cb0766 | 2015-06-08 17:13:33 +0530 | [diff] [blame] | 631 | uint32_t ldo_num = REG_LDO6 | REG_LDO17; |
| 632 | |
| 633 | if (platform_is_msm8956()) |
| 634 | ldo_num |= REG_LDO1; |
Padmanabhan Komanduru | 2ab03a6 | 2018-05-17 14:38:59 +0530 | [diff] [blame] | 635 | else if (platform_is_sdm439() || platform_is_sdm429()) |
| 636 | ldo_num |= REG_LDO5; /* LDO23 is enable by default */ |
Padmanabhan Komanduru | 3cb0766 | 2015-06-08 17:13:33 +0530 | [diff] [blame] | 637 | else |
| 638 | ldo_num |= REG_LDO2; |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 639 | |
| 640 | if (enable) { |
Padmanabhan Komanduru | 3cb0766 | 2015-06-08 17:13:33 +0530 | [diff] [blame] | 641 | regulator_enable(ldo_num); |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 642 | mdelay(10); |
Frank Yi | 2b7e2b9 | 2018-04-25 16:24:45 +0800 | [diff] [blame] | 643 | if(!pinfo->disable_wled_labibb) { |
| 644 | rc = wled_init(pinfo); |
| 645 | if (rc) { |
| 646 | dprintf(CRITICAL, "%s: wled init failed\n", __func__); |
| 647 | return rc; |
| 648 | } |
| 649 | if (target_get_pmic() == PMIC_IS_PMI632) |
| 650 | rc = qpnp_lcdb_enable(true); |
| 651 | else |
| 652 | rc = qpnp_ibb_enable(true); /*5V boost*/ |
| 653 | if (rc) { |
| 654 | dprintf(CRITICAL, "%s: qpnp_ibb/lcdb failed\n", __func__); |
| 655 | return rc; |
| 656 | } |
| 657 | mdelay(50); |
Sandeep Panda | aa4ea2f | 2016-07-05 13:52:25 +0530 | [diff] [blame] | 658 | } |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 659 | } else { |
Padmanabhan Komanduru | fa2899b | 2015-06-30 16:25:33 +0530 | [diff] [blame] | 660 | /* |
Padmanabhan Komanduru | 2ab03a6 | 2018-05-17 14:38:59 +0530 | [diff] [blame] | 661 | * LDO1, LDO2, LDO5 and LDO6 are shared with other subsystems. |
Padmanabhan Komanduru | fa2899b | 2015-06-30 16:25:33 +0530 | [diff] [blame] | 662 | * Do not disable them. |
| 663 | */ |
| 664 | regulator_disable(REG_LDO17); |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 665 | } |
| 666 | |
| 667 | return NO_ERROR; |
| 668 | } |
| 669 | |
Padmanabhan Komanduru | bccbcdc | 2015-06-30 16:19:24 +0530 | [diff] [blame] | 670 | bool target_display_panel_node(char *pbuf, uint16_t buf_size) |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 671 | { |
Ashish Garg | 9cfd6ca | 2016-12-20 01:41:54 +0530 | [diff] [blame] | 672 | int prefix_string_len = strlen(DISPLAY_CMDLINE_PREFIX); |
| 673 | bool ret = true; |
| 674 | struct oem_panel_data oem = mdss_dsi_get_oem_data(); |
| 675 | uint32_t platform_subtype = board_hardware_subtype(); |
Sachin Bhayare | 0ad7277 | 2018-03-22 19:11:29 +0530 | [diff] [blame] | 676 | uint32_t platform = board_platform_id(); |
Ashish Garg | 9cfd6ca | 2016-12-20 01:41:54 +0530 | [diff] [blame] | 677 | |
| 678 | /* default to hdmi for apq iot */ |
Sachin Bhayare | 0ad7277 | 2018-03-22 19:11:29 +0530 | [diff] [blame] | 679 | if ((APQ8017 == platform) && ((HW_PLATFORM_SUBTYPE_SAP == platform_subtype) || |
| 680 | (HW_PLATFORM_SUBTYPE_SAP_NOPMI == platform_subtype))) { |
Ashish Garg | 9cfd6ca | 2016-12-20 01:41:54 +0530 | [diff] [blame] | 681 | if (!strcmp(oem.panel, "")) { |
| 682 | if (buf_size < (prefix_string_len + |
| 683 | strlen(HDMI_ADV_PANEL_STRING))) { |
| 684 | dprintf(CRITICAL, "HDMI command line argument \ |
| 685 | is greater than buffer size\n"); |
| 686 | return false; |
| 687 | } |
| 688 | strlcpy(pbuf, DISPLAY_CMDLINE_PREFIX, buf_size); |
| 689 | buf_size -= prefix_string_len; |
| 690 | pbuf += prefix_string_len; |
| 691 | strlcpy(pbuf, HDMI_ADV_PANEL_STRING, buf_size); |
| 692 | } else if (!strcmp(oem.panel, TRULY_720P_VID_PANEL)) { |
| 693 | if (buf_size < (prefix_string_len + |
| 694 | strlen(TRULY_VID_PANEL_STRING))) { |
| 695 | dprintf(CRITICAL, "TRULY VIDEO command line \ |
| 696 | argument is greater than \ |
| 697 | buffer size\n"); |
| 698 | return false; |
| 699 | } |
| 700 | strlcpy(pbuf, DISPLAY_CMDLINE_PREFIX, buf_size); |
| 701 | buf_size -= prefix_string_len; |
| 702 | pbuf += prefix_string_len; |
| 703 | strlcpy(pbuf, TRULY_VID_PANEL_STRING, buf_size); |
| 704 | } else if (!strcmp(oem.panel, TRULY_720P_CMD_PANEL)) { |
| 705 | if (buf_size < (prefix_string_len + |
| 706 | strlen(TRULY_CMD_PANEL_STRING))) { |
| 707 | dprintf(CRITICAL, "TRULY CMD command line argument \ |
| 708 | argument is greater than \ |
| 709 | buffer size\n"); |
| 710 | return false; |
| 711 | } |
| 712 | strlcpy(pbuf, DISPLAY_CMDLINE_PREFIX, buf_size); |
| 713 | buf_size -= prefix_string_len; |
| 714 | pbuf += prefix_string_len; |
| 715 | strlcpy(pbuf, TRULY_CMD_PANEL_STRING, buf_size); |
| 716 | } |
| 717 | } else { |
| 718 | ret = gcdb_display_cmdline_arg(pbuf, buf_size); |
| 719 | } |
| 720 | |
| 721 | return ret; |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 722 | } |
| 723 | |
| 724 | void target_display_init(const char *panel_name) |
| 725 | { |
Padmanabhan Komanduru | bccbcdc | 2015-06-30 16:19:24 +0530 | [diff] [blame] | 726 | struct oem_panel_data oem; |
Ray Zhang | f95f5b9 | 2015-06-25 15:34:29 +0800 | [diff] [blame] | 727 | int32_t ret = 0; |
| 728 | uint32_t panel_loop = 0; |
Ashish Garg | 9cfd6ca | 2016-12-20 01:41:54 +0530 | [diff] [blame] | 729 | uint32_t platform_subtype = board_hardware_subtype(); |
Sachin Bhayare | 0ad7277 | 2018-03-22 19:11:29 +0530 | [diff] [blame] | 730 | uint32_t platform = board_platform_id(); |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 731 | |
Padmanabhan Komanduru | bccbcdc | 2015-06-30 16:19:24 +0530 | [diff] [blame] | 732 | set_panel_cmd_string(panel_name); |
| 733 | oem = mdss_dsi_get_oem_data(); |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 734 | |
Padmanabhan Komanduru | bccbcdc | 2015-06-30 16:19:24 +0530 | [diff] [blame] | 735 | if (!strcmp(oem.panel, NO_PANEL_CONFIG) |
| 736 | || !strcmp(oem.panel, SIM_VIDEO_PANEL) |
| 737 | || !strcmp(oem.panel, SIM_CMD_PANEL) |
| 738 | || oem.skip) { |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 739 | dprintf(INFO, "Selected panel: %s\nSkip panel configuration\n", |
Padmanabhan Komanduru | bccbcdc | 2015-06-30 16:19:24 +0530 | [diff] [blame] | 740 | oem.panel); |
Vishnuvardhan Prodduturi | 4cd5638 | 2017-08-22 21:46:38 +0530 | [diff] [blame] | 741 | oem.cont_splash = false; |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 742 | } |
| 743 | |
Sachin Bhayare | 0ad7277 | 2018-03-22 19:11:29 +0530 | [diff] [blame] | 744 | if ((APQ8017 == platform) && ((HW_PLATFORM_SUBTYPE_SAP == platform_subtype) || |
| 745 | (HW_PLATFORM_SUBTYPE_SAP_NOPMI == platform_subtype))) { |
Ashish Garg | 9cfd6ca | 2016-12-20 01:41:54 +0530 | [diff] [blame] | 746 | dprintf(INFO, "%s: Platform subtype %d\n", |
| 747 | __func__, platform_subtype); |
| 748 | return; |
| 749 | } |
| 750 | |
Ray Zhang | f95f5b9 | 2015-06-25 15:34:29 +0800 | [diff] [blame] | 751 | do { |
| 752 | target_force_cont_splash_disable(false); |
| 753 | ret = gcdb_display_init(oem.panel, MDP_REV_50, (void *)MIPI_FB_ADDR); |
| 754 | if (!ret || ret == ERR_NOT_SUPPORTED) { |
| 755 | break; |
| 756 | } else { |
| 757 | target_force_cont_splash_disable(true); |
| 758 | msm_display_off(); |
| 759 | } |
| 760 | } while (++panel_loop <= oem_panel_max_auto_detect_panels()); |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 761 | |
Padmanabhan Komanduru | bccbcdc | 2015-06-30 16:19:24 +0530 | [diff] [blame] | 762 | if (!oem.cont_splash) { |
Padmanabhan Komanduru | 9d49f89 | 2015-04-10 12:58:46 -0700 | [diff] [blame] | 763 | dprintf(INFO, "Forcing continuous splash disable\n"); |
| 764 | target_force_cont_splash_disable(true); |
| 765 | } |
| 766 | } |
| 767 | |
| 768 | void target_display_shutdown(void) |
| 769 | { |
| 770 | gcdb_display_shutdown(); |
| 771 | } |