ARM: tegra: remove warnings on board roth
[linux-3.10.git] / arch / arm / mach-tegra / board-roth-leds.c
1 /*
2  * arch/arm/mach-tegra/board-roth-leds.c
3  *
4  * Copyright (c) 2013, NVIDIA CORPORATION.  All rights reserved.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18  */
19
20 #include <linux/gpio.h>
21 #include <linux/platform_device.h>
22 #include <linux/leds.h>
23 #include <linux/leds_pwm.h>
24 #include <linux/pwm.h>
25 #include <mach/gpio-tegra.h>
26 #include <mach/pinmux.h>
27 #include <mach/pinmux-t11.h>
28
29 #include "gpio-names.h"
30 #include "devices.h"
31 #include "board.h"
32 #include "board-common.h"
33 #include "board-roth.h"
34 #include "tegra-board-id.h"
35
36 #define LED_ENABLE_GPIO TEGRA_GPIO_PU1
37
38 #ifdef CONFIG_LEDS_PWM
39
40 static struct led_pwm roth_led_info[] = {
41         {
42                 .name                   = "roth-led",
43                 .default_trigger        = "none",
44                 .pwm_id                 = 2,
45                 .active_low             = 0,
46                 .max_brightness         = 255,
47                 .pwm_period_ns          = 10000000,
48         },
49 };
50
51 static struct led_pwm_platform_data roth_leds_pdata = {
52         .leds           = roth_led_info,
53         .num_leds       = ARRAY_SIZE(roth_led_info),
54 };
55
56 static struct platform_device roth_leds_pwm_device = {
57         .name   = "leds_pwm",
58         .id     = -1,
59         .dev    = {
60                 .platform_data = &roth_leds_pdata,
61         },
62 };
63
64
65 #else
66 static struct gpio_led roth_led_info[] = {
67         {
68                 .name                   = "roth-led",
69                 .default_trigger        = "none",
70                 .gpio                   = TEGRA_GPIO_PQ3,
71                 .active_low             = 0,
72                 .retain_state_suspended = 0,
73                 .default_state          = LEDS_GPIO_DEFSTATE_OFF,
74         },
75 };
76
77 static struct gpio_led_platform_data roth_leds_pdata = {
78         .leds           = roth_led_info,
79         .num_leds       = ARRAY_SIZE(roth_led_info),
80 };
81
82 static struct platform_device roth_leds_gpio_device = {
83         .name   = "leds-gpio",
84         .id     = -1,
85         .dev    = {
86                 .platform_data = &roth_leds_pdata,
87         },
88 };
89 #endif
90
91 /*static struct platform_device *roth_led_device[] = {
92         &tegra_pwfm2_device,
93 };*/
94
95 int __init roth_led_init(void)
96 {
97 #ifdef CONFIG_LEDS_PWM
98         platform_device_register(&roth_leds_pwm_device);
99 #else
100         platform_device_register(&roth_leds_gpio_device);
101 #endif
102         gpio_request(LED_ENABLE_GPIO, "LED Trisate Buffer OE");
103         gpio_direction_output(LED_ENABLE_GPIO, 1);
104         gpio_export(LED_ENABLE_GPIO, false);
105         return 0;
106 }