| Ajay Singh Parmar | 39599cc | 2013-03-13 17:24:53 +0530 | [diff] [blame] | 1 | /* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 2 | * | 
|  | 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 Humpherys | 78267eb | 2012-09-06 11:33:47 -0700 | [diff] [blame] | 18 | #include <linux/msm_ion.h> | 
| Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 19 | #include <linux/gpio.h> | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 20 | #include <asm/mach-types.h> | 
|  | 21 | #include <mach/msm_bus_board.h> | 
| Huaibin Yang | a541942 | 2011-12-08 23:52:10 -0800 | [diff] [blame] | 22 | #include <mach/msm_memtypes.h> | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 23 | #include <mach/board.h> | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 24 | #include <mach/gpiomux.h> | 
| Nagamalleswararao Ganji | 937a119 | 2011-12-07 19:00:52 -0800 | [diff] [blame] | 25 | #include <mach/ion.h> | 
| Amir Samuelov | 6f1e500 | 2012-02-01 17:42:43 +0200 | [diff] [blame] | 26 | #include <mach/socinfo.h> | 
| Nagamalleswararao Ganji | 937a119 | 2011-12-07 19:00:52 -0800 | [diff] [blame] | 27 |  | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 28 | #include "devices.h" | 
| Stepan Moskovchenko | 5a83dba | 2011-12-05 17:30:17 -0800 | [diff] [blame] | 29 | #include "board-8960.h" | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 30 |  | 
|  | 31 | #ifdef CONFIG_FB_MSM_TRIPLE_BUFFER | 
| Padmanabhan Komanduru | ede0a63 | 2012-01-25 12:01:28 +0530 | [diff] [blame] | 32 | #define MSM_FB_PRIM_BUF_SIZE \ | 
| Eugene Yasman | 7052e13 | 2012-03-11 16:16:06 +0200 | [diff] [blame] | 33 | (roundup((roundup(1920, 32) * roundup(1200, 32) * 4), 4096) * 3) | 
|  | 34 | /* 4 bpp x 3 pages */ | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 35 | #else | 
| Padmanabhan Komanduru | ede0a63 | 2012-01-25 12:01:28 +0530 | [diff] [blame] | 36 | #define MSM_FB_PRIM_BUF_SIZE \ | 
| Eugene Yasman | 7052e13 | 2012-03-11 16:16:06 +0200 | [diff] [blame] | 37 | (roundup((roundup(1920, 32) * roundup(1200, 32) * 4), 4096) * 2) | 
|  | 38 | /* 4 bpp x 2 pages */ | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 39 | #endif | 
|  | 40 |  | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 41 | /* Note: must be multiple of 4096 */ | 
| Huaibin Yang | c8946d4 | 2012-05-04 17:22:02 -0700 | [diff] [blame] | 42 | #define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE, 4096) | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 43 |  | 
| Huaibin Yang | a541942 | 2011-12-08 23:52:10 -0800 | [diff] [blame] | 44 | #ifdef CONFIG_FB_MSM_OVERLAY0_WRITEBACK | 
| Eugene Yasman | 7052e13 | 2012-03-11 16:16:06 +0200 | [diff] [blame] | 45 | #define MSM_FB_OVERLAY0_WRITEBACK_SIZE \ | 
|  | 46 | roundup((roundup(1920, 32) * roundup(1200, 32) * 3 * 2), 4096) | 
| Huaibin Yang | a541942 | 2011-12-08 23:52:10 -0800 | [diff] [blame] | 47 | #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 Yasman | 7052e13 | 2012-03-11 16:16:06 +0200 | [diff] [blame] | 52 | #define MSM_FB_OVERLAY1_WRITEBACK_SIZE \ | 
|  | 53 | roundup((roundup(1920, 32) * roundup(1080, 32) * 3 * 2), 4096) | 
| Huaibin Yang | a541942 | 2011-12-08 23:52:10 -0800 | [diff] [blame] | 54 | #else | 
|  | 55 | #define MSM_FB_OVERLAY1_WRITEBACK_SIZE (0) | 
|  | 56 | #endif  /* CONFIG_FB_MSM_OVERLAY1_WRITEBACK */ | 
|  | 57 |  | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 58 | #define MDP_VSYNC_GPIO 0 | 
|  | 59 |  | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 60 | #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 Kalyanam | da07f66 | 2012-02-16 13:29:43 -0800 | [diff] [blame] | 63 | #define MIPI_VIDEO_TOSHIBA_WUXGA_PANEL_NAME	"mipi_video_toshiba_wuxga" | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 64 | #define MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME	"mipi_video_chimei_wxga" | 
| Amir Samuelov | 6f1e500 | 2012-02-01 17:42:43 +0200 | [diff] [blame] | 65 | #define MIPI_VIDEO_CHIMEI_WUXGA_PANEL_NAME	"mipi_video_chimei_wuxga" | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 66 | #define MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME	"mipi_video_simulator_vga" | 
|  | 67 | #define MIPI_CMD_RENESAS_FWVGA_PANEL_NAME	"mipi_cmd_renesas_fwvga" | 
| Ravishangar Kalyanam | e2d015c | 2012-01-26 14:47:14 -0800 | [diff] [blame] | 68 | #define MIPI_VIDEO_ORISE_720P_PANEL_NAME	"mipi_video_orise_720p" | 
|  | 69 | #define MIPI_CMD_ORISE_720P_PANEL_NAME		"mipi_cmd_orise_720p" | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 70 | #define HDMI_PANEL_NAME	"hdmi_msm" | 
|  | 71 | #define TVOUT_PANEL_NAME	"tvout_msm" | 
|  | 72 |  | 
| Ravishangar Kalyanam | 8c79ead | 2011-12-02 21:05:01 -0800 | [diff] [blame] | 73 | #ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY | 
| Ravishangar Kalyanam | fda36c4 | 2012-03-26 16:28:19 -0700 | [diff] [blame] | 74 | static unsigned char hdmi_is_primary = 1; | 
| Ravishangar Kalyanam | 8c79ead | 2011-12-02 21:05:01 -0800 | [diff] [blame] | 75 | #else | 
| Ravishangar Kalyanam | fda36c4 | 2012-03-26 16:28:19 -0700 | [diff] [blame] | 76 | static unsigned char hdmi_is_primary; | 
| Ravishangar Kalyanam | 8c79ead | 2011-12-02 21:05:01 -0800 | [diff] [blame] | 77 | #endif | 
|  | 78 |  | 
| Ravishangar Kalyanam | fda36c4 | 2012-03-26 16:28:19 -0700 | [diff] [blame] | 79 | unsigned char msm8960_hdmi_as_primary_selected(void) | 
|  | 80 | { | 
|  | 81 | return hdmi_is_primary; | 
|  | 82 | } | 
|  | 83 |  | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 84 | static struct resource msm_fb_resources[] = { | 
|  | 85 | { | 
|  | 86 | .flags = IORESOURCE_DMA, | 
|  | 87 | } | 
|  | 88 | }; | 
|  | 89 |  | 
| Ravishangar Kalyanam | 8e78425 | 2012-02-10 16:27:51 -0800 | [diff] [blame] | 90 | static void set_mdp_clocks_for_wuxga(void); | 
| Amir Samuelov | f0d1f54 | 2012-02-06 12:50:42 +0200 | [diff] [blame] | 91 |  | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 92 | static int msm_fb_detect_panel(const char *name) | 
|  | 93 | { | 
|  | 94 | if (machine_is_msm8960_liquid()) { | 
| Amir Samuelov | 6f1e500 | 2012-02-01 17:42:43 +0200 | [diff] [blame] | 95 | 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 Samuelov | f0d1f54 | 2012-02-06 12:50:42 +0200 | [diff] [blame] | 99 | PANEL_NAME_MAX_LEN))) { | 
| Ravishangar Kalyanam | 8e78425 | 2012-02-10 16:27:51 -0800 | [diff] [blame] | 100 | set_mdp_clocks_for_wuxga(); | 
| Amir Samuelov | 6f1e500 | 2012-02-01 17:42:43 +0200 | [diff] [blame] | 101 | return 0; | 
| Amir Samuelov | f0d1f54 | 2012-02-06 12:50:42 +0200 | [diff] [blame] | 102 | } | 
| Amir Samuelov | 6f1e500 | 2012-02-01 17:42:43 +0200 | [diff] [blame] | 103 | } 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 Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 109 | } 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 Kalyanam | a4286d7 | 2012-02-15 16:09:58 -0800 | [diff] [blame] | 115 | #if !defined(CONFIG_FB_MSM_LVDS_MIPI_PANEL_DETECT) && \ | 
|  | 116 | !defined(CONFIG_FB_MSM_MIPI_PANEL_DETECT) | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 117 | 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 Kalyanam | 8e78425 | 2012-02-10 16:27:51 -0800 | [diff] [blame] | 136 |  | 
| Ravishangar Kalyanam | da07f66 | 2012-02-16 13:29:43 -0800 | [diff] [blame] | 137 | if (!strncmp(name, MIPI_VIDEO_TOSHIBA_WUXGA_PANEL_NAME, | 
|  | 138 | strnlen(MIPI_VIDEO_TOSHIBA_WUXGA_PANEL_NAME, | 
| Ravishangar Kalyanam | 8e78425 | 2012-02-10 16:27:51 -0800 | [diff] [blame] | 139 | PANEL_NAME_MAX_LEN))) { | 
|  | 140 | set_mdp_clocks_for_wuxga(); | 
|  | 141 | return 0; | 
|  | 142 | } | 
| Ravishangar Kalyanam | e2d015c | 2012-01-26 14:47:14 -0800 | [diff] [blame] | 143 |  | 
|  | 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 Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 153 | #endif | 
|  | 154 | } | 
|  | 155 |  | 
|  | 156 | if (!strncmp(name, HDMI_PANEL_NAME, | 
|  | 157 | strnlen(HDMI_PANEL_NAME, | 
| Ravishangar Kalyanam | 5f0c641 | 2012-03-15 17:24:11 -0700 | [diff] [blame] | 158 | PANEL_NAME_MAX_LEN))) { | 
|  | 159 | if (hdmi_is_primary) | 
|  | 160 | set_mdp_clocks_for_wuxga(); | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 161 | return 0; | 
| Ravishangar Kalyanam | 5f0c641 | 2012-03-15 17:24:11 -0700 | [diff] [blame] | 162 | } | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 163 |  | 
|  | 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 |  | 
|  | 173 | static struct msm_fb_platform_data msm_fb_pdata = { | 
|  | 174 | .detect_client = msm_fb_detect_panel, | 
|  | 175 | }; | 
|  | 176 |  | 
|  | 177 | static 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 Uddaraju | 2679f09 | 2012-03-09 15:48:04 -0800 | [diff] [blame] | 185 | static 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 Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 229 | static bool dsi_power_on; | 
|  | 230 |  | 
|  | 231 | /** | 
|  | 232 | * LiQUID panel on/off | 
|  | 233 | * | 
|  | 234 | * @param on | 
|  | 235 | * | 
|  | 236 | * @return int | 
|  | 237 | */ | 
|  | 238 | static 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 Uddaraju | 2679f09 | 2012-03-09 15:48:04 -0800 | [diff] [blame] | 244 | mipi_dsi_panel_pwm_cfg(); | 
| Jeff Ohlstein | 2cbe5ba | 2011-12-16 13:32:56 -0800 | [diff] [blame] | 245 | pr_debug("%s: on=%d\n", __func__, on); | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 246 |  | 
|  | 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 |  | 
|  | 349 | static 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 Ohlstein | 2cbe5ba | 2011-12-16 13:32:56 -0800 | [diff] [blame] | 355 | pr_debug("%s: state : %d\n", __func__, on); | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 356 |  | 
|  | 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 Kalyanam | 87dd72e | 2012-04-16 19:07:36 -0700 | [diff] [blame] | 471 | static char mipi_dsi_splash_is_enabled(void); | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 472 | static int mipi_dsi_panel_power(int on) | 
|  | 473 | { | 
|  | 474 | int ret; | 
|  | 475 |  | 
| Jeff Ohlstein | 2cbe5ba | 2011-12-16 13:32:56 -0800 | [diff] [blame] | 476 | pr_debug("%s: on=%d\n", __func__, on); | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 477 |  | 
|  | 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 |  | 
|  | 486 | static struct mipi_dsi_platform_data mipi_dsi_pdata = { | 
|  | 487 | .vsync_gpio = MDP_VSYNC_GPIO, | 
|  | 488 | .dsi_power_save = mipi_dsi_panel_power, | 
| Ravishangar Kalyanam | 87dd72e | 2012-04-16 19:07:36 -0700 | [diff] [blame] | 489 | .splash_is_enabled = mipi_dsi_splash_is_enabled, | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 490 | }; | 
|  | 491 |  | 
|  | 492 | #ifdef CONFIG_MSM_BUS_SCALING | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 493 | static 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 Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 502 | static 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 |  | 
|  | 511 | static 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 |  | 
|  | 521 | static 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 |  | 
|  | 531 | static 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 |  | 
|  | 541 | static 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 Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 567 |  | 
|  | 568 | static 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 Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 576 | static struct msm_panel_common_pdata mdp_pdata = { | 
|  | 577 | .gpio = MDP_VSYNC_GPIO, | 
| Siddhartha Agrawal | 496f928 | 2012-08-15 17:41:34 -0700 | [diff] [blame] | 578 | .mdp_max_clk = 200000000, | 
| Huaibin Yang | 42f7371 | 2013-03-21 17:27:45 -0700 | [diff] [blame] | 579 | .mdp_max_bw = 2000000000, | 
|  | 580 | .mdp_bw_ab_factor = 115, | 
|  | 581 | .mdp_bw_ib_factor = 125, | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 582 | #ifdef CONFIG_MSM_BUS_SCALING | 
|  | 583 | .mdp_bus_scale_table = &mdp_bus_scale_pdata, | 
|  | 584 | #endif | 
|  | 585 | .mdp_rev = MDP_REV_42, | 
| Nagamalleswararao Ganji | 937a119 | 2011-12-07 19:00:52 -0800 | [diff] [blame] | 586 | #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION | 
| Ravishangar Kalyanam | a3b168b | 2012-03-26 11:13:11 -0700 | [diff] [blame] | 587 | .mem_hid = BIT(ION_CP_MM_HEAP_ID), | 
| Nagamalleswararao Ganji | 937a119 | 2011-12-07 19:00:52 -0800 | [diff] [blame] | 588 | #else | 
|  | 589 | .mem_hid = MEMTYPE_EBI1, | 
|  | 590 | #endif | 
| Chandan Uddaraju | 2679f09 | 2012-03-09 15:48:04 -0800 | [diff] [blame] | 591 | .cont_splash_enabled = 0x01, | 
| Pradeep Jilagam | 425cde4 | 2012-08-03 15:52:06 +0530 | [diff] [blame] | 592 | .splash_screen_addr = 0x00, | 
|  | 593 | .splash_screen_size = 0x00, | 
| Olav Haugan | ef95ae3 | 2012-05-15 09:50:30 -0700 | [diff] [blame] | 594 | .mdp_iommu_split_domain = 0, | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 595 | }; | 
|  | 596 |  | 
| Huaibin Yang | a541942 | 2011-12-08 23:52:10 -0800 | [diff] [blame] | 597 | void __init msm8960_mdp_writeback(struct memtype_reserve* reserve_table) | 
|  | 598 | { | 
| Nagamalleswararao Ganji | 937a119 | 2011-12-07 19:00:52 -0800 | [diff] [blame] | 599 | mdp_pdata.ov0_wb_size = MSM_FB_OVERLAY0_WRITEBACK_SIZE; | 
|  | 600 | mdp_pdata.ov1_wb_size = MSM_FB_OVERLAY1_WRITEBACK_SIZE; | 
|  | 601 | #if defined(CONFIG_ANDROID_PMEM) && !defined(CONFIG_MSM_MULTIMEDIA_USE_ION) | 
|  | 602 | reserve_table[mdp_pdata.mem_hid].size += | 
|  | 603 | mdp_pdata.ov0_wb_size; | 
|  | 604 | reserve_table[mdp_pdata.mem_hid].size += | 
|  | 605 | mdp_pdata.ov1_wb_size; | 
|  | 606 | #endif | 
| Huaibin Yang | a541942 | 2011-12-08 23:52:10 -0800 | [diff] [blame] | 607 | } | 
|  | 608 |  | 
| Ravishangar Kalyanam | 87dd72e | 2012-04-16 19:07:36 -0700 | [diff] [blame] | 609 | static char mipi_dsi_splash_is_enabled(void) | 
|  | 610 | { | 
|  | 611 | return mdp_pdata.cont_splash_enabled; | 
|  | 612 | } | 
|  | 613 |  | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 614 | #define LPM_CHANNEL0 0 | 
|  | 615 | static int toshiba_gpio[] = {LPM_CHANNEL0}; | 
|  | 616 |  | 
|  | 617 | static struct mipi_dsi_panel_platform_data toshiba_pdata = { | 
|  | 618 | .gpio = toshiba_gpio, | 
| Chandan Uddaraju | 2679f09 | 2012-03-09 15:48:04 -0800 | [diff] [blame] | 619 | .dsi_pwm_cfg = mipi_dsi_panel_pwm_cfg, | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 620 | }; | 
|  | 621 |  | 
|  | 622 | static struct platform_device mipi_dsi_toshiba_panel_device = { | 
|  | 623 | .name = "mipi_toshiba", | 
|  | 624 | .id = 0, | 
|  | 625 | .dev = { | 
|  | 626 | .platform_data = &toshiba_pdata, | 
|  | 627 | } | 
|  | 628 | }; | 
|  | 629 |  | 
|  | 630 | #define FPGA_3D_GPIO_CONFIG_ADDR	0xB5 | 
| Amir Samuelov | ca199b9 | 2012-01-31 14:50:04 +0200 | [diff] [blame] | 631 | static int dsi2lvds_gpio[4] = { | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 632 | 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */ | 
| Amir Samuelov | ca199b9 | 2012-01-31 14:50:04 +0200 | [diff] [blame] | 633 | 0x1F08, /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */ | 
|  | 634 | GPIO_LIQUID_EXPANDER_BASE+6,	/* TN Enable */ | 
|  | 635 | GPIO_LIQUID_EXPANDER_BASE+7,	/* TN Mode */ | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 636 | }; | 
|  | 637 |  | 
|  | 638 | static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = { | 
|  | 639 | .gpio_num = dsi2lvds_gpio, | 
|  | 640 | }; | 
|  | 641 |  | 
|  | 642 | static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = { | 
|  | 643 |  | 
|  | 644 | /* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */ | 
|  | 645 | {0x0F, 0x0a, 0x04, 0x00, 0x20},	/* regulator */ | 
|  | 646 | /* timing   */ | 
|  | 647 | {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c, | 
|  | 648 | 0x0c, 0x03, 0x04, 0xa0}, | 
|  | 649 | {0x5f, 0x00, 0x00, 0x10},	/* phy ctrl */ | 
|  | 650 | {0xff, 0x00, 0x06, 0x00},	/* strength */ | 
|  | 651 | /* pll control */ | 
|  | 652 | {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62, | 
|  | 653 | 0x40, 0x07, 0x03, | 
|  | 654 | 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01}, | 
|  | 655 | }; | 
|  | 656 |  | 
|  | 657 | static struct mipi_dsi_panel_platform_data novatek_pdata = { | 
|  | 658 | .fpga_3d_config_addr  = FPGA_3D_GPIO_CONFIG_ADDR, | 
|  | 659 | .fpga_ctrl_mode = FPGA_SPI_INTF, | 
|  | 660 | .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db, | 
|  | 661 | }; | 
|  | 662 |  | 
|  | 663 | static struct platform_device mipi_dsi_novatek_panel_device = { | 
|  | 664 | .name = "mipi_novatek", | 
|  | 665 | .id = 0, | 
|  | 666 | .dev = { | 
|  | 667 | .platform_data = &novatek_pdata, | 
|  | 668 | } | 
|  | 669 | }; | 
|  | 670 |  | 
|  | 671 | static struct platform_device mipi_dsi2lvds_bridge_device = { | 
|  | 672 | .name = "mipi_tc358764", | 
|  | 673 | .id = 0, | 
|  | 674 | .dev.platform_data = &mipi_dsi2lvds_pdata, | 
|  | 675 | }; | 
|  | 676 |  | 
| Ravishangar Kalyanam | e2d015c | 2012-01-26 14:47:14 -0800 | [diff] [blame] | 677 | static struct platform_device mipi_dsi_orise_panel_device = { | 
|  | 678 | .name = "mipi_orise", | 
|  | 679 | .id = 0, | 
|  | 680 | }; | 
|  | 681 |  | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 682 | #ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL | 
|  | 683 | static struct resource hdmi_msm_resources[] = { | 
|  | 684 | { | 
|  | 685 | .name  = "hdmi_msm_qfprom_addr", | 
|  | 686 | .start = 0x00700000, | 
|  | 687 | .end   = 0x007060FF, | 
|  | 688 | .flags = IORESOURCE_MEM, | 
|  | 689 | }, | 
|  | 690 | { | 
|  | 691 | .name  = "hdmi_msm_hdmi_addr", | 
|  | 692 | .start = 0x04A00000, | 
|  | 693 | .end   = 0x04A00FFF, | 
|  | 694 | .flags = IORESOURCE_MEM, | 
|  | 695 | }, | 
|  | 696 | { | 
|  | 697 | .name  = "hdmi_msm_irq", | 
|  | 698 | .start = HDMI_IRQ, | 
|  | 699 | .end   = HDMI_IRQ, | 
|  | 700 | .flags = IORESOURCE_IRQ, | 
|  | 701 | }, | 
|  | 702 | }; | 
|  | 703 |  | 
|  | 704 | static int hdmi_enable_5v(int on); | 
|  | 705 | static int hdmi_core_power(int on, int show); | 
|  | 706 | static int hdmi_cec_power(int on); | 
| Ajay Singh Parmar | 7d11c27 | 2012-06-07 12:25:31 +0530 | [diff] [blame] | 707 | static int hdmi_gpio_config(int on); | 
|  | 708 | static int hdmi_panel_power(int on); | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 709 |  | 
|  | 710 | static struct msm_hdmi_platform_data hdmi_msm_data = { | 
|  | 711 | .irq = HDMI_IRQ, | 
|  | 712 | .enable_5v = hdmi_enable_5v, | 
|  | 713 | .core_power = hdmi_core_power, | 
|  | 714 | .cec_power = hdmi_cec_power, | 
| Ajay Singh Parmar | 7d11c27 | 2012-06-07 12:25:31 +0530 | [diff] [blame] | 715 | .panel_power = hdmi_panel_power, | 
|  | 716 | .gpio_config = hdmi_gpio_config, | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 717 | }; | 
|  | 718 |  | 
|  | 719 | static struct platform_device hdmi_msm_device = { | 
|  | 720 | .name = "hdmi_msm", | 
|  | 721 | .id = 0, | 
|  | 722 | .num_resources = ARRAY_SIZE(hdmi_msm_resources), | 
|  | 723 | .resource = hdmi_msm_resources, | 
|  | 724 | .dev.platform_data = &hdmi_msm_data, | 
|  | 725 | }; | 
| Ajay Singh Parmar | 39599cc | 2013-03-13 17:24:53 +0530 | [diff] [blame] | 726 | #else | 
|  | 727 | static int hdmi_panel_power(int on) { return 0; } | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 728 | #endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */ | 
|  | 729 |  | 
|  | 730 | #ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL | 
|  | 731 | static struct platform_device wfd_panel_device = { | 
|  | 732 | .name = "wfd_panel", | 
|  | 733 | .id = 0, | 
|  | 734 | .dev.platform_data = NULL, | 
|  | 735 | }; | 
| Stepan Moskovchenko | 270888d | 2011-11-30 12:19:11 -0800 | [diff] [blame] | 736 |  | 
|  | 737 | static struct platform_device wfd_device = { | 
|  | 738 | .name          = "msm_wfd", | 
|  | 739 | .id            = -1, | 
|  | 740 | }; | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 741 | #endif | 
|  | 742 |  | 
|  | 743 | #ifdef CONFIG_MSM_BUS_SCALING | 
|  | 744 | static struct msm_bus_vectors dtv_bus_init_vectors[] = { | 
|  | 745 | { | 
|  | 746 | .src = MSM_BUS_MASTER_MDP_PORT0, | 
|  | 747 | .dst = MSM_BUS_SLAVE_EBI_CH0, | 
|  | 748 | .ab = 0, | 
|  | 749 | .ib = 0, | 
|  | 750 | }, | 
|  | 751 | }; | 
|  | 752 |  | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 753 | static struct msm_bus_vectors dtv_bus_def_vectors[] = { | 
|  | 754 | { | 
|  | 755 | .src = MSM_BUS_MASTER_MDP_PORT0, | 
|  | 756 | .dst = MSM_BUS_SLAVE_EBI_CH0, | 
|  | 757 | .ab = 566092800 * 2, | 
|  | 758 | .ib = 707616000 * 2, | 
|  | 759 | }, | 
|  | 760 | }; | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 761 |  | 
|  | 762 | static struct msm_bus_paths dtv_bus_scale_usecases[] = { | 
|  | 763 | { | 
|  | 764 | ARRAY_SIZE(dtv_bus_init_vectors), | 
|  | 765 | dtv_bus_init_vectors, | 
|  | 766 | }, | 
|  | 767 | { | 
|  | 768 | ARRAY_SIZE(dtv_bus_def_vectors), | 
|  | 769 | dtv_bus_def_vectors, | 
|  | 770 | }, | 
|  | 771 | }; | 
|  | 772 | static struct msm_bus_scale_pdata dtv_bus_scale_pdata = { | 
|  | 773 | dtv_bus_scale_usecases, | 
|  | 774 | ARRAY_SIZE(dtv_bus_scale_usecases), | 
|  | 775 | .name = "dtv", | 
|  | 776 | }; | 
|  | 777 |  | 
|  | 778 | static struct lcdc_platform_data dtv_pdata = { | 
|  | 779 | .bus_scale_table = &dtv_bus_scale_pdata, | 
| Ajay Singh Parmar | 7d11c27 | 2012-06-07 12:25:31 +0530 | [diff] [blame] | 780 | .lcdc_power_save = hdmi_panel_power, | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 781 | }; | 
|  | 782 | #endif | 
|  | 783 |  | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 784 | #ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 785 | static int hdmi_enable_5v(int on) | 
|  | 786 | { | 
|  | 787 | /* TBD: PM8921 regulator instead of 8901 */ | 
|  | 788 | static struct regulator *reg_8921_hdmi_mvs;	/* HDMI_5V */ | 
|  | 789 | static int prev_on; | 
|  | 790 | int rc; | 
|  | 791 |  | 
|  | 792 | if (on == prev_on) | 
|  | 793 | return 0; | 
|  | 794 |  | 
| Ajay Singh Parmar | 0784764 | 2011-12-09 02:57:45 +0530 | [diff] [blame] | 795 | if (!reg_8921_hdmi_mvs) { | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 796 | reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev, | 
| Ajay Singh Parmar | 0784764 | 2011-12-09 02:57:45 +0530 | [diff] [blame] | 797 | "hdmi_mvs"); | 
|  | 798 | if (IS_ERR(reg_8921_hdmi_mvs)) { | 
|  | 799 | pr_err("'%s' regulator not found, rc=%ld\n", | 
|  | 800 | "hdmi_mvs", IS_ERR(reg_8921_hdmi_mvs)); | 
|  | 801 | reg_8921_hdmi_mvs = NULL; | 
|  | 802 | return -ENODEV; | 
|  | 803 | } | 
|  | 804 | } | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 805 |  | 
|  | 806 | if (on) { | 
|  | 807 | rc = regulator_enable(reg_8921_hdmi_mvs); | 
|  | 808 | if (rc) { | 
|  | 809 | pr_err("'%s' regulator enable failed, rc=%d\n", | 
|  | 810 | "8921_hdmi_mvs", rc); | 
|  | 811 | return rc; | 
|  | 812 | } | 
|  | 813 | pr_debug("%s(on): success\n", __func__); | 
|  | 814 | } else { | 
|  | 815 | rc = regulator_disable(reg_8921_hdmi_mvs); | 
|  | 816 | if (rc) | 
|  | 817 | pr_warning("'%s' regulator disable failed, rc=%d\n", | 
|  | 818 | "8921_hdmi_mvs", rc); | 
|  | 819 | pr_debug("%s(off): success\n", __func__); | 
|  | 820 | } | 
|  | 821 |  | 
|  | 822 | prev_on = on; | 
|  | 823 |  | 
|  | 824 | return 0; | 
|  | 825 | } | 
|  | 826 |  | 
|  | 827 | static int hdmi_core_power(int on, int show) | 
|  | 828 | { | 
|  | 829 | static struct regulator *reg_8921_l23, *reg_8921_s4; | 
|  | 830 | static int prev_on; | 
|  | 831 | int rc; | 
|  | 832 |  | 
|  | 833 | if (on == prev_on) | 
|  | 834 | return 0; | 
|  | 835 |  | 
|  | 836 | /* TBD: PM8921 regulator instead of 8901 */ | 
|  | 837 | if (!reg_8921_l23) { | 
|  | 838 | reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd"); | 
|  | 839 | if (IS_ERR(reg_8921_l23)) { | 
|  | 840 | pr_err("could not get reg_8921_l23, rc = %ld\n", | 
|  | 841 | PTR_ERR(reg_8921_l23)); | 
|  | 842 | return -ENODEV; | 
|  | 843 | } | 
|  | 844 | rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000); | 
|  | 845 | if (rc) { | 
|  | 846 | pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc); | 
|  | 847 | return -EINVAL; | 
|  | 848 | } | 
|  | 849 | } | 
|  | 850 | if (!reg_8921_s4) { | 
|  | 851 | reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc"); | 
|  | 852 | if (IS_ERR(reg_8921_s4)) { | 
|  | 853 | pr_err("could not get reg_8921_s4, rc = %ld\n", | 
|  | 854 | PTR_ERR(reg_8921_s4)); | 
|  | 855 | return -ENODEV; | 
|  | 856 | } | 
|  | 857 | rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000); | 
|  | 858 | if (rc) { | 
|  | 859 | pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc); | 
|  | 860 | return -EINVAL; | 
|  | 861 | } | 
|  | 862 | } | 
|  | 863 |  | 
|  | 864 | if (on) { | 
|  | 865 | rc = regulator_set_optimum_mode(reg_8921_l23, 100000); | 
|  | 866 | if (rc < 0) { | 
|  | 867 | pr_err("set_optimum_mode l23 failed, rc=%d\n", rc); | 
|  | 868 | return -EINVAL; | 
|  | 869 | } | 
|  | 870 | rc = regulator_enable(reg_8921_l23); | 
|  | 871 | if (rc) { | 
|  | 872 | pr_err("'%s' regulator enable failed, rc=%d\n", | 
|  | 873 | "hdmi_avdd", rc); | 
|  | 874 | return rc; | 
|  | 875 | } | 
|  | 876 | rc = regulator_enable(reg_8921_s4); | 
|  | 877 | if (rc) { | 
|  | 878 | pr_err("'%s' regulator enable failed, rc=%d\n", | 
|  | 879 | "hdmi_vcc", rc); | 
|  | 880 | return rc; | 
|  | 881 | } | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 882 | pr_debug("%s(on): success\n", __func__); | 
|  | 883 | } else { | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 884 | rc = regulator_disable(reg_8921_l23); | 
|  | 885 | if (rc) { | 
|  | 886 | pr_err("disable reg_8921_l23 failed, rc=%d\n", rc); | 
|  | 887 | return -ENODEV; | 
|  | 888 | } | 
|  | 889 | rc = regulator_disable(reg_8921_s4); | 
|  | 890 | if (rc) { | 
|  | 891 | pr_err("disable reg_8921_s4 failed, rc=%d\n", rc); | 
|  | 892 | return -ENODEV; | 
|  | 893 | } | 
|  | 894 | rc = regulator_set_optimum_mode(reg_8921_l23, 100); | 
|  | 895 | if (rc < 0) { | 
|  | 896 | pr_err("set_optimum_mode l23 failed, rc=%d\n", rc); | 
|  | 897 | return -EINVAL; | 
|  | 898 | } | 
|  | 899 | pr_debug("%s(off): success\n", __func__); | 
|  | 900 | } | 
|  | 901 |  | 
|  | 902 | prev_on = on; | 
|  | 903 |  | 
|  | 904 | return 0; | 
| Ajay Singh Parmar | 7d11c27 | 2012-06-07 12:25:31 +0530 | [diff] [blame] | 905 | } | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 906 |  | 
| Ajay Singh Parmar | 7d11c27 | 2012-06-07 12:25:31 +0530 | [diff] [blame] | 907 | static int hdmi_gpio_config(int on) | 
|  | 908 | { | 
|  | 909 | int rc = 0; | 
|  | 910 | static int prev_on; | 
|  | 911 |  | 
|  | 912 | if (on == prev_on) | 
|  | 913 | return 0; | 
|  | 914 |  | 
|  | 915 | if (on) { | 
|  | 916 | rc = gpio_request(100, "HDMI_DDC_CLK"); | 
|  | 917 | if (rc) { | 
|  | 918 | pr_err("'%s'(%d) gpio_request failed, rc=%d\n", | 
|  | 919 | "HDMI_DDC_CLK", 100, rc); | 
|  | 920 | return rc; | 
|  | 921 | } | 
|  | 922 | rc = gpio_request(101, "HDMI_DDC_DATA"); | 
|  | 923 | if (rc) { | 
|  | 924 | pr_err("'%s'(%d) gpio_request failed, rc=%d\n", | 
|  | 925 | "HDMI_DDC_DATA", 101, rc); | 
|  | 926 | goto error1; | 
|  | 927 | } | 
|  | 928 | rc = gpio_request(102, "HDMI_HPD"); | 
|  | 929 | if (rc) { | 
|  | 930 | pr_err("'%s'(%d) gpio_request failed, rc=%d\n", | 
|  | 931 | "HDMI_HPD", 102, rc); | 
|  | 932 | goto error2; | 
|  | 933 | } | 
|  | 934 | pr_debug("%s(on): success\n", __func__); | 
|  | 935 | } else { | 
|  | 936 | gpio_free(100); | 
|  | 937 | gpio_free(101); | 
|  | 938 | gpio_free(102); | 
|  | 939 | pr_debug("%s(off): success\n", __func__); | 
|  | 940 | } | 
|  | 941 |  | 
|  | 942 | prev_on = on; | 
|  | 943 | return 0; | 
|  | 944 |  | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 945 | error2: | 
| Ajay Singh Parmar | 7d11c27 | 2012-06-07 12:25:31 +0530 | [diff] [blame] | 946 | gpio_free(101); | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 947 | error1: | 
| Ajay Singh Parmar | 7d11c27 | 2012-06-07 12:25:31 +0530 | [diff] [blame] | 948 | gpio_free(100); | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 949 | return rc; | 
|  | 950 | } | 
|  | 951 |  | 
|  | 952 | static int hdmi_cec_power(int on) | 
|  | 953 | { | 
|  | 954 | static int prev_on; | 
|  | 955 | int rc; | 
|  | 956 |  | 
|  | 957 | if (on == prev_on) | 
|  | 958 | return 0; | 
|  | 959 |  | 
|  | 960 | if (on) { | 
|  | 961 | rc = gpio_request(99, "HDMI_CEC_VAR"); | 
|  | 962 | if (rc) { | 
|  | 963 | pr_err("'%s'(%d) gpio_request failed, rc=%d\n", | 
|  | 964 | "HDMI_CEC_VAR", 99, rc); | 
|  | 965 | goto error; | 
|  | 966 | } | 
|  | 967 | pr_debug("%s(on): success\n", __func__); | 
|  | 968 | } else { | 
|  | 969 | gpio_free(99); | 
|  | 970 | pr_debug("%s(off): success\n", __func__); | 
|  | 971 | } | 
|  | 972 |  | 
|  | 973 | prev_on = on; | 
|  | 974 |  | 
|  | 975 | return 0; | 
|  | 976 | error: | 
|  | 977 | return rc; | 
|  | 978 | } | 
| Ajay Singh Parmar | 39599cc | 2013-03-13 17:24:53 +0530 | [diff] [blame] | 979 |  | 
|  | 980 | static int hdmi_panel_power(int on) | 
|  | 981 | { | 
|  | 982 | int rc; | 
|  | 983 |  | 
|  | 984 | pr_debug("%s: HDMI Core: %s\n", __func__, (on ? "ON" : "OFF")); | 
|  | 985 | rc = hdmi_core_power(on, 1); | 
|  | 986 | if (rc) | 
|  | 987 | rc = hdmi_cec_power(on); | 
|  | 988 |  | 
|  | 989 | pr_debug("%s: HDMI Core: %s Success\n", __func__, (on ? "ON" : "OFF")); | 
|  | 990 | return rc; | 
|  | 991 | } | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 992 | #endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */ | 
|  | 993 |  | 
|  | 994 | void __init msm8960_init_fb(void) | 
|  | 995 | { | 
| Carl Vanderlip | 460bdda | 2012-11-16 11:34:44 -0800 | [diff] [blame] | 996 | uint32_t soc_platform_version = socinfo_get_version(); | 
|  | 997 |  | 
|  | 998 |  | 
|  | 999 | if (SOCINFO_VERSION_MAJOR(soc_platform_version) >= 3) | 
|  | 1000 | mdp_pdata.mdp_rev = MDP_REV_43; | 
|  | 1001 |  | 
| Ravishangar Kalyanam | 34ddee5 | 2012-07-13 14:42:53 -0700 | [diff] [blame] | 1002 | if (cpu_is_msm8960ab()) | 
|  | 1003 | mdp_pdata.mdp_rev = MDP_REV_44; | 
|  | 1004 |  | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 1005 | platform_device_register(&msm_fb_device); | 
|  | 1006 |  | 
| Stepan Moskovchenko | 270888d | 2011-11-30 12:19:11 -0800 | [diff] [blame] | 1007 | #ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL | 
|  | 1008 | platform_device_register(&wfd_panel_device); | 
|  | 1009 | platform_device_register(&wfd_device); | 
|  | 1010 | #endif | 
|  | 1011 |  | 
| Syed Rameez Mustafa | cf645e8 | 2012-07-06 19:00:49 -0700 | [diff] [blame] | 1012 | platform_device_register(&mipi_dsi_novatek_panel_device); | 
|  | 1013 | platform_device_register(&mipi_dsi_orise_panel_device); | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 1014 |  | 
|  | 1015 | #ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL | 
| Syed Rameez Mustafa | cf645e8 | 2012-07-06 19:00:49 -0700 | [diff] [blame] | 1016 | platform_device_register(&hdmi_msm_device); | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 1017 | #endif | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 1018 |  | 
|  | 1019 | if (machine_is_msm8960_liquid()) | 
|  | 1020 | platform_device_register(&mipi_dsi2lvds_bridge_device); | 
|  | 1021 | else | 
|  | 1022 | platform_device_register(&mipi_dsi_toshiba_panel_device); | 
|  | 1023 |  | 
| Syed Rameez Mustafa | e4a6f8e | 2012-07-09 15:25:13 -0700 | [diff] [blame] | 1024 | msm_fb_register_device("mdp", &mdp_pdata); | 
| Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 1025 | msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata); | 
|  | 1026 | #ifdef CONFIG_MSM_BUS_SCALING | 
|  | 1027 | msm_fb_register_device("dtv", &dtv_pdata); | 
|  | 1028 | #endif | 
|  | 1029 | } | 
|  | 1030 |  | 
|  | 1031 | void __init msm8960_allocate_fb_region(void) | 
|  | 1032 | { | 
|  | 1033 | void *addr; | 
|  | 1034 | unsigned long size; | 
|  | 1035 |  | 
|  | 1036 | size = MSM_FB_SIZE; | 
|  | 1037 | addr = alloc_bootmem_align(size, 0x1000); | 
|  | 1038 | msm_fb_resources[0].start = __pa(addr); | 
|  | 1039 | msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1; | 
|  | 1040 | pr_info("allocating %lu bytes at %p (%lx physical) for fb\n", | 
|  | 1041 | size, addr, __pa(addr)); | 
|  | 1042 | } | 
| Ravishangar Kalyanam | 8c79ead | 2011-12-02 21:05:01 -0800 | [diff] [blame] | 1043 |  | 
| Ravishangar Kalyanam | 5f0c641 | 2012-03-15 17:24:11 -0700 | [diff] [blame] | 1044 | /** | 
|  | 1045 | * Set MDP clocks to high frequency to avoid DSI underflow | 
|  | 1046 | * when using high resolution 1200x1920 WUXGA panels | 
|  | 1047 | */ | 
|  | 1048 | static void set_mdp_clocks_for_wuxga(void) | 
|  | 1049 | { | 
| Ravishangar Kalyanam | 5f0c641 | 2012-03-15 17:24:11 -0700 | [diff] [blame] | 1050 | mdp_ui_vectors[0].ab = 2000000000; | 
|  | 1051 | mdp_ui_vectors[0].ib = 2000000000; | 
|  | 1052 | mdp_vga_vectors[0].ab = 2000000000; | 
|  | 1053 | mdp_vga_vectors[0].ib = 2000000000; | 
|  | 1054 | mdp_720p_vectors[0].ab = 2000000000; | 
|  | 1055 | mdp_720p_vectors[0].ib = 2000000000; | 
|  | 1056 | mdp_1080p_vectors[0].ab = 2000000000; | 
|  | 1057 | mdp_1080p_vectors[0].ib = 2000000000; | 
|  | 1058 |  | 
| Ravishangar Kalyanam | 5f0c641 | 2012-03-15 17:24:11 -0700 | [diff] [blame] | 1059 | if (hdmi_is_primary) { | 
|  | 1060 | dtv_bus_def_vectors[0].ab = 2000000000; | 
|  | 1061 | dtv_bus_def_vectors[0].ib = 2000000000; | 
|  | 1062 | } | 
|  | 1063 | } | 
|  | 1064 |  | 
| Ravishangar Kalyanam | 8c79ead | 2011-12-02 21:05:01 -0800 | [diff] [blame] | 1065 | void __init msm8960_set_display_params(char *prim_panel, char *ext_panel) | 
|  | 1066 | { | 
| Ravishangar Kalyanam | 87dd72e | 2012-04-16 19:07:36 -0700 | [diff] [blame] | 1067 | int disable_splash = 0; | 
| Ravishangar Kalyanam | 8c79ead | 2011-12-02 21:05:01 -0800 | [diff] [blame] | 1068 | if (strnlen(prim_panel, PANEL_NAME_MAX_LEN)) { | 
|  | 1069 | strlcpy(msm_fb_pdata.prim_panel_name, prim_panel, | 
|  | 1070 | PANEL_NAME_MAX_LEN); | 
|  | 1071 | pr_debug("msm_fb_pdata.prim_panel_name %s\n", | 
|  | 1072 | msm_fb_pdata.prim_panel_name); | 
|  | 1073 |  | 
| Ravishangar Kalyanam | 87dd72e | 2012-04-16 19:07:36 -0700 | [diff] [blame] | 1074 | if (strncmp((char *)msm_fb_pdata.prim_panel_name, | 
|  | 1075 | MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME, | 
|  | 1076 | strnlen(MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME, | 
|  | 1077 | PANEL_NAME_MAX_LEN))) { | 
|  | 1078 | /* Disable splash for panels other than Toshiba WSVGA */ | 
|  | 1079 | disable_splash = 1; | 
|  | 1080 | } | 
|  | 1081 |  | 
| Ravishangar Kalyanam | 8c79ead | 2011-12-02 21:05:01 -0800 | [diff] [blame] | 1082 | if (!strncmp((char *)msm_fb_pdata.prim_panel_name, | 
|  | 1083 | HDMI_PANEL_NAME, strnlen(HDMI_PANEL_NAME, | 
|  | 1084 | PANEL_NAME_MAX_LEN))) { | 
|  | 1085 | pr_debug("HDMI is the primary display by" | 
|  | 1086 | " boot parameter\n"); | 
|  | 1087 | hdmi_is_primary = 1; | 
| Ravishangar Kalyanam | 5f0c641 | 2012-03-15 17:24:11 -0700 | [diff] [blame] | 1088 | set_mdp_clocks_for_wuxga(); | 
|  | 1089 | } | 
|  | 1090 | if (!strncmp((char *)msm_fb_pdata.prim_panel_name, | 
|  | 1091 | MIPI_VIDEO_TOSHIBA_WUXGA_PANEL_NAME, | 
|  | 1092 | strnlen(MIPI_VIDEO_TOSHIBA_WUXGA_PANEL_NAME, | 
|  | 1093 | PANEL_NAME_MAX_LEN))) { | 
|  | 1094 | set_mdp_clocks_for_wuxga(); | 
| Ravishangar Kalyanam | 8c79ead | 2011-12-02 21:05:01 -0800 | [diff] [blame] | 1095 | } | 
|  | 1096 | } | 
|  | 1097 | if (strnlen(ext_panel, PANEL_NAME_MAX_LEN)) { | 
|  | 1098 | strlcpy(msm_fb_pdata.ext_panel_name, ext_panel, | 
|  | 1099 | PANEL_NAME_MAX_LEN); | 
|  | 1100 | pr_debug("msm_fb_pdata.ext_panel_name %s\n", | 
|  | 1101 | msm_fb_pdata.ext_panel_name); | 
|  | 1102 | } | 
| Ravishangar Kalyanam | b52a251 | 2012-04-10 18:27:23 -0700 | [diff] [blame] | 1103 |  | 
| Ravishangar Kalyanam | 87dd72e | 2012-04-16 19:07:36 -0700 | [diff] [blame] | 1104 | if (disable_splash) | 
| Ravishangar Kalyanam | b52a251 | 2012-04-10 18:27:23 -0700 | [diff] [blame] | 1105 | mdp_pdata.cont_splash_enabled = 0; | 
| Ravishangar Kalyanam | 8c79ead | 2011-12-02 21:05:01 -0800 | [diff] [blame] | 1106 | } |