aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/input/misc/Kconfig10
-rw-r--r--drivers/input/misc/Makefile2
-rw-r--r--drivers/input/misc/sgi_btns.c (renamed from drivers/input/misc/sgio2_btns.c)74
3 files changed, 54 insertions, 32 deletions
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index e33d7cbcb1df..e99b7882f382 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -189,15 +189,15 @@ config INPUT_UINPUT
189 To compile this driver as a module, choose M here: the 189 To compile this driver as a module, choose M here: the
190 module will be called uinput. 190 module will be called uinput.
191 191
192config INPUT_SGIO2_BTNS 192config INPUT_SGI_BTNS
193 tristate "SGI O2 volume button interface" 193 tristate "SGI Indy/O2 volume button interface"
194 depends on SGI_IP32 194 depends on SGI_IP22 || SGI_IP32
195 select INPUT_POLLDEV 195 select INPUT_POLLDEV
196 help 196 help
197 Say Y here if you want to support SGI O2 volume button interface. 197 Say Y here if you want to support SGI Indy/O2 volume button interface.
198 198
199 To compile this driver as a module, choose M here: the 199 To compile this driver as a module, choose M here: the
200 module will be called sgio_btns. 200 module will be called sgi_btns.
201 201
202config HP_SDC_RTC 202config HP_SDC_RTC
203 tristate "HP SDC Real Time Clock" 203 tristate "HP SDC Real Time Clock"
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index 0e274f19bcb3..f48009b52226 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -19,4 +19,4 @@ obj-$(CONFIG_INPUT_YEALINK) += yealink.o
19obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o 19obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o
20obj-$(CONFIG_INPUT_UINPUT) += uinput.o 20obj-$(CONFIG_INPUT_UINPUT) += uinput.o
21obj-$(CONFIG_INPUT_APANEL) += apanel.o 21obj-$(CONFIG_INPUT_APANEL) += apanel.o
22obj-$(CONFIG_INPUT_SGIO2_BTNS) += sgio2_btns.o 22obj-$(CONFIG_INPUT_SGI_BTNS) += sgi_btns.o
diff --git a/drivers/input/misc/sgio2_btns.c b/drivers/input/misc/sgi_btns.c
index b1ab43d903dd..ce238f59b3c8 100644
--- a/drivers/input/misc/sgio2_btns.c
+++ b/drivers/input/misc/sgi_btns.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * SGI O2 Volume Button interface driver 2 * SGI Volume Button interface driver
3 * 3 *
4 * Copyright (C) 2008 Thomas Bogendoerfer <tsbogend@alpha.franken.de> 4 * Copyright (C) 2008 Thomas Bogendoerfer <tsbogend@alpha.franken.de>
5 * 5 *
@@ -23,35 +23,57 @@
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25 25
26#ifdef CONFIG_SGI_IP22
27#include <asm/sgi/ioc.h>
28
29static inline u8 button_status(void)
30{
31 u8 status;
32
33 status = readb(&sgioc->panel) ^ 0xa0;
34 return ((status & 0x80) >> 6) | ((status & 0x20) >> 5);
35}
36#endif
37
38#ifdef CONFIG_SGI_IP32
26#include <asm/ip32/mace.h> 39#include <asm/ip32/mace.h>
27 40
41static inline u8 button_status(void)
42{
43 u64 status;
44
45 status = readq(&mace->perif.audio.control);
46 writeq(status & ~(3U << 23), &mace->perif.audio.control);
47
48 return (status >> 23) & 3;
49}
50#endif
51
28#define BUTTONS_POLL_INTERVAL 30 /* msec */ 52#define BUTTONS_POLL_INTERVAL 30 /* msec */
29#define BUTTONS_COUNT_THRESHOLD 3 53#define BUTTONS_COUNT_THRESHOLD 3
30 54
31static const unsigned short sgio2_map[] = { 55static const unsigned short sgi_map[] = {
32 KEY_VOLUMEUP, 56 KEY_VOLUMEDOWN,
33 KEY_VOLUMEDOWN 57 KEY_VOLUMEUP
34}; 58};
35 59
36struct buttons_dev { 60struct buttons_dev {
37 struct input_polled_dev *poll_dev; 61 struct input_polled_dev *poll_dev;
38 unsigned short keymap[ARRAY_SIZE(sgio2_map)]; 62 unsigned short keymap[ARRAY_SIZE(sgi_map)];
39 int count[ARRAY_SIZE(sgio2_map)]; 63 int count[ARRAY_SIZE(sgi_map)];
40 void __iomem *reg;
41}; 64};
42 65
43static void handle_buttons(struct input_polled_dev *dev) 66static void handle_buttons(struct input_polled_dev *dev)
44{ 67{
45 struct buttons_dev *bdev = dev->private; 68 struct buttons_dev *bdev = dev->private;
46 struct input_dev *input = dev->input; 69 struct input_dev *input = dev->input;
47 u64 status; 70 u8 status;
48 int i; 71 int i;
49 72
50 status = (readq(&mace->perif.audio.control) >> 23) & 3; 73 status = button_status();
51 74
52 for (i = 0; i < ARRAY_SIZE(bdev->keymap); i++) { 75 for (i = 0; i < ARRAY_SIZE(bdev->keymap); i++) {
53 if (status & (1U << i)) { 76 if (status & (1U << i)) {
54 writeq(status & ~(1U << i), &mace->perif.audio.control);
55 if (++bdev->count[i] == BUTTONS_COUNT_THRESHOLD) { 77 if (++bdev->count[i] == BUTTONS_COUNT_THRESHOLD) {
56 input_event(input, EV_MSC, MSC_SCAN, i); 78 input_event(input, EV_MSC, MSC_SCAN, i);
57 input_report_key(input, bdev->keymap[i], 1); 79 input_report_key(input, bdev->keymap[i], 1);
@@ -68,7 +90,7 @@ static void handle_buttons(struct input_polled_dev *dev)
68 } 90 }
69} 91}
70 92
71static int __devinit sgio2_buttons_probe(struct platform_device *pdev) 93static int __devinit sgi_buttons_probe(struct platform_device *pdev)
72{ 94{
73 struct buttons_dev *bdev; 95 struct buttons_dev *bdev;
74 struct input_polled_dev *poll_dev; 96 struct input_polled_dev *poll_dev;
@@ -82,15 +104,15 @@ static int __devinit sgio2_buttons_probe(struct platform_device *pdev)
82 goto err_free_mem; 104 goto err_free_mem;
83 } 105 }
84 106
85 memcpy(bdev->keymap, sgio2_map, sizeof(bdev->keymap)); 107 memcpy(bdev->keymap, sgi_map, sizeof(bdev->keymap));
86 108
87 poll_dev->private = bdev; 109 poll_dev->private = bdev;
88 poll_dev->poll = handle_buttons; 110 poll_dev->poll = handle_buttons;
89 poll_dev->poll_interval = BUTTONS_POLL_INTERVAL; 111 poll_dev->poll_interval = BUTTONS_POLL_INTERVAL;
90 112
91 input = poll_dev->input; 113 input = poll_dev->input;
92 input->name = "SGI O2 buttons"; 114 input->name = "SGI buttons";
93 input->phys = "sgio2/input0"; 115 input->phys = "sgi/input0";
94 input->id.bustype = BUS_HOST; 116 input->id.bustype = BUS_HOST;
95 input->dev.parent = &pdev->dev; 117 input->dev.parent = &pdev->dev;
96 118
@@ -100,7 +122,7 @@ static int __devinit sgio2_buttons_probe(struct platform_device *pdev)
100 122
101 input_set_capability(input, EV_MSC, MSC_SCAN); 123 input_set_capability(input, EV_MSC, MSC_SCAN);
102 __set_bit(EV_KEY, input->evbit); 124 __set_bit(EV_KEY, input->evbit);
103 for (i = 0; i < ARRAY_SIZE(sgio2_map); i++) 125 for (i = 0; i < ARRAY_SIZE(sgi_map); i++)
104 __set_bit(bdev->keymap[i], input->keybit); 126 __set_bit(bdev->keymap[i], input->keybit);
105 __clear_bit(KEY_RESERVED, input->keybit); 127 __clear_bit(KEY_RESERVED, input->keybit);
106 128
@@ -120,7 +142,7 @@ static int __devinit sgio2_buttons_probe(struct platform_device *pdev)
120 return error; 142 return error;
121} 143}
122 144
123static int __devexit sgio2_buttons_remove(struct platform_device *pdev) 145static int __devexit sgi_buttons_remove(struct platform_device *pdev)
124{ 146{
125 struct device *dev = &pdev->dev; 147 struct device *dev = &pdev->dev;
126 struct buttons_dev *bdev = dev_get_drvdata(dev); 148 struct buttons_dev *bdev = dev_get_drvdata(dev);
@@ -133,24 +155,24 @@ static int __devexit sgio2_buttons_remove(struct platform_device *pdev)
133 return 0; 155 return 0;
134} 156}
135 157
136static struct platform_driver sgio2_buttons_driver = { 158static struct platform_driver sgi_buttons_driver = {
137 .probe = sgio2_buttons_probe, 159 .probe = sgi_buttons_probe,
138 .remove = __devexit_p(sgio2_buttons_remove), 160 .remove = __devexit_p(sgi_buttons_remove),
139 .driver = { 161 .driver = {
140 .name = "sgio2btns", 162 .name = "sgibtns",
141 .owner = THIS_MODULE, 163 .owner = THIS_MODULE,
142 }, 164 },
143}; 165};
144 166
145static int __init sgio2_buttons_init(void) 167static int __init sgi_buttons_init(void)
146{ 168{
147 return platform_driver_register(&sgio2_buttons_driver); 169 return platform_driver_register(&sgi_buttons_driver);
148} 170}
149 171
150static void __exit sgio2_buttons_exit(void) 172static void __exit sgi_buttons_exit(void)
151{ 173{
152 platform_driver_unregister(&sgio2_buttons_driver); 174 platform_driver_unregister(&sgi_buttons_driver);
153} 175}
154 176
155module_init(sgio2_buttons_init); 177module_init(sgi_buttons_init);
156module_exit(sgio2_buttons_exit); 178module_exit(sgi_buttons_exit);