diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-led.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-led.c | 257 |
1 files changed, 126 insertions, 131 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-led.c b/drivers/net/wireless/iwlwifi/iwl-led.c index 03fdf5b434a1..4eee1b163cd2 100644 --- a/drivers/net/wireless/iwlwifi/iwl-led.c +++ b/drivers/net/wireless/iwlwifi/iwl-led.c | |||
@@ -27,7 +27,6 @@ | |||
27 | 27 | ||
28 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
30 | #include <linux/version.h> | ||
31 | #include <linux/init.h> | 30 | #include <linux/init.h> |
32 | #include <linux/pci.h> | 31 | #include <linux/pci.h> |
33 | #include <linux/dma-mapping.h> | 32 | #include <linux/dma-mapping.h> |
@@ -39,19 +38,26 @@ | |||
39 | #include <linux/etherdevice.h> | 38 | #include <linux/etherdevice.h> |
40 | #include <asm/unaligned.h> | 39 | #include <asm/unaligned.h> |
41 | 40 | ||
42 | #include "iwl-4965.h" | 41 | #include "iwl-dev.h" |
43 | #include "iwl-core.h" | 42 | #include "iwl-core.h" |
44 | #include "iwl-io.h" | 43 | #include "iwl-io.h" |
45 | #include "iwl-helpers.h" | 44 | #include "iwl-helpers.h" |
46 | 45 | ||
47 | #define IWL_1MB_RATE (128 * 1024) | 46 | #ifdef CONFIG_IWLWIFI_DEBUG |
48 | #define IWL_LED_THRESHOLD (16) | 47 | static const char *led_type_str[] = { |
49 | #define IWL_MAX_BLINK_TBL (10) | 48 | __stringify(IWL_LED_TRG_TX), |
49 | __stringify(IWL_LED_TRG_RX), | ||
50 | __stringify(IWL_LED_TRG_ASSOC), | ||
51 | __stringify(IWL_LED_TRG_RADIO), | ||
52 | NULL | ||
53 | }; | ||
54 | #endif /* CONFIG_IWLWIFI_DEBUG */ | ||
55 | |||
50 | 56 | ||
51 | static const struct { | 57 | static const struct { |
52 | u16 tpt; | 58 | u16 tpt; |
53 | u8 on_time; | 59 | u8 on_time; |
54 | u8 of_time; | 60 | u8 off_time; |
55 | } blink_tbl[] = | 61 | } blink_tbl[] = |
56 | { | 62 | { |
57 | {300, 25, 25}, | 63 | {300, 25, 25}, |
@@ -63,26 +69,31 @@ static const struct { | |||
63 | {15, 95, 95 }, | 69 | {15, 95, 95 }, |
64 | {10, 110, 110}, | 70 | {10, 110, 110}, |
65 | {5, 130, 130}, | 71 | {5, 130, 130}, |
66 | {0, 167, 167} | 72 | {0, 167, 167}, |
73 | /* SOLID_ON */ | ||
74 | {-1, IWL_LED_SOLID, 0} | ||
67 | }; | 75 | }; |
68 | 76 | ||
69 | static int iwl_led_cmd_callback(struct iwl_priv *priv, | 77 | #define IWL_1MB_RATE (128 * 1024) |
70 | struct iwl_cmd *cmd, struct sk_buff *skb) | 78 | #define IWL_LED_THRESHOLD (16) |
79 | #define IWL_MAX_BLINK_TBL (ARRAY_SIZE(blink_tbl) - 1) /* exclude SOLID_ON */ | ||
80 | #define IWL_SOLID_BLINK_IDX (ARRAY_SIZE(blink_tbl) - 1) | ||
81 | |||
82 | /* [0-256] -> [0..8] FIXME: we need [0..10] */ | ||
83 | static inline int iwl_brightness_to_idx(enum led_brightness brightness) | ||
71 | { | 84 | { |
72 | return 1; | 85 | return fls(0x000000FF & (u32)brightness); |
73 | } | 86 | } |
74 | 87 | ||
75 | |||
76 | /* Send led command */ | 88 | /* Send led command */ |
77 | static int iwl_send_led_cmd(struct iwl_priv *priv, | 89 | static int iwl_send_led_cmd(struct iwl_priv *priv, struct iwl_led_cmd *led_cmd) |
78 | struct iwl4965_led_cmd *led_cmd) | ||
79 | { | 90 | { |
80 | struct iwl_host_cmd cmd = { | 91 | struct iwl_host_cmd cmd = { |
81 | .id = REPLY_LEDS_CMD, | 92 | .id = REPLY_LEDS_CMD, |
82 | .len = sizeof(struct iwl4965_led_cmd), | 93 | .len = sizeof(struct iwl_led_cmd), |
83 | .data = led_cmd, | 94 | .data = led_cmd, |
84 | .meta.flags = CMD_ASYNC, | 95 | .meta.flags = CMD_ASYNC, |
85 | .meta.u.callback = iwl_led_cmd_callback | 96 | .meta.u.callback = NULL, |
86 | }; | 97 | }; |
87 | u32 reg; | 98 | u32 reg; |
88 | 99 | ||
@@ -93,33 +104,20 @@ static int iwl_send_led_cmd(struct iwl_priv *priv, | |||
93 | return iwl_send_cmd(priv, &cmd); | 104 | return iwl_send_cmd(priv, &cmd); |
94 | } | 105 | } |
95 | 106 | ||
96 | 107 | /* Set led pattern command */ | |
97 | /* Set led on command */ | ||
98 | static int iwl4965_led_on(struct iwl_priv *priv, int led_id) | ||
99 | { | ||
100 | struct iwl4965_led_cmd led_cmd = { | ||
101 | .id = led_id, | ||
102 | .on = IWL_LED_SOLID, | ||
103 | .off = 0, | ||
104 | .interval = IWL_DEF_LED_INTRVL | ||
105 | }; | ||
106 | return iwl_send_led_cmd(priv, &led_cmd); | ||
107 | } | ||
108 | |||
109 | /* Set led on command */ | ||
110 | static int iwl4965_led_pattern(struct iwl_priv *priv, int led_id, | 108 | static int iwl4965_led_pattern(struct iwl_priv *priv, int led_id, |
111 | enum led_brightness brightness) | 109 | unsigned int idx) |
112 | { | 110 | { |
113 | struct iwl4965_led_cmd led_cmd = { | 111 | struct iwl_led_cmd led_cmd = { |
114 | .id = led_id, | 112 | .id = led_id, |
115 | .on = brightness, | ||
116 | .off = brightness, | ||
117 | .interval = IWL_DEF_LED_INTRVL | 113 | .interval = IWL_DEF_LED_INTRVL |
118 | }; | 114 | }; |
119 | if (brightness == LED_FULL) { | 115 | |
120 | led_cmd.on = IWL_LED_SOLID; | 116 | BUG_ON(idx > IWL_MAX_BLINK_TBL); |
121 | led_cmd.off = 0; | 117 | |
122 | } | 118 | led_cmd.on = blink_tbl[idx].on_time; |
119 | led_cmd.off = blink_tbl[idx].off_time; | ||
120 | |||
123 | return iwl_send_led_cmd(priv, &led_cmd); | 121 | return iwl_send_led_cmd(priv, &led_cmd); |
124 | } | 122 | } |
125 | 123 | ||
@@ -132,10 +130,22 @@ static int iwl4965_led_on_reg(struct iwl_priv *priv, int led_id) | |||
132 | } | 130 | } |
133 | 131 | ||
134 | #if 0 | 132 | #if 0 |
133 | /* Set led on command */ | ||
134 | static int iwl4965_led_on(struct iwl_priv *priv, int led_id) | ||
135 | { | ||
136 | struct iwl_led_cmd led_cmd = { | ||
137 | .id = led_id, | ||
138 | .on = IWL_LED_SOLID, | ||
139 | .off = 0, | ||
140 | .interval = IWL_DEF_LED_INTRVL | ||
141 | }; | ||
142 | return iwl_send_led_cmd(priv, &led_cmd); | ||
143 | } | ||
144 | |||
135 | /* Set led off command */ | 145 | /* Set led off command */ |
136 | int iwl4965_led_off(struct iwl_priv *priv, int led_id) | 146 | int iwl4965_led_off(struct iwl_priv *priv, int led_id) |
137 | { | 147 | { |
138 | struct iwl4965_led_cmd led_cmd = { | 148 | struct iwl_led_cmd led_cmd = { |
139 | .id = led_id, | 149 | .id = led_id, |
140 | .on = 0, | 150 | .on = 0, |
141 | .off = 0, | 151 | .off = 0, |
@@ -150,30 +160,35 @@ int iwl4965_led_off(struct iwl_priv *priv, int led_id) | |||
150 | /* Set led register off */ | 160 | /* Set led register off */ |
151 | static int iwl4965_led_off_reg(struct iwl_priv *priv, int led_id) | 161 | static int iwl4965_led_off_reg(struct iwl_priv *priv, int led_id) |
152 | { | 162 | { |
153 | IWL_DEBUG_LED("radio off\n"); | 163 | IWL_DEBUG_LED("LED Reg off\n"); |
154 | iwl_write32(priv, CSR_LED_REG, CSR_LED_REG_TRUN_OFF); | 164 | iwl_write32(priv, CSR_LED_REG, CSR_LED_REG_TRUN_OFF); |
155 | return 0; | 165 | return 0; |
156 | } | 166 | } |
157 | 167 | ||
158 | /* Set led blink command */ | 168 | /* |
159 | static int iwl4965_led_not_solid(struct iwl_priv *priv, int led_id, | 169 | * Set led register in case of disassociation according to rfkill state |
160 | u8 brightness) | 170 | */ |
171 | static int iwl_led_associate(struct iwl_priv *priv, int led_id) | ||
161 | { | 172 | { |
162 | struct iwl4965_led_cmd led_cmd = { | 173 | IWL_DEBUG_LED("Associated\n"); |
163 | .id = led_id, | 174 | priv->allow_blinking = 1; |
164 | .on = brightness, | 175 | return iwl4965_led_on_reg(priv, led_id); |
165 | .off = brightness, | ||
166 | .interval = IWL_DEF_LED_INTRVL | ||
167 | }; | ||
168 | |||
169 | return iwl_send_led_cmd(priv, &led_cmd); | ||
170 | } | 176 | } |
177 | static int iwl_led_disassociate(struct iwl_priv *priv, int led_id) | ||
178 | { | ||
179 | priv->allow_blinking = 0; | ||
180 | if (iwl_is_rfkill(priv)) | ||
181 | iwl4965_led_off_reg(priv, led_id); | ||
182 | else | ||
183 | iwl4965_led_on_reg(priv, led_id); | ||
171 | 184 | ||
185 | return 0; | ||
186 | } | ||
172 | 187 | ||
173 | /* | 188 | /* |
174 | * brightness call back function for Tx/Rx LED | 189 | * brightness call back function for Tx/Rx LED |
175 | */ | 190 | */ |
176 | static int iwl4965_led_associated(struct iwl_priv *priv, int led_id) | 191 | static int iwl_led_associated(struct iwl_priv *priv, int led_id) |
177 | { | 192 | { |
178 | if (test_bit(STATUS_EXIT_PENDING, &priv->status) || | 193 | if (test_bit(STATUS_EXIT_PENDING, &priv->status) || |
179 | !test_bit(STATUS_READY, &priv->status)) | 194 | !test_bit(STATUS_READY, &priv->status)) |
@@ -189,34 +204,32 @@ static int iwl4965_led_associated(struct iwl_priv *priv, int led_id) | |||
189 | /* | 204 | /* |
190 | * brightness call back for association and radio | 205 | * brightness call back for association and radio |
191 | */ | 206 | */ |
192 | static void iwl4965_led_brightness_set(struct led_classdev *led_cdev, | 207 | static void iwl_led_brightness_set(struct led_classdev *led_cdev, |
193 | enum led_brightness brightness) | 208 | enum led_brightness brightness) |
194 | { | 209 | { |
195 | struct iwl4965_led *led = container_of(led_cdev, | 210 | struct iwl_led *led = container_of(led_cdev, struct iwl_led, led_dev); |
196 | struct iwl4965_led, led_dev); | ||
197 | struct iwl_priv *priv = led->priv; | 211 | struct iwl_priv *priv = led->priv; |
198 | 212 | ||
199 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 213 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
200 | return; | 214 | return; |
201 | 215 | ||
216 | |||
217 | IWL_DEBUG_LED("Led type = %s brightness = %d\n", | ||
218 | led_type_str[led->type], brightness); | ||
202 | switch (brightness) { | 219 | switch (brightness) { |
203 | case LED_FULL: | 220 | case LED_FULL: |
204 | if (led->type == IWL_LED_TRG_ASSOC) | ||
205 | priv->allow_blinking = 1; | ||
206 | |||
207 | if (led->led_on) | 221 | if (led->led_on) |
208 | led->led_on(priv, IWL_LED_LINK); | 222 | led->led_on(priv, IWL_LED_LINK); |
209 | break; | 223 | break; |
210 | case LED_OFF: | 224 | case LED_OFF: |
211 | if (led->type == IWL_LED_TRG_ASSOC) | ||
212 | priv->allow_blinking = 0; | ||
213 | |||
214 | if (led->led_off) | 225 | if (led->led_off) |
215 | led->led_off(priv, IWL_LED_LINK); | 226 | led->led_off(priv, IWL_LED_LINK); |
216 | break; | 227 | break; |
217 | default: | 228 | default: |
218 | if (led->led_pattern) | 229 | if (led->led_pattern) { |
219 | led->led_pattern(priv, IWL_LED_LINK, brightness); | 230 | int idx = iwl_brightness_to_idx(brightness); |
231 | led->led_pattern(priv, IWL_LED_LINK, idx); | ||
232 | } | ||
220 | break; | 233 | break; |
221 | } | 234 | } |
222 | } | 235 | } |
@@ -226,16 +239,15 @@ static void iwl4965_led_brightness_set(struct led_classdev *led_cdev, | |||
226 | /* | 239 | /* |
227 | * Register led class with the system | 240 | * Register led class with the system |
228 | */ | 241 | */ |
229 | static int iwl_leds_register_led(struct iwl_priv *priv, | 242 | static int iwl_leds_register_led(struct iwl_priv *priv, struct iwl_led *led, |
230 | struct iwl4965_led *led, | ||
231 | enum led_type type, u8 set_led, | 243 | enum led_type type, u8 set_led, |
232 | const char *name, char *trigger) | 244 | char *trigger) |
233 | { | 245 | { |
234 | struct device *device = wiphy_dev(priv->hw->wiphy); | 246 | struct device *device = wiphy_dev(priv->hw->wiphy); |
235 | int ret; | 247 | int ret; |
236 | 248 | ||
237 | led->led_dev.name = name; | 249 | led->led_dev.name = led->name; |
238 | led->led_dev.brightness_set = iwl4965_led_brightness_set; | 250 | led->led_dev.brightness_set = iwl_led_brightness_set; |
239 | led->led_dev.default_trigger = trigger; | 251 | led->led_dev.default_trigger = trigger; |
240 | 252 | ||
241 | led->priv = priv; | 253 | led->priv = priv; |
@@ -259,38 +271,30 @@ static int iwl_leds_register_led(struct iwl_priv *priv, | |||
259 | /* | 271 | /* |
260 | * calculate blink rate according to last 2 sec Tx/Rx activities | 272 | * calculate blink rate according to last 2 sec Tx/Rx activities |
261 | */ | 273 | */ |
262 | static inline u8 get_blink_rate(struct iwl_priv *priv) | 274 | static int iwl_get_blink_rate(struct iwl_priv *priv) |
263 | { | 275 | { |
264 | int i; | 276 | int i; |
265 | u8 blink_rate; | 277 | u64 current_tpt = priv->tx_stats[2].bytes; |
266 | u64 current_tpt = priv->tx_stats[2].bytes + priv->rx_stats[2].bytes; | 278 | /* FIXME: + priv->rx_stats[2].bytes; */ |
267 | s64 tpt = current_tpt - priv->led_tpt; | 279 | s64 tpt = current_tpt - priv->led_tpt; |
268 | 280 | ||
269 | if (tpt < 0) /* wrapparound */ | 281 | if (tpt < 0) /* wrapparound */ |
270 | tpt = -tpt; | 282 | tpt = -tpt; |
271 | 283 | ||
284 | IWL_DEBUG_LED("tpt %lld current_tpt %llu\n", | ||
285 | (long long)tpt, | ||
286 | (unsigned long long)current_tpt); | ||
272 | priv->led_tpt = current_tpt; | 287 | priv->led_tpt = current_tpt; |
273 | 288 | ||
274 | if (tpt < IWL_LED_THRESHOLD) { | 289 | if (!priv->allow_blinking) |
275 | i = IWL_MAX_BLINK_TBL; | 290 | i = IWL_MAX_BLINK_TBL; |
276 | } else { | 291 | else |
277 | for (i = 0; i < IWL_MAX_BLINK_TBL; i++) | 292 | for (i = 0; i < IWL_MAX_BLINK_TBL; i++) |
278 | if (tpt > (blink_tbl[i].tpt * IWL_1MB_RATE)) | 293 | if (tpt > (blink_tbl[i].tpt * IWL_1MB_RATE)) |
279 | break; | 294 | break; |
280 | } | ||
281 | /* if 0 frame is transfered */ | ||
282 | if ((i == IWL_MAX_BLINK_TBL) || !priv->allow_blinking) | ||
283 | blink_rate = IWL_LED_SOLID; | ||
284 | else | ||
285 | blink_rate = blink_tbl[i].on_time; | ||
286 | |||
287 | return blink_rate; | ||
288 | } | ||
289 | 295 | ||
290 | static inline int is_rf_kill(struct iwl_priv *priv) | 296 | IWL_DEBUG_LED("LED BLINK IDX=%d", i); |
291 | { | 297 | return i; |
292 | return test_bit(STATUS_RF_KILL_HW, &priv->status) || | ||
293 | test_bit(STATUS_RF_KILL_SW, &priv->status); | ||
294 | } | 298 | } |
295 | 299 | ||
296 | /* | 300 | /* |
@@ -300,22 +304,23 @@ static inline int is_rf_kill(struct iwl_priv *priv) | |||
300 | */ | 304 | */ |
301 | void iwl_leds_background(struct iwl_priv *priv) | 305 | void iwl_leds_background(struct iwl_priv *priv) |
302 | { | 306 | { |
303 | u8 blink_rate; | 307 | u8 blink_idx; |
304 | 308 | ||
305 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { | 309 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) { |
306 | priv->last_blink_time = 0; | 310 | priv->last_blink_time = 0; |
307 | return; | 311 | return; |
308 | } | 312 | } |
309 | if (is_rf_kill(priv)) { | 313 | if (iwl_is_rfkill(priv)) { |
310 | priv->last_blink_time = 0; | 314 | priv->last_blink_time = 0; |
311 | return; | 315 | return; |
312 | } | 316 | } |
313 | 317 | ||
314 | if (!priv->allow_blinking) { | 318 | if (!priv->allow_blinking) { |
315 | priv->last_blink_time = 0; | 319 | priv->last_blink_time = 0; |
316 | if (priv->last_blink_rate != IWL_LED_SOLID) { | 320 | if (priv->last_blink_rate != IWL_SOLID_BLINK_IDX) { |
317 | priv->last_blink_rate = IWL_LED_SOLID; | 321 | priv->last_blink_rate = IWL_SOLID_BLINK_IDX; |
318 | iwl4965_led_on(priv, IWL_LED_LINK); | 322 | iwl4965_led_pattern(priv, IWL_LED_LINK, |
323 | IWL_SOLID_BLINK_IDX); | ||
319 | } | 324 | } |
320 | return; | 325 | return; |
321 | } | 326 | } |
@@ -324,21 +329,14 @@ void iwl_leds_background(struct iwl_priv *priv) | |||
324 | msecs_to_jiffies(1000))) | 329 | msecs_to_jiffies(1000))) |
325 | return; | 330 | return; |
326 | 331 | ||
327 | blink_rate = get_blink_rate(priv); | 332 | blink_idx = iwl_get_blink_rate(priv); |
328 | 333 | ||
329 | /* call only if blink rate change */ | 334 | /* call only if blink rate change */ |
330 | if (blink_rate != priv->last_blink_rate) { | 335 | if (blink_idx != priv->last_blink_rate) |
331 | if (blink_rate != IWL_LED_SOLID) { | 336 | iwl4965_led_pattern(priv, IWL_LED_LINK, blink_idx); |
332 | priv->last_blink_time = jiffies + | ||
333 | msecs_to_jiffies(1000); | ||
334 | iwl4965_led_not_solid(priv, IWL_LED_LINK, blink_rate); | ||
335 | } else { | ||
336 | priv->last_blink_time = 0; | ||
337 | iwl4965_led_on(priv, IWL_LED_LINK); | ||
338 | } | ||
339 | } | ||
340 | 337 | ||
341 | priv->last_blink_rate = blink_rate; | 338 | priv->last_blink_time = jiffies; |
339 | priv->last_blink_rate = blink_idx; | ||
342 | } | 340 | } |
343 | EXPORT_SYMBOL(iwl_leds_background); | 341 | EXPORT_SYMBOL(iwl_leds_background); |
344 | 342 | ||
@@ -346,7 +344,6 @@ EXPORT_SYMBOL(iwl_leds_background); | |||
346 | int iwl_leds_register(struct iwl_priv *priv) | 344 | int iwl_leds_register(struct iwl_priv *priv) |
347 | { | 345 | { |
348 | char *trigger; | 346 | char *trigger; |
349 | char name[32]; | ||
350 | int ret; | 347 | int ret; |
351 | 348 | ||
352 | priv->last_blink_rate = 0; | 349 | priv->last_blink_rate = 0; |
@@ -355,62 +352,60 @@ int iwl_leds_register(struct iwl_priv *priv) | |||
355 | priv->allow_blinking = 0; | 352 | priv->allow_blinking = 0; |
356 | 353 | ||
357 | trigger = ieee80211_get_radio_led_name(priv->hw); | 354 | trigger = ieee80211_get_radio_led_name(priv->hw); |
358 | snprintf(name, sizeof(name), "iwl-%s:radio", | 355 | snprintf(priv->led[IWL_LED_TRG_RADIO].name, |
356 | sizeof(priv->led[IWL_LED_TRG_RADIO].name), "iwl-%s:radio", | ||
359 | wiphy_name(priv->hw->wiphy)); | 357 | wiphy_name(priv->hw->wiphy)); |
360 | 358 | ||
361 | priv->led[IWL_LED_TRG_RADIO].led_on = iwl4965_led_on_reg; | 359 | priv->led[IWL_LED_TRG_RADIO].led_on = iwl4965_led_on_reg; |
362 | priv->led[IWL_LED_TRG_RADIO].led_off = iwl4965_led_off_reg; | 360 | priv->led[IWL_LED_TRG_RADIO].led_off = iwl4965_led_off_reg; |
363 | priv->led[IWL_LED_TRG_RADIO].led_pattern = NULL; | 361 | priv->led[IWL_LED_TRG_RADIO].led_pattern = NULL; |
364 | 362 | ||
365 | ret = iwl_leds_register_led(priv, | 363 | ret = iwl_leds_register_led(priv, &priv->led[IWL_LED_TRG_RADIO], |
366 | &priv->led[IWL_LED_TRG_RADIO], | 364 | IWL_LED_TRG_RADIO, 1, trigger); |
367 | IWL_LED_TRG_RADIO, 1, | ||
368 | name, trigger); | ||
369 | if (ret) | 365 | if (ret) |
370 | goto exit_fail; | 366 | goto exit_fail; |
371 | 367 | ||
372 | trigger = ieee80211_get_assoc_led_name(priv->hw); | 368 | trigger = ieee80211_get_assoc_led_name(priv->hw); |
373 | snprintf(name, sizeof(name), "iwl-%s:assoc", | 369 | snprintf(priv->led[IWL_LED_TRG_ASSOC].name, |
370 | sizeof(priv->led[IWL_LED_TRG_ASSOC].name), "iwl-%s:assoc", | ||
374 | wiphy_name(priv->hw->wiphy)); | 371 | wiphy_name(priv->hw->wiphy)); |
375 | 372 | ||
376 | ret = iwl_leds_register_led(priv, | 373 | ret = iwl_leds_register_led(priv, &priv->led[IWL_LED_TRG_ASSOC], |
377 | &priv->led[IWL_LED_TRG_ASSOC], | 374 | IWL_LED_TRG_ASSOC, 0, trigger); |
378 | IWL_LED_TRG_ASSOC, 0, | 375 | |
379 | name, trigger); | ||
380 | /* for assoc always turn led on */ | 376 | /* for assoc always turn led on */ |
381 | priv->led[IWL_LED_TRG_ASSOC].led_on = iwl4965_led_on_reg; | 377 | priv->led[IWL_LED_TRG_ASSOC].led_on = iwl_led_associate; |
382 | priv->led[IWL_LED_TRG_ASSOC].led_off = iwl4965_led_on_reg; | 378 | priv->led[IWL_LED_TRG_ASSOC].led_off = iwl_led_disassociate; |
383 | priv->led[IWL_LED_TRG_ASSOC].led_pattern = NULL; | 379 | priv->led[IWL_LED_TRG_ASSOC].led_pattern = NULL; |
384 | 380 | ||
385 | if (ret) | 381 | if (ret) |
386 | goto exit_fail; | 382 | goto exit_fail; |
387 | 383 | ||
388 | trigger = ieee80211_get_rx_led_name(priv->hw); | 384 | trigger = ieee80211_get_rx_led_name(priv->hw); |
389 | snprintf(name, sizeof(name), "iwl-%s:RX", | 385 | snprintf(priv->led[IWL_LED_TRG_RX].name, |
386 | sizeof(priv->led[IWL_LED_TRG_RX].name), "iwl-%s:RX", | ||
390 | wiphy_name(priv->hw->wiphy)); | 387 | wiphy_name(priv->hw->wiphy)); |
391 | 388 | ||
389 | ret = iwl_leds_register_led(priv, &priv->led[IWL_LED_TRG_RX], | ||
390 | IWL_LED_TRG_RX, 0, trigger); | ||
392 | 391 | ||
393 | ret = iwl_leds_register_led(priv, | 392 | priv->led[IWL_LED_TRG_RX].led_on = iwl_led_associated; |
394 | &priv->led[IWL_LED_TRG_RX], | 393 | priv->led[IWL_LED_TRG_RX].led_off = iwl_led_associated; |
395 | IWL_LED_TRG_RX, 0, | ||
396 | name, trigger); | ||
397 | |||
398 | priv->led[IWL_LED_TRG_RX].led_on = iwl4965_led_associated; | ||
399 | priv->led[IWL_LED_TRG_RX].led_off = iwl4965_led_associated; | ||
400 | priv->led[IWL_LED_TRG_RX].led_pattern = iwl4965_led_pattern; | 394 | priv->led[IWL_LED_TRG_RX].led_pattern = iwl4965_led_pattern; |
401 | 395 | ||
402 | if (ret) | 396 | if (ret) |
403 | goto exit_fail; | 397 | goto exit_fail; |
404 | 398 | ||
405 | trigger = ieee80211_get_tx_led_name(priv->hw); | 399 | trigger = ieee80211_get_tx_led_name(priv->hw); |
406 | snprintf(name, sizeof(name), "iwl-%s:TX", | 400 | snprintf(priv->led[IWL_LED_TRG_TX].name, |
401 | sizeof(priv->led[IWL_LED_TRG_TX].name), "iwl-%s:TX", | ||
407 | wiphy_name(priv->hw->wiphy)); | 402 | wiphy_name(priv->hw->wiphy)); |
408 | ret = iwl_leds_register_led(priv, | 403 | |
409 | &priv->led[IWL_LED_TRG_TX], | 404 | ret = iwl_leds_register_led(priv, &priv->led[IWL_LED_TRG_TX], |
410 | IWL_LED_TRG_TX, 0, | 405 | IWL_LED_TRG_TX, 0, trigger); |
411 | name, trigger); | 406 | |
412 | priv->led[IWL_LED_TRG_TX].led_on = iwl4965_led_associated; | 407 | priv->led[IWL_LED_TRG_TX].led_on = iwl_led_associated; |
413 | priv->led[IWL_LED_TRG_TX].led_off = iwl4965_led_associated; | 408 | priv->led[IWL_LED_TRG_TX].led_off = iwl_led_associated; |
414 | priv->led[IWL_LED_TRG_TX].led_pattern = iwl4965_led_pattern; | 409 | priv->led[IWL_LED_TRG_TX].led_pattern = iwl4965_led_pattern; |
415 | 410 | ||
416 | if (ret) | 411 | if (ret) |
@@ -425,7 +420,7 @@ exit_fail: | |||
425 | EXPORT_SYMBOL(iwl_leds_register); | 420 | EXPORT_SYMBOL(iwl_leds_register); |
426 | 421 | ||
427 | /* unregister led class */ | 422 | /* unregister led class */ |
428 | static void iwl_leds_unregister_led(struct iwl4965_led *led, u8 set_led) | 423 | static void iwl_leds_unregister_led(struct iwl_led *led, u8 set_led) |
429 | { | 424 | { |
430 | if (!led->registered) | 425 | if (!led->registered) |
431 | return; | 426 | return; |