Use myloader parser in the adm5120 mtd driver. Do not use EXPORT_SYMBOL in myloader...
[openwrt.git] / target / linux / adm5120-2.6 / files / drivers / char / adm5120_gpio.c
1 /*
2 * ADM5120 LED (GPIO) driver
3 *
4 * Copyright (C) Jeroen Vreeken (pe1rxq@amsat.org), 2005
5 */
6
7 #include <linux/autoconf.h>
8 #include <linux/module.h>
9 #include <linux/kernel.h>
10 #include <linux/miscdevice.h>
11 #include <linux/fs.h>
12
13 #define LED_MINOR 151
14 #define GPIO_IO ((unsigned long *)0xb20000b8)
15
16 static ssize_t adm5120_led_write(struct file *file, const char __user *data,
17 size_t len, loff_t *ppos)
18 {
19 unsigned char val;
20
21 if (!len || get_user(val, data))
22 return -EFAULT;
23 *GPIO_IO=(*GPIO_IO & 0x00ffffff) | (val<<24);
24 return 1;
25 }
26
27 static struct file_operations adm5120_led_fops = {
28 .owner = THIS_MODULE,
29 .write = adm5120_led_write,
30 };
31
32 static struct miscdevice adm5120_led_device = {
33 LED_MINOR,
34 "led",
35 &adm5120_led_fops,
36 };
37
38 static int __init adm5120_led_init(void)
39 {
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);
43 return -EBUSY;
44 }
45 return 0;
46 }
47
48 static void __exit adm5120_led_exit(void)
49 {
50 misc_deregister(&adm5120_led_device);
51 }
52
53 module_init(adm5120_led_init);
54 module_exit(adm5120_led_exit);
55
56 MODULE_DESCRIPTION("ADM5120 LED and GPIO driver");
57 MODULE_AUTHOR("Jeroen Vreeken");
58 MODULE_LICENSE("GPL");
This page took 0.044954 seconds and 5 git commands to generate.