diff options
author | Sachin Nikam <snikam@nvidia.com> | 2011-01-07 16:42:57 +0530 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:46:23 -0800 |
commit | 91738b278b8d783f5e6c3bb5fdc87af362dc5f06 (patch) | |
tree | d8e654a7008c9e50d616492b82ceb24bb37022a7 /arch/arm/mach-tegra/board-whistler-panel.c | |
parent | 9b43171df226030517b0afce42ffb7e28f377142 (diff) |
[ARM] tegra: whistler: hdmi support
Registering second display controller for hdmi.
And HDMI hotplug detection gpio.
Original-Change-Id: I8428044f034698b4158f8aabc8ab39aba9cf5f2d
Reviewed-on: http://git-master/r/15233
Reviewed-by: Jonathan Mayo <jmayo@nvidia.com>
Reviewed-by: Thomas Cherry <tcherry@nvidia.com>
Tested-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Rebase-Id: R9ec5401e1675f9b56ed6ffbf5ccc1a7814bd5f3a
Diffstat (limited to 'arch/arm/mach-tegra/board-whistler-panel.c')
-rw-r--r-- | arch/arm/mach-tegra/board-whistler-panel.c | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/board-whistler-panel.c b/arch/arm/mach-tegra/board-whistler-panel.c index 86539ec94b18..72fa6207eda5 100644 --- a/arch/arm/mach-tegra/board-whistler-panel.c +++ b/arch/arm/mach-tegra/board-whistler-panel.c @@ -37,6 +37,10 @@ #include "board.h" #define whistler_bl_enb TEGRA_GPIO_PW1 +#define whistler_hdmi_hpd TEGRA_GPIO_PN7 + +static struct regulator *whistler_hdmi_reg = NULL; +static struct regulator *whistler_hdmi_pll = NULL; static int whistler_backlight_init(struct device *dev) { int ret; @@ -84,6 +88,39 @@ static struct platform_device whistler_backlight_device = { }, }; +static int whistler_hdmi_enable(void) +{ + if (!whistler_hdmi_reg) { + whistler_hdmi_reg = regulator_get(NULL, "avdd_hdmi"); /* LD011 */ + if (IS_ERR_OR_NULL(whistler_hdmi_reg)) { + pr_err("hdmi: couldn't get regulator avdd_hdmi\n"); + whistler_hdmi_reg = NULL; + return PTR_ERR(whistler_hdmi_reg); + } + } + regulator_enable(whistler_hdmi_reg); + + if (!whistler_hdmi_pll) { + whistler_hdmi_pll = regulator_get(NULL, "avdd_hdmi_pll"); /* LD06 */ + if (IS_ERR_OR_NULL(whistler_hdmi_pll)) { + pr_err("hdmi: couldn't get regulator avdd_hdmi_pll\n"); + whistler_hdmi_pll = NULL; + regulator_disable(whistler_hdmi_reg); + whistler_hdmi_reg = NULL; + return PTR_ERR(whistler_hdmi_pll); + } + } + regulator_enable(whistler_hdmi_pll); + return 0; +} + +static int whistler_hdmi_disable(void) +{ + regulator_disable(whistler_hdmi_reg); + regulator_disable(whistler_hdmi_pll); + return 0; +} + static struct resource whistler_disp1_resources[] = { { .name = "irq", @@ -103,6 +140,31 @@ static struct resource whistler_disp1_resources[] = { }, }; +static struct resource whistler_disp2_resources[] = { + { + .name = "irq", + .start = INT_DISPLAY_B_GENERAL, + .end = INT_DISPLAY_B_GENERAL, + .flags = IORESOURCE_IRQ, + }, + { + .name = "regs", + .start = TEGRA_DISPLAY2_BASE, + .end = TEGRA_DISPLAY2_BASE + TEGRA_DISPLAY2_SIZE - 1, + .flags = IORESOURCE_MEM, + }, + { + .name = "fbmem", + .flags = IORESOURCE_MEM, + }, + { + .name = "hdmi_regs", + .start = TEGRA_HDMI_BASE, + .end = TEGRA_HDMI_BASE + TEGRA_HDMI_SIZE - 1, + .flags = IORESOURCE_MEM, + }, +}; + static struct tegra_dc_mode whistler_panel_modes[] = { { .pclk = 27000000, @@ -145,6 +207,21 @@ static struct tegra_dc_out whistler_disp1_out = { .out_pins = whistler_dc_out_pins, .n_out_pins = ARRAY_SIZE(whistler_dc_out_pins), + +}; + +static struct tegra_dc_out whistler_disp2_out = { + .type = TEGRA_DC_OUT_HDMI, + .flags = TEGRA_DC_OUT_HOTPLUG_HIGH, + + .dcc_bus = 1, + .hotplug_gpio = whistler_hdmi_hpd, + + .align = TEGRA_DC_ALIGN_MSB, + .order = TEGRA_DC_ORDER_RED_BLUE, + + .enable = whistler_hdmi_enable, + .disable = whistler_hdmi_disable, }; static struct tegra_fb_data whistler_fb_data = { @@ -154,6 +231,14 @@ static struct tegra_fb_data whistler_fb_data = { .bits_per_pixel = 32, }; +static struct tegra_fb_data whistler_hdmi_fb_data = { + .win = 0, + .xres = 800, + .yres = 480, + .bits_per_pixel = 32, +}; + + static struct tegra_dc_platform_data whistler_disp1_pdata = { .flags = TEGRA_DC_FLAG_ENABLED, .default_out = &whistler_disp1_out, @@ -170,6 +255,22 @@ static struct nvhost_device whistler_disp1_device = { }, }; +static struct tegra_dc_platform_data whistler_disp2_pdata = { + .flags = 0, + .default_out = &whistler_disp2_out, + .fb = &whistler_hdmi_fb_data, +}; + +static struct nvhost_device whistler_disp2_device = { + .name = "tegradc", + .id = 1, + .resource = whistler_disp2_resources, + .num_resources = ARRAY_SIZE(whistler_disp2_resources), + .dev = { + .platform_data = &whistler_disp2_pdata, + }, +}; + static struct nvmap_platform_carveout whistler_carveouts[] = { [0] = { .name = "iram", @@ -212,6 +313,10 @@ int __init whistler_panel_init(void) int err; struct resource *res; + tegra_gpio_enable(whistler_hdmi_hpd); + gpio_request(whistler_hdmi_hpd, "hdmi_hpd"); + gpio_direction_input(whistler_hdmi_hpd); + whistler_carveouts[1].base = tegra_carveout_start; whistler_carveouts[1].size = tegra_carveout_size; @@ -223,9 +328,17 @@ int __init whistler_panel_init(void) res->start = tegra_fb_start; res->end = tegra_fb_start + tegra_fb_size - 1; + res = nvhost_get_resource_byname(&whistler_disp2_device, + IORESOURCE_MEM, "fbmem"); + res->start = tegra_fb2_start; + res->end = tegra_fb2_start + tegra_fb2_size - 1; + if (!err) err = nvhost_device_register(&whistler_disp1_device); + if (!err) + err = nvhost_device_register(&whistler_disp2_device); + return err; } |