[ARM] tegra: stingray: Add backlight to the panel board file
authorDan Murphy <wldm10@motorola.com>
Thu, 20 May 2010 20:38:33 +0000 (15:38 -0500)
committerColin Cross <ccross@android.com>
Wed, 6 Oct 2010 23:32:56 +0000 (16:32 -0700)
The current display is GPIO driven for the display backlight.
There will be newer displays that will no longer need this mechanism.

This code can be tagged for future removal

Change-Id: Id8d9fc7699172e7a8bbfd889302af76b6a370a11
Signed-off-by: Dan Murphy <wldm10@motorola.com>
arch/arm/mach-tegra/board-stingray-panel.c

index 93a6d6553314a79823fabe9ffb1bf840c6ba5e76..52b06f39854344c0b845920f38343cb16be1d3ff 100644 (file)
@@ -14,6 +14,8 @@
  *
  */
 
+#include <linux/gpio.h>
+#include <linux/leds-auo-panel-backlight.h>
 #include <linux/resource.h>
 #include <linux/platform_device.h>
 #include <asm/mach-types.h>
 #include <mach/iomap.h>
 #include <mach/tegra_fb.h>
 
+#include "gpio-names.h"
+
+#define STINGRAY_AUO_DISP_BL   TEGRA_GPIO_PD0
+
 /* Framebuffer */
 static struct resource fb_resource[] = {
        [0] = {
@@ -49,16 +55,49 @@ static struct tegra_fb_lcd_data tegra_fb_lcd_platform_data = {
 };
 
 static struct platform_device tegra_fb_device = {
-       .name           = "tegrafb",
-       .id             = 0,
-       .resource       = fb_resource,
-       .num_resources  = ARRAY_SIZE(fb_resource),
+       .name = "tegrafb",
+       .id     = 0,
+       .resource = fb_resource,
+       .num_resources = ARRAY_SIZE(fb_resource),
        .dev = {
                .platform_data = &tegra_fb_lcd_platform_data,
        },
 };
 
-int __init stingray_panel_init(void) {
+static void stingray_backlight_enable(void)
+{
+       gpio_set_value(STINGRAY_AUO_DISP_BL, 1);
+}
+
+static void stingray_backlight_disable(void)
+{
+       gpio_set_value(STINGRAY_AUO_DISP_BL, 0);
+}
+
+struct auo_panel_bl_platform_data stingray_auo_backlight_data = {
+       .bl_enable = stingray_backlight_enable,
+       .bl_disable = stingray_backlight_disable,
+       .pwm_enable = NULL,
+       .pwm_disable = NULL,
+};
+
+static struct platform_device stingray_panel_bl_driver = {
+       .name = LD_AUO_PANEL_BL_NAME,
+       .id = -1,
+       .dev = {
+               .platform_data = &stingray_auo_backlight_data,
+               },
+};
+
+int __init stingray_panel_init(void)
+{
+       /* Display backlight control */
+       tegra_gpio_enable(STINGRAY_AUO_DISP_BL);
+       gpio_request(STINGRAY_AUO_DISP_BL, "auo_disp_bl");
+       gpio_direction_output(STINGRAY_AUO_DISP_BL, 1);
+
+       platform_device_register(&stingray_panel_bl_driver);
+
        return platform_device_register(&tegra_fb_device);
 }