diff options
author | Scott Williams <scwilliams@nvidia.com> | 2011-01-10 15:24:55 -0800 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-04-26 15:49:16 -0700 |
commit | 0adf3bbc25fcaa400cf51319721e56f1e9639a24 (patch) | |
tree | e2cea056d940dde7a6e060d244ffa2dc600c1130 /arch/arm/mach-tegra/board-cardhu-panel.c | |
parent | 2dbd7f29460568a5a8c0818a534bd10946faa47c (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>
Change-Id: Ie2dc49007c6b70be3bf0c921464cb7c72378b26e
Diffstat (limited to 'arch/arm/mach-tegra/board-cardhu-panel.c')
-rw-r--r-- | arch/arm/mach-tegra/board-cardhu-panel.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/board-cardhu-panel.c b/arch/arm/mach-tegra/board-cardhu-panel.c index 864ba5f3df11..2ee1a20da14e 100644 --- a/arch/arm/mach-tegra/board-cardhu-panel.c +++ b/arch/arm/mach-tegra/board-cardhu-panel.c @@ -38,6 +38,53 @@ #define PMC_SCRATCH20 0xa0 #define cardhu_lvds_shutdown TEGRA_GPIO_PB2 +#define cardhu_bl_enb TEGRA_GPIO_PW1 + +static int cardhu_backlight_init(struct device *dev) { + int ret; + + ret = gpio_request(cardhu_bl_enb, "backlight_enb"); + if (ret < 0) + return ret; + + ret = gpio_direction_output(cardhu_bl_enb, 1); + if (ret < 0) + gpio_free(cardhu_bl_enb); + else + tegra_gpio_enable(cardhu_bl_enb); + + return ret; +}; + +static void cardhu_backlight_exit(struct device *dev) { + gpio_set_value(cardhu_bl_enb, 0); + gpio_free(cardhu_bl_enb); + tegra_gpio_disable(cardhu_bl_enb); +} + +static int cardhu_backlight_notify(struct device *unused, int brightness) +{ + gpio_set_value(cardhu_bl_enb, !!brightness); + return brightness; +} + +static struct platform_pwm_backlight_data cardhu_backlight_data = { + .pwm_id = 2, + .max_brightness = 255, + .dft_brightness = 224, + .pwm_period_ns = 5000000, + .init = cardhu_backlight_init, + .exit = cardhu_backlight_exit, + .notify = cardhu_backlight_notify, +}; + +static struct platform_device cardhu_backlight_device = { + .name = "pwm-backlight", + .id = -1, + .dev = { + .platform_data = &cardhu_backlight_data, + }, +}; static int cardhu_panel_enable(void) { @@ -168,6 +215,8 @@ static struct platform_device cardhu_nvmap_device = { static struct platform_device *cardhu_gfx_devices[] __initdata = { &cardhu_nvmap_device, &tegra_grhost_device, + &tegra_pwfm2_device, + &cardhu_backlight_device, }; |