2 * ADM5120 LED (GPIO) driver
4 * Copyright (C) Jeroen Vreeken (pe1rxq@amsat.org), 2005
7 #include <linux/autoconf.h>
8 #include <linux/module.h>
9 #include <linux/kernel.h>
10 #include <linux/miscdevice.h>
14 #define GPIO_IO ((unsigned long *)0xb20000b8)
16 static ssize_t
adm5120_led_write(struct file
*file
, const char __user
*data
,
17 size_t len
, loff_t
*ppos
)
21 if (!len
|| get_user(val
, data
))
23 *GPIO_IO
=(*GPIO_IO
& 0x00ffffff) | (val
<<24);
27 static struct file_operations adm5120_led_fops
= {
29 .write
= adm5120_led_write
,
32 static struct miscdevice adm5120_led_device
= {
38 static int __init
adm5120_led_init(void)
40 printk(KERN_INFO
"ADM5120 LED & GPIO driver\n");
41 if (misc_register(&adm5120_led_device
)) {
42 printk(KERN_WARNING
"Couldn't register device %d\n", LED_MINOR
);
48 static void __exit
adm5120_led_exit(void)
50 misc_deregister(&adm5120_led_device
);
53 module_init(adm5120_led_init
);
54 module_exit(adm5120_led_exit
);
56 MODULE_DESCRIPTION("ADM5120 LED and GPIO driver");
57 MODULE_AUTHOR("Jeroen Vreeken");
58 MODULE_LICENSE("GPL");