diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /drivers/leds/led-core.c | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'drivers/leds/led-core.c')
-rw-r--r-- | drivers/leds/led-core.c | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c index ce8921a753a..016d19f5486 100644 --- a/drivers/leds/led-core.c +++ b/drivers/leds/led-core.c | |||
@@ -23,104 +23,3 @@ EXPORT_SYMBOL_GPL(leds_list_lock); | |||
23 | 23 | ||
24 | LIST_HEAD(leds_list); | 24 | LIST_HEAD(leds_list); |
25 | EXPORT_SYMBOL_GPL(leds_list); | 25 | EXPORT_SYMBOL_GPL(leds_list); |
26 | |||
27 | static void led_set_software_blink(struct led_classdev *led_cdev, | ||
28 | unsigned long delay_on, | ||
29 | unsigned long delay_off) | ||
30 | { | ||
31 | int current_brightness; | ||
32 | |||
33 | current_brightness = led_get_brightness(led_cdev); | ||
34 | if (current_brightness) | ||
35 | led_cdev->blink_brightness = current_brightness; | ||
36 | if (!led_cdev->blink_brightness) | ||
37 | led_cdev->blink_brightness = led_cdev->max_brightness; | ||
38 | |||
39 | led_cdev->blink_delay_on = delay_on; | ||
40 | led_cdev->blink_delay_off = delay_off; | ||
41 | |||
42 | /* never on - don't blink */ | ||
43 | if (!delay_on) | ||
44 | return; | ||
45 | |||
46 | /* never off - just set to brightness */ | ||
47 | if (!delay_off) { | ||
48 | __led_set_brightness(led_cdev, led_cdev->blink_brightness); | ||
49 | return; | ||
50 | } | ||
51 | |||
52 | mod_timer(&led_cdev->blink_timer, jiffies + 1); | ||
53 | } | ||
54 | |||
55 | |||
56 | static void led_blink_setup(struct led_classdev *led_cdev, | ||
57 | unsigned long *delay_on, | ||
58 | unsigned long *delay_off) | ||
59 | { | ||
60 | if (!(led_cdev->flags & LED_BLINK_ONESHOT) && | ||
61 | led_cdev->blink_set && | ||
62 | !led_cdev->blink_set(led_cdev, delay_on, delay_off)) | ||
63 | return; | ||
64 | |||
65 | /* blink with 1 Hz as default if nothing specified */ | ||
66 | if (!*delay_on && !*delay_off) | ||
67 | *delay_on = *delay_off = 500; | ||
68 | |||
69 | led_set_software_blink(led_cdev, *delay_on, *delay_off); | ||
70 | } | ||
71 | |||
72 | void led_blink_set(struct led_classdev *led_cdev, | ||
73 | unsigned long *delay_on, | ||
74 | unsigned long *delay_off) | ||
75 | { | ||
76 | del_timer_sync(&led_cdev->blink_timer); | ||
77 | |||
78 | led_cdev->flags &= ~LED_BLINK_ONESHOT; | ||
79 | led_cdev->flags &= ~LED_BLINK_ONESHOT_STOP; | ||
80 | |||
81 | led_blink_setup(led_cdev, delay_on, delay_off); | ||
82 | } | ||
83 | EXPORT_SYMBOL(led_blink_set); | ||
84 | |||
85 | void led_blink_set_oneshot(struct led_classdev *led_cdev, | ||
86 | unsigned long *delay_on, | ||
87 | unsigned long *delay_off, | ||
88 | int invert) | ||
89 | { | ||
90 | if ((led_cdev->flags & LED_BLINK_ONESHOT) && | ||
91 | timer_pending(&led_cdev->blink_timer)) | ||
92 | return; | ||
93 | |||
94 | led_cdev->flags |= LED_BLINK_ONESHOT; | ||
95 | led_cdev->flags &= ~LED_BLINK_ONESHOT_STOP; | ||
96 | |||
97 | if (invert) | ||
98 | led_cdev->flags |= LED_BLINK_INVERT; | ||
99 | else | ||
100 | led_cdev->flags &= ~LED_BLINK_INVERT; | ||
101 | |||
102 | led_blink_setup(led_cdev, delay_on, delay_off); | ||
103 | } | ||
104 | EXPORT_SYMBOL(led_blink_set_oneshot); | ||
105 | |||
106 | void led_stop_software_blink(struct led_classdev *led_cdev) | ||
107 | { | ||
108 | del_timer_sync(&led_cdev->blink_timer); | ||
109 | led_cdev->blink_delay_on = 0; | ||
110 | led_cdev->blink_delay_off = 0; | ||
111 | } | ||
112 | EXPORT_SYMBOL_GPL(led_stop_software_blink); | ||
113 | |||
114 | void led_set_brightness(struct led_classdev *led_cdev, | ||
115 | enum led_brightness brightness) | ||
116 | { | ||
117 | /* delay brightness setting if need to stop soft-blink timer */ | ||
118 | if (led_cdev->blink_delay_on || led_cdev->blink_delay_off) { | ||
119 | led_cdev->delayed_set_value = brightness; | ||
120 | schedule_work(&led_cdev->set_brightness_work); | ||
121 | return; | ||
122 | } | ||
123 | |||
124 | __led_set_brightness(led_cdev, brightness); | ||
125 | } | ||
126 | EXPORT_SYMBOL(led_set_brightness); | ||