ARM: tegra12: set CPU rate to 2.2GHz for sku 0x87
[linux-3.10.git] / arch / arm / mach-tegra / board-loki-panel.c
index 59361d7..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)
 {
@@ -143,7 +145,7 @@ static int loki_hdmi_enable(struct device *dev)
        int ret;
        if (!loki_hdmi_reg) {
                loki_hdmi_reg = regulator_get(dev, "avdd_hdmi");
-               if (IS_ERR_OR_NULL(loki_hdmi_reg)) {
+               if (IS_ERR(loki_hdmi_reg)) {
                        pr_err("hdmi: couldn't get regulator avdd_hdmi\n");
                        loki_hdmi_reg = NULL;
                        return PTR_ERR(loki_hdmi_reg);
@@ -156,7 +158,7 @@ static int loki_hdmi_enable(struct device *dev)
        }
        if (!loki_hdmi_pll) {
                loki_hdmi_pll = regulator_get(dev, "avdd_hdmi_pll");
-               if (IS_ERR_OR_NULL(loki_hdmi_pll)) {
+               if (IS_ERR(loki_hdmi_pll)) {
                        pr_err("hdmi: couldn't get regulator avdd_hdmi_pll\n");
                        loki_hdmi_pll = NULL;
                        regulator_put(loki_hdmi_reg);
@@ -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;
 }
@@ -222,7 +224,7 @@ struct tmds_config loki_tmds_config[] = {
                .pll0 = 0x01003f10,
                .pll1 = 0x10300b00,
                .pe_current = 0x00000000,
-               .drive_current = 0x2e2e2e2e,
+               .drive_current = 0x32323232,
                .peak_current = 0x05050505,
        },
        { /* 1080p / 148.5MHz modes */
@@ -230,7 +232,7 @@ struct tmds_config loki_tmds_config[] = {
                .pll0 = 0x01003f10,
                .pll1 = 0x10300b00,
                .pe_current = 0x00000000,
-               .drive_current = 0x2e2e2e2e,
+               .drive_current = 0x32323232,
                .peak_current = 0x05050505,
        },
        { /* 297MHz modes */
@@ -238,7 +240,7 @@ struct tmds_config loki_tmds_config[] = {
                .pll0 = 0x01003f10,
                .pll1 = 0x13300b00,
                .pe_current = 0x00000000,
-               .drive_current = 0x34343434,
+               .drive_current = 0x36363636,
                .peak_current = 0x07070707,
        },
 };
@@ -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,53 +370,30 @@ static struct platform_device loki_nvmap_device = {
                .platform_data = &loki_nvmap_data,
        },
 };
-
-static struct tegra_dc_sd_settings loki_sd_settings = {
-       .enable = 0, /* disabled by default. */
-       .use_auto_pwm = false,
-       .hw_update_delay = 0,
-       .bin_width = -1,
-       .aggressiveness = 1,
-       .use_vid_luma = false,
-       .phase_in_adjustments = 0,
-       .k_limit_enable = true,
-       .k_limit = 180,
-       .sd_window_enable = false,
-       .soft_clipping_enable = true,
-       /* Low soft clipping threshold to compensate for aggressive k_limit */
-       .soft_clipping_threshold = 128,
-       .smooth_k_enable = true,
-       .smooth_k_incr = 128,
-       /* Default video coefficients */
-       .coeff = {5, 9, 2},
-       .fc = {0, 0},
-       /* Immediate backlight changes */
-       .blp = {1024, 255},
-       /* Gammas: R: 2.2 G: 2.2 B: 2.2 */
-       /* Default BL TF */
-       .bltf = {
-                       {
-                               {57, 65, 73, 82},
-                               {92, 103, 114, 125},
-                               {138, 150, 164, 178},
-                               {193, 208, 224, 241},
-                       },
-               },
-       /* Default LUT */
-       .lut = {
-                       {
-                               {255, 255, 255},
-                               {199, 199, 199},
-                               {153, 153, 153},
-                               {116, 116, 116},
-                               {85, 85, 85},
-                               {59, 59, 59},
-                               {36, 36, 36},
-                               {17, 17, 17},
-                               {0, 0, 0},
-                       },
-               },
-       .sd_brightness = &sd_brightness,
+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)
@@ -428,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;
@@ -436,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);
@@ -469,10 +453,26 @@ int __init loki_panel_init(int board_id)
        int err = 0;
        struct resource __maybe_unused *res;
        struct platform_device *phost1x = NULL;
-
-       sd_settings = loki_sd_settings;
-
-       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;
@@ -510,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;