diff options
author | Scott Williams <scwilliams@nvidia.com> | 2011-01-10 15:24:55 -0800 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:45:28 -0800 |
commit | be7063d410d8353d492b60dd6397d1f5e42287db (patch) | |
tree | 7e13147da4e156aa8061e5dec176870301592c15 /arch/arm/mach-tegra/board-cardhu-panel.c | |
parent | 353d5433868ac7869944482b0f5f1a3b9efd573c (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: Rc8ec56873856710e20e949f4b3007877c219f234
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, }; |