diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2005-09-11 05:27:23 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-09-11 05:27:23 -0400 |
commit | 48c92022ad264cb8084cee78a499f183b264e45f (patch) | |
tree | 2d888fb2a7663d0d7130f1d82f231f335d757fcb /drivers/mfd | |
parent | acb45439a89c6830349c02405f00a7208db0a66b (diff) |
[MFD] Add code UCB1200/UCB1300 assabet platform support
Add support for Intel assabet specific board support for
UCB1200/UCB1300 devices.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/Makefile | 4 | ||||
-rw-r--r-- | drivers/mfd/ucb1x00-assabet.c | 73 |
2 files changed, 77 insertions, 0 deletions
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index a05cd1599a70..adb29b5368a8 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile | |||
@@ -6,3 +6,7 @@ obj-$(CONFIG_MCP) += mcp-core.o | |||
6 | obj-$(CONFIG_MCP_SA11X0) += mcp-sa11x0.o | 6 | obj-$(CONFIG_MCP_SA11X0) += mcp-sa11x0.o |
7 | obj-$(CONFIG_MCP_UCB1200) += ucb1x00-core.o | 7 | obj-$(CONFIG_MCP_UCB1200) += ucb1x00-core.o |
8 | obj-$(CONFIG_MCP_UCB1200_TS) += ucb1x00-ts.o | 8 | obj-$(CONFIG_MCP_UCB1200_TS) += ucb1x00-ts.o |
9 | |||
10 | ifeq ($(CONFIG_SA1100_ASSABET),y) | ||
11 | obj-$(CONFIG_MCP_UCB1200) += ucb1x00-assabet.o | ||
12 | endif | ||
diff --git a/drivers/mfd/ucb1x00-assabet.c b/drivers/mfd/ucb1x00-assabet.c new file mode 100644 index 000000000000..e325fa71f38b --- /dev/null +++ b/drivers/mfd/ucb1x00-assabet.c | |||
@@ -0,0 +1,73 @@ | |||
1 | /* | ||
2 | * linux/drivers/mfd/ucb1x00-assabet.c | ||
3 | * | ||
4 | * Copyright (C) 2001-2003 Russell King, All Rights Reserved. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License. | ||
9 | * | ||
10 | * We handle the machine-specific bits of the UCB1x00 driver here. | ||
11 | */ | ||
12 | #include <linux/module.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/fs.h> | ||
15 | #include <linux/proc_fs.h> | ||
16 | #include <linux/device.h> | ||
17 | |||
18 | #include <asm/dma.h> | ||
19 | |||
20 | #include "ucb1x00.h" | ||
21 | |||
22 | #define UCB1X00_ATTR(name,input)\ | ||
23 | static ssize_t name##_show(struct class_device *dev, char *buf) \ | ||
24 | { \ | ||
25 | struct ucb1x00 *ucb = classdev_to_ucb1x00(dev); \ | ||
26 | int val; \ | ||
27 | ucb1x00_adc_enable(ucb); \ | ||
28 | val = ucb1x00_adc_read(ucb, input, UCB_NOSYNC); \ | ||
29 | ucb1x00_adc_disable(ucb); \ | ||
30 | return sprintf(buf, "%d\n", val); \ | ||
31 | } \ | ||
32 | static CLASS_DEVICE_ATTR(name,0444,name##_show,NULL) | ||
33 | |||
34 | UCB1X00_ATTR(vbatt, UCB_ADC_INP_AD1); | ||
35 | UCB1X00_ATTR(vcharger, UCB_ADC_INP_AD0); | ||
36 | UCB1X00_ATTR(batt_temp, UCB_ADC_INP_AD2); | ||
37 | |||
38 | static int ucb1x00_assabet_add(struct ucb1x00_dev *dev) | ||
39 | { | ||
40 | class_device_create_file(&dev->ucb->cdev, &class_device_attr_vbatt); | ||
41 | class_device_create_file(&dev->ucb->cdev, &class_device_attr_vcharger); | ||
42 | class_device_create_file(&dev->ucb->cdev, &class_device_attr_batt_temp); | ||
43 | return 0; | ||
44 | } | ||
45 | |||
46 | static void ucb1x00_assabet_remove(struct ucb1x00_dev *dev) | ||
47 | { | ||
48 | class_device_remove_file(&dev->ucb->cdev, &class_device_attr_batt_temp); | ||
49 | class_device_remove_file(&dev->ucb->cdev, &class_device_attr_vcharger); | ||
50 | class_device_remove_file(&dev->ucb->cdev, &class_device_attr_vbatt); | ||
51 | } | ||
52 | |||
53 | static struct ucb1x00_driver ucb1x00_assabet_driver = { | ||
54 | .add = ucb1x00_assabet_add, | ||
55 | .remove = ucb1x00_assabet_remove, | ||
56 | }; | ||
57 | |||
58 | static int __init ucb1x00_assabet_init(void) | ||
59 | { | ||
60 | return ucb1x00_register_driver(&ucb1x00_assabet_driver); | ||
61 | } | ||
62 | |||
63 | static void __exit ucb1x00_assabet_exit(void) | ||
64 | { | ||
65 | ucb1x00_unregister_driver(&ucb1x00_assabet_driver); | ||
66 | } | ||
67 | |||
68 | module_init(ucb1x00_assabet_init); | ||
69 | module_exit(ucb1x00_assabet_exit); | ||
70 | |||
71 | MODULE_AUTHOR("Russell King <rmk@arm.linux.org.uk>"); | ||
72 | MODULE_DESCRIPTION("Assabet noddy testing only example ADC driver"); | ||
73 | MODULE_LICENSE("GPL"); | ||