video: tegra: cardhu: Default bpp from hardware
Christopher Freeman [Fri, 24 Aug 2012 21:04:29 +0000 (14:04 -0700)]
This patch adds:

1. A kernel config option that hints to DC driver
to use the current value of the color depth
register as the default for initializing the FB
driver.

2. Checks to see if DC is enabled before reading
off the color depth register in tegra_dc_probe.

Change-Id: I852cc1328fcf42f33052f46b86d753e691744329
Signed-off-by: Christopher Freeman <cfreeman@nvidia.com>
Reviewed-on: http://git-master/r/127297
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>

arch/arm/mach-tegra/Kconfig
arch/arm/mach-tegra/board-cardhu-panel.c
drivers/video/tegra/dc/dc.c

index 6f8711e..c8febb1 100644 (file)
@@ -675,3 +675,12 @@ config ARCH_TEGRA_4GB_MEMORY
          Harmless to select this even if hardware does not support full
          4GB physical memory.
 endif
+
+config TEGRA_DC_USE_HW_BPP
+       bool "Default Bits Per Pixel value from tegra DC hardware"
+       depends on TEGRA_DC
+       default n
+        help
+         Programs platform data to inform DC driver to use current
+         hardware value for bits per pixel setting.  Useful for
+          preserving and displaying framebuffer content from bootloader.
index 5d80e0d..6b37bd5 100644 (file)
@@ -680,7 +680,11 @@ static struct tegra_fb_data cardhu_fb_data = {
        .win            = 0,
        .xres           = 1366,
        .yres           = 768,
+#ifdef CONFIG_TEGRA_DC_USE_HW_BPP
+       .bits_per_pixel = -1,
+#else
        .bits_per_pixel = 32,
+#endif
        .flags          = TEGRA_FB_FLIP_ON_PROBE,
 };
 
@@ -688,7 +692,11 @@ static struct tegra_fb_data cardhu_hdmi_fb_data = {
        .win            = 0,
        .xres           = 640,
        .yres           = 480,
+#ifdef CONFIG_TEGRA_DC_USE_HW_BPP
+       .bits_per_pixel = -1,
+#else
        .bits_per_pixel = 32,
+#endif
        .flags          = TEGRA_FB_FLIP_ON_PROBE,
 };
 
index aeea12b..f426742 100644 (file)
@@ -2146,7 +2146,7 @@ static int tegra_dc_probe(struct nvhost_device *ndev,
        dev_info(&ndev->dev, "probed\n");
 
        if (dc->pdata->fb) {
-               if (dc->pdata->fb->bits_per_pixel == -1) {
+               if (dc->enabled && dc->pdata->fb->bits_per_pixel == -1) {
                        unsigned long fmt;
                        tegra_dc_writel(dc,
                                        WINDOW_A_SELECT << dc->pdata->fb->win,