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 | 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> |
| 18 | #include <asm/mach-types.h> |
| 19 | #include <mach/msm_bus_board.h> |
Huaibin Yang | a541942 | 2011-12-08 23:52:10 -0800 | [diff] [blame] | 20 | #include <mach/msm_memtypes.h> |
Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 21 | #include <mach/board.h> |
| 22 | #include <mach/gpio.h> |
| 23 | #include <mach/gpiomux.h> |
Nagamalleswararao Ganji | 937a119 | 2011-12-07 19:00:52 -0800 | [diff] [blame] | 24 | #include <linux/ion.h> |
| 25 | #include <mach/ion.h> |
| 26 | |
Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 27 | #include "devices.h" |
Stepan Moskovchenko | 5a83dba | 2011-12-05 17:30:17 -0800 | [diff] [blame] | 28 | #include "board-8960.h" |
Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 29 | |
| 30 | #ifdef CONFIG_FB_MSM_TRIPLE_BUFFER |
Amir Samuelov | d762103 | 2011-12-25 12:24:04 +0200 | [diff] [blame] | 31 | #define MSM_FB_PRIM_BUF_SIZE (1920 * 1200 * 4 * 3) /* 4 bpp x 3 pages */ |
Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 32 | #else |
Amir Samuelov | d762103 | 2011-12-25 12:24:04 +0200 | [diff] [blame] | 33 | #define MSM_FB_PRIM_BUF_SIZE (1920 * 1200 * 4 * 2) /* 4 bpp x 2 pages */ |
Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 34 | #endif |
| 35 | |
| 36 | #ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL |
| 37 | #define MSM_FB_EXT_BUF_SIZE (1920 * 1088 * 2 * 1) /* 2 bpp x 1 page */ |
| 38 | #elif defined(CONFIG_FB_MSM_TVOUT) |
| 39 | #define MSM_FB_EXT_BUF_SIZE (720 * 576 * 2 * 2) /* 2 bpp x 2 pages */ |
| 40 | #else |
| 41 | #define MSM_FB_EXT_BUF_SIZE 0 |
| 42 | #endif |
| 43 | |
Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 44 | #ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY |
| 45 | /* 4 bpp x 2 page HDMI case */ |
| 46 | #define MSM_FB_SIZE roundup((1920 * 1088 * 4 * 2), 4096) |
| 47 | #else |
| 48 | /* Note: must be multiple of 4096 */ |
Huaibin Yang | 27634b8 | 2011-12-09 00:16:25 -0800 | [diff] [blame] | 49 | #define MSM_FB_SIZE roundup(MSM_FB_PRIM_BUF_SIZE + MSM_FB_EXT_BUF_SIZE, 4096) |
Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 50 | #endif |
| 51 | |
Huaibin Yang | a541942 | 2011-12-08 23:52:10 -0800 | [diff] [blame] | 52 | #ifdef CONFIG_FB_MSM_OVERLAY0_WRITEBACK |
Amir Samuelov | d762103 | 2011-12-25 12:24:04 +0200 | [diff] [blame] | 53 | #define MSM_FB_OVERLAY0_WRITEBACK_SIZE roundup((1920 * 1200 * 3 * 2), 4096) |
Huaibin Yang | a541942 | 2011-12-08 23:52:10 -0800 | [diff] [blame] | 54 | #else |
| 55 | #define MSM_FB_OVERLAY0_WRITEBACK_SIZE (0) |
| 56 | #endif /* CONFIG_FB_MSM_OVERLAY0_WRITEBACK */ |
| 57 | |
| 58 | #ifdef CONFIG_FB_MSM_OVERLAY1_WRITEBACK |
| 59 | #define MSM_FB_OVERLAY1_WRITEBACK_SIZE roundup((1920 * 1088 * 3 * 2), 4096) |
| 60 | #else |
| 61 | #define MSM_FB_OVERLAY1_WRITEBACK_SIZE (0) |
| 62 | #endif /* CONFIG_FB_MSM_OVERLAY1_WRITEBACK */ |
| 63 | |
Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 64 | #define MDP_VSYNC_GPIO 0 |
| 65 | |
| 66 | #define PANEL_NAME_MAX_LEN 30 |
| 67 | #define MIPI_CMD_NOVATEK_QHD_PANEL_NAME "mipi_cmd_novatek_qhd" |
| 68 | #define MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME "mipi_video_novatek_qhd" |
| 69 | #define MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME "mipi_video_toshiba_wsvga" |
| 70 | #define MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME "mipi_video_chimei_wxga" |
| 71 | #define MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME "mipi_video_simulator_vga" |
| 72 | #define MIPI_CMD_RENESAS_FWVGA_PANEL_NAME "mipi_cmd_renesas_fwvga" |
| 73 | #define HDMI_PANEL_NAME "hdmi_msm" |
| 74 | #define TVOUT_PANEL_NAME "tvout_msm" |
| 75 | |
Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 76 | static struct resource msm_fb_resources[] = { |
| 77 | { |
| 78 | .flags = IORESOURCE_DMA, |
| 79 | } |
| 80 | }; |
| 81 | |
| 82 | static int msm_fb_detect_panel(const char *name) |
| 83 | { |
| 84 | if (machine_is_msm8960_liquid()) { |
| 85 | if (!strncmp(name, MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME, |
| 86 | strnlen(MIPI_VIDEO_CHIMEI_WXGA_PANEL_NAME, |
| 87 | PANEL_NAME_MAX_LEN))) |
| 88 | return 0; |
| 89 | } else { |
| 90 | if (!strncmp(name, MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME, |
| 91 | strnlen(MIPI_VIDEO_TOSHIBA_WSVGA_PANEL_NAME, |
| 92 | PANEL_NAME_MAX_LEN))) |
| 93 | return 0; |
| 94 | |
| 95 | #ifndef CONFIG_FB_MSM_MIPI_PANEL_DETECT |
| 96 | if (!strncmp(name, MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME, |
| 97 | strnlen(MIPI_VIDEO_NOVATEK_QHD_PANEL_NAME, |
| 98 | PANEL_NAME_MAX_LEN))) |
| 99 | return 0; |
| 100 | |
| 101 | if (!strncmp(name, MIPI_CMD_NOVATEK_QHD_PANEL_NAME, |
| 102 | strnlen(MIPI_CMD_NOVATEK_QHD_PANEL_NAME, |
| 103 | PANEL_NAME_MAX_LEN))) |
| 104 | return 0; |
| 105 | |
| 106 | if (!strncmp(name, MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME, |
| 107 | strnlen(MIPI_VIDEO_SIMULATOR_VGA_PANEL_NAME, |
| 108 | PANEL_NAME_MAX_LEN))) |
| 109 | return 0; |
| 110 | |
| 111 | if (!strncmp(name, MIPI_CMD_RENESAS_FWVGA_PANEL_NAME, |
| 112 | strnlen(MIPI_CMD_RENESAS_FWVGA_PANEL_NAME, |
| 113 | PANEL_NAME_MAX_LEN))) |
| 114 | return 0; |
| 115 | #endif |
| 116 | } |
| 117 | |
| 118 | if (!strncmp(name, HDMI_PANEL_NAME, |
| 119 | strnlen(HDMI_PANEL_NAME, |
| 120 | PANEL_NAME_MAX_LEN))) |
| 121 | return 0; |
| 122 | |
| 123 | if (!strncmp(name, TVOUT_PANEL_NAME, |
| 124 | strnlen(TVOUT_PANEL_NAME, |
| 125 | PANEL_NAME_MAX_LEN))) |
| 126 | return 0; |
| 127 | |
| 128 | pr_warning("%s: not supported '%s'", __func__, name); |
| 129 | return -ENODEV; |
| 130 | } |
| 131 | |
| 132 | static struct msm_fb_platform_data msm_fb_pdata = { |
| 133 | .detect_client = msm_fb_detect_panel, |
| 134 | }; |
| 135 | |
| 136 | static struct platform_device msm_fb_device = { |
| 137 | .name = "msm_fb", |
| 138 | .id = 0, |
| 139 | .num_resources = ARRAY_SIZE(msm_fb_resources), |
| 140 | .resource = msm_fb_resources, |
| 141 | .dev.platform_data = &msm_fb_pdata, |
| 142 | }; |
| 143 | |
| 144 | static bool dsi_power_on; |
| 145 | |
| 146 | /** |
| 147 | * LiQUID panel on/off |
| 148 | * |
| 149 | * @param on |
| 150 | * |
| 151 | * @return int |
| 152 | */ |
| 153 | static int mipi_dsi_liquid_panel_power(int on) |
| 154 | { |
| 155 | static struct regulator *reg_l2, *reg_ext_3p3v; |
| 156 | static int gpio21, gpio24, gpio43; |
| 157 | int rc; |
| 158 | |
| 159 | pr_info("%s: on=%d\n", __func__, on); |
| 160 | |
| 161 | gpio21 = PM8921_GPIO_PM_TO_SYS(21); /* disp power enable_n */ |
| 162 | gpio43 = PM8921_GPIO_PM_TO_SYS(43); /* Displays Enable (rst_n)*/ |
| 163 | gpio24 = PM8921_GPIO_PM_TO_SYS(24); /* Backlight PWM */ |
| 164 | |
| 165 | if (!dsi_power_on) { |
| 166 | |
| 167 | reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev, |
| 168 | "dsi_vdda"); |
| 169 | if (IS_ERR(reg_l2)) { |
| 170 | pr_err("could not get 8921_l2, rc = %ld\n", |
| 171 | PTR_ERR(reg_l2)); |
| 172 | return -ENODEV; |
| 173 | } |
| 174 | |
| 175 | rc = regulator_set_voltage(reg_l2, 1200000, 1200000); |
| 176 | if (rc) { |
| 177 | pr_err("set_voltage l2 failed, rc=%d\n", rc); |
| 178 | return -EINVAL; |
| 179 | } |
| 180 | |
| 181 | reg_ext_3p3v = regulator_get(&msm_mipi_dsi1_device.dev, |
| 182 | "vdd_lvds_3p3v"); |
| 183 | if (IS_ERR(reg_ext_3p3v)) { |
| 184 | pr_err("could not get reg_ext_3p3v, rc = %ld\n", |
| 185 | PTR_ERR(reg_ext_3p3v)); |
| 186 | return -ENODEV; |
| 187 | } |
| 188 | |
| 189 | rc = gpio_request(gpio21, "disp_pwr_en_n"); |
| 190 | if (rc) { |
| 191 | pr_err("request gpio 21 failed, rc=%d\n", rc); |
| 192 | return -ENODEV; |
| 193 | } |
| 194 | |
| 195 | rc = gpio_request(gpio43, "disp_rst_n"); |
| 196 | if (rc) { |
| 197 | pr_err("request gpio 43 failed, rc=%d\n", rc); |
| 198 | return -ENODEV; |
| 199 | } |
| 200 | |
| 201 | rc = gpio_request(gpio24, "disp_backlight_pwm"); |
| 202 | if (rc) { |
| 203 | pr_err("request gpio 24 failed, rc=%d\n", rc); |
| 204 | return -ENODEV; |
| 205 | } |
| 206 | |
| 207 | dsi_power_on = true; |
| 208 | } |
| 209 | |
| 210 | if (on) { |
| 211 | rc = regulator_set_optimum_mode(reg_l2, 100000); |
| 212 | if (rc < 0) { |
| 213 | pr_err("set_optimum_mode l2 failed, rc=%d\n", rc); |
| 214 | return -EINVAL; |
| 215 | } |
| 216 | rc = regulator_enable(reg_l2); |
| 217 | if (rc) { |
| 218 | pr_err("enable l2 failed, rc=%d\n", rc); |
| 219 | return -ENODEV; |
| 220 | } |
| 221 | |
| 222 | rc = regulator_enable(reg_ext_3p3v); |
| 223 | if (rc) { |
| 224 | pr_err("enable reg_ext_3p3v failed, rc=%d\n", rc); |
| 225 | return -ENODEV; |
| 226 | } |
| 227 | |
| 228 | /* set reset pin before power enable */ |
| 229 | gpio_set_value_cansleep(gpio43, 0); /* disp disable (resx=0) */ |
| 230 | |
| 231 | gpio_set_value_cansleep(gpio21, 0); /* disp power enable_n */ |
| 232 | msleep(20); |
| 233 | gpio_set_value_cansleep(gpio43, 1); /* disp enable */ |
| 234 | msleep(20); |
| 235 | gpio_set_value_cansleep(gpio43, 0); /* disp enable */ |
| 236 | msleep(20); |
| 237 | gpio_set_value_cansleep(gpio43, 1); /* disp enable */ |
| 238 | msleep(20); |
| 239 | } else { |
| 240 | gpio_set_value_cansleep(gpio43, 0); |
| 241 | gpio_set_value_cansleep(gpio21, 1); |
| 242 | |
| 243 | rc = regulator_disable(reg_l2); |
| 244 | if (rc) { |
| 245 | pr_err("disable reg_l2 failed, rc=%d\n", rc); |
| 246 | return -ENODEV; |
| 247 | } |
| 248 | rc = regulator_disable(reg_ext_3p3v); |
| 249 | if (rc) { |
| 250 | pr_err("disable reg_ext_3p3v failed, rc=%d\n", rc); |
| 251 | return -ENODEV; |
| 252 | } |
| 253 | rc = regulator_set_optimum_mode(reg_l2, 100); |
| 254 | if (rc < 0) { |
| 255 | pr_err("set_optimum_mode l2 failed, rc=%d\n", rc); |
| 256 | return -EINVAL; |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | return 0; |
| 261 | } |
| 262 | |
| 263 | static int mipi_dsi_cdp_panel_power(int on) |
| 264 | { |
| 265 | static struct regulator *reg_l8, *reg_l23, *reg_l2; |
| 266 | static int gpio43; |
| 267 | int rc; |
| 268 | |
| 269 | pr_info("%s: state : %d\n", __func__, on); |
| 270 | |
| 271 | if (!dsi_power_on) { |
| 272 | |
| 273 | reg_l8 = regulator_get(&msm_mipi_dsi1_device.dev, |
| 274 | "dsi_vdc"); |
| 275 | if (IS_ERR(reg_l8)) { |
| 276 | pr_err("could not get 8921_l8, rc = %ld\n", |
| 277 | PTR_ERR(reg_l8)); |
| 278 | return -ENODEV; |
| 279 | } |
| 280 | reg_l23 = regulator_get(&msm_mipi_dsi1_device.dev, |
| 281 | "dsi_vddio"); |
| 282 | if (IS_ERR(reg_l23)) { |
| 283 | pr_err("could not get 8921_l23, rc = %ld\n", |
| 284 | PTR_ERR(reg_l23)); |
| 285 | return -ENODEV; |
| 286 | } |
| 287 | reg_l2 = regulator_get(&msm_mipi_dsi1_device.dev, |
| 288 | "dsi_vdda"); |
| 289 | if (IS_ERR(reg_l2)) { |
| 290 | pr_err("could not get 8921_l2, rc = %ld\n", |
| 291 | PTR_ERR(reg_l2)); |
| 292 | return -ENODEV; |
| 293 | } |
| 294 | rc = regulator_set_voltage(reg_l8, 2800000, 3000000); |
| 295 | if (rc) { |
| 296 | pr_err("set_voltage l8 failed, rc=%d\n", rc); |
| 297 | return -EINVAL; |
| 298 | } |
| 299 | rc = regulator_set_voltage(reg_l23, 1800000, 1800000); |
| 300 | if (rc) { |
| 301 | pr_err("set_voltage l23 failed, rc=%d\n", rc); |
| 302 | return -EINVAL; |
| 303 | } |
| 304 | rc = regulator_set_voltage(reg_l2, 1200000, 1200000); |
| 305 | if (rc) { |
| 306 | pr_err("set_voltage l2 failed, rc=%d\n", rc); |
| 307 | return -EINVAL; |
| 308 | } |
| 309 | gpio43 = PM8921_GPIO_PM_TO_SYS(43); |
| 310 | rc = gpio_request(gpio43, "disp_rst_n"); |
| 311 | if (rc) { |
| 312 | pr_err("request gpio 43 failed, rc=%d\n", rc); |
| 313 | return -ENODEV; |
| 314 | } |
| 315 | dsi_power_on = true; |
| 316 | } |
| 317 | if (on) { |
| 318 | rc = regulator_set_optimum_mode(reg_l8, 100000); |
| 319 | if (rc < 0) { |
| 320 | pr_err("set_optimum_mode l8 failed, rc=%d\n", rc); |
| 321 | return -EINVAL; |
| 322 | } |
| 323 | rc = regulator_set_optimum_mode(reg_l23, 100000); |
| 324 | if (rc < 0) { |
| 325 | pr_err("set_optimum_mode l23 failed, rc=%d\n", rc); |
| 326 | return -EINVAL; |
| 327 | } |
| 328 | rc = regulator_set_optimum_mode(reg_l2, 100000); |
| 329 | if (rc < 0) { |
| 330 | pr_err("set_optimum_mode l2 failed, rc=%d\n", rc); |
| 331 | return -EINVAL; |
| 332 | } |
| 333 | rc = regulator_enable(reg_l8); |
| 334 | if (rc) { |
| 335 | pr_err("enable l8 failed, rc=%d\n", rc); |
| 336 | return -ENODEV; |
| 337 | } |
| 338 | rc = regulator_enable(reg_l23); |
| 339 | if (rc) { |
| 340 | pr_err("enable l8 failed, rc=%d\n", rc); |
| 341 | return -ENODEV; |
| 342 | } |
| 343 | rc = regulator_enable(reg_l2); |
| 344 | if (rc) { |
| 345 | pr_err("enable l2 failed, rc=%d\n", rc); |
| 346 | return -ENODEV; |
| 347 | } |
| 348 | gpio_set_value_cansleep(gpio43, 1); |
| 349 | } else { |
| 350 | rc = regulator_disable(reg_l2); |
| 351 | if (rc) { |
| 352 | pr_err("disable reg_l2 failed, rc=%d\n", rc); |
| 353 | return -ENODEV; |
| 354 | } |
| 355 | rc = regulator_disable(reg_l8); |
| 356 | if (rc) { |
| 357 | pr_err("disable reg_l8 failed, rc=%d\n", rc); |
| 358 | return -ENODEV; |
| 359 | } |
| 360 | rc = regulator_disable(reg_l23); |
| 361 | if (rc) { |
| 362 | pr_err("disable reg_l23 failed, rc=%d\n", rc); |
| 363 | return -ENODEV; |
| 364 | } |
| 365 | rc = regulator_set_optimum_mode(reg_l8, 100); |
| 366 | if (rc < 0) { |
| 367 | pr_err("set_optimum_mode l8 failed, rc=%d\n", rc); |
| 368 | return -EINVAL; |
| 369 | } |
| 370 | rc = regulator_set_optimum_mode(reg_l23, 100); |
| 371 | if (rc < 0) { |
| 372 | pr_err("set_optimum_mode l23 failed, rc=%d\n", rc); |
| 373 | return -EINVAL; |
| 374 | } |
| 375 | rc = regulator_set_optimum_mode(reg_l2, 100); |
| 376 | if (rc < 0) { |
| 377 | pr_err("set_optimum_mode l2 failed, rc=%d\n", rc); |
| 378 | return -EINVAL; |
| 379 | } |
| 380 | gpio_set_value_cansleep(gpio43, 0); |
| 381 | } |
| 382 | return 0; |
| 383 | } |
| 384 | |
| 385 | static int mipi_dsi_panel_power(int on) |
| 386 | { |
| 387 | int ret; |
| 388 | |
| 389 | pr_info("%s: on=%d\n", __func__, on); |
| 390 | |
| 391 | if (machine_is_msm8960_liquid()) |
| 392 | ret = mipi_dsi_liquid_panel_power(on); |
| 393 | else |
| 394 | ret = mipi_dsi_cdp_panel_power(on); |
| 395 | |
| 396 | return ret; |
| 397 | } |
| 398 | |
| 399 | static struct mipi_dsi_platform_data mipi_dsi_pdata = { |
| 400 | .vsync_gpio = MDP_VSYNC_GPIO, |
| 401 | .dsi_power_save = mipi_dsi_panel_power, |
| 402 | }; |
| 403 | |
| 404 | #ifdef CONFIG_MSM_BUS_SCALING |
| 405 | |
Nagamalleswararao Ganji | 5fabbd6 | 2011-11-06 23:10:43 -0800 | [diff] [blame^] | 406 | static struct msm_bus_vectors rotator_init_vectors[] = { |
| 407 | { |
| 408 | .src = MSM_BUS_MASTER_ROTATOR, |
| 409 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 410 | .ab = 0, |
| 411 | .ib = 0, |
| 412 | }, |
| 413 | }; |
| 414 | |
| 415 | static struct msm_bus_vectors rotator_ui_vectors[] = { |
| 416 | { |
| 417 | .src = MSM_BUS_MASTER_ROTATOR, |
| 418 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 419 | .ab = (1024 * 600 * 4 * 2 * 60), |
| 420 | .ib = (1024 * 600 * 4 * 2 * 60 * 1.5), |
| 421 | }, |
| 422 | }; |
| 423 | |
| 424 | static struct msm_bus_vectors rotator_vga_vectors[] = { |
| 425 | { |
| 426 | .src = MSM_BUS_MASTER_ROTATOR, |
| 427 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 428 | .ab = (640 * 480 * 2 * 2 * 30), |
| 429 | .ib = (640 * 480 * 2 * 2 * 30 * 1.5), |
| 430 | }, |
| 431 | }; |
| 432 | static struct msm_bus_vectors rotator_720p_vectors[] = { |
| 433 | { |
| 434 | .src = MSM_BUS_MASTER_ROTATOR, |
| 435 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 436 | .ab = (1280 * 736 * 2 * 2 * 30), |
| 437 | .ib = (1280 * 736 * 2 * 2 * 30 * 1.5), |
| 438 | }, |
| 439 | }; |
| 440 | |
| 441 | static struct msm_bus_vectors rotator_1080p_vectors[] = { |
| 442 | { |
| 443 | .src = MSM_BUS_MASTER_ROTATOR, |
| 444 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 445 | .ab = (1920 * 1088 * 2 * 2 * 30), |
| 446 | .ib = (1920 * 1088 * 2 * 2 * 30 * 1.5), |
| 447 | }, |
| 448 | }; |
| 449 | |
| 450 | static struct msm_bus_paths rotator_bus_scale_usecases[] = { |
| 451 | { |
| 452 | ARRAY_SIZE(rotator_init_vectors), |
| 453 | rotator_init_vectors, |
| 454 | }, |
| 455 | { |
| 456 | ARRAY_SIZE(rotator_ui_vectors), |
| 457 | rotator_ui_vectors, |
| 458 | }, |
| 459 | { |
| 460 | ARRAY_SIZE(rotator_vga_vectors), |
| 461 | rotator_vga_vectors, |
| 462 | }, |
| 463 | { |
| 464 | ARRAY_SIZE(rotator_720p_vectors), |
| 465 | rotator_720p_vectors, |
| 466 | }, |
| 467 | { |
| 468 | ARRAY_SIZE(rotator_1080p_vectors), |
| 469 | rotator_1080p_vectors, |
| 470 | }, |
| 471 | }; |
| 472 | |
| 473 | struct msm_bus_scale_pdata rotator_bus_scale_pdata = { |
| 474 | rotator_bus_scale_usecases, |
| 475 | ARRAY_SIZE(rotator_bus_scale_usecases), |
| 476 | .name = "rotator", |
| 477 | }; |
| 478 | |
Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 479 | static struct msm_bus_vectors mdp_init_vectors[] = { |
| 480 | { |
| 481 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 482 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 483 | .ab = 0, |
| 484 | .ib = 0, |
| 485 | }, |
| 486 | }; |
| 487 | |
| 488 | #ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY |
| 489 | static struct msm_bus_vectors hdmi_as_primary_vectors[] = { |
| 490 | /* If HDMI is used as primary */ |
| 491 | { |
| 492 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 493 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 494 | .ab = 2000000000, |
| 495 | .ib = 2000000000, |
| 496 | }, |
| 497 | }; |
| 498 | static struct msm_bus_paths mdp_bus_scale_usecases[] = { |
| 499 | { |
| 500 | ARRAY_SIZE(mdp_init_vectors), |
| 501 | mdp_init_vectors, |
| 502 | }, |
| 503 | { |
| 504 | ARRAY_SIZE(hdmi_as_primary_vectors), |
| 505 | hdmi_as_primary_vectors, |
| 506 | }, |
| 507 | { |
| 508 | ARRAY_SIZE(hdmi_as_primary_vectors), |
| 509 | hdmi_as_primary_vectors, |
| 510 | }, |
| 511 | { |
| 512 | ARRAY_SIZE(hdmi_as_primary_vectors), |
| 513 | hdmi_as_primary_vectors, |
| 514 | }, |
| 515 | { |
| 516 | ARRAY_SIZE(hdmi_as_primary_vectors), |
| 517 | hdmi_as_primary_vectors, |
| 518 | }, |
| 519 | { |
| 520 | ARRAY_SIZE(hdmi_as_primary_vectors), |
| 521 | hdmi_as_primary_vectors, |
| 522 | }, |
| 523 | }; |
| 524 | #else |
| 525 | static struct msm_bus_vectors mdp_ui_vectors[] = { |
| 526 | { |
| 527 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 528 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 529 | .ab = 216000000 * 2, |
| 530 | .ib = 270000000 * 2, |
| 531 | }, |
| 532 | }; |
| 533 | |
| 534 | static struct msm_bus_vectors mdp_vga_vectors[] = { |
| 535 | /* VGA and less video */ |
| 536 | { |
| 537 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 538 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 539 | .ab = 216000000 * 2, |
| 540 | .ib = 270000000 * 2, |
| 541 | }, |
| 542 | }; |
| 543 | |
| 544 | static struct msm_bus_vectors mdp_720p_vectors[] = { |
| 545 | /* 720p and less video */ |
| 546 | { |
| 547 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 548 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 549 | .ab = 230400000 * 2, |
| 550 | .ib = 288000000 * 2, |
| 551 | }, |
| 552 | }; |
| 553 | |
| 554 | static struct msm_bus_vectors mdp_1080p_vectors[] = { |
| 555 | /* 1080p and less video */ |
| 556 | { |
| 557 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 558 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 559 | .ab = 334080000 * 2, |
| 560 | .ib = 417600000 * 2, |
| 561 | }, |
| 562 | }; |
| 563 | |
| 564 | static struct msm_bus_paths mdp_bus_scale_usecases[] = { |
| 565 | { |
| 566 | ARRAY_SIZE(mdp_init_vectors), |
| 567 | mdp_init_vectors, |
| 568 | }, |
| 569 | { |
| 570 | ARRAY_SIZE(mdp_ui_vectors), |
| 571 | mdp_ui_vectors, |
| 572 | }, |
| 573 | { |
| 574 | ARRAY_SIZE(mdp_ui_vectors), |
| 575 | mdp_ui_vectors, |
| 576 | }, |
| 577 | { |
| 578 | ARRAY_SIZE(mdp_vga_vectors), |
| 579 | mdp_vga_vectors, |
| 580 | }, |
| 581 | { |
| 582 | ARRAY_SIZE(mdp_720p_vectors), |
| 583 | mdp_720p_vectors, |
| 584 | }, |
| 585 | { |
| 586 | ARRAY_SIZE(mdp_1080p_vectors), |
| 587 | mdp_1080p_vectors, |
| 588 | }, |
| 589 | }; |
| 590 | #endif |
| 591 | |
| 592 | static struct msm_bus_scale_pdata mdp_bus_scale_pdata = { |
| 593 | mdp_bus_scale_usecases, |
| 594 | ARRAY_SIZE(mdp_bus_scale_usecases), |
| 595 | .name = "mdp", |
| 596 | }; |
| 597 | |
| 598 | #endif |
| 599 | |
| 600 | #ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY |
Stepan Moskovchenko | fc70d90 | 2011-11-30 12:39:36 -0800 | [diff] [blame] | 601 | static int mdp_core_clk_rate_table[] = { |
Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 602 | 200000000, |
| 603 | 200000000, |
| 604 | 200000000, |
| 605 | 200000000, |
| 606 | }; |
| 607 | #else |
Stepan Moskovchenko | fc70d90 | 2011-11-30 12:39:36 -0800 | [diff] [blame] | 608 | static int mdp_core_clk_rate_table[] = { |
Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 609 | 85330000, |
| 610 | 85330000, |
| 611 | 160000000, |
| 612 | 200000000, |
| 613 | }; |
| 614 | #endif |
| 615 | |
| 616 | static struct msm_panel_common_pdata mdp_pdata = { |
| 617 | .gpio = MDP_VSYNC_GPIO, |
| 618 | #ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY |
| 619 | .mdp_core_clk_rate = 200000000, |
| 620 | #else |
| 621 | .mdp_core_clk_rate = 85330000, |
| 622 | #endif |
| 623 | .mdp_core_clk_table = mdp_core_clk_rate_table, |
| 624 | .num_mdp_clk = ARRAY_SIZE(mdp_core_clk_rate_table), |
| 625 | #ifdef CONFIG_MSM_BUS_SCALING |
| 626 | .mdp_bus_scale_table = &mdp_bus_scale_pdata, |
| 627 | #endif |
| 628 | .mdp_rev = MDP_REV_42, |
Nagamalleswararao Ganji | 937a119 | 2011-12-07 19:00:52 -0800 | [diff] [blame] | 629 | #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION |
| 630 | .mem_hid = ION_CP_MM_HEAP_ID, |
| 631 | #else |
| 632 | .mem_hid = MEMTYPE_EBI1, |
| 633 | #endif |
Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 634 | }; |
| 635 | |
Huaibin Yang | a541942 | 2011-12-08 23:52:10 -0800 | [diff] [blame] | 636 | void __init msm8960_mdp_writeback(struct memtype_reserve* reserve_table) |
| 637 | { |
Nagamalleswararao Ganji | 937a119 | 2011-12-07 19:00:52 -0800 | [diff] [blame] | 638 | mdp_pdata.ov0_wb_size = MSM_FB_OVERLAY0_WRITEBACK_SIZE; |
| 639 | mdp_pdata.ov1_wb_size = MSM_FB_OVERLAY1_WRITEBACK_SIZE; |
| 640 | #if defined(CONFIG_ANDROID_PMEM) && !defined(CONFIG_MSM_MULTIMEDIA_USE_ION) |
| 641 | reserve_table[mdp_pdata.mem_hid].size += |
| 642 | mdp_pdata.ov0_wb_size; |
| 643 | reserve_table[mdp_pdata.mem_hid].size += |
| 644 | mdp_pdata.ov1_wb_size; |
| 645 | #endif |
Huaibin Yang | a541942 | 2011-12-08 23:52:10 -0800 | [diff] [blame] | 646 | } |
| 647 | |
Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 648 | static struct platform_device mipi_dsi_renesas_panel_device = { |
| 649 | .name = "mipi_renesas", |
| 650 | .id = 0, |
| 651 | }; |
| 652 | |
| 653 | static struct platform_device mipi_dsi_simulator_panel_device = { |
| 654 | .name = "mipi_simulator", |
| 655 | .id = 0, |
| 656 | }; |
| 657 | |
| 658 | #define LPM_CHANNEL0 0 |
| 659 | static int toshiba_gpio[] = {LPM_CHANNEL0}; |
| 660 | |
| 661 | static struct mipi_dsi_panel_platform_data toshiba_pdata = { |
| 662 | .gpio = toshiba_gpio, |
| 663 | }; |
| 664 | |
| 665 | static struct platform_device mipi_dsi_toshiba_panel_device = { |
| 666 | .name = "mipi_toshiba", |
| 667 | .id = 0, |
| 668 | .dev = { |
| 669 | .platform_data = &toshiba_pdata, |
| 670 | } |
| 671 | }; |
| 672 | |
| 673 | #define FPGA_3D_GPIO_CONFIG_ADDR 0xB5 |
| 674 | static int dsi2lvds_gpio[2] = { |
| 675 | 0,/* Backlight PWM-ID=0 for PMIC-GPIO#24 */ |
| 676 | 0x1F08 /* DSI2LVDS Bridge GPIO Output, mask=0x1f, out=0x08 */ |
| 677 | }; |
| 678 | |
| 679 | static struct msm_panel_common_pdata mipi_dsi2lvds_pdata = { |
| 680 | .gpio_num = dsi2lvds_gpio, |
| 681 | }; |
| 682 | |
| 683 | static struct mipi_dsi_phy_ctrl dsi_novatek_cmd_mode_phy_db = { |
| 684 | |
| 685 | /* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */ |
| 686 | {0x0F, 0x0a, 0x04, 0x00, 0x20}, /* regulator */ |
| 687 | /* timing */ |
| 688 | {0xab, 0x8a, 0x18, 0x00, 0x92, 0x97, 0x1b, 0x8c, |
| 689 | 0x0c, 0x03, 0x04, 0xa0}, |
| 690 | {0x5f, 0x00, 0x00, 0x10}, /* phy ctrl */ |
| 691 | {0xff, 0x00, 0x06, 0x00}, /* strength */ |
| 692 | /* pll control */ |
| 693 | {0x40, 0xf9, 0x30, 0xda, 0x00, 0x40, 0x03, 0x62, |
| 694 | 0x40, 0x07, 0x03, |
| 695 | 0x00, 0x1a, 0x00, 0x00, 0x02, 0x00, 0x20, 0x00, 0x01}, |
| 696 | }; |
| 697 | |
| 698 | static struct mipi_dsi_panel_platform_data novatek_pdata = { |
| 699 | .fpga_3d_config_addr = FPGA_3D_GPIO_CONFIG_ADDR, |
| 700 | .fpga_ctrl_mode = FPGA_SPI_INTF, |
| 701 | .phy_ctrl_settings = &dsi_novatek_cmd_mode_phy_db, |
| 702 | }; |
| 703 | |
| 704 | static struct platform_device mipi_dsi_novatek_panel_device = { |
| 705 | .name = "mipi_novatek", |
| 706 | .id = 0, |
| 707 | .dev = { |
| 708 | .platform_data = &novatek_pdata, |
| 709 | } |
| 710 | }; |
| 711 | |
| 712 | static struct platform_device mipi_dsi2lvds_bridge_device = { |
| 713 | .name = "mipi_tc358764", |
| 714 | .id = 0, |
| 715 | .dev.platform_data = &mipi_dsi2lvds_pdata, |
| 716 | }; |
| 717 | |
| 718 | #ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL |
| 719 | static struct resource hdmi_msm_resources[] = { |
| 720 | { |
| 721 | .name = "hdmi_msm_qfprom_addr", |
| 722 | .start = 0x00700000, |
| 723 | .end = 0x007060FF, |
| 724 | .flags = IORESOURCE_MEM, |
| 725 | }, |
| 726 | { |
| 727 | .name = "hdmi_msm_hdmi_addr", |
| 728 | .start = 0x04A00000, |
| 729 | .end = 0x04A00FFF, |
| 730 | .flags = IORESOURCE_MEM, |
| 731 | }, |
| 732 | { |
| 733 | .name = "hdmi_msm_irq", |
| 734 | .start = HDMI_IRQ, |
| 735 | .end = HDMI_IRQ, |
| 736 | .flags = IORESOURCE_IRQ, |
| 737 | }, |
| 738 | }; |
| 739 | |
| 740 | static int hdmi_enable_5v(int on); |
| 741 | static int hdmi_core_power(int on, int show); |
| 742 | static int hdmi_cec_power(int on); |
| 743 | |
| 744 | static struct msm_hdmi_platform_data hdmi_msm_data = { |
| 745 | .irq = HDMI_IRQ, |
| 746 | .enable_5v = hdmi_enable_5v, |
| 747 | .core_power = hdmi_core_power, |
| 748 | .cec_power = hdmi_cec_power, |
| 749 | }; |
| 750 | |
| 751 | static struct platform_device hdmi_msm_device = { |
| 752 | .name = "hdmi_msm", |
| 753 | .id = 0, |
| 754 | .num_resources = ARRAY_SIZE(hdmi_msm_resources), |
| 755 | .resource = hdmi_msm_resources, |
| 756 | .dev.platform_data = &hdmi_msm_data, |
| 757 | }; |
| 758 | #endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */ |
| 759 | |
| 760 | #ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL |
| 761 | static struct platform_device wfd_panel_device = { |
| 762 | .name = "wfd_panel", |
| 763 | .id = 0, |
| 764 | .dev.platform_data = NULL, |
| 765 | }; |
Stepan Moskovchenko | 270888d | 2011-11-30 12:19:11 -0800 | [diff] [blame] | 766 | |
| 767 | static struct platform_device wfd_device = { |
| 768 | .name = "msm_wfd", |
| 769 | .id = -1, |
| 770 | }; |
Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 771 | #endif |
| 772 | |
| 773 | #ifdef CONFIG_MSM_BUS_SCALING |
| 774 | static struct msm_bus_vectors dtv_bus_init_vectors[] = { |
| 775 | { |
| 776 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 777 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 778 | .ab = 0, |
| 779 | .ib = 0, |
| 780 | }, |
| 781 | }; |
| 782 | |
| 783 | #ifdef CONFIG_FB_MSM_HDMI_AS_PRIMARY |
| 784 | static struct msm_bus_vectors dtv_bus_def_vectors[] = { |
| 785 | { |
| 786 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 787 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 788 | .ab = 2000000000, |
| 789 | .ib = 2000000000, |
| 790 | }, |
| 791 | }; |
| 792 | #else |
| 793 | static struct msm_bus_vectors dtv_bus_def_vectors[] = { |
| 794 | { |
| 795 | .src = MSM_BUS_MASTER_MDP_PORT0, |
| 796 | .dst = MSM_BUS_SLAVE_EBI_CH0, |
| 797 | .ab = 566092800 * 2, |
| 798 | .ib = 707616000 * 2, |
| 799 | }, |
| 800 | }; |
| 801 | #endif |
| 802 | |
| 803 | static struct msm_bus_paths dtv_bus_scale_usecases[] = { |
| 804 | { |
| 805 | ARRAY_SIZE(dtv_bus_init_vectors), |
| 806 | dtv_bus_init_vectors, |
| 807 | }, |
| 808 | { |
| 809 | ARRAY_SIZE(dtv_bus_def_vectors), |
| 810 | dtv_bus_def_vectors, |
| 811 | }, |
| 812 | }; |
| 813 | static struct msm_bus_scale_pdata dtv_bus_scale_pdata = { |
| 814 | dtv_bus_scale_usecases, |
| 815 | ARRAY_SIZE(dtv_bus_scale_usecases), |
| 816 | .name = "dtv", |
| 817 | }; |
| 818 | |
| 819 | static struct lcdc_platform_data dtv_pdata = { |
| 820 | .bus_scale_table = &dtv_bus_scale_pdata, |
| 821 | }; |
| 822 | #endif |
| 823 | |
Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 824 | #ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL |
Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 825 | static int hdmi_enable_5v(int on) |
| 826 | { |
| 827 | /* TBD: PM8921 regulator instead of 8901 */ |
| 828 | static struct regulator *reg_8921_hdmi_mvs; /* HDMI_5V */ |
| 829 | static int prev_on; |
| 830 | int rc; |
| 831 | |
| 832 | if (on == prev_on) |
| 833 | return 0; |
| 834 | |
| 835 | if (!reg_8921_hdmi_mvs) |
| 836 | reg_8921_hdmi_mvs = regulator_get(&hdmi_msm_device.dev, |
| 837 | "hdmi_mvs"); |
| 838 | |
| 839 | if (on) { |
| 840 | rc = regulator_enable(reg_8921_hdmi_mvs); |
| 841 | if (rc) { |
| 842 | pr_err("'%s' regulator enable failed, rc=%d\n", |
| 843 | "8921_hdmi_mvs", rc); |
| 844 | return rc; |
| 845 | } |
| 846 | pr_debug("%s(on): success\n", __func__); |
| 847 | } else { |
| 848 | rc = regulator_disable(reg_8921_hdmi_mvs); |
| 849 | if (rc) |
| 850 | pr_warning("'%s' regulator disable failed, rc=%d\n", |
| 851 | "8921_hdmi_mvs", rc); |
| 852 | pr_debug("%s(off): success\n", __func__); |
| 853 | } |
| 854 | |
| 855 | prev_on = on; |
| 856 | |
| 857 | return 0; |
| 858 | } |
| 859 | |
| 860 | static int hdmi_core_power(int on, int show) |
| 861 | { |
| 862 | static struct regulator *reg_8921_l23, *reg_8921_s4; |
| 863 | static int prev_on; |
| 864 | int rc; |
| 865 | |
| 866 | if (on == prev_on) |
| 867 | return 0; |
| 868 | |
| 869 | /* TBD: PM8921 regulator instead of 8901 */ |
| 870 | if (!reg_8921_l23) { |
| 871 | reg_8921_l23 = regulator_get(&hdmi_msm_device.dev, "hdmi_avdd"); |
| 872 | if (IS_ERR(reg_8921_l23)) { |
| 873 | pr_err("could not get reg_8921_l23, rc = %ld\n", |
| 874 | PTR_ERR(reg_8921_l23)); |
| 875 | return -ENODEV; |
| 876 | } |
| 877 | rc = regulator_set_voltage(reg_8921_l23, 1800000, 1800000); |
| 878 | if (rc) { |
| 879 | pr_err("set_voltage failed for 8921_l23, rc=%d\n", rc); |
| 880 | return -EINVAL; |
| 881 | } |
| 882 | } |
| 883 | if (!reg_8921_s4) { |
| 884 | reg_8921_s4 = regulator_get(&hdmi_msm_device.dev, "hdmi_vcc"); |
| 885 | if (IS_ERR(reg_8921_s4)) { |
| 886 | pr_err("could not get reg_8921_s4, rc = %ld\n", |
| 887 | PTR_ERR(reg_8921_s4)); |
| 888 | return -ENODEV; |
| 889 | } |
| 890 | rc = regulator_set_voltage(reg_8921_s4, 1800000, 1800000); |
| 891 | if (rc) { |
| 892 | pr_err("set_voltage failed for 8921_s4, rc=%d\n", rc); |
| 893 | return -EINVAL; |
| 894 | } |
| 895 | } |
| 896 | |
| 897 | if (on) { |
| 898 | rc = regulator_set_optimum_mode(reg_8921_l23, 100000); |
| 899 | if (rc < 0) { |
| 900 | pr_err("set_optimum_mode l23 failed, rc=%d\n", rc); |
| 901 | return -EINVAL; |
| 902 | } |
| 903 | rc = regulator_enable(reg_8921_l23); |
| 904 | if (rc) { |
| 905 | pr_err("'%s' regulator enable failed, rc=%d\n", |
| 906 | "hdmi_avdd", rc); |
| 907 | return rc; |
| 908 | } |
| 909 | rc = regulator_enable(reg_8921_s4); |
| 910 | if (rc) { |
| 911 | pr_err("'%s' regulator enable failed, rc=%d\n", |
| 912 | "hdmi_vcc", rc); |
| 913 | return rc; |
| 914 | } |
| 915 | rc = gpio_request(100, "HDMI_DDC_CLK"); |
| 916 | if (rc) { |
| 917 | pr_err("'%s'(%d) gpio_request failed, rc=%d\n", |
| 918 | "HDMI_DDC_CLK", 100, rc); |
| 919 | goto error1; |
| 920 | } |
| 921 | rc = gpio_request(101, "HDMI_DDC_DATA"); |
| 922 | if (rc) { |
| 923 | pr_err("'%s'(%d) gpio_request failed, rc=%d\n", |
| 924 | "HDMI_DDC_DATA", 101, rc); |
| 925 | goto error2; |
| 926 | } |
| 927 | rc = gpio_request(102, "HDMI_HPD"); |
| 928 | if (rc) { |
| 929 | pr_err("'%s'(%d) gpio_request failed, rc=%d\n", |
| 930 | "HDMI_HPD", 102, rc); |
| 931 | goto error3; |
| 932 | } |
| 933 | pr_debug("%s(on): success\n", __func__); |
| 934 | } else { |
| 935 | gpio_free(100); |
| 936 | gpio_free(101); |
| 937 | gpio_free(102); |
| 938 | |
| 939 | rc = regulator_disable(reg_8921_l23); |
| 940 | if (rc) { |
| 941 | pr_err("disable reg_8921_l23 failed, rc=%d\n", rc); |
| 942 | return -ENODEV; |
| 943 | } |
| 944 | rc = regulator_disable(reg_8921_s4); |
| 945 | if (rc) { |
| 946 | pr_err("disable reg_8921_s4 failed, rc=%d\n", rc); |
| 947 | return -ENODEV; |
| 948 | } |
| 949 | rc = regulator_set_optimum_mode(reg_8921_l23, 100); |
| 950 | if (rc < 0) { |
| 951 | pr_err("set_optimum_mode l23 failed, rc=%d\n", rc); |
| 952 | return -EINVAL; |
| 953 | } |
| 954 | pr_debug("%s(off): success\n", __func__); |
| 955 | } |
| 956 | |
| 957 | prev_on = on; |
| 958 | |
| 959 | return 0; |
| 960 | |
| 961 | error3: |
| 962 | gpio_free(101); |
| 963 | error2: |
| 964 | gpio_free(100); |
| 965 | error1: |
| 966 | regulator_disable(reg_8921_l23); |
| 967 | regulator_disable(reg_8921_s4); |
| 968 | return rc; |
| 969 | } |
| 970 | |
| 971 | static int hdmi_cec_power(int on) |
| 972 | { |
| 973 | static int prev_on; |
| 974 | int rc; |
| 975 | |
| 976 | if (on == prev_on) |
| 977 | return 0; |
| 978 | |
| 979 | if (on) { |
| 980 | rc = gpio_request(99, "HDMI_CEC_VAR"); |
| 981 | if (rc) { |
| 982 | pr_err("'%s'(%d) gpio_request failed, rc=%d\n", |
| 983 | "HDMI_CEC_VAR", 99, rc); |
| 984 | goto error; |
| 985 | } |
| 986 | pr_debug("%s(on): success\n", __func__); |
| 987 | } else { |
| 988 | gpio_free(99); |
| 989 | pr_debug("%s(off): success\n", __func__); |
| 990 | } |
| 991 | |
| 992 | prev_on = on; |
| 993 | |
| 994 | return 0; |
| 995 | error: |
| 996 | return rc; |
| 997 | } |
| 998 | #endif /* CONFIG_FB_MSM_HDMI_MSM_PANEL */ |
| 999 | |
| 1000 | void __init msm8960_init_fb(void) |
| 1001 | { |
Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 1002 | platform_device_register(&msm_fb_device); |
| 1003 | |
Stepan Moskovchenko | 270888d | 2011-11-30 12:19:11 -0800 | [diff] [blame] | 1004 | #ifdef CONFIG_FB_MSM_WRITEBACK_MSM_PANEL |
| 1005 | platform_device_register(&wfd_panel_device); |
| 1006 | platform_device_register(&wfd_device); |
| 1007 | #endif |
| 1008 | |
Stepan Moskovchenko | 24cd864 | 2011-11-29 13:07:53 -0800 | [diff] [blame] | 1009 | if (machine_is_msm8960_sim()) |
| 1010 | platform_device_register(&mipi_dsi_simulator_panel_device); |
| 1011 | |
| 1012 | if (machine_is_msm8960_rumi3()) |
| 1013 | platform_device_register(&mipi_dsi_renesas_panel_device); |
| 1014 | |
| 1015 | if (!machine_is_msm8960_sim() && !machine_is_msm8960_rumi3()) { |
| 1016 | platform_device_register(&mipi_dsi_novatek_panel_device); |
| 1017 | |
| 1018 | #ifdef CONFIG_FB_MSM_HDMI_MSM_PANEL |
| 1019 | platform_device_register(&hdmi_msm_device); |
| 1020 | #endif |
| 1021 | } |
| 1022 | |
| 1023 | if (machine_is_msm8960_liquid()) |
| 1024 | platform_device_register(&mipi_dsi2lvds_bridge_device); |
| 1025 | else |
| 1026 | platform_device_register(&mipi_dsi_toshiba_panel_device); |
| 1027 | |
| 1028 | if (machine_is_msm8x60_rumi3()) { |
| 1029 | msm_fb_register_device("mdp", NULL); |
| 1030 | mipi_dsi_pdata.target_type = 1; |
| 1031 | } else |
| 1032 | msm_fb_register_device("mdp", &mdp_pdata); |
| 1033 | msm_fb_register_device("mipi_dsi", &mipi_dsi_pdata); |
| 1034 | #ifdef CONFIG_MSM_BUS_SCALING |
| 1035 | msm_fb_register_device("dtv", &dtv_pdata); |
| 1036 | #endif |
| 1037 | } |
| 1038 | |
| 1039 | void __init msm8960_allocate_fb_region(void) |
| 1040 | { |
| 1041 | void *addr; |
| 1042 | unsigned long size; |
| 1043 | |
| 1044 | size = MSM_FB_SIZE; |
| 1045 | addr = alloc_bootmem_align(size, 0x1000); |
| 1046 | msm_fb_resources[0].start = __pa(addr); |
| 1047 | msm_fb_resources[0].end = msm_fb_resources[0].start + size - 1; |
| 1048 | pr_info("allocating %lu bytes at %p (%lx physical) for fb\n", |
| 1049 | size, addr, __pa(addr)); |
| 1050 | } |