diff options
author | Tom Cherry <tcherry@nvidia.com> | 2010-12-02 15:02:18 -0800 |
---|---|---|
committer | Bharat Nihalani <bnihalani@nvidia.com> | 2010-12-18 00:56:37 -0800 |
commit | 37ec8b37da1a95eab2e46b9129cd00e4628b6ebd (patch) | |
tree | b1506e195a1b3c2f1c6c46a6377edd0f0c08dcb7 /arch/arm/mach-tegra/board-whistler-panel.c | |
parent | a37a8664c99213050017b5a89dabd9d0d5969a82 (diff) |
Initial whistler backlight support
Change-Id: I6ec5ec582470feb389a988ae6b48f08b04fc6402
Reviewed-on: http://git-master/r/12349
Tested-by: Thomas Cherry <tcherry@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra/board-whistler-panel.c')
-rw-r--r-- | arch/arm/mach-tegra/board-whistler-panel.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/board-whistler-panel.c b/arch/arm/mach-tegra/board-whistler-panel.c index 90acf239ecfd..86539ec94b18 100644 --- a/arch/arm/mach-tegra/board-whistler-panel.c +++ b/arch/arm/mach-tegra/board-whistler-panel.c @@ -36,6 +36,54 @@ #include "gpio-names.h" #include "board.h" +#define whistler_bl_enb TEGRA_GPIO_PW1 + +static int whistler_backlight_init(struct device *dev) { + int ret; + + ret = gpio_request(whistler_bl_enb, "backlight_enb"); + if (ret < 0) + return ret; + + ret = gpio_direction_output(whistler_bl_enb, 1); + if (ret < 0) + gpio_free(whistler_bl_enb); + else + tegra_gpio_enable(whistler_bl_enb); + + return ret; +}; + +static void whistler_backlight_exit(struct device *dev) { + gpio_set_value(whistler_bl_enb, 0); + gpio_free(whistler_bl_enb); + tegra_gpio_disable(whistler_bl_enb); +} + +static int whistler_backlight_notify(struct device *unused, int brightness) +{ + gpio_set_value(whistler_bl_enb, !!brightness); + return brightness; +} + +static struct platform_pwm_backlight_data whistler_backlight_data = { + .pwm_id = 2, + .max_brightness = 255, + .dft_brightness = 224, + .pwm_period_ns = 5000000, + .init = whistler_backlight_init, + .exit = whistler_backlight_exit, + .notify = whistler_backlight_notify, +}; + +static struct platform_device whistler_backlight_device = { + .name = "pwm-backlight", + .id = -1, + .dev = { + .platform_data = &whistler_backlight_data, + }, +}; + static struct resource whistler_disp1_resources[] = { { .name = "irq", @@ -155,6 +203,8 @@ static struct platform_device whistler_nvmap_device = { static struct platform_device *whistler_gfx_devices[] __initdata = { &whistler_nvmap_device, &tegra_grhost_device, + &tegra_pwfm2_device, + &whistler_backlight_device, }; int __init whistler_panel_init(void) |