ARM: tegra12: set CPU rate to 2.2GHz for sku 0x87
[linux-3.10.git] / arch / arm / mach-tegra / board-loki-panel.c
index 0f9f22d..026d8b9 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * arch/arm/mach-tegra/board-loki-panel.c
  *
- * Copyright (c) 2011-2013, NVIDIA Corporation. All rights reserved.
+ * Copyright (c) 2011-2014, NVIDIA Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -31,6 +31,7 @@
 #include <mach/irqs.h>
 #include <mach/dc.h>
 #include <mach/pinmux-t12.h>
+#include <mach/io_dpd.h>
 
 #include "board.h"
 #include "devices.h"
@@ -39,6 +40,7 @@
 #include "tegra12_host1x_devices.h"
 #include "board-panel.h"
 #include "common.h"
+#include "tegra-board-id.h"
 
 struct platform_device * __init loki_host1x_init(void)
 {
@@ -208,7 +210,7 @@ static int loki_hdmi_hotplug_init(struct device *dev)
                                        __func__, PTR_ERR(loki_hdmi_vddio));
                        loki_hdmi_vddio = NULL;
                } else
-                       regulator_enable(loki_hdmi_vddio);
+                       return regulator_enable(loki_hdmi_vddio);
        }
        return 0;
 }
@@ -286,7 +288,6 @@ static struct tegra_dc_out loki_disp2_out = {
 static struct tegra_fb_data loki_disp1_fb_data = {
        .win            = 0,
        .bits_per_pixel = 32,
-       .flags          = TEGRA_FB_FLIP_ON_PROBE,
 };
 
 static struct tegra_dc_platform_data loki_disp1_pdata = {
@@ -304,7 +305,6 @@ static struct tegra_fb_data loki_disp2_fb_data = {
        .xres           = 1024,
        .yres           = 600,
        .bits_per_pixel = 32,
-       .flags          = TEGRA_FB_FLIP_ON_PROBE,
 };
 
 static struct tegra_dc_platform_data loki_disp2_pdata = {
@@ -370,6 +370,31 @@ static struct platform_device loki_nvmap_device = {
                .platform_data = &loki_nvmap_data,
        },
 };
+static struct tegra_io_dpd dsic_io = {
+       .name                   = "DSIC",
+       .io_dpd_reg_index       = 1,
+       .io_dpd_bit             = 8,
+};
+static struct tegra_io_dpd dsid_io = {
+       .name                   = "DSID",
+       .io_dpd_reg_index       = 1,
+       .io_dpd_bit             = 9,
+};
+static struct tegra_dc_mode hdmi_panel_modes[] = {
+       {
+               .pclk = 148500000,
+               .h_ref_to_sync = 1,
+               .v_ref_to_sync = 1,
+               .h_sync_width = 44,
+               .v_sync_width = 5,
+               .h_back_porch = 148,
+               .v_back_porch = 36,
+               .h_active = 1920,
+               .v_active = 1080,
+               .h_front_porch = 88,
+               .v_front_porch = 4,
+       },
+};
 
 static void loki_panel_select(void)
 {
@@ -380,6 +405,9 @@ static void loki_panel_select(void)
        tegra_get_display_board_info(&board);
 
        switch (board.fab) {
+       case 0x2:
+               panel = &dsi_j_720p_5;
+               break;
        case 0x1:
                panel = &dsi_j_1440_810_5_8;
                break;
@@ -388,6 +416,10 @@ static void loki_panel_select(void)
                panel = &dsi_l_720p_5_loki;
                break;
        }
+
+       tegra_io_dpd_enable(&dsic_io);
+       tegra_io_dpd_enable(&dsid_io);
+
        if (panel) {
                if (panel->init_sd_settings)
                        panel->init_sd_settings(&sd_settings);
@@ -421,8 +453,26 @@ int __init loki_panel_init(int board_id)
        int err = 0;
        struct resource __maybe_unused *res;
        struct platform_device *phost1x = NULL;
-
-       loki_panel_select();
+       struct board_info bi;
+
+       tegra_get_board_info(&bi);
+       if ((bi.sku == BOARD_SKU_FOSTER) && (bi.board_id == BOARD_P2530)) {
+               res = platform_get_resource_byname(&loki_disp2_device,
+                                        IORESOURCE_IRQ, "irq");
+               res->start = INT_DISPLAY_GENERAL;
+               res->end = INT_DISPLAY_GENERAL;
+               res = platform_get_resource_byname(&loki_disp2_device,
+                                        IORESOURCE_MEM, "regs");
+               res->start = TEGRA_DISPLAY_BASE;
+               res->end = TEGRA_DISPLAY_BASE + TEGRA_DISPLAY_SIZE - 1;
+               loki_disp2_fb_data.xres = 1920;
+               loki_disp2_fb_data.yres = 1080;
+               loki_disp2_device.id = 0;
+
+               loki_disp2_out.modes = hdmi_panel_modes;
+               loki_disp2_out.n_modes = ARRAY_SIZE(hdmi_panel_modes);
+       } else
+               loki_panel_select();
 
 #ifdef CONFIG_TEGRA_NVMAP
        loki_carveouts[1].base = tegra_carveout_start;
@@ -460,16 +510,27 @@ int __init loki_panel_init(int board_id)
                tegra_fb_start, tegra_bootloader_fb_start,
                        min(tegra_fb_size, tegra_bootloader_fb_size));
 
+       if (tegra_bootloader_fb2_size)
+               __tegra_move_framebuffer(&loki_nvmap_device,
+                       tegra_fb2_start, tegra_bootloader_fb2_start,
+                       min(tegra_fb2_size, tegra_bootloader_fb2_size));
+       else
+               __tegra_clear_framebuffer(&loki_nvmap_device,
+                               tegra_fb2_start, tegra_fb2_size);
+
        res = platform_get_resource_byname(&loki_disp2_device,
                                         IORESOURCE_MEM, "fbmem");
        res->start = tegra_fb2_start;
        res->end = tegra_fb2_start + tegra_fb2_size - 1;
 
        loki_disp1_device.dev.parent = &phost1x->dev;
-       err = platform_device_register(&loki_disp1_device);
-       if (err) {
-               pr_err("disp1 device registration failed\n");
-               return err;
+
+       if ((bi.sku != BOARD_SKU_FOSTER) || (bi.board_id != BOARD_P2530)) {
+               err = platform_device_register(&loki_disp1_device);
+               if (err) {
+                       pr_err("disp1 device registration failed\n");
+                       return err;
+               }
        }
 
        loki_disp2_device.dev.parent = &phost1x->dev;