/*
* arch/arm/mach-tegra/board-cardhu-panel.c
*
- * Copyright (c) 2010-2011, NVIDIA Corporation.
+ * Copyright (c) 2010-2012, NVIDIA Corporation.
*
* 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
*/
#include <linux/delay.h>
+#include <linux/ion.h>
+#include <linux/tegra_ion.h>
#include <linux/gpio.h>
#include <linux/regulator/consumer.h>
#include <linux/resource.h>
#include <mach/iomap.h>
#include <mach/dc.h>
#include <mach/fb.h>
+#include <mach/smmu.h>
#include "board.h"
#include "board-cardhu.h"
/* Select LVDS panel resolution. 13X7 is default */
#define PM313_LVDS_PANEL_19X12 1
-#define PM313_LVDS_PANEL_BPP 1 /* 0:24bpp, 1:18bpp */
+#define PM313_LVDS_PANEL_BPP 0 /* 0:24bpp, 1:18bpp */
/* PM313 display board specific pins */
#define pm313_R_FDE TEGRA_GPIO_PW0
.parent_clk = "pll_p",
#ifndef CONFIG_TEGRA_CARDHU_DSI
+ .parent_clk_backup = "pll_d2_out0",
+
.type = TEGRA_DC_OUT_RGB,
.depth = 18,
.dither = TEGRA_DC_ORDERED_DITHER,
}
#endif
+#if defined(CONFIG_TEGRA_NVMAP)
static struct nvmap_platform_carveout cardhu_carveouts[] = {
[0] = NVMAP_HEAP_CARVEOUT_IRAM_INIT,
[1] = {
.platform_data = &cardhu_nvmap_data,
},
};
+#endif
+#if defined(CONFIG_ION_TEGRA)
+
+static struct platform_device tegra_iommu_device = {
+ .name = "tegra_iommu_device",
+ .id = -1,
+ .dev = {
+ .platform_data = (void *)((1 << HWGRP_COUNT) - 1),
+ },
+};
+
+static struct ion_platform_data tegra_ion_data = {
+ .nr = 4,
+ .heaps = {
+ {
+ .type = ION_HEAP_TYPE_CARVEOUT,
+ .id = TEGRA_ION_HEAP_CARVEOUT,
+ .name = "carveout",
+ .base = 0,
+ .size = 0,
+ },
+ {
+ .type = ION_HEAP_TYPE_CARVEOUT,
+ .id = TEGRA_ION_HEAP_IRAM,
+ .name = "iram",
+ .base = TEGRA_IRAM_BASE + TEGRA_RESET_HANDLER_SIZE,
+ .size = TEGRA_IRAM_SIZE - TEGRA_RESET_HANDLER_SIZE,
+ },
+ {
+ .type = ION_HEAP_TYPE_CARVEOUT,
+ .id = TEGRA_ION_HEAP_VPR,
+ .name = "vpr",
+ .base = 0,
+ .size = 0,
+ },
+ {
+ .type = ION_HEAP_TYPE_IOMMU,
+ .id = TEGRA_ION_HEAP_IOMMU,
+ .name = "iommu",
+ .base = TEGRA_SMMU_BASE,
+ .size = TEGRA_SMMU_SIZE,
+ .priv = &tegra_iommu_device.dev,
+ },
+ },
+};
+
+static struct platform_device tegra_ion_device = {
+ .name = "ion-tegra",
+ .id = -1,
+ .dev = {
+ .platform_data = &tegra_ion_data,
+ },
+};
+#endif
static struct platform_device *cardhu_gfx_devices[] __initdata = {
+#if defined(CONFIG_TEGRA_NVMAP)
&cardhu_nvmap_device,
-#ifdef CONFIG_TEGRA_GRHOST
- &tegra_grhost_device,
+#endif
+#if defined(CONFIG_ION_TEGRA)
+ &tegra_ion_device,
#endif
&tegra_pwfm0_device,
&cardhu_backlight_device,
static void cardhu_panel_early_suspend(struct early_suspend *h)
{
- unsigned i;
- for (i = 0; i < num_registered_fb; i++)
- fb_blank(registered_fb[i], FB_BLANK_POWERDOWN);
+ /* power down LCD, add use a black screen for HDMI */
+ if (num_registered_fb > 0)
+ fb_blank(registered_fb[0], FB_BLANK_POWERDOWN);
+ if (num_registered_fb > 1)
+ fb_blank(registered_fb[1], FB_BLANK_NORMAL);
}
static void cardhu_panel_late_resume(struct early_suspend *h)
tegra_get_board_info(&board_info);
tegra_get_display_board_info(&display_board_info);
+#if defined(CONFIG_TEGRA_NVMAP)
cardhu_carveouts[1].base = tegra_carveout_start;
cardhu_carveouts[1].size = tegra_carveout_size;
+#endif
+
+#if defined(CONFIG_ION_TEGRA)
+ tegra_ion_data.heaps[0].base = tegra_carveout_start;
+ tegra_ion_data.heaps[0].size = tegra_carveout_size;
+#endif
if (board_info.board_id == BOARD_E1291 &&
((board_info.sku & SKU_TOUCHSCREEN_MECH_FIX) == 0)) {
cardhu_disp1_out.n_modes = ARRAY_SIZE(cardhu_panel_modes_55hz);
}
+#if defined(CONFIG_TEGRA_DC) && !defined(CONFIG_TEGRA_CARDHU_DSI)
if (display_board_info.board_id == BOARD_DISPLAY_PM313) {
/* initialize the values */
#if defined(PM313_LVDS_PANEL_19X12)
gpio_direction_output(cardhu_lvds_shutdown, 1);
tegra_gpio_enable(cardhu_lvds_shutdown);
}
+#endif
tegra_gpio_enable(cardhu_hdmi_hpd);
gpio_request(cardhu_hdmi_hpd, "hdmi_hpd");
register_early_suspend(&cardhu_panel_early_suspender);
#endif
+#ifdef CONFIG_TEGRA_GRHOST
+ err = nvhost_device_register(&tegra_grhost_device);
+ if (err)
+ return err;
+#endif
+
err = platform_add_devices(cardhu_gfx_devices,
ARRAY_SIZE(cardhu_gfx_devices));