blob: 24bc14cee05836f0682615e14448254a7dd9d63d [file] [log] [blame]
Sachin Bhayare015045f2017-01-25 17:52:17 +05301/* Copyright (c) 2014-2015, 2017, The Linux Foundation. All rights reserved.
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +05302 *
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 <smem.h>
32#include <err.h>
33#include <msm_panel.h>
34#include <mipi_dsi.h>
35#include <pm8x41.h>
Shivaraj Shettyaf4c6072014-11-04 16:25:31 +053036#include <pm8x41_wled.h>
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +053037#include <board.h>
38#include <mdp3.h>
39#include <scm.h>
40#include <platform/gpio.h>
41#include <platform/iomap.h>
42#include <target/display.h>
Casey Piperd2af07b2015-04-01 18:01:58 -070043#include <regulator.h>
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +053044
45#include "include/panel.h"
46#include "include/display_resource.h"
Veera Sundaram Sankaran87f88132015-01-28 11:32:44 -080047#include "gcdb_display.h"
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +053048
49#define VCO_DELAY_USEC 1000
50#define GPIO_STATE_LOW 0
51#define GPIO_STATE_HIGH 2
52#define RESET_GPIO_SEQ_LEN 3
53#define PWM_DUTY_US 13
54#define PWM_PERIOD_US 27
Shivaraj Shetty89fc8ed2015-01-23 15:03:35 +053055#define PM8916_VER 0x20000
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +053056
Ashish Garg22001a92017-08-07 14:46:54 +053057/*---------------------------------------------------------------------------*/
58/* GPIO configuration */
59/*---------------------------------------------------------------------------*/
60static struct gpio_pin bob_gpio = {
61 "pm8941_gpios", 12, 2, 1, 0, 1
62};
Krishna Manikandancf693b22017-12-05 18:14:52 +053063static bool display_efuse = false;
Ashish Garg22001a92017-08-07 14:46:54 +053064
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +053065static void mdss_dsi_uniphy_pll_sw_reset_8909(uint32_t pll_base)
66{
67 writel(0x01, pll_base + 0x0068); /* PLL TEST CFG */
68 mdelay(1);
69 writel(0x00, pll_base + 0x0068); /* PLL TEST CFG */
70 mdelay(1);
71}
72
Padmanabhan Komanduru048df212015-05-28 15:21:22 +053073static void dsi_pll_toggle_lock_detect_8909(uint32_t pll_base)
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +053074{
Padmanabhan Komanduru048df212015-05-28 15:21:22 +053075 writel(0x04, pll_base + 0x0064); /* LKDetect CFG2 */
76 udelay(1);
77 writel(0x05, pll_base + 0x0064); /* LKDetect CFG2 */
78 udelay(512);
79}
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +053080
Padmanabhan Komanduru048df212015-05-28 15:21:22 +053081static void dsi_pll_sw_reset_8909(uint32_t pll_base)
82{
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +053083 writel(0x01, pll_base + 0x0068); /* PLL TEST CFG */
84 udelay(1);
85 writel(0x00, pll_base + 0x0068); /* PLL TEST CFG */
Padmanabhan Komanduru048df212015-05-28 15:21:22 +053086}
87
88static uint32_t dsi_pll_enable_seq_1_8909(uint32_t pll_base)
89{
90 uint32_t rc;
91
92 dsi_pll_sw_reset_8909(pll_base);
93 /*
94 * Add hardware recommended delays between register writes for
95 * the updates to take effect. These delays are necessary for the
96 * PLL to successfully lock
97 */
98
99 writel(0x34, pll_base + 0x0070); /* CAL CFG1*/
100 writel(0x01, pll_base + 0x0020); /* GLB CFG */
101 writel(0x05, pll_base + 0x0020); /* GLB CFG */
102 writel(0x0f, pll_base + 0x0020); /* GLB CFG */
103 udelay(500);
104
105 dsi_pll_toggle_lock_detect_8909(pll_base);
106 rc = readl(pll_base + 0x00c0) & 0x01;
107
108 return rc;
109}
110
111static uint32_t dsi_pll_enable_seq_2_8909(uint32_t pll_base)
112{
113 uint32_t rc;
114
115 dsi_pll_sw_reset_8909(pll_base);
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +0530116
117 /*
118 * Add hardware recommended delays between register writes for
119 * the updates to take effect. These delays are necessary for the
120 * PLL to successfully lock
121 */
Padmanabhan Komanduru048df212015-05-28 15:21:22 +0530122 writel(0x14, pll_base + 0x0070); /* CAL CFG1*/
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +0530123 writel(0x01, pll_base + 0x0020); /* GLB CFG */
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +0530124 writel(0x05, pll_base + 0x0020); /* GLB CFG */
Padmanabhan Komanduru048df212015-05-28 15:21:22 +0530125 udelay(3);
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +0530126 writel(0x0f, pll_base + 0x0020); /* GLB CFG */
Padmanabhan Komanduru048df212015-05-28 15:21:22 +0530127 udelay(500);
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +0530128
Padmanabhan Komanduru048df212015-05-28 15:21:22 +0530129 dsi_pll_toggle_lock_detect_8909(pll_base);
130 rc = readl(pll_base + 0x00c0) & 0x01;
131
132 return rc;
133}
134
135static uint32_t dsi_pll_enable_seq_3_8909(uint32_t pll_base)
136{
137 uint32_t rc;
138
139 dsi_pll_sw_reset_8909(pll_base);
140
141 /*
142 * Add hardware recommended delays between register writes for
143 * the updates to take effect. These delays are necessary for the
144 * PLL to successfully lock
145 */
146 writel(0x04, pll_base + 0x0070); /* CAL CFG1*/
147 writel(0x01, pll_base + 0x0020); /* GLB CFG */
148 writel(0x05, pll_base + 0x0020); /* GLB CFG */
149 udelay(3);
150 writel(0x0f, pll_base + 0x0020); /* GLB CFG */
151 udelay(500);
152
153 dsi_pll_toggle_lock_detect_8909(pll_base);
154 rc = readl(pll_base + 0x00c0) & 0x01;
155
156 return rc;
157}
158
159static uint32_t dsi_pll_enable_seq_8909(uint32_t pll_base)
160{
161 uint32_t pll_locked = 0;
162 uint32_t counter = 0;
163
164 do {
165 pll_locked = dsi_pll_enable_seq_1_8909(pll_base);
166
167 dprintf(SPEW, "TSMC pll locked status is %d\n", pll_locked);
168 ++counter;
169 } while (!pll_locked && (counter < 3));
170
171 if (!pll_locked) {
172 counter = 0;
173 do {
174 pll_locked = dsi_pll_enable_seq_2_8909(pll_base);
175
176 dprintf(SPEW, "GF P1 pll locked status is %d\n",
177 pll_locked);
178 ++counter;
179 } while (!pll_locked && (counter < 3));
180 }
181
182 if (!pll_locked) {
183 counter = 0;
184 do {
185 pll_locked = dsi_pll_enable_seq_3_8909(pll_base);
186
187 dprintf(SPEW, "GF P2 pll locked status is %d\n",
188 pll_locked);
189 ++counter;
190 } while (!pll_locked && (counter < 3));
191 }
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +0530192
193 return pll_locked;
194}
195
196int target_backlight_ctrl(struct backlight *bl, uint8_t enable)
197{
Shivaraj Shettybe6b6fd2014-12-12 13:48:29 +0530198 uint32_t hw_id = board_hardware_id();
Ashish Garg22001a92017-08-07 14:46:54 +0530199 uint32_t platform = board_platform_id();
200 uint32_t platform_subtype = board_hardware_subtype();
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +0530201
202 if (bl->bl_interface_type == BL_DCS)
203 return 0;
204
Baochu Xu34bb8e62017-12-05 14:22:06 +0800205 if (!(((HW_PLATFORM_SUBTYPE_8909_PM660 == platform_subtype) ||
Swetha Vuchae3baf912017-12-20 15:49:28 +0530206 (HW_PLATFORM_SUBTYPE_8909_PM660_V1 == platform_subtype) ||
207 (HW_PLATFORM_SUBTYPE_8909_COMPAL_ALPHA == platform_subtype)) &&
Sachin Bhayare39da0ce2017-09-15 16:10:28 +0530208 ((MSM8909W == platform) || (APQ8009W == platform)) &&
Ashish Garg22001a92017-08-07 14:46:54 +0530209 (HW_PLATFORM_MTP == hw_id))) {
210 struct pm8x41_mpp mpp;
211 struct board_pmic_data pmic_info;
212 int rc;
Shivaraj Shettybe6b6fd2014-12-12 13:48:29 +0530213
Ashish Garg22001a92017-08-07 14:46:54 +0530214 board_pmic_info(&pmic_info, 1);
215 if (pmic_info.pmic_version == PM8916_VER)
216 mpp.base = PM8x41_MMP4_BASE;
217 else
218 mpp.base = PM8x41_MMP2_BASE;
219
220 mpp.vin = MPP_VIN0;
221 if (enable) {
222 pm_pwm_enable(false);
223 rc = pm_pwm_config(PWM_DUTY_US, PWM_PERIOD_US);
224 if (rc < 0)
225 mpp.mode = MPP_HIGH;
226 else {
227 mpp.mode = MPP_DTEST1;
228 pm_pwm_enable(true);
229 }
230 pm8x41_config_output_mpp(&mpp);
231 pm8x41_enable_mpp(&mpp, MPP_ENABLE);
232 } else {
233 pm_pwm_enable(false);
234 pm8x41_enable_mpp(&mpp, MPP_DISABLE);
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +0530235 }
Ashish Garg22001a92017-08-07 14:46:54 +0530236 mdelay(20);
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +0530237 }
Sandeep Pandaae8d68e2014-12-29 20:07:22 +0530238 if (enable) {
239 gpio_tlmm_config(bkl_gpio.pin_id, 0,
240 bkl_gpio.pin_direction, bkl_gpio.pin_pull,
241 bkl_gpio.pin_strength, bkl_gpio.pin_state);
242 gpio_set(bkl_gpio.pin_id, 2);
Wenjun Zhanga083eea2018-02-01 03:32:03 -0500243
244 if (HW_PLATFORM_SUBTYPE_8909_PM660_V1 == platform_subtype) {
245 gpio_tlmm_config(spi_bkl_gpio.pin_id, 0,
246 spi_bkl_gpio.pin_direction,
247 spi_bkl_gpio.pin_pull,
248 spi_bkl_gpio.pin_strength,
249 spi_bkl_gpio.pin_state);
250 gpio_set(spi_bkl_gpio.pin_id, 2);
251 }
Sandeep Pandaae8d68e2014-12-29 20:07:22 +0530252 }
253
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +0530254 return 0;
255}
256
257int target_panel_clock(uint8_t enable, struct msm_panel_info *pinfo)
258{
259 int32_t ret = 0;
260 struct mdss_dsi_pll_config *pll_data;
261 dprintf(SPEW, "target_panel_clock\n");
262
263 pll_data = pinfo->mipi.dsi_pll_config;
264 pll_data->vco_delay = VCO_DELAY_USEC;
265
266 if (enable) {
267 mdp_gdsc_ctrl(enable);
268 mdss_bus_clocks_enable();
269 mdp_clock_enable();
Shivaraj Shettyaf4c6072014-11-04 16:25:31 +0530270
271 /*
272 * Enable auto functional gating
273 * on DSI CMD AXI fetch from DDR
274 */
Sachin Bhayarea8deb5c2015-07-16 11:49:08 +0530275 writel(0x3fbff, MDP_CGC_EN);
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +0530276 ret = restore_secure_cfg(SECURE_DEVICE_MDSS);
277 if (ret) {
278 dprintf(CRITICAL,
279 "%s: Failed to restore MDP security configs",
280 __func__);
281 mdp_clock_disable();
282 mdss_bus_clocks_disable();
283 mdp_gdsc_ctrl(0);
284 return ret;
285 }
Padmanabhan Komanduruc0766c82015-04-27 16:39:15 -0700286 mdss_dsi_uniphy_pll_sw_reset_8909(pinfo->mipi.pll_base);
287 mdss_dsi_auto_pll_config(pinfo->mipi.pll_base,
Jeevan Shriram2d3500b2014-12-29 16:25:06 -0800288 pinfo->mipi.ctl_base, pll_data);
Padmanabhan Komanduruc0766c82015-04-27 16:39:15 -0700289 if (!dsi_pll_enable_seq_8909(pinfo->mipi.pll_base))
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +0530290 dprintf(CRITICAL, "Not able to enable the pll\n");
291 gcc_dsi_clocks_enable(pll_data->pclk_m,
292 pll_data->pclk_n,
293 pll_data->pclk_d);
294 } else if(!target_cont_splash_screen()) {
295 gcc_dsi_clocks_disable();
296 mdp_clock_disable();
297 mdss_bus_clocks_disable();
298 mdp_gdsc_ctrl(enable);
299 }
300
301 return 0;
302}
303
304int target_panel_reset(uint8_t enable, struct panel_reset_sequence *resetseq,
305 struct msm_panel_info *pinfo)
306{
307 int ret = NO_ERROR;
Ashish Garg22001a92017-08-07 14:46:54 +0530308 uint32_t bob_pmic_gpio = bob_gpio.pin_id;
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +0530309 uint32_t hw_id = board_hardware_id();
310 uint32_t hw_subtype = board_hardware_subtype();
Ashish Garg22001a92017-08-07 14:46:54 +0530311 uint32_t platform = board_platform_id();
312
Baochu Xu34bb8e62017-12-05 14:22:06 +0800313 if (((HW_PLATFORM_SUBTYPE_8909_PM660 == hw_subtype) ||
Swetha Vuchae3baf912017-12-20 15:49:28 +0530314 (HW_PLATFORM_SUBTYPE_8909_PM660_V1 == hw_subtype) ||
315 (HW_PLATFORM_SUBTYPE_8909_COMPAL_ALPHA == hw_subtype)) &&
Sachin Bhayare39da0ce2017-09-15 16:10:28 +0530316 ((MSM8909W == platform) || (APQ8009W == platform)) &&
Ashish Garg22001a92017-08-07 14:46:54 +0530317 (HW_PLATFORM_MTP == hw_id)) {
318 struct pm8x41_gpio bobgpio_param = {
319 .direction = PM_GPIO_DIR_OUT,
320 .vin_sel = 0,
321 .out_strength = PM_GPIO_OUT_DRIVE_MED,
322 .function = PM_GPIO_FUNC_HIGH,
323 .pull = PM_GPIO_PULLDOWN_10,
324 .inv_int_pol = PM_GPIO_INVERT,
325 };
326
327 pm8x41_gpio_config(bob_pmic_gpio, &bobgpio_param);
328 }
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +0530329
330 if (enable) {
331 if (pinfo->mipi.use_enable_gpio) {
332 gpio_tlmm_config(enable_gpio.pin_id, 0,
333 enable_gpio.pin_direction, enable_gpio.pin_pull,
334 enable_gpio.pin_strength,
335 enable_gpio.pin_state);
336
Shivaraj Shettyaf4c6072014-11-04 16:25:31 +0530337 gpio_set(enable_gpio.pin_id, 2);
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +0530338 }
339
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +0530340 gpio_tlmm_config(reset_gpio.pin_id, 0,
341 reset_gpio.pin_direction, reset_gpio.pin_pull,
342 reset_gpio.pin_strength, reset_gpio.pin_state);
343
Shivaraj Shettyaf4c6072014-11-04 16:25:31 +0530344 gpio_set(reset_gpio.pin_id, 2);
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +0530345
346 /* reset */
347 for (int i = 0; i < RESET_GPIO_SEQ_LEN; i++) {
348 if (resetseq->pin_state[i] == GPIO_STATE_LOW)
Shivaraj Shettyaf4c6072014-11-04 16:25:31 +0530349 gpio_set(reset_gpio.pin_id, GPIO_STATE_LOW);
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +0530350 else
Shivaraj Shettyaf4c6072014-11-04 16:25:31 +0530351 gpio_set(reset_gpio.pin_id, GPIO_STATE_HIGH);
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +0530352 mdelay(resetseq->sleep[i]);
353 }
354 } else if(!target_cont_splash_screen()) {
Shivaraj Shettyaf4c6072014-11-04 16:25:31 +0530355 gpio_set(reset_gpio.pin_id, 0);
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +0530356 if (pinfo->mipi.use_enable_gpio)
Shivaraj Shettyaf4c6072014-11-04 16:25:31 +0530357 gpio_set(enable_gpio.pin_id, 0);
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +0530358 }
359
360 return ret;
361}
362
Veera Sundaram Sankaran87f88132015-01-28 11:32:44 -0800363int target_ldo_ctrl(uint8_t enable, struct msm_panel_info *pinfo)
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +0530364{
Ashish Garg22001a92017-08-07 14:46:54 +0530365 uint32_t hw_id = board_hardware_id();
366 uint32_t hw_subtype = board_hardware_subtype();
367 uint32_t platform = board_platform_id();
368
369 if (enable) {
Baochu Xu34bb8e62017-12-05 14:22:06 +0800370 if (((HW_PLATFORM_SUBTYPE_8909_PM660 == hw_subtype) ||
Swetha Vuchae3baf912017-12-20 15:49:28 +0530371 (HW_PLATFORM_SUBTYPE_8909_PM660_V1 == hw_subtype) ||
372 (HW_PLATFORM_SUBTYPE_8909_COMPAL_ALPHA == hw_subtype)) &&
Sachin Bhayare39da0ce2017-09-15 16:10:28 +0530373 ((MSM8909W == platform) || (APQ8009W == platform)) &&
Ashish Garg22001a92017-08-07 14:46:54 +0530374 (HW_PLATFORM_MTP == hw_id))
375 regulator_enable(REG_LDO12 | REG_LDO5 | REG_LDO11 | REG_LDO18);
Wenjun Zhanga083eea2018-02-01 03:32:03 -0500376 else if (pinfo->type == SPI_PANEL)
377 {
378 regulator_enable(REG_LDO11 | REG_LDO18);
379 }
Ashish Garg22001a92017-08-07 14:46:54 +0530380 else
381 regulator_enable(REG_LDO2 | REG_LDO6 | REG_LDO17);
382 }
Shivaraj Shetty01734d32014-11-20 12:24:01 +0530383
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +0530384 return NO_ERROR;
385}
386
Dhaval Patel7709c412015-05-12 10:09:41 -0700387int target_dsi_phy_config(struct mdss_dsi_phy_ctrl *phy_db)
388{
389 memcpy(phy_db->regulator, panel_regulator_settings, REGULATOR_SIZE);
390 memcpy(phy_db->ctrl, panel_physical_ctrl, PHYSICAL_SIZE);
391 memcpy(phy_db->strength, panel_strength_ctrl, STRENGTH_SIZE);
392 memcpy(phy_db->bistCtrl, panel_bist_ctrl, BIST_SIZE);
393 memcpy(phy_db->laneCfg, panel_lane_config, LANE_SIZE);
394 return NO_ERROR;
395}
396
Sachin Bhayare015045f2017-01-25 17:52:17 +0530397static bool target_splash_disable(void)
398{
399 uint32_t hw_id = board_hardware_id();
400 uint32_t platform_subtype = board_hardware_subtype();
401 uint32_t platform = board_platform_id();
402
403 if ((APQ8009 == platform) &&
404 (((HW_PLATFORM_MTP == hw_id) &&
405 (HW_PLATFORM_SUBTYPE_DSDA2 == platform_subtype)) ||
406 ((HW_PLATFORM_RCM == hw_id) &&
Parth Dixitacec6bf2017-02-27 19:06:39 +0530407 ((HW_PLATFORM_SUBTYPE_SAP == platform_subtype)||
408 (HW_PLATFORM_SUBTYPE_SAP_NOPMI == platform_subtype))))) {
Sachin Bhayare015045f2017-01-25 17:52:17 +0530409 dprintf(INFO, "Splash disabled\n");
410 return true;
411 } else {
412 return false;
413 }
414}
415
Krishna Manikandancf693b22017-12-05 18:14:52 +0530416bool is_display_disabled(void)
417{
418 return display_efuse;
419}
420
421bool display_efuse_check(void)
422{
423 int i;
424 uint32_t efuse = 0;
425 uint32_t board_id = board_platform_id();
426
427 for (i = 0; i < ARRAY_SIZE(efuse_data);i++)
428 if (board_id == efuse_data[i].board_id) {
429 efuse = readl((efuse_data[i].start_address + efuse_data[i].offset));
430 display_efuse = (efuse & (efuse_data[i].mask)) >> (efuse_data[i].shift);
431 }
432
433 dprintf(INFO,"Efuse register: display disable flag = %d\n",display_efuse);
434 return display_efuse;
435}
436
437void efuse_display_enable(char *pbuf, uint16_t buf_size)
438{
439 char *default_str;
440 int prefix_display_len = strlen(pbuf);
441 if (display_efuse)
442 default_str = ";display_disabled:1";
443 pbuf += prefix_display_len;
444 buf_size -= prefix_display_len;
445 strlcpy(pbuf, default_str, buf_size);
446}
447
Padmanabhan Komandurubccbcdc2015-06-30 16:19:24 +0530448bool target_display_panel_node(char *pbuf, uint16_t buf_size)
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +0530449{
Sachin Bhayare015045f2017-01-25 17:52:17 +0530450 int ret = true;
451
452 if (!target_splash_disable())
453 ret = gcdb_display_cmdline_arg(pbuf, buf_size);
454
Krishna Manikandancf693b22017-12-05 18:14:52 +0530455 if (display_efuse_check()){
456 if (target_splash_disable()){
457 strlcpy(pbuf, DISPLAY_CMDLINE_PREFIX, buf_size);
458 efuse_display_enable(pbuf, buf_size);
459 } else
460 efuse_display_enable(pbuf, buf_size);
461 }
462
Sachin Bhayare015045f2017-01-25 17:52:17 +0530463 return ret;
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +0530464}
465
466void target_display_init(const char *panel_name)
467{
468 uint32_t panel_loop = 0;
469 uint32_t ret = 0;
Padmanabhan Komandurubccbcdc2015-06-30 16:19:24 +0530470 struct oem_panel_data oem;
Veera Sundaram Sankaran7868d542015-01-02 14:48:47 -0800471
Krishna Manikandancf693b22017-12-05 18:14:52 +0530472 if (display_efuse_check())
473 return;
474
Padmanabhan Komandurubccbcdc2015-06-30 16:19:24 +0530475 set_panel_cmd_string(panel_name);
476 oem = mdss_dsi_get_oem_data();
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +0530477
Padmanabhan Komandurubccbcdc2015-06-30 16:19:24 +0530478 if (!strcmp(oem.panel, NO_PANEL_CONFIG)
479 || !strcmp(oem.panel, SIM_VIDEO_PANEL)
480 || !strcmp(oem.panel, SIM_CMD_PANEL)
481 || oem.skip) {
Sandeep Panda63933f92014-11-26 19:13:44 +0530482 dprintf(INFO, "Selected %s: Skip panel configuration\n",
Padmanabhan Komandurubccbcdc2015-06-30 16:19:24 +0530483 oem.panel);
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +0530484 return;
485 }
486
Sachin Bhayare015045f2017-01-25 17:52:17 +0530487 if (target_splash_disable())
488 return;
489
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +0530490 do {
491 target_force_cont_splash_disable(false);
Padmanabhan Komandurubccbcdc2015-06-30 16:19:24 +0530492 ret = gcdb_display_init(oem.panel, MDP_REV_305, MIPI_FB_ADDR);
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +0530493 if (!ret || ret == ERR_NOT_SUPPORTED) {
494 break;
495 } else {
496 target_force_cont_splash_disable(true);
497 msm_display_off();
498 }
499 } while (++panel_loop <= oem_panel_max_auto_detect_panels());
Veera Sundaram Sankaran7868d542015-01-02 14:48:47 -0800500
Padmanabhan Komandurubccbcdc2015-06-30 16:19:24 +0530501 if (!oem.cont_splash) {
Veera Sundaram Sankaran7868d542015-01-02 14:48:47 -0800502 dprintf(INFO, "Forcing continuous splash disable\n");
503 target_force_cont_splash_disable(true);
504 }
Shivaraj Shettyf9e10c42014-09-17 04:21:15 +0530505}
506
507void target_display_shutdown(void)
508{
509 gcdb_display_shutdown();
510}