Nagamalleswararao Ganji | 70fac1e | 2011-12-29 19:06:37 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved. |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -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> |
Steve Muckle | f132c6c | 2012-06-06 18:30:57 -0700 | [diff] [blame] | 18 | #include <linux/gpio.h> |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 19 | #include <asm/mach-types.h> |
| 20 | #include <mach/msm_bus_board.h> |
Huaibin Yang | a541942 | 2011-12-08 23:52:10 -0800 | [diff] [blame] | 21 | #include <mach/msm_memtypes.h> |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 22 | #include <mach/board.h> |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 23 | #include <mach/gpiomux.h> |
Ajay Dudani | 9114be7 | 2011-12-03 07:46:35 -0800 | [diff] [blame] | 24 | #include <mach/socinfo.h> |
Nagamalleswararao Ganji | 937a119 | 2011-12-07 19:00:52 -0800 | [diff] [blame] | 25 | #include <linux/ion.h> |
| 26 | #include <mach/ion.h> |
| 27 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 28 | #include "devices.h" |
Stepan Moskovchenko | 5a83dba | 2011-12-05 17:30:17 -0800 | [diff] [blame] | 29 | #include "board-8930.h" |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -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 \ |
Huaibin Yang | c8946d4 | 2012-05-04 17:22:02 -0700 | [diff] [blame] | 33 | (roundup((1920 * 1088 * 4), 4096) * 3) /* 4 bpp x 3 pages */ |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 34 | #else |
Padmanabhan Komanduru | ede0a63 | 2012-01-25 12:01:28 +0530 | [diff] [blame] | 35 | #define MSM_FB_PRIM_BUF_SIZE \ |
Huaibin Yang | c8946d4 | 2012-05-04 17:22:02 -0700 | [diff] [blame] | 36 | (roundup((1920 * 1088 * 4), 4096) * 2) /* 4 bpp x 2 pages */ |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 37 | #endif |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 38 | /* Note: must be multiple of 4096 */ |
Huaibin Yang | c8946d4 | 2012-05-04 17:22:02 -0700 | [diff] [blame] | 39 | #define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE, 4096) |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 40 | |
Huaibin Yang | a541942 | 2011-12-08 23:52:10 -0800 | [diff] [blame] | 41 | #ifdef CONFIG_FB_MSM_OVERLAY0_WRITEBACK |
| 42 | #define MSM_FB_OVERLAY0_WRITEBACK_SIZE roundup((1376 * 768 * 3 * 2), 4096) |
| 43 | #else |
| 44 | #define MSM_FB_OVERLAY0_WRITEBACK_SIZE (0) |
| 45 | #endif /* CONFIG_FB_MSM_OVERLAY0_WRITEBACK */ |
| 46 | |
| 47 | #ifdef CONFIG_FB_MSM_OVERLAY1_WRITEBACK |
| 48 | #define MSM_FB_OVERLAY1_WRITEBACK_SIZE roundup((1920 * 1088 * 3 * 2), 4096) |
| 49 | #else |
| 50 | #define MSM_FB_OVERLAY1_WRITEBACK_SIZE (0) |
| 51 | #endif /* CONFIG_FB_MSM_OVERLAY1_WRITEBACK */ |
| 52 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 53 | #define MDP_VSYNC_GPIO 0 |
| 54 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 55 | #define MIPI_CMD_NOVATEK_QHD_PANEL_NAME "mipi_cmd_novatek_qhd" |
| 56 | #define MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME "mipi_video_novatek_qhd" |
| 57 | #define MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME "mipi_video_toshiba_wsvga" |
| 58 | #define MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME "mipi_video_chimei_wxga" |
| 59 | #define MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME "mipi_video_simulator_vga" |
| 60 | #define MIPI_CMD_RENESAS_FWVGA_PANEL_NAME "mipi_cmd_renesas_fwvga" |
| 61 | #define HDMI_PANEL_NAME "hdmi_msm" |
| 62 | #define TVOUT_PANEL_NAME "tvout_msm" |
| 63 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 64 | static struct resource msm_fb_resources[] = { |
| 65 | { |
| 66 | .flags = IORESOURCE_DMA, |
| 67 | } |
| 68 | }; |
| 69 | |
| 70 | static int msm_fb_detect_panel(const char *name) |
| 71 | { |
Chandan Uddaraju | 59894ca | 2011-12-05 17:07:02 -0800 | [diff] [blame] | 72 | if (!strncmp(name, MIPI_CMD_NOVATEK_QHD_PANEL_NAME, |
| 73 | strnlen(MIPI_CMD_NOVATEK_QHD_PANEL_NAME, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 74 | PANEL_NAME_MAX_LEN))) |
| 75 | return 0; |
| 76 | |
Ravishangar Kalyanam | a4286d7 | 2012-02-15 16:09:58 -0800 | [diff] [blame] | 77 | #if !defined(CONFIG_FB_MSM_LVDS_MIPI_PANEL_DETECT) && \ |
| 78 | !defined(CONFIG_FB_MSM_MIPI_PANEL_DETECT) |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 79 | if (!strncmp(name, MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME, |
| 80 | strnlen(MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME, |
| 81 | PANEL_NAME_MAX_LEN))) |
| 82 | return 0; |
| 83 | |
Chandan Uddaraju | 59894ca | 2011-12-05 17:07:02 -0800 | [diff] [blame] | 84 | if (!strncmp(name, MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME, |
| 85 | strnlen(MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 86 | PANEL_NAME_MAX_LEN))) |
| 87 | return 0; |
| 88 | |
| 89 | if (!strncmp(name, MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME, |
| 90 | strnlen(MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME, |
| 91 | PANEL_NAME_MAX_LEN))) |
| 92 | return 0; |
| 93 | |
| 94 | if (!strncmp(name, MIPI_CMD_RENESAS_FWVGA_PANEL_NAME, |
| 95 | strnlen(MIPI_CMD_RENESAS_FWVGA_PANEL_NAME, |
| 96 | PANEL_NAME_MAX_LEN))) |
| 97 | return 0; |
| 98 | #endif |
| 99 | |
| 100 | if (!strncmp(name, HDMI_PANEL_NAME, |
| 101 | strnlen(HDMI_PANEL_NAME, |
| 102 | PANEL_NAME_MAX_LEN))) |
| 103 | return 0; |
| 104 | |
| 105 | if (!strncmp(name, TVOUT_PANEL_NAME, |
| 106 | strnlen(TVOUT_PANEL_NAME, |
| 107 | PANEL_NAME_MAX_LEN))) |
| 108 | return 0; |
| 109 | |
| 110 | pr_warning("%s: not supported '%s'", __func__, name); |
| 111 | return -ENODEV; |
| 112 | } |
| 113 | |
| 114 | static struct msm_fb_platform_data msm_fb_pdata = { |
| 115 | .detect_client = msm_fb_detect_panel, |
| 116 | }; |
| 117 | |
| 118 | static struct platform_device msm_fb_device = { |
| 119 | .name = "msm_fb", |
| 120 | .id = 0, |
| 121 | .num_resources = ARRAY_SIZE(msm_fb_resources), |
| 122 | .resource = msm_fb_resources, |
| 123 | .dev.platform_data = &msm_fb_pdata, |
| 124 | }; |
| 125 | |
| 126 | static bool dsi_power_on; |
| 127 | |
Jay Chokshi | 06fa754 | 2011-12-07 13:09:17 -0800 | [diff] [blame] | 128 | /* |
| 129 | * TODO: When physical 8930/PM8038 hardware becomes |
| 130 | * available, replace mipi_dsi_cdp_panel_power with |
| 131 | * appropriate function. |
| 132 | */ |
Chandan Uddaraju | 59894ca | 2011-12-05 17:07:02 -0800 | [diff] [blame] | 133 | #define DISP_RST_GPIO 58 |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 134 | static int mipi_dsi_cdp_panel_power(int on) |
| 135 | { |
| 136 | static struct regulator *reg_l8, *reg_l23, *reg_l2; |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 137 | int rc; |
| 138 | |
Jeff Ohlstein | 2cbe5ba | 2011-12-16 13:32:56 -0800 | [diff] [blame] | 139 | pr_debug("%s: state : %d\n", __func__, on); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 140 | |
| 141 | if (!dsi_power_on) { |
| 142 | |
| 143 | reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev, |
| 144 | "dsi_vdc"); |
| 145 | if (IS_ERR(reg_l8)) { |
Chandan Uddaraju | 59894ca | 2011-12-05 17:07:02 -0800 | [diff] [blame] | 146 | pr_err("could not get 8038_l8, rc = %ld\n", |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 147 | PTR_ERR(reg_l8)); |
| 148 | return -ENODEV; |
| 149 | } |
| 150 | reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev, |
| 151 | "dsi_vddio"); |
| 152 | if (IS_ERR(reg_l23)) { |
Chandan Uddaraju | 59894ca | 2011-12-05 17:07:02 -0800 | [diff] [blame] | 153 | pr_err("could not get 8038_l23, rc = %ld\n", |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 154 | PTR_ERR(reg_l23)); |
| 155 | return -ENODEV; |
| 156 | } |
| 157 | reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev, |
| 158 | "dsi_vdda"); |
| 159 | if (IS_ERR(reg_l2)) { |
Chandan Uddaraju | 59894ca | 2011-12-05 17:07:02 -0800 | [diff] [blame] | 160 | pr_err("could not get 8038_l2, rc = %ld\n", |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 161 | PTR_ERR(reg_l2)); |
| 162 | return -ENODEV; |
| 163 | } |
| 164 | rc = regulator_set_voltage(reg_l8, 2800000, 3000000); |
| 165 | if (rc) { |
| 166 | pr_err("set_voltage l8 failed, rc=%d\n", rc); |
| 167 | return -EINVAL; |
| 168 | } |
| 169 | rc = regulator_set_voltage(reg_l23, 1800000, 1800000); |
| 170 | if (rc) { |
| 171 | pr_err("set_voltage l23 failed, rc=%d\n", rc); |
| 172 | return -EINVAL; |
| 173 | } |
| 174 | rc = regulator_set_voltage(reg_l2, 1200000, 1200000); |
| 175 | if (rc) { |
| 176 | pr_err("set_voltage l2 failed, rc=%d\n", rc); |
| 177 | return -EINVAL; |
| 178 | } |
Chandan Uddaraju | 59894ca | 2011-12-05 17:07:02 -0800 | [diff] [blame] | 179 | rc = gpio_request(DISP_RST_GPIO, "disp_rst_n"); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 180 | if (rc) { |
Chandan Uddaraju | 59894ca | 2011-12-05 17:07:02 -0800 | [diff] [blame] | 181 | pr_err("request gpio DISP_RST_GPIO failed, rc=%d\n", |
| 182 | rc); |
| 183 | gpio_free(DISP_RST_GPIO); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 184 | return -ENODEV; |
| 185 | } |
| 186 | dsi_power_on = true; |
| 187 | } |
| 188 | if (on) { |
| 189 | rc = regulator_set_optimum_mode(reg_l8, 100000); |
| 190 | if (rc < 0) { |
| 191 | pr_err("set_optimum_mode l8 failed, rc=%d\n", rc); |
| 192 | return -EINVAL; |
| 193 | } |
| 194 | rc = regulator_set_optimum_mode(reg_l23, 100000); |
| 195 | if (rc < 0) { |
| 196 | pr_err("set_optimum_mode l23 failed, rc=%d\n", rc); |
| 197 | return -EINVAL; |
| 198 | } |
| 199 | rc = regulator_set_optimum_mode(reg_l2, 100000); |
| 200 | if (rc < 0) { |
| 201 | pr_err("set_optimum_mode l2 failed, rc=%d\n", rc); |
| 202 | return -EINVAL; |
| 203 | } |
| 204 | rc = regulator_enable(reg_l8); |
| 205 | if (rc) { |
| 206 | pr_err("enable l8 failed, rc=%d\n", rc); |
| 207 | return -ENODEV; |
| 208 | } |
| 209 | rc = regulator_enable(reg_l23); |
| 210 | if (rc) { |
| 211 | pr_err("enable l8 failed, rc=%d\n", rc); |
| 212 | return -ENODEV; |
| 213 | } |
| 214 | rc = regulator_enable(reg_l2); |
| 215 | if (rc) { |
| 216 | pr_err("enable l2 failed, rc=%d\n", rc); |
| 217 | return -ENODEV; |
| 218 | } |
Ravishangar Kalyanam | 87c5fb6 | 2012-01-28 21:24:58 -0800 | [diff] [blame] | 219 | usleep(10000); |
| 220 | gpio_set_value(DISP_RST_GPIO, 1); |
| 221 | usleep(10); |
| 222 | gpio_set_value(DISP_RST_GPIO, 0); |
| 223 | usleep(20); |
Chandan Uddaraju | 59894ca | 2011-12-05 17:07:02 -0800 | [diff] [blame] | 224 | gpio_set_value(DISP_RST_GPIO, 1); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 225 | } else { |
Chandan Uddaraju | 59894ca | 2011-12-05 17:07:02 -0800 | [diff] [blame] | 226 | |
| 227 | gpio_set_value(DISP_RST_GPIO, 0); |
| 228 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 229 | rc = regulator_disable(reg_l2); |
| 230 | if (rc) { |
| 231 | pr_err("disable reg_l2 failed, rc=%d\n", rc); |
| 232 | return -ENODEV; |
| 233 | } |
| 234 | rc = regulator_disable(reg_l8); |
| 235 | if (rc) { |
| 236 | pr_err("disable reg_l8 failed, rc=%d\n", rc); |
| 237 | return -ENODEV; |
| 238 | } |
| 239 | rc = regulator_disable(reg_l23); |
| 240 | if (rc) { |
| 241 | pr_err("disable reg_l23 failed, rc=%d\n", rc); |
| 242 | return -ENODEV; |
| 243 | } |
| 244 | rc = regulator_set_optimum_mode(reg_l8, 100); |
| 245 | if (rc < 0) { |
| 246 | pr_err("set_optimum_mode l8 failed, rc=%d\n", rc); |
| 247 | return -EINVAL; |
| 248 | } |
| 249 | rc = regulator_set_optimum_mode(reg_l23, 100); |
| 250 | if (rc < 0) { |
| 251 | pr_err("set_optimum_mode l23 failed, rc=%d\n", rc); |
| 252 | return -EINVAL; |
| 253 | } |
| 254 | rc = regulator_set_optimum_mode(reg_l2, 100); |
| 255 | if (rc < 0) { |
| 256 | pr_err("set_optimum_mode l2 failed, rc=%d\n", rc); |
| 257 | return -EINVAL; |
| 258 | } |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 259 | } |
| 260 | return 0; |
| 261 | } |
| 262 | |
| 263 | static int mipi_dsi_panel_power(int on) |
| 264 | { |
Jeff Ohlstein | 2cbe5ba | 2011-12-16 13:32:56 -0800 | [diff] [blame] | 265 | pr_debug("%s: on=%d\n", __func__, on); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 266 | |
| 267 | return mipi_dsi_cdp_panel_power(on); |
| 268 | } |
| 269 | |
| 270 | static struct mipi_dsi_platform_data mipi_dsi_pdata = { |
| 271 | .vsync_gpio = MDP_VSYNC_GPIO, |
| 272 | .dsi_power_save = mipi_dsi_panel_power, |
| 273 | }; |
| 274 | |
| 275 | #ifdef CONFIG_MSM_BUS_SCALING |
| 276 | |
| 277 | static struct msm_bus_vectors mdp_init_vectors[] = { |
| 278 | { |
| 279 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 280 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 281 | .ab = 0, |
| 282 | .ib = 0, |
| 283 | }, |
| 284 | }; |
| 285 | |
| 286 | #ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY |
| 287 | static struct msm_bus_vectors hdmi_as_primary_vectors[] = { |
| 288 | /* If HDMI is used as primary */ |
| 289 | { |
| 290 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 291 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 292 | .ab = 2000000000, |
| 293 | .ib = 2000000000, |
| 294 | }, |
| 295 | }; |
| 296 | static struct msm_bus_paths mdp_bus_scale_usecases[] = { |
| 297 | { |
| 298 | ARRAY_SIZE(mdp_init_vectors), |
| 299 | mdp_init_vectors, |
| 300 | }, |
| 301 | { |
| 302 | ARRAY_SIZE(hdmi_as_primary_vectors), |
| 303 | hdmi_as_primary_vectors, |
| 304 | }, |
| 305 | { |
| 306 | ARRAY_SIZE(hdmi_as_primary_vectors), |
| 307 | hdmi_as_primary_vectors, |
| 308 | }, |
| 309 | { |
| 310 | ARRAY_SIZE(hdmi_as_primary_vectors), |
| 311 | hdmi_as_primary_vectors, |
| 312 | }, |
| 313 | { |
| 314 | ARRAY_SIZE(hdmi_as_primary_vectors), |
| 315 | hdmi_as_primary_vectors, |
| 316 | }, |
| 317 | { |
| 318 | ARRAY_SIZE(hdmi_as_primary_vectors), |
| 319 | hdmi_as_primary_vectors, |
| 320 | }, |
| 321 | }; |
| 322 | #else |
| 323 | static struct msm_bus_vectors mdp_ui_vectors[] = { |
| 324 | { |
| 325 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 326 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 327 | .ab = 216000000 * 2, |
| 328 | .ib = 270000000 * 2, |
| 329 | }, |
| 330 | }; |
| 331 | |
| 332 | static struct msm_bus_vectors mdp_vga_vectors[] = { |
| 333 | /* VGA and less video */ |
| 334 | { |
| 335 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 336 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 337 | .ab = 216000000 * 2, |
| 338 | .ib = 270000000 * 2, |
| 339 | }, |
| 340 | }; |
| 341 | |
| 342 | static struct msm_bus_vectors mdp_720p_vectors[] = { |
| 343 | /* 720p and less video */ |
| 344 | { |
| 345 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 346 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 347 | .ab = 230400000 * 2, |
| 348 | .ib = 288000000 * 2, |
| 349 | }, |
| 350 | }; |
| 351 | |
| 352 | static struct msm_bus_vectors mdp_1080p_vectors[] = { |
| 353 | /* 1080p and less video */ |
| 354 | { |
| 355 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 356 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 357 | .ab = 334080000 * 2, |
| 358 | .ib = 417600000 * 2, |
| 359 | }, |
| 360 | }; |
| 361 | |
| 362 | static struct msm_bus_paths mdp_bus_scale_usecases[] = { |
| 363 | { |
| 364 | ARRAY_SIZE(mdp_init_vectors), |
| 365 | mdp_init_vectors, |
| 366 | }, |
| 367 | { |
| 368 | ARRAY_SIZE(mdp_ui_vectors), |
| 369 | mdp_ui_vectors, |
| 370 | }, |
| 371 | { |
| 372 | ARRAY_SIZE(mdp_ui_vectors), |
| 373 | mdp_ui_vectors, |
| 374 | }, |
| 375 | { |
| 376 | ARRAY_SIZE(mdp_vga_vectors), |
| 377 | mdp_vga_vectors, |
| 378 | }, |
| 379 | { |
| 380 | ARRAY_SIZE(mdp_720p_vectors), |
| 381 | mdp_720p_vectors, |
| 382 | }, |
| 383 | { |
| 384 | ARRAY_SIZE(mdp_1080p_vectors), |
| 385 | mdp_1080p_vectors, |
| 386 | }, |
| 387 | }; |
| 388 | #endif |
| 389 | |
| 390 | static struct msm_bus_scale_pdata mdp_bus_scale_pdata = { |
| 391 | mdp_bus_scale_usecases, |
| 392 | ARRAY_SIZE(mdp_bus_scale_usecases), |
| 393 | .name = "mdp", |
| 394 | }; |
| 395 | |
| 396 | #endif |
| 397 | |
| 398 | #ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY |
| 399 | static int mdp_core_clk_rate_table[] = { |
| 400 | 200000000, |
| 401 | 200000000, |
| 402 | 200000000, |
| 403 | 200000000, |
| 404 | }; |
| 405 | #else |
| 406 | static int mdp_core_clk_rate_table[] = { |
| 407 | 85330000, |
Huaibin Yang | 1f180ee | 2012-01-30 16:23:06 -0800 | [diff] [blame] | 408 | 128000000, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 409 | 160000000, |
| 410 | 200000000, |
| 411 | }; |
| 412 | #endif |
| 413 | |
| 414 | static struct msm_panel_common_pdata mdp_pdata = { |
| 415 | .gpio = MDP_VSYNC_GPIO, |
| 416 | #ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY |
| 417 | .mdp_core_clk_rate = 200000000, |
| 418 | #else |
| 419 | .mdp_core_clk_rate = 85330000, |
| 420 | #endif |
| 421 | .mdp_core_clk_table = mdp_core_clk_rate_table, |
| 422 | .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table), |
| 423 | #ifdef CONFIG_MSM_BUS_SCALING |
| 424 | .mdp_bus_scale_table = &mdp_bus_scale_pdata, |
| 425 | #endif |
| 426 | .mdp_rev = MDP_REV_42, |
Nagamalleswararao Ganji | 937a119 | 2011-12-07 19:00:52 -0800 | [diff] [blame] | 427 | #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION |
Ravishangar Kalyanam | a3b168b | 2012-03-26 11:13:11 -0700 | [diff] [blame] | 428 | .mem_hid = BIT(ION_CP_MM_HEAP_ID), |
Nagamalleswararao Ganji | 937a119 | 2011-12-07 19:00:52 -0800 | [diff] [blame] | 429 | #else |
| 430 | .mem_hid = MEMTYPE_EBI1, |
| 431 | #endif |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 432 | }; |
| 433 | |
Huaibin Yang | a541942 | 2011-12-08 23:52:10 -0800 | [diff] [blame] | 434 | void __init msm8930_mdp_writeback(struct memtype_reserve* reserve_table) |
| 435 | { |
Nagamalleswararao Ganji | 937a119 | 2011-12-07 19:00:52 -0800 | [diff] [blame] | 436 | mdp_pdata.ov0_wb_size = MSM_FB_OVERLAY0_WRITEBACK_SIZE; |
| 437 | mdp_pdata.ov1_wb_size = MSM_FB_OVERLAY1_WRITEBACK_SIZE; |
| 438 | #if defined(CONFIG_ANDROID_PMEM) && !defined(CONFIG_MSM_MULTIMEDIA_USE_ION) |
| 439 | reserve_table[mdp_pdata.mem_hid].size += |
| 440 | mdp_pdata.ov0_wb_size; |
| 441 | reserve_table[mdp_pdata.mem_hid].size += |
| 442 | mdp_pdata.ov1_wb_size; |
| 443 | #endif |
Huaibin Yang | a541942 | 2011-12-08 23:52:10 -0800 | [diff] [blame] | 444 | } |
| 445 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 446 | #define LPM_CHANNEL0 0 |
| 447 | static int toshiba_gpio[] = {LPM_CHANNEL0}; |
| 448 | |
| 449 | static struct mipi_dsi_panel_platform_data toshiba_pdata = { |
| 450 | .gpio = toshiba_gpio, |
| 451 | }; |
| 452 | |
| 453 | static struct platform_device mipi_dsi_toshiba_panel_device = { |
| 454 | .name = "mipi_toshiba", |
| 455 | .id = 0, |
| 456 | .dev = { |
| 457 | .platform_data = &toshiba_pdata, |
| 458 | } |
| 459 | }; |
| 460 | |
| 461 | #define FPGA_3D_GPIO_CONFIG_ADDR 0xB5 |
| 462 | |
| 463 | static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = { |
| 464 | |
| 465 | /* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */ |
| 466 | {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */ |
| 467 | /* timing */ |
| 468 | {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c, |
| 469 | 0x0c, 0x03, 0x04, 0xa0}, |
| 470 | {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */ |
| 471 | {0xff, 0x00, 0x06, 0x00}, /* strength */ |
| 472 | /* pll control */ |
| 473 | {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62, |
| 474 | 0x40, 0x07, 0x03, |
| 475 | 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01}, |
| 476 | }; |
| 477 | |
| 478 | static struct mipi_dsi_panel_platform_data novatek_pdata = { |
| 479 | .fpga_3d_config_addr = FPGA_3D_GPIO_CONFIG_ADDR, |
| 480 | .fpga_ctrl_mode = FPGA_SPI_INTF, |
| 481 | .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db, |
Ravishangar Kalyanam | 903f65c | 2012-01-28 21:36:22 -0800 | [diff] [blame] | 482 | .dlane_swap = 0x1, |
Chandan Uddaraju | 194a4b5 | 2012-03-21 10:11:18 -0700 | [diff] [blame] | 483 | .enable_wled_bl_ctrl = 0x1, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 484 | }; |
| 485 | |
| 486 | static struct platform_device mipi_dsi_novatek_panel_device = { |
| 487 | .name = "mipi_novatek", |
| 488 | .id = 0, |
| 489 | .dev = { |
| 490 | .platform_data = &novatek_pdata, |
| 491 | } |
| 492 | }; |
| 493 | |
| 494 | #ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL |
| 495 | static struct resource hdmi_msm_resources[] = { |
| 496 | { |
| 497 | .name = "hdmi_msm_qfprom_addr", |
| 498 | .start = 0x00700000, |
| 499 | .end = 0x007060FF, |
| 500 | .flags = IORESOURCE_MEM, |
| 501 | }, |
| 502 | { |
| 503 | .name = "hdmi_msm_hdmi_addr", |
| 504 | .start = 0x04A00000, |
| 505 | .end = 0x04A00FFF, |
| 506 | .flags = IORESOURCE_MEM, |
| 507 | }, |
| 508 | { |
| 509 | .name = "hdmi_msm_irq", |
| 510 | .start = HDMI_IRQ, |
| 511 | .end = HDMI_IRQ, |
| 512 | .flags = IORESOURCE_IRQ, |
| 513 | }, |
| 514 | }; |
| 515 | |
| 516 | static int hdmi_enable_5v(int on); |
| 517 | static int hdmi_core_power(int on, int show); |
| 518 | static int hdmi_cec_power(int on); |
Ajay Singh Parmar | 7d11c27 | 2012-06-07 12:25:31 +0530 | [diff] [blame] | 519 | static int hdmi_gpio_config(int on); |
| 520 | static int hdmi_panel_power(int on); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 521 | |
| 522 | static struct msm_hdmi_platform_data hdmi_msm_data = { |
| 523 | .irq = HDMI_IRQ, |
| 524 | .enable_5v = hdmi_enable_5v, |
| 525 | .core_power = hdmi_core_power, |
| 526 | .cec_power = hdmi_cec_power, |
Ajay Singh Parmar | 7d11c27 | 2012-06-07 12:25:31 +0530 | [diff] [blame] | 527 | .panel_power = hdmi_panel_power, |
| 528 | .gpio_config = hdmi_gpio_config, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 529 | }; |
| 530 | |
| 531 | static struct platform_device hdmi_msm_device = { |
| 532 | .name = "hdmi_msm", |
| 533 | .id = 0, |
| 534 | .num_resources = ARRAY_SIZE(hdmi_msm_resources), |
| 535 | .resource = hdmi_msm_resources, |
| 536 | .dev.platform_data = &hdmi_msm_data, |
| 537 | }; |
| 538 | #endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */ |
| 539 | |
| 540 | #ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL |
| 541 | static struct platform_device wfd_panel_device = { |
| 542 | .name = "wfd_panel", |
| 543 | .id = 0, |
| 544 | .dev.platform_data = NULL, |
| 545 | }; |
| 546 | |
| 547 | static struct platform_device wfd_device = { |
| 548 | .name = "msm_wfd", |
| 549 | .id = -1, |
| 550 | }; |
| 551 | #endif |
| 552 | |
| 553 | #ifdef CONFIG_MSM_BUS_SCALING |
| 554 | static struct msm_bus_vectors dtv_bus_init_vectors[] = { |
| 555 | { |
| 556 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 557 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 558 | .ab = 0, |
| 559 | .ib = 0, |
| 560 | }, |
| 561 | }; |
| 562 | |
| 563 | #ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY |
| 564 | static struct msm_bus_vectors dtv_bus_def_vectors[] = { |
| 565 | { |
| 566 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 567 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 568 | .ab = 2000000000, |
| 569 | .ib = 2000000000, |
| 570 | }, |
| 571 | }; |
| 572 | #else |
| 573 | static struct msm_bus_vectors dtv_bus_def_vectors[] = { |
| 574 | { |
| 575 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 576 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 577 | .ab = 566092800 * 2, |
| 578 | .ib = 707616000 * 2, |
| 579 | }, |
| 580 | }; |
| 581 | #endif |
| 582 | |
| 583 | static struct msm_bus_paths dtv_bus_scale_usecases[] = { |
| 584 | { |
| 585 | ARRAY_SIZE(dtv_bus_init_vectors), |
| 586 | dtv_bus_init_vectors, |
| 587 | }, |
| 588 | { |
| 589 | ARRAY_SIZE(dtv_bus_def_vectors), |
| 590 | dtv_bus_def_vectors, |
| 591 | }, |
| 592 | }; |
| 593 | static struct msm_bus_scale_pdata dtv_bus_scale_pdata = { |
| 594 | dtv_bus_scale_usecases, |
| 595 | ARRAY_SIZE(dtv_bus_scale_usecases), |
| 596 | .name = "dtv", |
| 597 | }; |
| 598 | |
| 599 | static struct lcdc_platform_data dtv_pdata = { |
| 600 | .bus_scale_table = &dtv_bus_scale_pdata, |
Ajay Singh Parmar | 7d11c27 | 2012-06-07 12:25:31 +0530 | [diff] [blame] | 601 | .lcdc_power_save = hdmi_panel_power, |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 602 | }; |
Ajay Singh Parmar | 7d11c27 | 2012-06-07 12:25:31 +0530 | [diff] [blame] | 603 | |
| 604 | static int hdmi_panel_power(int on) |
| 605 | { |
| 606 | int rc; |
| 607 | |
| 608 | pr_debug("%s: HDMI Core: %s\n", __func__, (on ? "ON" : "OFF")); |
| 609 | rc = hdmi_core_power(on, 1); |
| 610 | if (rc) |
| 611 | rc = hdmi_cec_power(on); |
| 612 | |
| 613 | pr_debug("%s: HDMI Core: %s Success\n", __func__, (on ? "ON" : "OFF")); |
| 614 | return rc; |
| 615 | } |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 616 | #endif |
| 617 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 618 | #ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 619 | static int hdmi_enable_5v(int on) |
| 620 | { |
Chandan Uddaraju | 59894ca | 2011-12-05 17:07:02 -0800 | [diff] [blame] | 621 | static struct regulator *reg_ext_5v; /* HDMI_5V */ |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 622 | static int prev_on; |
| 623 | int rc; |
| 624 | |
| 625 | if (on == prev_on) |
| 626 | return 0; |
| 627 | |
Ajay Singh Parmar | 0784764 | 2011-12-09 02:57:45 +0530 | [diff] [blame] | 628 | if (!reg_ext_5v) { |
| 629 | reg_ext_5v = regulator_get(&hdmi_msm_device.dev, "hdmi_mvs"); |
| 630 | if (IS_ERR(reg_ext_5v)) { |
| 631 | pr_err("'%s' regulator not found, rc=%ld\n", |
| 632 | "hdmi_mvs", IS_ERR(reg_ext_5v)); |
| 633 | reg_ext_5v = NULL; |
| 634 | return -ENODEV; |
| 635 | } |
| 636 | } |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 637 | |
| 638 | if (on) { |
Chandan Uddaraju | 59894ca | 2011-12-05 17:07:02 -0800 | [diff] [blame] | 639 | rc = regulator_enable(reg_ext_5v); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 640 | if (rc) { |
| 641 | pr_err("'%s' regulator enable failed, rc=%d\n", |
Chandan Uddaraju | 59894ca | 2011-12-05 17:07:02 -0800 | [diff] [blame] | 642 | "reg_ext_5v", rc); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 643 | return rc; |
| 644 | } |
| 645 | pr_debug("%s(on): success\n", __func__); |
| 646 | } else { |
Chandan Uddaraju | 59894ca | 2011-12-05 17:07:02 -0800 | [diff] [blame] | 647 | rc = regulator_disable(reg_ext_5v); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 648 | if (rc) |
| 649 | pr_warning("'%s' regulator disable failed, rc=%d\n", |
Chandan Uddaraju | 59894ca | 2011-12-05 17:07:02 -0800 | [diff] [blame] | 650 | "reg_ext_5v", rc); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 651 | pr_debug("%s(off): success\n", __func__); |
| 652 | } |
| 653 | |
| 654 | prev_on = on; |
| 655 | |
| 656 | return 0; |
| 657 | } |
| 658 | |
| 659 | static int hdmi_core_power(int on, int show) |
| 660 | { |
Chandan Uddaraju | 59894ca | 2011-12-05 17:07:02 -0800 | [diff] [blame] | 661 | /* Both HDMI "avdd" and "vcc" are powered by 8038_l23 regulator */ |
| 662 | static struct regulator *reg_8038_l23; |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 663 | static int prev_on; |
| 664 | int rc; |
| 665 | |
| 666 | if (on == prev_on) |
| 667 | return 0; |
| 668 | |
Chandan Uddaraju | 59894ca | 2011-12-05 17:07:02 -0800 | [diff] [blame] | 669 | if (!reg_8038_l23) { |
| 670 | reg_8038_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd"); |
| 671 | if (IS_ERR(reg_8038_l23)) { |
| 672 | pr_err("could not get reg_8038_l23, rc = %ld\n", |
| 673 | PTR_ERR(reg_8038_l23)); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 674 | return -ENODEV; |
| 675 | } |
Chandan Uddaraju | 59894ca | 2011-12-05 17:07:02 -0800 | [diff] [blame] | 676 | rc = regulator_set_voltage(reg_8038_l23, 1800000, 1800000); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 677 | if (rc) { |
| 678 | pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc); |
| 679 | return -EINVAL; |
| 680 | } |
| 681 | } |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 682 | |
| 683 | if (on) { |
Chandan Uddaraju | 59894ca | 2011-12-05 17:07:02 -0800 | [diff] [blame] | 684 | rc = regulator_set_optimum_mode(reg_8038_l23, 100000); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 685 | if (rc < 0) { |
| 686 | pr_err("set_optimum_mode l23 failed, rc=%d\n", rc); |
| 687 | return -EINVAL; |
| 688 | } |
Chandan Uddaraju | 59894ca | 2011-12-05 17:07:02 -0800 | [diff] [blame] | 689 | rc = regulator_enable(reg_8038_l23); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 690 | if (rc) { |
| 691 | pr_err("'%s' regulator enable failed, rc=%d\n", |
| 692 | "hdmi_avdd", rc); |
| 693 | return rc; |
| 694 | } |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 695 | pr_debug("%s(on): success\n", __func__); |
| 696 | } else { |
Chandan Uddaraju | 59894ca | 2011-12-05 17:07:02 -0800 | [diff] [blame] | 697 | rc = regulator_disable(reg_8038_l23); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 698 | if (rc) { |
Chandan Uddaraju | 59894ca | 2011-12-05 17:07:02 -0800 | [diff] [blame] | 699 | pr_err("disable reg_8038_l23 failed, rc=%d\n", rc); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 700 | return -ENODEV; |
| 701 | } |
Chandan Uddaraju | 59894ca | 2011-12-05 17:07:02 -0800 | [diff] [blame] | 702 | rc = regulator_set_optimum_mode(reg_8038_l23, 100); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 703 | if (rc < 0) { |
| 704 | pr_err("set_optimum_mode l23 failed, rc=%d\n", rc); |
| 705 | return -EINVAL; |
| 706 | } |
| 707 | pr_debug("%s(off): success\n", __func__); |
| 708 | } |
| 709 | |
| 710 | prev_on = on; |
| 711 | |
| 712 | return 0; |
Ajay Singh Parmar | 7d11c27 | 2012-06-07 12:25:31 +0530 | [diff] [blame] | 713 | } |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 714 | |
Ajay Singh Parmar | 7d11c27 | 2012-06-07 12:25:31 +0530 | [diff] [blame] | 715 | static int hdmi_gpio_config(int on) |
| 716 | { |
| 717 | int rc = 0; |
| 718 | static int prev_on; |
| 719 | |
| 720 | if (on == prev_on) |
| 721 | return 0; |
| 722 | |
| 723 | if (on) { |
| 724 | rc = gpio_request(100, "HDMI_DDC_CLK"); |
| 725 | if (rc) { |
| 726 | pr_err("'%s'(%d) gpio_request failed, rc=%d\n", |
| 727 | "HDMI_DDC_CLK", 100, rc); |
| 728 | return rc; |
| 729 | } |
| 730 | rc = gpio_request(101, "HDMI_DDC_DATA"); |
| 731 | if (rc) { |
| 732 | pr_err("'%s'(%d) gpio_request failed, rc=%d\n", |
| 733 | "HDMI_DDC_DATA", 101, rc); |
| 734 | goto error1; |
| 735 | } |
| 736 | rc = gpio_request(102, "HDMI_HPD"); |
| 737 | if (rc) { |
| 738 | pr_err("'%s'(%d) gpio_request failed, rc=%d\n", |
| 739 | "HDMI_HPD", 102, rc); |
| 740 | goto error2; |
| 741 | } |
| 742 | pr_debug("%s(on): success\n", __func__); |
| 743 | } else { |
| 744 | gpio_free(100); |
| 745 | gpio_free(101); |
| 746 | gpio_free(102); |
| 747 | pr_debug("%s(off): success\n", __func__); |
| 748 | } |
| 749 | |
| 750 | prev_on = on; |
| 751 | return 0; |
| 752 | |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 753 | error2: |
Ajay Singh Parmar | 7d11c27 | 2012-06-07 12:25:31 +0530 | [diff] [blame] | 754 | gpio_free(101); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 755 | error1: |
Ajay Singh Parmar | 7d11c27 | 2012-06-07 12:25:31 +0530 | [diff] [blame] | 756 | gpio_free(100); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 757 | return rc; |
| 758 | } |
| 759 | |
| 760 | static int hdmi_cec_power(int on) |
| 761 | { |
| 762 | static int prev_on; |
| 763 | int rc; |
| 764 | |
| 765 | if (on == prev_on) |
| 766 | return 0; |
| 767 | |
| 768 | if (on) { |
| 769 | rc = gpio_request(99, "HDMI_CEC_VAR"); |
| 770 | if (rc) { |
| 771 | pr_err("'%s'(%d) gpio_request failed, rc=%d\n", |
| 772 | "HDMI_CEC_VAR", 99, rc); |
| 773 | goto error; |
| 774 | } |
| 775 | pr_debug("%s(on): success\n", __func__); |
| 776 | } else { |
| 777 | gpio_free(99); |
| 778 | pr_debug("%s(off): success\n", __func__); |
| 779 | } |
| 780 | |
| 781 | prev_on = on; |
| 782 | |
| 783 | return 0; |
| 784 | error: |
| 785 | return rc; |
| 786 | } |
| 787 | #endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */ |
| 788 | |
| 789 | void __init msm8930_init_fb(void) |
| 790 | { |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 791 | platform_device_register(&msm_fb_device); |
| 792 | |
| 793 | #ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL |
| 794 | platform_device_register(&wfd_panel_device); |
| 795 | platform_device_register(&wfd_device); |
| 796 | #endif |
| 797 | |
| 798 | platform_device_register(&mipi_dsi_novatek_panel_device); |
| 799 | |
| 800 | #ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL |
Aravind Venkateswaran | fff132d | 2012-03-07 13:22:30 -0800 | [diff] [blame] | 801 | platform_device_register(&hdmi_msm_device); |
Stepan Moskovchenko | 39236d7 | 2011-11-30 17:42:23 -0800 | [diff] [blame] | 802 | #endif |
| 803 | |
| 804 | platform_device_register(&mipi_dsi_toshiba_panel_device); |
| 805 | |
| 806 | msm_fb_register_device("mdp", &mdp_pdata); |
| 807 | msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata); |
| 808 | #ifdef CONFIG_MSM_BUS_SCALING |
| 809 | msm_fb_register_device("dtv", &dtv_pdata); |
| 810 | #endif |
| 811 | } |
| 812 | |
| 813 | void __init msm8930_allocate_fb_region(void) |
| 814 | { |
| 815 | void *addr; |
| 816 | unsigned long size; |
| 817 | |
| 818 | size = MSM_FB_SIZE; |
| 819 | addr = alloc_bootmem_align(size, 0x1000); |
| 820 | msm_fb_resources[0].start = __pa(addr); |
| 821 | msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1; |
| 822 | pr_info("allocating %lu bytes at %p (%lx physical) for fb\n", |
| 823 | size, addr, __pa(addr)); |
| 824 | } |