blob: c779ab69945a93dd97c809996842b2fed9b5f803 [file] [log] [blame]
Duy Truong790f06d2013-02-13 16:38:12 -08001/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13
14#include <linux/init.h>
15#include <linux/ioport.h>
16#include <linux/platform_device.h>
17#include <linux/bootmem.h>
Mitchel Humpherys328be572012-09-06 11:33:47 -070018#include <linux/msm_ion.h>
Steve Mucklef132c6c2012-06-06 18:30:57 -070019#include <linux/gpio.h>
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080020#include <asm/mach-types.h>
21#include <mach/msm_bus_board.h>
Huaibin Yanga5419422011-12-08 23:52:10 -080022#include <mach/msm_memtypes.h>
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080023#include <mach/board.h>
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080024#include <mach/gpiomux.h>
Nagamalleswararao Ganji937a1192011-12-07 19:00:52 -080025#include <mach/ion.h>
Amir Samuelov6f1e5002012-02-01 17:42:43 +020026#include <mach/socinfo.h>
Nagamalleswararao Ganji937a1192011-12-07 19:00:52 -080027
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080028#include "devices.h"
Stepan Moskovchenko5a83dba2011-12-05 17:30:17 -080029#include "board-8960.h"
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080030
31#ifdef CONFIG_FB_MSM_TRIPLE_BUFFER
Padmanabhan Komanduruede0a632012-01-25 12:01:28 +053032#define MSM_FB_PRIM_BUF_SIZE \
Eugene Yasman7052e132012-03-11 16:16:06 +020033 (roundup((roundup(1920, 32) * roundup(1200, 32) * 4), 4096) * 3)
34 /* 4 bpp x 3 pages */
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080035#else
Padmanabhan Komanduruede0a632012-01-25 12:01:28 +053036#define MSM_FB_PRIM_BUF_SIZE \
Eugene Yasman7052e132012-03-11 16:16:06 +020037 (roundup((roundup(1920, 32) * roundup(1200, 32) * 4), 4096) * 2)
38 /* 4 bpp x 2 pages */
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080039#endif
40
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080041/* Note: must be multiple of 4096 */
Huaibin Yangc8946d42012-05-04 17:22:02 -070042#define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE, 4096)
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080043
Huaibin Yanga5419422011-12-08 23:52:10 -080044#ifdef CONFIG_FB_MSM_OVERLAY0_WRITEBACK
Eugene Yasman7052e132012-03-11 16:16:06 +020045#define MSM_FB_OVERLAY0_WRITEBACK_SIZE \
46 roundup((roundup(1920, 32) * roundup(1200, 32) * 3 * 2), 4096)
Huaibin Yanga5419422011-12-08 23:52:10 -080047#else
48#define MSM_FB_OVERLAY0_WRITEBACK_SIZE (0)
49#endif /* CONFIG_FB_MSM_OVERLAY0_WRITEBACK */
50
51#ifdef CONFIG_FB_MSM_OVERLAY1_WRITEBACK
Eugene Yasman7052e132012-03-11 16:16:06 +020052#define MSM_FB_OVERLAY1_WRITEBACK_SIZE \
53 roundup((roundup(1920, 32) * roundup(1080, 32) * 3 * 2), 4096)
Huaibin Yanga5419422011-12-08 23:52:10 -080054#else
55#define MSM_FB_OVERLAY1_WRITEBACK_SIZE (0)
56#endif /* CONFIG_FB_MSM_OVERLAY1_WRITEBACK */
57
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080058#define MDP_VSYNC_GPIO 0
59
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080060#define MIPI_CMD_NOVATEK_QHD_PANEL_NAME "mipi_cmd_novatek_qhd"
61#define MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME "mipi_video_novatek_qhd"
62#define MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME "mipi_video_toshiba_wsvga"
Ravishangar Kalyanamda07f662012-02-16 13:29:43 -080063#define MIPI_VIDEO_TOSHIBA_WUXGA_PANEL_NAME "mipi_video_toshiba_wuxga"
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080064#define MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME "mipi_video_chimei_wxga"
Amir Samuelov6f1e5002012-02-01 17:42:43 +020065#define MIPI_VIDEO_CHIMEI_WUXGA_PANEL_NAME "mipi_video_chimei_wuxga"
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080066#define MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME "mipi_video_simulator_vga"
67#define MIPI_CMD_RENESAS_FWVGA_PANEL_NAME "mipi_cmd_renesas_fwvga"
Ravishangar Kalyaname2d015c2012-01-26 14:47:14 -080068#define MIPI_VIDEO_ORISE_720P_PANEL_NAME "mipi_video_orise_720p"
69#define MIPI_CMD_ORISE_720P_PANEL_NAME "mipi_cmd_orise_720p"
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080070#define HDMI_PANEL_NAME "hdmi_msm"
71#define TVOUT_PANEL_NAME "tvout_msm"
72
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -080073#ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -070074static unsigned char hdmi_is_primary = 1;
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -080075#else
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -070076static unsigned char hdmi_is_primary;
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -080077#endif
78
Ravishangar Kalyanamfda36c42012-03-26 16:28:19 -070079unsigned char msm8960_hdmi_as_primary_selected(void)
80{
81 return hdmi_is_primary;
82}
83
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080084static struct resource msm_fb_resources[] = {
85 {
86 .flags = IORESOURCE_DMA,
87 }
88};
89
Ravishangar Kalyanam8e784252012-02-10 16:27:51 -080090static void set_mdp_clocks_for_wuxga(void);
Amir Samuelovf0d1f542012-02-06 12:50:42 +020091
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -080092static int msm_fb_detect_panel(const char *name)
93{
94 if (machine_is_msm8960_liquid()) {
Amir Samuelov6f1e5002012-02-01 17:42:43 +020095 u32 ver = socinfo_get_platform_version();
96 if (SOCINFO_VERSION_MAJOR(ver) == 3) {
97 if (!strncmp(name, MIPI_VIDEO_CHIMEI_WUXGA_PANEL_NAME,
98 strnlen(MIPI_VIDEO_CHIMEI_WUXGA_PANEL_NAME,
Amir Samuelovf0d1f542012-02-06 12:50:42 +020099 PANEL_NAME_MAX_LEN))) {
Ravishangar Kalyanam8e784252012-02-10 16:27:51 -0800100 set_mdp_clocks_for_wuxga();
Amir Samuelov6f1e5002012-02-01 17:42:43 +0200101 return 0;
Amir Samuelovf0d1f542012-02-06 12:50:42 +0200102 }
Amir Samuelov6f1e5002012-02-01 17:42:43 +0200103 } else {
104 if (!strncmp(name, MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
105 strnlen(MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME,
106 PANEL_NAME_MAX_LEN)))
107 return 0;
108 }
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800109 } else {
110 if (!strncmp(name, MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
111 strnlen(MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
112 PANEL_NAME_MAX_LEN)))
113 return 0;
114
Ravishangar Kalyanama4286d72012-02-15 16:09:58 -0800115#if !defined(CONFIG_FB_MSM_LVDS_MIPI_PANEL_DETECT) && \
116 !defined(CONFIG_FB_MSM_MIPI_PANEL_DETECT)
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800117 if (!strncmp(name, MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
118 strnlen(MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME,
119 PANEL_NAME_MAX_LEN)))
120 return 0;
121
122 if (!strncmp(name, MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
123 strnlen(MIPI_CMD_NOVATEK_QHD_PANEL_NAME,
124 PANEL_NAME_MAX_LEN)))
125 return 0;
126
127 if (!strncmp(name, MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
128 strnlen(MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME,
129 PANEL_NAME_MAX_LEN)))
130 return 0;
131
132 if (!strncmp(name, MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
133 strnlen(MIPI_CMD_RENESAS_FWVGA_PANEL_NAME,
134 PANEL_NAME_MAX_LEN)))
135 return 0;
Ravishangar Kalyanam8e784252012-02-10 16:27:51 -0800136
Ravishangar Kalyanamda07f662012-02-16 13:29:43 -0800137 if (!strncmp(name, MIPI_VIDEO_TOSHIBA_WUXGA_PANEL_NAME,
138 strnlen(MIPI_VIDEO_TOSHIBA_WUXGA_PANEL_NAME,
Ravishangar Kalyanam8e784252012-02-10 16:27:51 -0800139 PANEL_NAME_MAX_LEN))) {
140 set_mdp_clocks_for_wuxga();
141 return 0;
142 }
Ravishangar Kalyaname2d015c2012-01-26 14:47:14 -0800143
144 if (!strncmp(name, MIPI_VIDEO_ORISE_720P_PANEL_NAME,
145 strnlen(MIPI_VIDEO_ORISE_720P_PANEL_NAME,
146 PANEL_NAME_MAX_LEN)))
147 return 0;
148
149 if (!strncmp(name, MIPI_CMD_ORISE_720P_PANEL_NAME,
150 strnlen(MIPI_CMD_ORISE_720P_PANEL_NAME,
151 PANEL_NAME_MAX_LEN)))
152 return 0;
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800153#endif
154 }
155
156 if (!strncmp(name, HDMI_PANEL_NAME,
157 strnlen(HDMI_PANEL_NAME,
Ravishangar Kalyanam5f0c6412012-03-15 17:24:11 -0700158 PANEL_NAME_MAX_LEN))) {
159 if (hdmi_is_primary)
160 set_mdp_clocks_for_wuxga();
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800161 return 0;
Ravishangar Kalyanam5f0c6412012-03-15 17:24:11 -0700162 }
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800163
164 if (!strncmp(name, TVOUT_PANEL_NAME,
165 strnlen(TVOUT_PANEL_NAME,
166 PANEL_NAME_MAX_LEN)))
167 return 0;
168
169 pr_warning("%s: not supported '%s'", __func__, name);
170 return -ENODEV;
171}
172
173static struct msm_fb_platform_data msm_fb_pdata = {
174 .detect_client = msm_fb_detect_panel,
175};
176
177static struct platform_device msm_fb_device = {
178 .name = "msm_fb",
179 .id = 0,
180 .num_resources = ARRAY_SIZE(msm_fb_resources),
181 .resource = msm_fb_resources,
182 .dev.platform_data = &msm_fb_pdata,
183};
184
Chandan Uddaraju2679f092012-03-09 15:48:04 -0800185static void mipi_dsi_panel_pwm_cfg(void)
186{
187 int rc;
188 static int mipi_dsi_panel_gpio_configured;
189 static struct pm_gpio pwm_enable = {
190 .direction = PM_GPIO_DIR_OUT,
191 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
192 .output_value = 1,
193 .pull = PM_GPIO_PULL_NO,
194 .vin_sel = PM_GPIO_VIN_VPH,
195 .out_strength = PM_GPIO_STRENGTH_HIGH,
196 .function = PM_GPIO_FUNC_NORMAL,
197 .inv_int_pol = 0,
198 .disable_pin = 0,
199 };
200 static struct pm_gpio pwm_mode = {
201 .direction = PM_GPIO_DIR_OUT,
202 .output_buffer = PM_GPIO_OUT_BUF_CMOS,
203 .output_value = 0,
204 .pull = PM_GPIO_PULL_NO,
205 .vin_sel = PM_GPIO_VIN_S4,
206 .out_strength = PM_GPIO_STRENGTH_HIGH,
207 .function = PM_GPIO_FUNC_2,
208 .inv_int_pol = 0,
209 .disable_pin = 0,
210 };
211
212 if (mipi_dsi_panel_gpio_configured == 0) {
213 /* pm8xxx: gpio-21, Backlight Enable */
214 rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(21),
215 &pwm_enable);
216 if (rc != 0)
217 pr_err("%s: pwm_enabled failed\n", __func__);
218
219 /* pm8xxx: gpio-24, Bl: Off, PWM mode */
220 rc = pm8xxx_gpio_config(PM8921_GPIO_PM_TO_SYS(24),
221 &pwm_mode);
222 if (rc != 0)
223 pr_err("%s: pwm_mode failed\n", __func__);
224
225 mipi_dsi_panel_gpio_configured++;
226 }
227}
228
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800229static bool dsi_power_on;
230
231/**
232 * LiQUID panel on/off
233 *
234 * @param on
235 *
236 * @return int
237 */
238static int mipi_dsi_liquid_panel_power(int on)
239{
240 static struct regulator *reg_l2, *reg_ext_3p3v;
241 static int gpio21, gpio24, gpio43;
242 int rc;
243
Chandan Uddaraju2679f092012-03-09 15:48:04 -0800244 mipi_dsi_panel_pwm_cfg();
Jeff Ohlstein2cbe5ba2011-12-16 13:32:56 -0800245 pr_debug("%s: on=%d\n", __func__, on);
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800246
247 gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */
248 gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/
249 gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */
250
251 if (!dsi_power_on) {
252
253 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
254 "dsi_vdda");
255 if (IS_ERR(reg_l2)) {
256 pr_err("could not get 8921_l2, rc = %ld\n",
257 PTR_ERR(reg_l2));
258 return -ENODEV;
259 }
260
261 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
262 if (rc) {
263 pr_err("set_voltage l2 failed, rc=%d\n", rc);
264 return -EINVAL;
265 }
266
267 reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev,
268 "vdd_lvds_3p3v");
269 if (IS_ERR(reg_ext_3p3v)) {
270 pr_err("could not get reg_ext_3p3v, rc = %ld\n",
271 PTR_ERR(reg_ext_3p3v));
272 return -ENODEV;
273 }
274
275 rc = gpio_request(gpio21, "disp_pwr_en_n");
276 if (rc) {
277 pr_err("request gpio 21 failed, rc=%d\n", rc);
278 return -ENODEV;
279 }
280
281 rc = gpio_request(gpio43, "disp_rst_n");
282 if (rc) {
283 pr_err("request gpio 43 failed, rc=%d\n", rc);
284 return -ENODEV;
285 }
286
287 rc = gpio_request(gpio24, "disp_backlight_pwm");
288 if (rc) {
289 pr_err("request gpio 24 failed, rc=%d\n", rc);
290 return -ENODEV;
291 }
292
293 dsi_power_on = true;
294 }
295
296 if (on) {
297 rc = regulator_set_optimum_mode(reg_l2, 100000);
298 if (rc < 0) {
299 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
300 return -EINVAL;
301 }
302 rc = regulator_enable(reg_l2);
303 if (rc) {
304 pr_err("enable l2 failed, rc=%d\n", rc);
305 return -ENODEV;
306 }
307
308 rc = regulator_enable(reg_ext_3p3v);
309 if (rc) {
310 pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc);
311 return -ENODEV;
312 }
313
314 /* set reset pin before power enable */
315 gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */
316
317 gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */
318 msleep(20);
319 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
320 msleep(20);
321 gpio_set_value_cansleep(gpio43, 0); /* disp enable */
322 msleep(20);
323 gpio_set_value_cansleep(gpio43, 1); /* disp enable */
324 msleep(20);
325 } else {
326 gpio_set_value_cansleep(gpio43, 0);
327 gpio_set_value_cansleep(gpio21, 1);
328
329 rc = regulator_disable(reg_l2);
330 if (rc) {
331 pr_err("disable reg_l2 failed, rc=%d\n", rc);
332 return -ENODEV;
333 }
334 rc = regulator_disable(reg_ext_3p3v);
335 if (rc) {
336 pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc);
337 return -ENODEV;
338 }
339 rc = regulator_set_optimum_mode(reg_l2, 100);
340 if (rc < 0) {
341 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
342 return -EINVAL;
343 }
344 }
345
346 return 0;
347}
348
349static int mipi_dsi_cdp_panel_power(int on)
350{
351 static struct regulator *reg_l8, *reg_l23, *reg_l2;
352 static int gpio43;
353 int rc;
354
Jeff Ohlstein2cbe5ba2011-12-16 13:32:56 -0800355 pr_debug("%s: state : %d\n", __func__, on);
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800356
357 if (!dsi_power_on) {
358
359 reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev,
360 "dsi_vdc");
361 if (IS_ERR(reg_l8)) {
362 pr_err("could not get 8921_l8, rc = %ld\n",
363 PTR_ERR(reg_l8));
364 return -ENODEV;
365 }
366 reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev,
367 "dsi_vddio");
368 if (IS_ERR(reg_l23)) {
369 pr_err("could not get 8921_l23, rc = %ld\n",
370 PTR_ERR(reg_l23));
371 return -ENODEV;
372 }
373 reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev,
374 "dsi_vdda");
375 if (IS_ERR(reg_l2)) {
376 pr_err("could not get 8921_l2, rc = %ld\n",
377 PTR_ERR(reg_l2));
378 return -ENODEV;
379 }
380 rc = regulator_set_voltage(reg_l8, 2800000, 3000000);
381 if (rc) {
382 pr_err("set_voltage l8 failed, rc=%d\n", rc);
383 return -EINVAL;
384 }
385 rc = regulator_set_voltage(reg_l23, 1800000, 1800000);
386 if (rc) {
387 pr_err("set_voltage l23 failed, rc=%d\n", rc);
388 return -EINVAL;
389 }
390 rc = regulator_set_voltage(reg_l2, 1200000, 1200000);
391 if (rc) {
392 pr_err("set_voltage l2 failed, rc=%d\n", rc);
393 return -EINVAL;
394 }
395 gpio43 = PM8921_GPIO_PM_TO_SYS(43);
396 rc = gpio_request(gpio43, "disp_rst_n");
397 if (rc) {
398 pr_err("request gpio 43 failed, rc=%d\n", rc);
399 return -ENODEV;
400 }
401 dsi_power_on = true;
402 }
403 if (on) {
404 rc = regulator_set_optimum_mode(reg_l8, 100000);
405 if (rc < 0) {
406 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
407 return -EINVAL;
408 }
409 rc = regulator_set_optimum_mode(reg_l23, 100000);
410 if (rc < 0) {
411 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
412 return -EINVAL;
413 }
414 rc = regulator_set_optimum_mode(reg_l2, 100000);
415 if (rc < 0) {
416 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
417 return -EINVAL;
418 }
419 rc = regulator_enable(reg_l8);
420 if (rc) {
421 pr_err("enable l8 failed, rc=%d\n", rc);
422 return -ENODEV;
423 }
424 rc = regulator_enable(reg_l23);
425 if (rc) {
426 pr_err("enable l8 failed, rc=%d\n", rc);
427 return -ENODEV;
428 }
429 rc = regulator_enable(reg_l2);
430 if (rc) {
431 pr_err("enable l2 failed, rc=%d\n", rc);
432 return -ENODEV;
433 }
434 gpio_set_value_cansleep(gpio43, 1);
435 } else {
436 rc = regulator_disable(reg_l2);
437 if (rc) {
438 pr_err("disable reg_l2 failed, rc=%d\n", rc);
439 return -ENODEV;
440 }
441 rc = regulator_disable(reg_l8);
442 if (rc) {
443 pr_err("disable reg_l8 failed, rc=%d\n", rc);
444 return -ENODEV;
445 }
446 rc = regulator_disable(reg_l23);
447 if (rc) {
448 pr_err("disable reg_l23 failed, rc=%d\n", rc);
449 return -ENODEV;
450 }
451 rc = regulator_set_optimum_mode(reg_l8, 100);
452 if (rc < 0) {
453 pr_err("set_optimum_mode l8 failed, rc=%d\n", rc);
454 return -EINVAL;
455 }
456 rc = regulator_set_optimum_mode(reg_l23, 100);
457 if (rc < 0) {
458 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
459 return -EINVAL;
460 }
461 rc = regulator_set_optimum_mode(reg_l2, 100);
462 if (rc < 0) {
463 pr_err("set_optimum_mode l2 failed, rc=%d\n", rc);
464 return -EINVAL;
465 }
466 gpio_set_value_cansleep(gpio43, 0);
467 }
468 return 0;
469}
470
Ravishangar Kalyanam87dd72e2012-04-16 19:07:36 -0700471static char mipi_dsi_splash_is_enabled(void);
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800472static int mipi_dsi_panel_power(int on)
473{
474 int ret;
475
Jeff Ohlstein2cbe5ba2011-12-16 13:32:56 -0800476 pr_debug("%s: on=%d\n", __func__, on);
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800477
478 if (machine_is_msm8960_liquid())
479 ret = mipi_dsi_liquid_panel_power(on);
480 else
481 ret = mipi_dsi_cdp_panel_power(on);
482
483 return ret;
484}
485
486static struct mipi_dsi_platform_data mipi_dsi_pdata = {
487 .vsync_gpio = MDP_VSYNC_GPIO,
488 .dsi_power_save = mipi_dsi_panel_power,
Ravishangar Kalyanam87dd72e2012-04-16 19:07:36 -0700489 .splash_is_enabled = mipi_dsi_splash_is_enabled,
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800490};
491
492#ifdef CONFIG_MSM_BUS_SCALING
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800493static struct msm_bus_vectors mdp_init_vectors[] = {
494 {
495 .src = MSM_BUS_MASTER_MDP_PORT0,
496 .dst = MSM_BUS_SLAVE_EBI_CH0,
497 .ab = 0,
498 .ib = 0,
499 },
500};
501
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800502static struct msm_bus_vectors mdp_ui_vectors[] = {
503 {
504 .src = MSM_BUS_MASTER_MDP_PORT0,
505 .dst = MSM_BUS_SLAVE_EBI_CH0,
506 .ab = 216000000 * 2,
507 .ib = 270000000 * 2,
508 },
509};
510
511static struct msm_bus_vectors mdp_vga_vectors[] = {
512 /* VGA and less video */
513 {
514 .src = MSM_BUS_MASTER_MDP_PORT0,
515 .dst = MSM_BUS_SLAVE_EBI_CH0,
516 .ab = 216000000 * 2,
517 .ib = 270000000 * 2,
518 },
519};
520
521static struct msm_bus_vectors mdp_720p_vectors[] = {
522 /* 720p and less video */
523 {
524 .src = MSM_BUS_MASTER_MDP_PORT0,
525 .dst = MSM_BUS_SLAVE_EBI_CH0,
526 .ab = 230400000 * 2,
527 .ib = 288000000 * 2,
528 },
529};
530
531static struct msm_bus_vectors mdp_1080p_vectors[] = {
532 /* 1080p and less video */
533 {
534 .src = MSM_BUS_MASTER_MDP_PORT0,
535 .dst = MSM_BUS_SLAVE_EBI_CH0,
536 .ab = 334080000 * 2,
537 .ib = 417600000 * 2,
538 },
539};
540
541static struct msm_bus_paths mdp_bus_scale_usecases[] = {
542 {
543 ARRAY_SIZE(mdp_init_vectors),
544 mdp_init_vectors,
545 },
546 {
547 ARRAY_SIZE(mdp_ui_vectors),
548 mdp_ui_vectors,
549 },
550 {
551 ARRAY_SIZE(mdp_ui_vectors),
552 mdp_ui_vectors,
553 },
554 {
555 ARRAY_SIZE(mdp_vga_vectors),
556 mdp_vga_vectors,
557 },
558 {
559 ARRAY_SIZE(mdp_720p_vectors),
560 mdp_720p_vectors,
561 },
562 {
563 ARRAY_SIZE(mdp_1080p_vectors),
564 mdp_1080p_vectors,
565 },
566};
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800567
568static struct msm_bus_scale_pdata mdp_bus_scale_pdata = {
569 mdp_bus_scale_usecases,
570 ARRAY_SIZE(mdp_bus_scale_usecases),
571 .name = "mdp",
572};
573
574#endif
575
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800576static struct msm_panel_common_pdata mdp_pdata = {
577 .gpio = MDP_VSYNC_GPIO,
Siddhartha Agrawal496f9282012-08-15 17:41:34 -0700578 .mdp_max_clk = 200000000,
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800579#ifdef CONFIG_MSM_BUS_SCALING
580 .mdp_bus_scale_table = &mdp_bus_scale_pdata,
581#endif
582 .mdp_rev = MDP_REV_42,
Nagamalleswararao Ganji937a1192011-12-07 19:00:52 -0800583#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
Ravishangar Kalyanama3b168b2012-03-26 11:13:11 -0700584 .mem_hid = BIT(ION_CP_MM_HEAP_ID),
Nagamalleswararao Ganji937a1192011-12-07 19:00:52 -0800585#else
586 .mem_hid = MEMTYPE_EBI1,
587#endif
Chandan Uddaraju2679f092012-03-09 15:48:04 -0800588 .cont_splash_enabled = 0x01,
Pradeep Jilagamd635cad2012-08-03 15:52:06 +0530589 .splash_screen_addr = 0x00,
590 .splash_screen_size = 0x00,
Olav Hauganef95ae32012-05-15 09:50:30 -0700591 .mdp_iommu_split_domain = 0,
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800592};
593
Huaibin Yanga5419422011-12-08 23:52:10 -0800594void __init msm8960_mdp_writeback(struct memtype_reserve* reserve_table)
595{
Nagamalleswararao Ganji937a1192011-12-07 19:00:52 -0800596 mdp_pdata.ov0_wb_size = MSM_FB_OVERLAY0_WRITEBACK_SIZE;
597 mdp_pdata.ov1_wb_size = MSM_FB_OVERLAY1_WRITEBACK_SIZE;
598#if defined(CONFIG_ANDROID_PMEM) && !defined(CONFIG_MSM_MULTIMEDIA_USE_ION)
599 reserve_table[mdp_pdata.mem_hid].size +=
600 mdp_pdata.ov0_wb_size;
601 reserve_table[mdp_pdata.mem_hid].size +=
602 mdp_pdata.ov1_wb_size;
603#endif
Huaibin Yanga5419422011-12-08 23:52:10 -0800604}
605
Ravishangar Kalyanam87dd72e2012-04-16 19:07:36 -0700606static char mipi_dsi_splash_is_enabled(void)
607{
608 return mdp_pdata.cont_splash_enabled;
609}
610
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800611#define LPM_CHANNEL0 0
612static int toshiba_gpio[] = {LPM_CHANNEL0};
613
614static struct mipi_dsi_panel_platform_data toshiba_pdata = {
615 .gpio = toshiba_gpio,
Chandan Uddaraju2679f092012-03-09 15:48:04 -0800616 .dsi_pwm_cfg = mipi_dsi_panel_pwm_cfg,
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800617};
618
619static struct platform_device mipi_dsi_toshiba_panel_device = {
620 .name = "mipi_toshiba",
621 .id = 0,
622 .dev = {
623 .platform_data = &toshiba_pdata,
624 }
625};
626
627#define FPGA_3D_GPIO_CONFIG_ADDR 0xB5
Amir Samuelovca199b92012-01-31 14:50:04 +0200628static int dsi2lvds_gpio[4] = {
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800629 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */
Amir Samuelovca199b92012-01-31 14:50:04 +0200630 0x1F08, /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */
631 GPIO_LIQUID_EXPANDER_BASE+6, /* TN Enable */
632 GPIO_LIQUID_EXPANDER_BASE+7, /* TN Mode */
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800633 };
634
635static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = {
636 .gpio_num = dsi2lvds_gpio,
637};
638
639static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = {
640
641/* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */
642 {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */
643 /* timing */
644 {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c,
645 0x0c, 0x03, 0x04, 0xa0},
646 {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */
647 {0xff, 0x00, 0x06, 0x00}, /* strength */
648 /* pll control */
649 {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62,
650 0x40, 0x07, 0x03,
651 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01},
652};
653
654static struct mipi_dsi_panel_platform_data novatek_pdata = {
655 .fpga_3d_config_addr = FPGA_3D_GPIO_CONFIG_ADDR,
656 .fpga_ctrl_mode = FPGA_SPI_INTF,
657 .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db,
658};
659
660static struct platform_device mipi_dsi_novatek_panel_device = {
661 .name = "mipi_novatek",
662 .id = 0,
663 .dev = {
664 .platform_data = &novatek_pdata,
665 }
666};
667
668static struct platform_device mipi_dsi2lvds_bridge_device = {
669 .name = "mipi_tc358764",
670 .id = 0,
671 .dev.platform_data = &mipi_dsi2lvds_pdata,
672};
673
Ravishangar Kalyaname2d015c2012-01-26 14:47:14 -0800674static struct platform_device mipi_dsi_orise_panel_device = {
675 .name = "mipi_orise",
676 .id = 0,
677};
678
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800679#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
680static struct resource hdmi_msm_resources[] = {
681 {
682 .name = "hdmi_msm_qfprom_addr",
683 .start = 0x00700000,
684 .end = 0x007060FF,
685 .flags = IORESOURCE_MEM,
686 },
687 {
688 .name = "hdmi_msm_hdmi_addr",
689 .start = 0x04A00000,
690 .end = 0x04A00FFF,
691 .flags = IORESOURCE_MEM,
692 },
693 {
694 .name = "hdmi_msm_irq",
695 .start = HDMI_IRQ,
696 .end = HDMI_IRQ,
697 .flags = IORESOURCE_IRQ,
698 },
699};
700
701static int hdmi_enable_5v(int on);
702static int hdmi_core_power(int on, int show);
703static int hdmi_cec_power(int on);
Ajay Singh Parmar7d11c272012-06-07 12:25:31 +0530704static int hdmi_gpio_config(int on);
705static int hdmi_panel_power(int on);
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800706
707static struct msm_hdmi_platform_data hdmi_msm_data = {
708 .irq = HDMI_IRQ,
709 .enable_5v = hdmi_enable_5v,
710 .core_power = hdmi_core_power,
711 .cec_power = hdmi_cec_power,
Ajay Singh Parmar7d11c272012-06-07 12:25:31 +0530712 .panel_power = hdmi_panel_power,
713 .gpio_config = hdmi_gpio_config,
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800714};
715
716static struct platform_device hdmi_msm_device = {
717 .name = "hdmi_msm",
718 .id = 0,
719 .num_resources = ARRAY_SIZE(hdmi_msm_resources),
720 .resource = hdmi_msm_resources,
721 .dev.platform_data = &hdmi_msm_data,
722};
723#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
724
725#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
726static struct platform_device wfd_panel_device = {
727 .name = "wfd_panel",
728 .id = 0,
729 .dev.platform_data = NULL,
730};
Stepan Moskovchenko270888d2011-11-30 12:19:11 -0800731
732static struct platform_device wfd_device = {
733 .name = "msm_wfd",
734 .id = -1,
735};
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800736#endif
737
738#ifdef CONFIG_MSM_BUS_SCALING
739static struct msm_bus_vectors dtv_bus_init_vectors[] = {
740 {
741 .src = MSM_BUS_MASTER_MDP_PORT0,
742 .dst = MSM_BUS_SLAVE_EBI_CH0,
743 .ab = 0,
744 .ib = 0,
745 },
746};
747
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800748static struct msm_bus_vectors dtv_bus_def_vectors[] = {
749 {
750 .src = MSM_BUS_MASTER_MDP_PORT0,
751 .dst = MSM_BUS_SLAVE_EBI_CH0,
752 .ab = 566092800 * 2,
753 .ib = 707616000 * 2,
754 },
755};
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800756
757static struct msm_bus_paths dtv_bus_scale_usecases[] = {
758 {
759 ARRAY_SIZE(dtv_bus_init_vectors),
760 dtv_bus_init_vectors,
761 },
762 {
763 ARRAY_SIZE(dtv_bus_def_vectors),
764 dtv_bus_def_vectors,
765 },
766};
767static struct msm_bus_scale_pdata dtv_bus_scale_pdata = {
768 dtv_bus_scale_usecases,
769 ARRAY_SIZE(dtv_bus_scale_usecases),
770 .name = "dtv",
771};
772
773static struct lcdc_platform_data dtv_pdata = {
774 .bus_scale_table = &dtv_bus_scale_pdata,
Ajay Singh Parmar7d11c272012-06-07 12:25:31 +0530775 .lcdc_power_save = hdmi_panel_power,
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800776};
Ajay Singh Parmar7d11c272012-06-07 12:25:31 +0530777
778static int hdmi_panel_power(int on)
779{
780 int rc;
781
782 pr_debug("%s: HDMI Core: %s\n", __func__, (on ? "ON" : "OFF"));
783 rc = hdmi_core_power(on, 1);
784 if (rc)
785 rc = hdmi_cec_power(on);
786
787 pr_debug("%s: HDMI Core: %s Success\n", __func__, (on ? "ON" : "OFF"));
788 return rc;
789}
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800790#endif
791
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800792#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800793static int hdmi_enable_5v(int on)
794{
795 /* TBD: PM8921 regulator instead of 8901 */
796 static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */
797 static int prev_on;
798 int rc;
799
800 if (on == prev_on)
801 return 0;
802
Ajay Singh Parmar07847642011-12-09 02:57:45 +0530803 if (!reg_8921_hdmi_mvs) {
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800804 reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev,
Ajay Singh Parmar07847642011-12-09 02:57:45 +0530805 "hdmi_mvs");
806 if (IS_ERR(reg_8921_hdmi_mvs)) {
807 pr_err("'%s' regulator not found, rc=%ld\n",
808 "hdmi_mvs", IS_ERR(reg_8921_hdmi_mvs));
809 reg_8921_hdmi_mvs = NULL;
810 return -ENODEV;
811 }
812 }
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800813
814 if (on) {
815 rc = regulator_enable(reg_8921_hdmi_mvs);
816 if (rc) {
817 pr_err("'%s' regulator enable failed, rc=%d\n",
818 "8921_hdmi_mvs", rc);
819 return rc;
820 }
821 pr_debug("%s(on): success\n", __func__);
822 } else {
823 rc = regulator_disable(reg_8921_hdmi_mvs);
824 if (rc)
825 pr_warning("'%s' regulator disable failed, rc=%d\n",
826 "8921_hdmi_mvs", rc);
827 pr_debug("%s(off): success\n", __func__);
828 }
829
830 prev_on = on;
831
832 return 0;
833}
834
835static int hdmi_core_power(int on, int show)
836{
837 static struct regulator *reg_8921_l23, *reg_8921_s4;
838 static int prev_on;
839 int rc;
840
841 if (on == prev_on)
842 return 0;
843
844 /* TBD: PM8921 regulator instead of 8901 */
845 if (!reg_8921_l23) {
846 reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd");
847 if (IS_ERR(reg_8921_l23)) {
848 pr_err("could not get reg_8921_l23, rc = %ld\n",
849 PTR_ERR(reg_8921_l23));
850 return -ENODEV;
851 }
852 rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000);
853 if (rc) {
854 pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc);
855 return -EINVAL;
856 }
857 }
858 if (!reg_8921_s4) {
859 reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc");
860 if (IS_ERR(reg_8921_s4)) {
861 pr_err("could not get reg_8921_s4, rc = %ld\n",
862 PTR_ERR(reg_8921_s4));
863 return -ENODEV;
864 }
865 rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000);
866 if (rc) {
867 pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc);
868 return -EINVAL;
869 }
870 }
871
872 if (on) {
873 rc = regulator_set_optimum_mode(reg_8921_l23, 100000);
874 if (rc < 0) {
875 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
876 return -EINVAL;
877 }
878 rc = regulator_enable(reg_8921_l23);
879 if (rc) {
880 pr_err("'%s' regulator enable failed, rc=%d\n",
881 "hdmi_avdd", rc);
882 return rc;
883 }
884 rc = regulator_enable(reg_8921_s4);
885 if (rc) {
886 pr_err("'%s' regulator enable failed, rc=%d\n",
887 "hdmi_vcc", rc);
888 return rc;
889 }
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800890 pr_debug("%s(on): success\n", __func__);
891 } else {
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800892 rc = regulator_disable(reg_8921_l23);
893 if (rc) {
894 pr_err("disable reg_8921_l23 failed, rc=%d\n", rc);
895 return -ENODEV;
896 }
897 rc = regulator_disable(reg_8921_s4);
898 if (rc) {
899 pr_err("disable reg_8921_s4 failed, rc=%d\n", rc);
900 return -ENODEV;
901 }
902 rc = regulator_set_optimum_mode(reg_8921_l23, 100);
903 if (rc < 0) {
904 pr_err("set_optimum_mode l23 failed, rc=%d\n", rc);
905 return -EINVAL;
906 }
907 pr_debug("%s(off): success\n", __func__);
908 }
909
910 prev_on = on;
911
912 return 0;
Ajay Singh Parmar7d11c272012-06-07 12:25:31 +0530913}
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800914
Ajay Singh Parmar7d11c272012-06-07 12:25:31 +0530915static int hdmi_gpio_config(int on)
916{
917 int rc = 0;
918 static int prev_on;
919
920 if (on == prev_on)
921 return 0;
922
923 if (on) {
924 rc = gpio_request(100, "HDMI_DDC_CLK");
925 if (rc) {
926 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
927 "HDMI_DDC_CLK", 100, rc);
928 return rc;
929 }
930 rc = gpio_request(101, "HDMI_DDC_DATA");
931 if (rc) {
932 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
933 "HDMI_DDC_DATA", 101, rc);
934 goto error1;
935 }
936 rc = gpio_request(102, "HDMI_HPD");
937 if (rc) {
938 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
939 "HDMI_HPD", 102, rc);
940 goto error2;
941 }
942 pr_debug("%s(on): success\n", __func__);
943 } else {
944 gpio_free(100);
945 gpio_free(101);
946 gpio_free(102);
947 pr_debug("%s(off): success\n", __func__);
948 }
949
950 prev_on = on;
951 return 0;
952
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800953error2:
Ajay Singh Parmar7d11c272012-06-07 12:25:31 +0530954 gpio_free(101);
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800955error1:
Ajay Singh Parmar7d11c272012-06-07 12:25:31 +0530956 gpio_free(100);
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -0800957 return rc;
958}
959
960static int hdmi_cec_power(int on)
961{
962 static int prev_on;
963 int rc;
964
965 if (on == prev_on)
966 return 0;
967
968 if (on) {
969 rc = gpio_request(99, "HDMI_CEC_VAR");
970 if (rc) {
971 pr_err("'%s'(%d) gpio_request failed, rc=%d\n",
972 "HDMI_CEC_VAR", 99, rc);
973 goto error;
974 }
975 pr_debug("%s(on): success\n", __func__);
976 } else {
977 gpio_free(99);
978 pr_debug("%s(off): success\n", __func__);
979 }
980
981 prev_on = on;
982
983 return 0;
984error:
985 return rc;
986}
987#endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */
988
989void __init msm8960_init_fb(void)
990{
Carl Vanderlip37bbc552012-11-16 11:34:44 -0800991 uint32_t soc_platform_version = socinfo_get_version();
992
993
994 if (SOCINFO_VERSION_MAJOR(soc_platform_version) >= 3)
995 mdp_pdata.mdp_rev = MDP_REV_43;
996
Ravishangar Kalyanam34ddee52012-07-13 14:42:53 -0700997 if (cpu_is_msm8960ab())
998 mdp_pdata.mdp_rev = MDP_REV_44;
999
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08001000 platform_device_register(&msm_fb_device);
1001
Stepan Moskovchenko270888d2011-11-30 12:19:11 -08001002#ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
1003 platform_device_register(&wfd_panel_device);
1004 platform_device_register(&wfd_device);
1005#endif
1006
Syed Rameez Mustafacf645e82012-07-06 19:00:49 -07001007 platform_device_register(&mipi_dsi_novatek_panel_device);
1008 platform_device_register(&mipi_dsi_orise_panel_device);
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08001009
1010#ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL
Syed Rameez Mustafacf645e82012-07-06 19:00:49 -07001011 platform_device_register(&hdmi_msm_device);
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08001012#endif
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08001013
1014 if (machine_is_msm8960_liquid())
1015 platform_device_register(&mipi_dsi2lvds_bridge_device);
1016 else
1017 platform_device_register(&mipi_dsi_toshiba_panel_device);
1018
Syed Rameez Mustafae4a6f8e2012-07-09 15:25:13 -07001019 msm_fb_register_device("mdp", &mdp_pdata);
Stepan Moskovchenko24cd8642011-11-29 13:07:53 -08001020 msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata);
1021#ifdef CONFIG_MSM_BUS_SCALING
1022 msm_fb_register_device("dtv", &dtv_pdata);
1023#endif
1024}
1025
1026void __init msm8960_allocate_fb_region(void)
1027{
1028 void *addr;
1029 unsigned long size;
1030
1031 size = MSM_FB_SIZE;
1032 addr = alloc_bootmem_align(size, 0x1000);
1033 msm_fb_resources[0].start = __pa(addr);
1034 msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1;
1035 pr_info("allocating %lu bytes at %p (%lx physical) for fb\n",
1036 size, addr, __pa(addr));
1037}
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -08001038
Ravishangar Kalyanam5f0c6412012-03-15 17:24:11 -07001039/**
1040 * Set MDP clocks to high frequency to avoid DSI underflow
1041 * when using high resolution 1200x1920 WUXGA panels
1042 */
1043static void set_mdp_clocks_for_wuxga(void)
1044{
Ravishangar Kalyanam5f0c6412012-03-15 17:24:11 -07001045 mdp_ui_vectors[0].ab = 2000000000;
1046 mdp_ui_vectors[0].ib = 2000000000;
1047 mdp_vga_vectors[0].ab = 2000000000;
1048 mdp_vga_vectors[0].ib = 2000000000;
1049 mdp_720p_vectors[0].ab = 2000000000;
1050 mdp_720p_vectors[0].ib = 2000000000;
1051 mdp_1080p_vectors[0].ab = 2000000000;
1052 mdp_1080p_vectors[0].ib = 2000000000;
1053
Ravishangar Kalyanam5f0c6412012-03-15 17:24:11 -07001054 if (hdmi_is_primary) {
1055 dtv_bus_def_vectors[0].ab = 2000000000;
1056 dtv_bus_def_vectors[0].ib = 2000000000;
1057 }
1058}
1059
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -08001060void __init msm8960_set_display_params(char *prim_panel, char *ext_panel)
1061{
Ravishangar Kalyanam87dd72e2012-04-16 19:07:36 -07001062 int disable_splash = 0;
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -08001063 if (strnlen(prim_panel, PANEL_NAME_MAX_LEN)) {
1064 strlcpy(msm_fb_pdata.prim_panel_name, prim_panel,
1065 PANEL_NAME_MAX_LEN);
1066 pr_debug("msm_fb_pdata.prim_panel_name %s\n",
1067 msm_fb_pdata.prim_panel_name);
1068
Ravishangar Kalyanam87dd72e2012-04-16 19:07:36 -07001069 if (strncmp((char *)msm_fb_pdata.prim_panel_name,
1070 MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1071 strnlen(MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME,
1072 PANEL_NAME_MAX_LEN))) {
1073 /* Disable splash for panels other than Toshiba WSVGA */
1074 disable_splash = 1;
1075 }
1076
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -08001077 if (!strncmp((char *)msm_fb_pdata.prim_panel_name,
1078 HDMI_PANEL_NAME, strnlen(HDMI_PANEL_NAME,
1079 PANEL_NAME_MAX_LEN))) {
1080 pr_debug("HDMI is the primary display by"
1081 " boot parameter\n");
1082 hdmi_is_primary = 1;
Ravishangar Kalyanam5f0c6412012-03-15 17:24:11 -07001083 set_mdp_clocks_for_wuxga();
1084 }
1085 if (!strncmp((char *)msm_fb_pdata.prim_panel_name,
1086 MIPI_VIDEO_TOSHIBA_WUXGA_PANEL_NAME,
1087 strnlen(MIPI_VIDEO_TOSHIBA_WUXGA_PANEL_NAME,
1088 PANEL_NAME_MAX_LEN))) {
1089 set_mdp_clocks_for_wuxga();
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -08001090 }
1091 }
1092 if (strnlen(ext_panel, PANEL_NAME_MAX_LEN)) {
1093 strlcpy(msm_fb_pdata.ext_panel_name, ext_panel,
1094 PANEL_NAME_MAX_LEN);
1095 pr_debug("msm_fb_pdata.ext_panel_name %s\n",
1096 msm_fb_pdata.ext_panel_name);
1097 }
Ravishangar Kalyanamb52a2512012-04-10 18:27:23 -07001098
Ravishangar Kalyanam87dd72e2012-04-16 19:07:36 -07001099 if (disable_splash)
Ravishangar Kalyanamb52a2512012-04-10 18:27:23 -07001100 mdp_pdata.cont_splash_enabled = 0;
Ravishangar Kalyanam8c79ead2011-12-02 21:05:01 -08001101}