blob: 06ce3cf28bd3522f9b6b58605abe6091da88af33 [file] [log] [blame]
Sandeep Panda0ce96e92015-05-13 12:24:10 +05301/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
Ray Zhang743e5032013-05-25 23:25:39 +08002 *
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>
Arpita Banerjeec5f78df2013-05-24 15:43:40 -070032#include <err.h>
Ray Zhang743e5032013-05-25 23:25:39 +080033#include <msm_panel.h>
Arpita Banerjee0906ffd2013-05-24 16:25:38 -070034#include <mipi_dsi.h>
Ray Zhang743e5032013-05-25 23:25:39 +080035#include <pm8x41.h>
36#include <pm8x41_wled.h>
37#include <board.h>
38#include <mdp5.h>
Aravind Venkateswaran2713dc92013-09-19 15:23:34 -070039#include <scm.h>
Ray Zhang743e5032013-05-25 23:25:39 +080040#include <platform/gpio.h>
41#include <platform/iomap.h>
42#include <target/display.h>
43
Casey Pipercbdfbd22013-08-14 17:22:16 -070044#include "include/panel.h"
Arpita Banerjeec5f78df2013-05-24 15:43:40 -070045#include "include/display_resource.h"
Ray Zhang743e5032013-05-25 23:25:39 +080046
Dhaval Patel815567c2013-07-31 11:13:25 -070047#define HFPLL_LDO_ID 8
Sandeep Panda0ce96e92015-05-13 12:24:10 +053048#define MAX_M_SEQ_COUNTER 7
Sandeep Pandaabe9ad42015-08-21 12:20:40 +053049#define DSI_PLL_POLL_MAX_READS 10
Dhaval Patel815567c2013-07-31 11:13:25 -070050
Ray Zhang743e5032013-05-25 23:25:39 +080051static struct pm8x41_wled_data wled_ctrl = {
rayzhanga3667cd2013-07-01 12:22:54 +080052 .mod_scheme = 0x00,
Ray Zhang743e5032013-05-25 23:25:39 +080053 .led1_brightness = (0x0F << 8) | 0xEF,
Ray Zhang743e5032013-05-25 23:25:39 +080054 .max_duty_cycle = 0x01,
rayzhanga3667cd2013-07-01 12:22:54 +080055 .ovp = 0x0,
Zhenhua Huangd5355cb2013-09-04 16:03:01 +080056 .full_current_scale = 0x19,
57 .fdbck = 0x1
Ray Zhang743e5032013-05-25 23:25:39 +080058};
59
Sandeep Pandaabe9ad42015-08-21 12:20:40 +053060static int mdss_dsi_pll_lock_status(uint32_t ctl_base)
61{
62 int pll_locked = 0, i = 0;
63
64 while (i < DSI_PLL_POLL_MAX_READS) {
65 pll_locked = (readl(ctl_base + 0x02c0) & 0x01);
66 if (pll_locked)
67 break;
68 udelay(50);
69 i++;
70 }
71 return pll_locked;
72}
73
Casey Piper992edde2013-08-26 11:14:02 -070074static uint32_t dsi_pll_enable_seq_m(uint32_t ctl_base)
75{
76 uint32_t i = 0;
77 uint32_t pll_locked = 0;
78
79 mdss_dsi_uniphy_pll_sw_reset(ctl_base);
80
81 /*
82 * Add hardware recommended delays between register writes for
83 * the updates to take effect. These delays are necessary for the
84 * PLL to successfully lock
85 */
Sandeep Panda0ce96e92015-05-13 12:24:10 +053086 writel(0x34, ctl_base + 0x00270); /* CAL CFG1*/
Casey Piper992edde2013-08-26 11:14:02 -070087 writel(0x01, ctl_base + 0x0220); /* GLB CFG */
88 udelay(200);
89 writel(0x05, ctl_base + 0x0220); /* GLB CFG */
90 udelay(200);
91 writel(0x0f, ctl_base + 0x0220); /* GLB CFG */
Sandeep Panda0ce96e92015-05-13 12:24:10 +053092 udelay(600);
Casey Piper992edde2013-08-26 11:14:02 -070093
94 mdss_dsi_uniphy_pll_lock_detect_setting(ctl_base);
Sandeep Pandaabe9ad42015-08-21 12:20:40 +053095 pll_locked = mdss_dsi_pll_lock_status(ctl_base);
Sandeep Panda0ce96e92015-05-13 12:24:10 +053096 for (i = 0; (i < MAX_M_SEQ_COUNTER) && !pll_locked; i++) {
97 writel(0x00, ctl_base + 0x0214); /* PWRGEN CFG */
98 udelay(50);
99 writel(0x05, ctl_base + 0x0220); /* GLB CFG */
100 udelay(100);
Casey Piper992edde2013-08-26 11:14:02 -0700101 writel(0x0f, ctl_base + 0x0220); /* GLB CFG */
Sandeep Panda0ce96e92015-05-13 12:24:10 +0530102 udelay(600);
Casey Piper992edde2013-08-26 11:14:02 -0700103 mdss_dsi_uniphy_pll_lock_detect_setting(ctl_base);
Sandeep Pandaabe9ad42015-08-21 12:20:40 +0530104 pll_locked = mdss_dsi_pll_lock_status(ctl_base);
Casey Piper992edde2013-08-26 11:14:02 -0700105 }
106
107 return pll_locked;
108}
109
110static uint32_t dsi_pll_enable_seq_d(uint32_t ctl_base)
111{
112 uint32_t pll_locked = 0;
113
114 mdss_dsi_uniphy_pll_sw_reset(ctl_base);
115
116 /*
117 * Add hardware recommended delays between register writes for
118 * the updates to take effect. These delays are necessary for the
119 * PLL to successfully lock
120 */
Sandeep Panda0ce96e92015-05-13 12:24:10 +0530121 writel(0x00, ctl_base + 0x0214); /* PWRGEN CFG */
122 udelay(50);
Casey Piper992edde2013-08-26 11:14:02 -0700123 writel(0x01, ctl_base + 0x0220); /* GLB CFG */
124 udelay(200);
125 writel(0x05, ctl_base + 0x0220); /* GLB CFG */
126 udelay(200);
127 writel(0x07, ctl_base + 0x0220); /* GLB CFG */
128 udelay(200);
129 writel(0x05, ctl_base + 0x0220); /* GLB CFG */
130 udelay(200);
131 writel(0x07, ctl_base + 0x0220); /* GLB CFG */
132 udelay(200);
133 writel(0x0f, ctl_base + 0x0220); /* GLB CFG */
Sandeep Panda0ce96e92015-05-13 12:24:10 +0530134 udelay(600);
Casey Piper992edde2013-08-26 11:14:02 -0700135
136 mdss_dsi_uniphy_pll_lock_detect_setting(ctl_base);
Sandeep Pandaabe9ad42015-08-21 12:20:40 +0530137 pll_locked = mdss_dsi_pll_lock_status(ctl_base);
Casey Piper992edde2013-08-26 11:14:02 -0700138
139 return pll_locked;
140}
141
142static uint32_t dsi_pll_enable_seq_f1(uint32_t ctl_base)
143{
144 uint32_t pll_locked = 0;
145
146 mdss_dsi_uniphy_pll_sw_reset(ctl_base);
147
148 /*
149 * Add hardware recommended delays between register writes for
150 * the updates to take effect. These delays are necessary for the
151 * PLL to successfully lock
152 */
Sandeep Panda0ce96e92015-05-13 12:24:10 +0530153 writel(0x00, ctl_base + 0x0214); /* PWRGEN CFG */
154 udelay(50);
Casey Piper992edde2013-08-26 11:14:02 -0700155 writel(0x01, ctl_base + 0x0220); /* GLB CFG */
156 udelay(200);
157 writel(0x05, ctl_base + 0x0220); /* GLB CFG */
158 udelay(200);
159 writel(0x0f, ctl_base + 0x0220); /* GLB CFG */
160 udelay(200);
161 writel(0x0d, ctl_base + 0x0220); /* GLB CFG */
162 udelay(200);
163 writel(0x0f, ctl_base + 0x0220); /* GLB CFG */
Sandeep Panda0ce96e92015-05-13 12:24:10 +0530164 udelay(600);
Casey Piper992edde2013-08-26 11:14:02 -0700165
166 mdss_dsi_uniphy_pll_lock_detect_setting(ctl_base);
Sandeep Pandaabe9ad42015-08-21 12:20:40 +0530167 pll_locked = mdss_dsi_pll_lock_status(ctl_base);
Casey Piper992edde2013-08-26 11:14:02 -0700168
169 return pll_locked;
170}
171
172static uint32_t dsi_pll_enable_seq_c(uint32_t ctl_base)
173{
174 uint32_t pll_locked = 0;
175
176 mdss_dsi_uniphy_pll_sw_reset(ctl_base);
177
178 /*
179 * Add hardware recommended delays between register writes for
180 * the updates to take effect. These delays are necessary for the
181 * PLL to successfully lock
182 */
Sandeep Panda0ce96e92015-05-13 12:24:10 +0530183 writel(0x00, ctl_base + 0x0214); /* PWRGEN CFG */
184 udelay(50);
Casey Piper992edde2013-08-26 11:14:02 -0700185 writel(0x01, ctl_base + 0x0220); /* GLB CFG */
186 udelay(200);
187 writel(0x05, ctl_base + 0x0220); /* GLB CFG */
188 udelay(200);
189 writel(0x0f, ctl_base + 0x0220); /* GLB CFG */
Sandeep Panda0ce96e92015-05-13 12:24:10 +0530190 udelay(600);
Casey Piper992edde2013-08-26 11:14:02 -0700191
192 mdss_dsi_uniphy_pll_lock_detect_setting(ctl_base);
Sandeep Pandaabe9ad42015-08-21 12:20:40 +0530193 pll_locked = mdss_dsi_pll_lock_status(ctl_base);
Casey Piper992edde2013-08-26 11:14:02 -0700194
195 return pll_locked;
196}
197
198static uint32_t dsi_pll_enable_seq_e(uint32_t ctl_base)
199{
200 uint32_t pll_locked = 0;
201
202 mdss_dsi_uniphy_pll_sw_reset(ctl_base);
203
204 /*
205 * Add hardware recommended delays between register writes for
206 * the updates to take effect. These delays are necessary for the
207 * PLL to successfully lock
208 */
Sandeep Panda0ce96e92015-05-13 12:24:10 +0530209 writel(0x00, ctl_base + 0x0214); /* PWRGEN CFG */
210 udelay(50);
Casey Piper992edde2013-08-26 11:14:02 -0700211 writel(0x01, ctl_base + 0x0220); /* GLB CFG */
212 udelay(200);
213 writel(0x05, ctl_base + 0x0220); /* GLB CFG */
214 udelay(200);
215 writel(0x0d, ctl_base + 0x0220); /* GLB CFG */
216 udelay(1);
217 writel(0x0f, ctl_base + 0x0220); /* GLB CFG */
Sandeep Panda0ce96e92015-05-13 12:24:10 +0530218 udelay(600);
Casey Piper992edde2013-08-26 11:14:02 -0700219
220 mdss_dsi_uniphy_pll_lock_detect_setting(ctl_base);
Sandeep Pandaabe9ad42015-08-21 12:20:40 +0530221 pll_locked = mdss_dsi_pll_lock_status(ctl_base);
Casey Piper992edde2013-08-26 11:14:02 -0700222
223 return pll_locked;
224}
225
Vineet Bajaj0d557f42014-05-15 19:06:27 +0530226static int msm8226_wled_backlight_ctrl(uint8_t enable)
227{
228 if (enable) {
229 pm8x41_wled_config(&wled_ctrl);
230 pm8x41_wled_sink_control(enable);
231 pm8x41_wled_iled_sync_control(enable);
232 pm8x41_wled_led_mod_enable(enable);
233 }
234 pm8x41_wled_enable(enable);
235
236 return NO_ERROR;
237}
238
239static int msm8226_pwm_backlight_ctrl(int gpio_num, int lpg_chan, int enable)
240{
241 struct pm8x41_gpio gpio_param = {
242 .direction = PM_GPIO_DIR_OUT,
243 .function = PM_GPIO_FUNC_2,
244 .vin_sel = 2, /* VIN_2 */
245 .pull = PM_GPIO_PULL_UP_1_5 | PM_GPIO_PULLDOWN_10,
246 .output_buffer = PM_GPIO_OUT_CMOS,
247 .out_strength = PM_GPIO_OUT_DRIVE_HIGH,
248 };
249
250 dprintf(SPEW, "%s: gpio=%d lpg=%d enable=%d\n", __func__,
251 gpio_num, lpg_chan, enable);
252
253 if (enable) {
254 pm8x41_gpio_config(gpio_num, &gpio_param);
255 pm8x41_lpg_write(lpg_chan, 0x41, 0x33); /* LPG_PWM_SIZE_CLK, */
256 pm8x41_lpg_write(lpg_chan, 0x42, 0x01); /* LPG_PWM_FREQ_PREDIV */
257 pm8x41_lpg_write(lpg_chan, 0x43, 0x20); /* LPG_PWM_TYPE_CONFIG */
258 pm8x41_lpg_write(lpg_chan, 0x44, 0xb2); /* LPG_VALUE_LSB */
259 pm8x41_lpg_write(lpg_chan, 0x45, 0x01); /* LPG_VALUE_MSB */
260 pm8x41_lpg_write(lpg_chan, 0x46, 0xe4); /* LPG_ENABLE_CONTROL */
261 } else {
262 pm8x41_lpg_write(lpg_chan, 0x46, 0x00);
263 }
264
265 return NO_ERROR;
266}
267
268
Kuogee Hsieh7c3982a2013-12-18 14:13:45 -0800269int target_backlight_ctrl(struct backlight *bl, uint8_t enable)
Ray Zhang743e5032013-05-25 23:25:39 +0800270{
Vineet Bajaj0d557f42014-05-15 19:06:27 +0530271 uint32_t ret = NO_ERROR;
272
Arpita Banerjeec5f78df2013-05-24 15:43:40 -0700273 dprintf(SPEW, "target_backlight_ctrl\n");
274
Kuogee Hsieh7c3982a2013-12-18 14:13:45 -0800275 if (!bl) {
276 dprintf(CRITICAL, "backlight structure is not available\n");
277 return ERR_INVALID_ARGS;
278 }
279
Vineet Bajaj0d557f42014-05-15 19:06:27 +0530280 switch (bl->bl_interface_type) {
281 case BL_WLED:
282 ret = msm8226_wled_backlight_ctrl(enable);
283 break;
284 case BL_PWM:
285 ret = msm8226_pwm_backlight_ctrl(pwm_gpio.pin_id,
286 PWM_BL_LPG_CHAN_ID,
287 enable);
288 break;
289 default:
290 dprintf(CRITICAL, "backlight type:%d not supported\n",
Kuogee Hsieh7c3982a2013-12-18 14:13:45 -0800291 bl->bl_interface_type);
Vineet Bajaj0d557f42014-05-15 19:06:27 +0530292 return ERR_NOT_SUPPORTED;
Kuogee Hsieh7c3982a2013-12-18 14:13:45 -0800293 }
294
Vineet Bajaj0d557f42014-05-15 19:06:27 +0530295 return ret;
Ray Zhang743e5032013-05-25 23:25:39 +0800296}
297
Casey Piper992edde2013-08-26 11:14:02 -0700298static void dsi_pll_enable_seq(uint32_t ctl_base)
299{
300 if (dsi_pll_enable_seq_m(ctl_base)) {
Sandeep Panda0ce96e92015-05-13 12:24:10 +0530301 } else if (dsi_pll_enable_seq_m(ctl_base)) {
Casey Piper992edde2013-08-26 11:14:02 -0700302 } else if (dsi_pll_enable_seq_d(ctl_base)) {
303 } else if (dsi_pll_enable_seq_d(ctl_base)) {
304 } else if (dsi_pll_enable_seq_f1(ctl_base)) {
305 } else if (dsi_pll_enable_seq_c(ctl_base)) {
306 } else if (dsi_pll_enable_seq_e(ctl_base)) {
307 } else {
308 dprintf(CRITICAL, "Not able to enable the pll\n");
309 }
310}
311
Arpita Banerjee0906ffd2013-05-24 16:25:38 -0700312int target_panel_clock(uint8_t enable, struct msm_panel_info *pinfo)
Ray Zhang743e5032013-05-25 23:25:39 +0800313{
Aravind Venkateswaran2713dc92013-09-19 15:23:34 -0700314 int32_t ret;
Arpita Banerjee0906ffd2013-05-24 16:25:38 -0700315 struct mdss_dsi_pll_config *pll_data;
Arpita Banerjeec5f78df2013-05-24 15:43:40 -0700316 dprintf(SPEW, "target_panel_clock\n");
Ray Zhang743e5032013-05-25 23:25:39 +0800317
Arpita Banerjee0906ffd2013-05-24 16:25:38 -0700318 pll_data = pinfo->mipi.dsi_pll_config;
319
Ray Zhang743e5032013-05-25 23:25:39 +0800320 if (enable) {
321 mdp_gdsc_ctrl(enable);
Aravind Venkateswaran24406c02013-09-19 15:13:43 -0700322 mmss_bus_clocks_enable();
323 mdp_clock_enable();
Aravind Venkateswaran2713dc92013-09-19 15:23:34 -0700324 ret = restore_secure_cfg(SECURE_DEVICE_MDSS);
325 if (ret) {
326 dprintf(CRITICAL,
327 "%s: Failed to restore MDP security configs",
328 __func__);
329 mdp_clock_disable();
330 mmss_bus_clocks_disable();
331 mdp_gdsc_ctrl(0);
332 return ret;
333 }
Casey Piper992edde2013-08-26 11:14:02 -0700334 mdss_dsi_auto_pll_config(MIPI_DSI0_BASE, pll_data);
335 dsi_pll_enable_seq(MIPI_DSI0_BASE);
Aravind Venkateswaran24406c02013-09-19 15:13:43 -0700336 mmss_dsi_clocks_enable(pll_data->pclk_m,
Arpita Banerjee0906ffd2013-05-24 16:25:38 -0700337 pll_data->pclk_n,
338 pll_data->pclk_d);
Ray Zhang743e5032013-05-25 23:25:39 +0800339 } else if(!target_cont_splash_screen()) {
Aravind Venkateswaran24406c02013-09-19 15:13:43 -0700340 mmss_dsi_clocks_disable();
341 mdp_clock_disable();
342 mmss_bus_clocks_disable();
343 mdp_gdsc_ctrl(enable);
Ray Zhang743e5032013-05-25 23:25:39 +0800344 }
345
346 return 0;
347}
348
Dhaval Patel7a349562013-08-08 20:43:52 -0700349int target_panel_reset(uint8_t enable, struct panel_reset_sequence *resetseq,
350 struct msm_panel_info *pinfo)
Ray Zhang743e5032013-05-25 23:25:39 +0800351{
Arpita Banerjeec5f78df2013-05-24 15:43:40 -0700352 int ret = NO_ERROR;
Ray Zhang743e5032013-05-25 23:25:39 +0800353 if (enable) {
Aravind Venkateswarand0398502013-11-04 16:46:46 -0800354 if (pinfo->mipi.use_enable_gpio) {
355 gpio_tlmm_config(enable_gpio.pin_id, 0,
356 enable_gpio.pin_direction, enable_gpio.pin_pull,
357 enable_gpio.pin_strength,
358 enable_gpio.pin_state);
359
360 gpio_set_dir(enable_gpio.pin_id, 2);
361 }
362
Dhaval Patel7a349562013-08-08 20:43:52 -0700363 gpio_tlmm_config(reset_gpio.pin_id, 0,
364 reset_gpio.pin_direction, reset_gpio.pin_pull,
365 reset_gpio.pin_strength, reset_gpio.pin_state);
Ray Zhang743e5032013-05-25 23:25:39 +0800366
Dhaval Patel7a349562013-08-08 20:43:52 -0700367 gpio_set_dir(reset_gpio.pin_id, 2);
Arpita Banerjeec5f78df2013-05-24 15:43:40 -0700368
Dhaval Patel7a349562013-08-08 20:43:52 -0700369 gpio_set_value(reset_gpio.pin_id, resetseq->pin_state[0]);
Arpita Banerjeec5f78df2013-05-24 15:43:40 -0700370 mdelay(resetseq->sleep[0]);
Dhaval Patel7a349562013-08-08 20:43:52 -0700371 gpio_set_value(reset_gpio.pin_id, resetseq->pin_state[1]);
Arpita Banerjeec5f78df2013-05-24 15:43:40 -0700372 mdelay(resetseq->sleep[1]);
Dhaval Patel7a349562013-08-08 20:43:52 -0700373 gpio_set_value(reset_gpio.pin_id, resetseq->pin_state[2]);
Arpita Banerjeec5f78df2013-05-24 15:43:40 -0700374 mdelay(resetseq->sleep[2]);
Ray Zhang743e5032013-05-25 23:25:39 +0800375 } else if(!target_cont_splash_screen()) {
Dhaval Patel7a349562013-08-08 20:43:52 -0700376 gpio_set_value(reset_gpio.pin_id, 0);
Aravind Venkateswarand0398502013-11-04 16:46:46 -0800377 if (pinfo->mipi.use_enable_gpio)
378 gpio_set_value(enable_gpio.pin_id, 0);
Ray Zhang743e5032013-05-25 23:25:39 +0800379 }
380
Arpita Banerjeec5f78df2013-05-24 15:43:40 -0700381 return ret;
Ray Zhang743e5032013-05-25 23:25:39 +0800382}
383
Dhaval Patel7a349562013-08-08 20:43:52 -0700384int target_ldo_ctrl(uint8_t enable)
Ray Zhang743e5032013-05-25 23:25:39 +0800385{
Arpita Banerjeec5f78df2013-05-24 15:43:40 -0700386 uint32_t ret = NO_ERROR;
387 uint32_t ldocounter = 0;
388 uint32_t pm8x41_ldo_base = 0x13F00;
Ray Zhang743e5032013-05-25 23:25:39 +0800389
Dhaval Patel7a349562013-08-08 20:43:52 -0700390 while (ldocounter < TOTAL_LDO_DEFINED) {
Arpita Banerjeec5f78df2013-05-24 15:43:40 -0700391 struct pm8x41_ldo ldo_entry = LDO((pm8x41_ldo_base +
392 0x100 * ldo_entry_array[ldocounter].ldo_id),
393 ldo_entry_array[ldocounter].ldo_type);
Ray Zhang743e5032013-05-25 23:25:39 +0800394
Arpita Banerjeec5f78df2013-05-24 15:43:40 -0700395 dprintf(SPEW, "Setting %s\n",
396 ldo_entry_array[ldocounter].ldo_id);
Ray Zhang743e5032013-05-25 23:25:39 +0800397
Arpita Banerjeec5f78df2013-05-24 15:43:40 -0700398 /* Set voltage during power on */
Dhaval Patel815567c2013-07-31 11:13:25 -0700399 if (enable) {
Arpita Banerjeec5f78df2013-05-24 15:43:40 -0700400 pm8x41_ldo_set_voltage(&ldo_entry,
401 ldo_entry_array[ldocounter].ldo_voltage);
Dhaval Patel815567c2013-07-31 11:13:25 -0700402
403 pm8x41_ldo_control(&ldo_entry, enable);
404
405 } else if(!target_cont_splash_screen() &&
406 ldo_entry_array[ldocounter].ldo_id != HFPLL_LDO_ID) {
407 pm8x41_ldo_control(&ldo_entry, enable);
Arpita Banerjeec5f78df2013-05-24 15:43:40 -0700408 }
Arpita Banerjeec5f78df2013-05-24 15:43:40 -0700409 ldocounter++;
Ray Zhang743e5032013-05-25 23:25:39 +0800410 }
411
Arpita Banerjeec5f78df2013-05-24 15:43:40 -0700412 return ret;
Ray Zhang743e5032013-05-25 23:25:39 +0800413}
414
Aravind Venkateswaran35d110b2014-02-25 16:45:11 -0800415void target_display_init(const char *panel_name)
Ray Zhang743e5032013-05-25 23:25:39 +0800416{
Pradeep Jilagamcd51b522013-10-29 13:08:51 +0530417 uint32_t panel_loop = 0;
418 uint32_t ret = 0;
419
420 do {
Justin Philipd4b293a2014-09-17 12:26:49 +0530421 target_force_cont_splash_disable(false);
Aravind Venkateswaran927e9102014-02-25 17:16:49 -0800422 ret = gcdb_display_init(panel_name, MDP_REV_50, MIPI_FB_ADDR);
Pradeep Jilagamcd51b522013-10-29 13:08:51 +0530423 if (!ret || ret == ERR_NOT_SUPPORTED) {
424 break;
425 } else {
426 target_force_cont_splash_disable(true);
427 msm_display_off();
Pradeep Jilagamcd51b522013-10-29 13:08:51 +0530428 }
429 } while (++panel_loop <= oem_panel_max_auto_detect_panels());
430
Ray Zhang743e5032013-05-25 23:25:39 +0800431}
432
Aravind Venkateswaran497653f2014-02-25 14:42:43 -0800433void target_display_shutdown(void)
Ray Zhang743e5032013-05-25 23:25:39 +0800434{
Arpita Banerjeec5f78df2013-05-24 15:43:40 -0700435 gcdb_display_shutdown();
Ray Zhang743e5032013-05-25 23:25:39 +0800436}