summaryrefslogtreecommitdiffstats
path: root/target/linux/ifxmips/files
diff options
context:
space:
mode:
authorblogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-12-25 12:04:08 +0000
committerblogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-12-25 12:04:08 +0000
commit7c0deb5e1c479c5747a24abc4caf008b504e520e (patch)
treec17941467de4bfef4500703f3e87d296612e905e /target/linux/ifxmips/files
parent7654e9a41952efeed72980460037870c84c51e75 (diff)
make ifxmips led driver a platform device
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@9920 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ifxmips/files')
-rw-r--r--target/linux/ifxmips/files/drivers/char/ifxmips_led.c78
1 files changed, 53 insertions, 25 deletions
diff --git a/target/linux/ifxmips/files/drivers/char/ifxmips_led.c b/target/linux/ifxmips/files/drivers/char/ifxmips_led.c
index b0b8e8289..15c173b08 100644
--- a/target/linux/ifxmips/files/drivers/char/ifxmips_led.c
+++ b/target/linux/ifxmips/files/drivers/char/ifxmips_led.c
@@ -24,6 +24,7 @@
#include <linux/types.h>
#include <linux/fs.h>
#include <linux/init.h>
+#include <linux/platform_device.h>
#include <asm/uaccess.h>
#include <asm/unistd.h>
#include <linux/errno.h>
@@ -31,12 +32,14 @@
#include <asm/ifxmips/ifxmips_gpio.h>
#include <asm/ifxmips/ifxmips_pmu.h>
-#define IFXMIPS_LED_CLK_EDGE IFXMIPS_LED_FALLING
+#define DRVNAME "ifxmips_led"
+
+#define IFXMIPS_LED_CLK_EDGE IFXMIPS_LED_FALLING
//#define IFXMIPS_LED_CLK_EDGE IFXMIPS_LED_RISING
#define IFXMIPS_LED_SPEED IFXMIPS_LED_8HZ
-#define IFXMIPS_LED_GPIO_PORT 0
+#define IFXMIPS_LED_GPIO_PORT 0
static int ifxmips_led_major;
@@ -118,27 +121,8 @@ static struct file_operations ifxmips_led_fops = {
.release = led_release
};
-
-/*
-Map for LED on reference board
- WLAN_READ LED11 OUT1 15
- WARNING LED12 OUT2 14
- FXS1_LINK LED13 OUT3 13
- FXS2_LINK LED14 OUT4 12
- FXO_ACT LED15 OUT5 11
- USB_LINK LED16 OUT6 10
- ADSL2_LINK LED19 OUT7 9
- BT_LINK LED17 OUT8 8
- SD_LINK LED20 OUT9 7
- ADSL2_TRAFFIC LED31 OUT16 0
-Map for hardware relay on reference board
- USB Power On OUT11 5
- RELAY OUT12 4
-*/
-
-
-int __init
-ifxmips_led_init (void)
+static int
+ifxmips_led_probe(struct platform_device *dev)
{
int ret = 0;
@@ -181,16 +165,60 @@ ifxmips_led_init (void)
goto out;
}
- printk(KERN_INFO "ifxmips_led : device registered on major %d\n", ifxmips_led_major);
+ printk(KERN_INFO "ifxmips_led: device successfully initialized #%d.\n", ifxmips_led_major);
out:
return ret;
}
+static int
+ifxmips_led_remove(struct platform_device *pdev)
+{
+ unregister_chrdev(ifxmips_led_major, "ifxmips_led");
+ return 0;
+}
+
+static struct
+platform_driver ifxmips_led_driver = {
+ .probe = ifxmips_led_probe,
+ .remove = ifxmips_led_remove,
+ .driver = {
+ .name = DRVNAME,
+ .owner = THIS_MODULE,
+ },
+};
+
+/*
+Map for LED on reference board
+ WLAN_READ LED11 OUT1 15
+ WARNING LED12 OUT2 14
+ FXS1_LINK LED13 OUT3 13
+ FXS2_LINK LED14 OUT4 12
+ FXO_ACT LED15 OUT5 11
+ USB_LINK LED16 OUT6 10
+ ADSL2_LINK LED19 OUT7 9
+ BT_LINK LED17 OUT8 8
+ SD_LINK LED20 OUT9 7
+ ADSL2_TRAFFIC LED31 OUT16 0
+Map for hardware relay on reference board
+ USB Power On OUT11 5
+ RELAY OUT12 4
+*/
+
+int __init
+ifxmips_led_init (void)
+{
+ int ret = platform_driver_register(&ifxmips_led_driver);
+ if (ret)
+ printk(KERN_INFO "ifxmips_led: Error registering platfom driver!");
+
+ return ret;
+}
+
void __exit
ifxmips_led_exit (void)
{
- unregister_chrdev(ifxmips_led_major, "ifxmips_led");
+ platform_driver_unregister(&ifxmips_led_driver);
}
module_init(ifxmips_led_init);