blob: 99414dce04374dd69e2f78fed703bafb0ea718ce (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
/*
* arch/arm/mach-ns9xxx/leds.c
*
* Copyright (C) 2008 by Digi International Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*/
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/gpio.h>
#include <asm/leds.h>
#include <mach/module.h>
static void cc9p9215_leds_event(led_event_t evt)
{
switch(evt) {
case led_idle_start:
gpio_set_value(89, 1);
break;
case led_idle_end:
gpio_set_value(89, 0);
break;
case led_green_on:
if (module_is_ccw9p9215())
gpio_set_value(88, 0);
break;
case led_green_off:
if (module_is_ccw9p9215())
gpio_set_value(88, 1);
break;
default:
break;
}
}
static int __init ns9xxx_init_leds(void)
{
int ret;
if (!module_is_cc9p9215() && !module_is_ccw9p9215())
return -ENODEV;
ret = gpio_request(89, "idle led");
if (ret)
return ret;
if (module_is_ccw9p9215()) {
ret = gpio_request(88, "wifi led");
if (ret)
return ret;
/* switch the led, just in case it were on */
gpio_set_value(88, 1);
}
leds_event = cc9p9215_leds_event;
return 0;
}
device_initcall(ns9xxx_init_leds);
|