summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/board-aruba-panel.c
diff options
context:
space:
mode:
authorScott Williams <scwilliams@nvidia.com>2011-01-10 15:24:55 -0800
committerDan Willemsen <dwillemsen@nvidia.com>2012-03-23 19:56:34 -0700
commit4eea987cd20dcd944989bb711cc61e20d53224ff (patch)
treecfa9b71196b3daeb7b73a2159c54f6c970a1b7fb /arch/arm/mach-tegra/board-aruba-panel.c
parent5ea7b1b97a357decc8882dc1633cc5585f837629 (diff)
arm: tegra: Backlight control for aruba2/cardhu platforms
Bug 776857 Original-Change-Id: I0ed5723c381095b684b03c5650820019ab11b8a0 Reviewed-on: http://git-master/r/15430 Tested-by: Scott Williams <scwilliams@nvidia.com> Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com> Reviewed-by: Scott Williams <scwilliams@nvidia.com> Original-Change-Id: Ie2dc49007c6b70be3bf0c921464cb7c72378b26e Rebase-Id: R28653f495ee024f93546900583f35cad6ef12001
Diffstat (limited to 'arch/arm/mach-tegra/board-aruba-panel.c')
-rw-r--r--arch/arm/mach-tegra/board-aruba-panel.c50
1 files changed, 49 insertions, 1 deletions
diff --git a/arch/arm/mach-tegra/board-aruba-panel.c b/arch/arm/mach-tegra/board-aruba-panel.c
index a56c5d05e478..e192ef315641 100644
--- a/arch/arm/mach-tegra/board-aruba-panel.c
+++ b/arch/arm/mach-tegra/board-aruba-panel.c
@@ -38,6 +38,53 @@
#define PMC_SCRATCH20 0xa0
#define aruba_lvds_shutdown TEGRA_GPIO_PB2
+#define aruba_bl_enb TEGRA_GPIO_PW1
+
+static int aruba_backlight_init(struct device *dev) {
+ int ret;
+
+ ret = gpio_request(aruba_bl_enb, "backlight_enb");
+ if (ret < 0)
+ return ret;
+
+ ret = gpio_direction_output(aruba_bl_enb, 1);
+ if (ret < 0)
+ gpio_free(aruba_bl_enb);
+ else
+ tegra_gpio_enable(aruba_bl_enb);
+
+ return ret;
+};
+
+static void aruba_backlight_exit(struct device *dev) {
+ gpio_set_value(aruba_bl_enb, 0);
+ gpio_free(aruba_bl_enb);
+ tegra_gpio_disable(aruba_bl_enb);
+}
+
+static int aruba_backlight_notify(struct device *unused, int brightness)
+{
+ gpio_set_value(aruba_bl_enb, !!brightness);
+ return brightness;
+}
+
+static struct platform_pwm_backlight_data aruba_backlight_data = {
+ .pwm_id = 2,
+ .max_brightness = 255,
+ .dft_brightness = 224,
+ .pwm_period_ns = 5000000,
+ .init = aruba_backlight_init,
+ .exit = aruba_backlight_exit,
+ .notify = aruba_backlight_notify,
+};
+
+static struct platform_device aruba_backlight_device = {
+ .name = "pwm-backlight",
+ .id = -1,
+ .dev = {
+ .platform_data = &aruba_backlight_data,
+ },
+};
static int aruba_panel_enable(void)
{
@@ -168,9 +215,10 @@ static struct platform_device aruba_nvmap_device = {
static struct platform_device *aruba_gfx_devices[] __initdata = {
&aruba_nvmap_device,
&tegra_grhost_device,
+ &tegra_pwfm2_device,
+ &aruba_backlight_device,
};
-
static inline u32 pmc_readl(unsigned long offset)
{
return readl(IO_TO_VIRT(TEGRA_PMC_BASE + offset));