Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Linux-御风守护者
linux
提交
cf6856d6
L
linux
项目概览
Linux-御风守护者
/
linux
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
cf6856d6
编写于
3月 14, 2012
作者:
B
Bryan Wu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ARM: mach-footbridge: retire custom LED code
Signed-off-by:
N
Bryan Wu
<
bryan.wu@canonical.com
>
上级
3dd6b990
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
179 addition
and
294 deletion
+179
-294
arch/arm/mach-footbridge/Makefile
arch/arm/mach-footbridge/Makefile
+0
-4
arch/arm/mach-footbridge/ebsa285-leds.c
arch/arm/mach-footbridge/ebsa285-leds.c
+0
-138
arch/arm/mach-footbridge/ebsa285.c
arch/arm/mach-footbridge/ebsa285.c
+81
-0
arch/arm/mach-footbridge/netwinder-hw.c
arch/arm/mach-footbridge/netwinder-hw.c
+98
-14
arch/arm/mach-footbridge/netwinder-leds.c
arch/arm/mach-footbridge/netwinder-leds.c
+0
-138
未找到文件。
arch/arm/mach-footbridge/Makefile
浏览文件 @
cf6856d6
...
...
@@ -14,15 +14,11 @@ pci-$(CONFIG_ARCH_EBSA285_HOST) += ebsa285-pci.o
pci-$(CONFIG_ARCH_NETWINDER)
+=
netwinder-pci.o
pci-$(CONFIG_ARCH_PERSONAL_SERVER)
+=
personal-pci.o
leds-$(CONFIG_ARCH_EBSA285)
+=
ebsa285-leds.o
leds-$(CONFIG_ARCH_NETWINDER)
+=
netwinder-leds.o
obj-$(CONFIG_ARCH_CATS)
+=
cats-hw.o isa-timer.o
obj-$(CONFIG_ARCH_EBSA285)
+=
ebsa285.o dc21285-timer.o
obj-$(CONFIG_ARCH_NETWINDER)
+=
netwinder-hw.o isa-timer.o
obj-$(CONFIG_ARCH_PERSONAL_SERVER)
+=
personal.o dc21285-timer.o
obj-$(CONFIG_PCI)
+=
$
(
pci-y
)
obj-$(CONFIG_LEDS)
+=
$
(
leds-y
)
obj-$(CONFIG_ISA)
+=
isa.o isa-rtc.o
arch/arm/mach-footbridge/ebsa285-leds.c
已删除
100644 → 0
浏览文件 @
3dd6b990
/*
* linux/arch/arm/mach-footbridge/ebsa285-leds.c
*
* Copyright (C) 1998-1999 Russell King
*
* 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.
* EBSA-285 control routines.
*
* The EBSA-285 uses the leds as follows:
* - Green - toggles state every 50 timer interrupts
* - Amber - On if system is not idle
* - Red - currently unused
*
* Changelog:
* 02-05-1999 RMK Various cleanups
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/spinlock.h>
#include <mach/hardware.h>
#include <asm/leds.h>
#include <asm/mach-types.h>
#define LED_STATE_ENABLED 1
#define LED_STATE_CLAIMED 2
static
char
led_state
;
static
char
hw_led_state
;
static
DEFINE_SPINLOCK
(
leds_lock
);
static
void
ebsa285_leds_event
(
led_event_t
evt
)
{
unsigned
long
flags
;
spin_lock_irqsave
(
&
leds_lock
,
flags
);
switch
(
evt
)
{
case
led_start
:
hw_led_state
=
XBUS_LED_RED
|
XBUS_LED_GREEN
;
#ifndef CONFIG_LEDS_CPU
hw_led_state
|=
XBUS_LED_AMBER
;
#endif
led_state
|=
LED_STATE_ENABLED
;
break
;
case
led_stop
:
led_state
&=
~
LED_STATE_ENABLED
;
break
;
case
led_claim
:
led_state
|=
LED_STATE_CLAIMED
;
hw_led_state
=
XBUS_LED_RED
|
XBUS_LED_GREEN
|
XBUS_LED_AMBER
;
break
;
case
led_release
:
led_state
&=
~
LED_STATE_CLAIMED
;
hw_led_state
=
XBUS_LED_RED
|
XBUS_LED_GREEN
|
XBUS_LED_AMBER
;
break
;
#ifdef CONFIG_LEDS_TIMER
case
led_timer
:
if
(
!
(
led_state
&
LED_STATE_CLAIMED
))
hw_led_state
^=
XBUS_LED_GREEN
;
break
;
#endif
#ifdef CONFIG_LEDS_CPU
case
led_idle_start
:
if
(
!
(
led_state
&
LED_STATE_CLAIMED
))
hw_led_state
|=
XBUS_LED_AMBER
;
break
;
case
led_idle_end
:
if
(
!
(
led_state
&
LED_STATE_CLAIMED
))
hw_led_state
&=
~
XBUS_LED_AMBER
;
break
;
#endif
case
led_halted
:
if
(
!
(
led_state
&
LED_STATE_CLAIMED
))
hw_led_state
&=
~
XBUS_LED_RED
;
break
;
case
led_green_on
:
if
(
led_state
&
LED_STATE_CLAIMED
)
hw_led_state
&=
~
XBUS_LED_GREEN
;
break
;
case
led_green_off
:
if
(
led_state
&
LED_STATE_CLAIMED
)
hw_led_state
|=
XBUS_LED_GREEN
;
break
;
case
led_amber_on
:
if
(
led_state
&
LED_STATE_CLAIMED
)
hw_led_state
&=
~
XBUS_LED_AMBER
;
break
;
case
led_amber_off
:
if
(
led_state
&
LED_STATE_CLAIMED
)
hw_led_state
|=
XBUS_LED_AMBER
;
break
;
case
led_red_on
:
if
(
led_state
&
LED_STATE_CLAIMED
)
hw_led_state
&=
~
XBUS_LED_RED
;
break
;
case
led_red_off
:
if
(
led_state
&
LED_STATE_CLAIMED
)
hw_led_state
|=
XBUS_LED_RED
;
break
;
default:
break
;
}
if
(
led_state
&
LED_STATE_ENABLED
)
*
XBUS_LEDS
=
hw_led_state
;
spin_unlock_irqrestore
(
&
leds_lock
,
flags
);
}
static
int
__init
leds_init
(
void
)
{
if
(
machine_is_ebsa285
())
leds_event
=
ebsa285_leds_event
;
leds_event
(
led_start
);
return
0
;
}
__initcall
(
leds_init
);
arch/arm/mach-footbridge/ebsa285.c
浏览文件 @
cf6856d6
...
...
@@ -5,6 +5,8 @@
*/
#include <linux/init.h>
#include <linux/spinlock.h>
#include <linux/slab.h>
#include <linux/leds.h>
#include <asm/hardware/dec21285.h>
#include <asm/mach-types.h>
...
...
@@ -13,6 +15,85 @@
#include "common.h"
/* LEDs */
#if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS)
struct
ebsa285_led
{
struct
led_classdev
cdev
;
u8
mask
;
};
/*
* The triggers lines up below will only be used if the
* LED triggers are compiled in.
*/
static
const
struct
{
const
char
*
name
;
const
char
*
trigger
;
}
ebsa285_leds
[]
=
{
{
"ebsa285:amber"
,
"heartbeat"
,
},
{
"ebsa285:green"
,
"cpu0"
,
},
{
"ebsa285:red"
,},
};
static
void
ebsa285_led_set
(
struct
led_classdev
*
cdev
,
enum
led_brightness
b
)
{
struct
ebsa285_led
*
led
=
container_of
(
cdev
,
struct
ebsa285_led
,
cdev
);
if
(
b
!=
LED_OFF
)
*
XBUS_LEDS
|=
led
->
mask
;
else
*
XBUS_LEDS
&=
~
led
->
mask
;
}
static
enum
led_brightness
ebsa285_led_get
(
struct
led_classdev
*
cdev
)
{
struct
ebsa285_led
*
led
=
container_of
(
cdev
,
struct
ebsa285_led
,
cdev
);
return
(
*
XBUS_LEDS
&
led
->
mask
)
?
LED_FULL
:
LED_OFF
;
}
static
int
__init
ebsa285_leds_init
(
void
)
{
int
i
;
if
(
machine_is_ebsa285
())
return
-
ENODEV
;
/* 3 LEDS All ON */
*
XBUS_LEDS
|=
XBUS_LED_AMBER
|
XBUS_LED_GREEN
|
XBUS_LED_RED
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
ebsa285_leds
);
i
++
)
{
struct
ebsa285_led
*
led
;
led
=
kzalloc
(
sizeof
(
*
led
),
GFP_KERNEL
);
if
(
!
led
)
break
;
led
->
cdev
.
name
=
ebsa285_leds
[
i
].
name
;
led
->
cdev
.
brightness_set
=
ebsa285_led_set
;
led
->
cdev
.
brightness_get
=
ebsa285_led_get
;
led
->
cdev
.
default_trigger
=
ebsa285_leds
[
i
].
trigger
;
led
->
mask
=
BIT
(
i
);
if
(
led_classdev_register
(
NULL
,
&
led
->
cdev
)
<
0
)
{
kfree
(
led
);
break
;
}
}
return
0
;
}
/*
* Since we may have triggers on any subsystem, defer registration
* until after subsystem_init.
*/
fs_initcall
(
ebsa285_leds_init
);
#endif
MACHINE_START
(
EBSA285
,
"EBSA285"
)
/* Maintainer: Russell King */
.
atag_offset
=
0x100
,
...
...
arch/arm/mach-footbridge/netwinder-hw.c
浏览文件 @
cf6856d6
...
...
@@ -12,9 +12,10 @@
#include <linux/init.h>
#include <linux/io.h>
#include <linux/spinlock.h>
#include <linux/slab.h>
#include <linux/leds.h>
#include <asm/hardware/dec21285.h>
#include <asm/leds.h>
#include <asm/mach-types.h>
#include <asm/setup.h>
#include <asm/system_misc.h>
...
...
@@ -27,13 +28,6 @@
#define GP1_IO_BASE 0x338
#define GP2_IO_BASE 0x33a
#ifdef CONFIG_LEDS
#define DEFAULT_LEDS 0
#else
#define DEFAULT_LEDS GPIO_GREEN_LED
#endif
/*
* Winbond WB83977F accessibility stuff
*/
...
...
@@ -611,15 +605,9 @@ static void __init rwa010_init(void)
static
int
__init
nw_hw_init
(
void
)
{
if
(
machine_is_netwinder
())
{
unsigned
long
flags
;
wb977_init
();
cpld_init
();
rwa010_init
();
raw_spin_lock_irqsave
(
&
nw_gpio_lock
,
flags
);
nw_gpio_modify_op
(
GPIO_RED_LED
|
GPIO_GREEN_LED
,
DEFAULT_LEDS
);
raw_spin_unlock_irqrestore
(
&
nw_gpio_lock
,
flags
);
}
return
0
;
}
...
...
@@ -672,6 +660,102 @@ static void netwinder_restart(char mode, const char *cmd)
}
}
/* LEDs */
#if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS)
struct
netwinder_led
{
struct
led_classdev
cdev
;
u8
mask
;
};
/*
* The triggers lines up below will only be used if the
* LED triggers are compiled in.
*/
static
const
struct
{
const
char
*
name
;
const
char
*
trigger
;
}
netwinder_leds
[]
=
{
{
"netwinder:green"
,
"heartbeat"
,
},
{
"netwinder:red"
,
"cpu0"
,
},
};
/*
* The LED control in Netwinder is reversed:
* - setting bit means turn off LED
* - clearing bit means turn on LED
*/
static
void
netwinder_led_set
(
struct
led_classdev
*
cdev
,
enum
led_brightness
b
)
{
struct
netwinder_led
*
led
=
container_of
(
cdev
,
struct
netwinder_led
,
cdev
);
unsigned
long
flags
;
u32
reg
;
spin_lock_irqsave
(
&
nw_gpio_lock
,
flags
);
reg
=
nw_gpio_read
();
if
(
b
!=
LED_OFF
)
reg
&=
~
led
->
mask
;
else
reg
|=
led
->
mask
;
nw_gpio_modify_op
(
led
->
mask
,
reg
);
spin_unlock_irqrestore
(
&
nw_gpio_lock
,
flags
);
}
static
enum
led_brightness
netwinder_led_get
(
struct
led_classdev
*
cdev
)
{
struct
netwinder_led
*
led
=
container_of
(
cdev
,
struct
netwinder_led
,
cdev
);
unsigned
long
flags
;
u32
reg
;
spin_lock_irqsave
(
&
nw_gpio_lock
,
flags
);
reg
=
nw_gpio_read
();
spin_unlock_irqrestore
(
&
nw_gpio_lock
,
flags
);
return
(
reg
&
led
->
mask
)
?
LED_OFF
:
LED_FULL
;
}
static
int
__init
netwinder_leds_init
(
void
)
{
int
i
;
if
(
!
machine_is_netwinder
())
return
-
ENODEV
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
netwinder_leds
);
i
++
)
{
struct
netwinder_led
*
led
;
led
=
kzalloc
(
sizeof
(
*
led
),
GFP_KERNEL
);
if
(
!
led
)
break
;
led
->
cdev
.
name
=
netwinder_leds
[
i
].
name
;
led
->
cdev
.
brightness_set
=
netwinder_led_set
;
led
->
cdev
.
brightness_get
=
netwinder_led_get
;
led
->
cdev
.
default_trigger
=
netwinder_leds
[
i
].
trigger
;
if
(
i
==
0
)
led
->
mask
=
GPIO_GREEN_LED
;
else
led
->
mask
=
GPIO_RED_LED
;
if
(
led_classdev_register
(
NULL
,
&
led
->
cdev
)
<
0
)
{
kfree
(
led
);
break
;
}
}
return
0
;
}
/*
* Since we may have triggers on any subsystem, defer registration
* until after subsystem_init.
*/
fs_initcall
(
netwinder_leds_init
);
#endif
MACHINE_START
(
NETWINDER
,
"Rebel-NetWinder"
)
/* Maintainer: Russell King/Rebel.com */
.
atag_offset
=
0x100
,
...
...
arch/arm/mach-footbridge/netwinder-leds.c
已删除
100644 → 0
浏览文件 @
3dd6b990
/*
* linux/arch/arm/mach-footbridge/netwinder-leds.c
*
* Copyright (C) 1998-1999 Russell King
*
* 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.
*
* NetWinder LED control routines.
*
* The Netwinder uses the leds as follows:
* - Green - toggles state every 50 timer interrupts
* - Red - On if the system is not idle
*
* Changelog:
* 02-05-1999 RMK Various cleanups
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/spinlock.h>
#include <mach/hardware.h>
#include <asm/leds.h>
#include <asm/mach-types.h>
#define LED_STATE_ENABLED 1
#define LED_STATE_CLAIMED 2
static
char
led_state
;
static
char
hw_led_state
;
static
DEFINE_RAW_SPINLOCK
(
leds_lock
);
static
void
netwinder_leds_event
(
led_event_t
evt
)
{
unsigned
long
flags
;
raw_spin_lock_irqsave
(
&
leds_lock
,
flags
);
switch
(
evt
)
{
case
led_start
:
led_state
|=
LED_STATE_ENABLED
;
hw_led_state
=
GPIO_GREEN_LED
;
break
;
case
led_stop
:
led_state
&=
~
LED_STATE_ENABLED
;
break
;
case
led_claim
:
led_state
|=
LED_STATE_CLAIMED
;
hw_led_state
=
0
;
break
;
case
led_release
:
led_state
&=
~
LED_STATE_CLAIMED
;
hw_led_state
=
0
;
break
;
#ifdef CONFIG_LEDS_TIMER
case
led_timer
:
if
(
!
(
led_state
&
LED_STATE_CLAIMED
))
hw_led_state
^=
GPIO_GREEN_LED
;
break
;
#endif
#ifdef CONFIG_LEDS_CPU
case
led_idle_start
:
if
(
!
(
led_state
&
LED_STATE_CLAIMED
))
hw_led_state
&=
~
GPIO_RED_LED
;
break
;
case
led_idle_end
:
if
(
!
(
led_state
&
LED_STATE_CLAIMED
))
hw_led_state
|=
GPIO_RED_LED
;
break
;
#endif
case
led_halted
:
if
(
!
(
led_state
&
LED_STATE_CLAIMED
))
hw_led_state
|=
GPIO_RED_LED
;
break
;
case
led_green_on
:
if
(
led_state
&
LED_STATE_CLAIMED
)
hw_led_state
|=
GPIO_GREEN_LED
;
break
;
case
led_green_off
:
if
(
led_state
&
LED_STATE_CLAIMED
)
hw_led_state
&=
~
GPIO_GREEN_LED
;
break
;
case
led_amber_on
:
if
(
led_state
&
LED_STATE_CLAIMED
)
hw_led_state
|=
GPIO_GREEN_LED
|
GPIO_RED_LED
;
break
;
case
led_amber_off
:
if
(
led_state
&
LED_STATE_CLAIMED
)
hw_led_state
&=
~
(
GPIO_GREEN_LED
|
GPIO_RED_LED
);
break
;
case
led_red_on
:
if
(
led_state
&
LED_STATE_CLAIMED
)
hw_led_state
|=
GPIO_RED_LED
;
break
;
case
led_red_off
:
if
(
led_state
&
LED_STATE_CLAIMED
)
hw_led_state
&=
~
GPIO_RED_LED
;
break
;
default:
break
;
}
raw_spin_unlock_irqrestore
(
&
leds_lock
,
flags
);
if
(
led_state
&
LED_STATE_ENABLED
)
{
raw_spin_lock_irqsave
(
&
nw_gpio_lock
,
flags
);
nw_gpio_modify_op
(
GPIO_RED_LED
|
GPIO_GREEN_LED
,
hw_led_state
);
raw_spin_unlock_irqrestore
(
&
nw_gpio_lock
,
flags
);
}
}
static
int
__init
leds_init
(
void
)
{
if
(
machine_is_netwinder
())
leds_event
=
netwinder_leds_event
;
leds_event
(
led_start
);
return
0
;
}
__initcall
(
leds_init
);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录