aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorJaya Kumar <jayakumar.acpi@gmail.com>2007-02-10 01:29:00 -0500
committerDmitry Torokhov <dtor@insightbb.com>2007-02-10 01:29:00 -0500
commit31ea7ff0f880dc3f4ad94e85c1432d4b910c9fca (patch)
treef2fe5dd4f400edbb02cf524f94a37b6c9fdd823f /drivers/input
parentb22364c8eec89e6b0c081a237f3b6348df87796f (diff)
Input: add Atlas button driver
This patch adds support for the buttons on the Atlas wallmount touchscreen. Signed-off-by: Jaya Kumar <jayakumar.acpi@gmail.com> Acked-by: Len Brown <len.brown@intel.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/misc/Kconfig10
-rw-r--r--drivers/input/misc/Makefile1
-rw-r--r--drivers/input/misc/atlas_btns.c170
3 files changed, 181 insertions, 0 deletions
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index ba0e88c64e1e..41b42587f5e9 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -50,6 +50,16 @@ config INPUT_WISTRON_BTNS
50 To compile this driver as a module, choose M here: the module will 50 To compile this driver as a module, choose M here: the module will
51 be called wistron_btns. 51 be called wistron_btns.
52 52
53config INPUT_ATLAS_BTNS
54 tristate "x86 Atlas button interface"
55 depends on X86 && ACPI
56 help
57 Say Y here for support of Atlas wallmount touchscreen buttons.
58 The events will show up as scancodes F1 through F9 via evdev.
59
60 To compile this driver as a module, choose M here: the module will
61 be called atlas_btns.
62
53config INPUT_IXP4XX_BEEPER 63config INPUT_IXP4XX_BEEPER
54 tristate "IXP4XX Beeper support" 64 tristate "IXP4XX Beeper support"
55 depends on ARCH_IXP4XX 65 depends on ARCH_IXP4XX
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index 415c49178985..e0a8d58c9e9b 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -9,5 +9,6 @@ obj-$(CONFIG_INPUT_PCSPKR) += pcspkr.o
9obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o 9obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o
10obj-$(CONFIG_INPUT_UINPUT) += uinput.o 10obj-$(CONFIG_INPUT_UINPUT) += uinput.o
11obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o 11obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o
12obj-$(CONFIG_INPUT_ATLAS_BTNS) += atlas_btns.o
12obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o 13obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o
13obj-$(CONFIG_INPUT_IXP4XX_BEEPER) += ixp4xx-beeper.o 14obj-$(CONFIG_INPUT_IXP4XX_BEEPER) += ixp4xx-beeper.o
diff --git a/drivers/input/misc/atlas_btns.c b/drivers/input/misc/atlas_btns.c
new file mode 100644
index 000000000000..0acc3a123604
--- /dev/null
+++ b/drivers/input/misc/atlas_btns.c
@@ -0,0 +1,170 @@
1/*
2 * atlas_btns.c - Atlas Wallmount Touchscreen ACPI Extras
3 *
4 * Copyright (C) 2006 Jaya Kumar
5 * Based on Toshiba ACPI by John Belmonte and ASUS ACPI
6 * This work was sponsored by CIS(M) Sdn Bhd.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23
24#include <linux/kernel.h>
25#include <linux/module.h>
26#include <linux/init.h>
27#include <linux/input.h>
28#include <linux/types.h>
29#include <asm/uaccess.h>
30#include <acpi/acpi_drivers.h>
31
32#define ACPI_ATLAS_NAME "Atlas ACPI"
33#define ACPI_ATLAS_CLASS "Atlas"
34#define ACPI_ATLAS_BUTTON_HID "ASIM0000"
35
36static struct input_dev *input_dev;
37
38/* button handling code */
39static acpi_status acpi_atlas_button_setup(acpi_handle region_handle,
40 u32 function, void *handler_context, void **return_context)
41{
42 *return_context =
43 (function != ACPI_REGION_DEACTIVATE) ? handler_context : NULL;
44
45 return AE_OK;
46}
47
48static acpi_status acpi_atlas_button_handler(u32 function,
49 acpi_physical_address address,
50 u32 bit_width, acpi_integer *value,
51 void *handler_context, void *region_context)
52{
53 acpi_status status;
54 int keycode;
55
56 if (function == ACPI_WRITE) {
57 keycode = KEY_F1 + (address & 0x0F);
58 input_report_key(input_dev, keycode, !(address & 0x10));
59 input_sync(input_dev);
60 status = 0;
61 } else {
62 printk(KERN_WARNING "atlas: shrugged on unexpected function"
63 ":function=%x,address=%lx,value=%x\n",
64 function, (unsigned long)address, (u32)*value);
65 status = -EINVAL;
66 }
67
68 return status;
69}
70
71static int atlas_acpi_button_add(struct acpi_device *device)
72{
73 acpi_status status;
74 int err;
75
76 input_dev = input_allocate_device();
77 if (!input_dev) {
78 printk(KERN_ERR "atlas: unable to allocate input device\n");
79 return -ENOMEM;
80 }
81
82 input_dev->name = "Atlas ACPI button driver";
83 input_dev->phys = "ASIM0000/atlas/input0";
84 input_dev->id.bustype = BUS_HOST;
85 input_dev->evbit[LONG(EV_KEY)] = BIT(EV_KEY);
86
87 set_bit(KEY_F1, input_dev->keybit);
88 set_bit(KEY_F2, input_dev->keybit);
89 set_bit(KEY_F3, input_dev->keybit);
90 set_bit(KEY_F4, input_dev->keybit);
91 set_bit(KEY_F5, input_dev->keybit);
92 set_bit(KEY_F6, input_dev->keybit);
93 set_bit(KEY_F7, input_dev->keybit);
94 set_bit(KEY_F8, input_dev->keybit);
95 set_bit(KEY_F9, input_dev->keybit);
96
97 err = input_register_device(input_dev);
98 if (err) {
99 printk(KERN_ERR "atlas: couldn't register input device\n");
100 input_free_device(input_dev);
101 return err;
102 }
103
104 /* hookup button handler */
105 status = acpi_install_address_space_handler(device->handle,
106 0x81, &acpi_atlas_button_handler,
107 &acpi_atlas_button_setup, device);
108 if (ACPI_FAILURE(status)) {
109 printk(KERN_ERR "Atlas: Error installing addr spc handler\n");
110 input_unregister_device(input_dev);
111 status = -EINVAL;
112 }
113
114 return status;
115}
116
117static int atlas_acpi_button_remove(struct acpi_device *device, int type)
118{
119 acpi_status status;
120
121 status = acpi_remove_address_space_handler(device->handle,
122 0x81, &acpi_atlas_button_handler);
123 if (ACPI_FAILURE(status)) {
124 printk(KERN_ERR "Atlas: Error removing addr spc handler\n");
125 status = -EINVAL;
126 }
127
128 input_unregister_device(input_dev);
129
130 return status;
131}
132
133static struct acpi_driver atlas_acpi_driver = {
134 .name = ACPI_ATLAS_NAME,
135 .class = ACPI_ATLAS_CLASS,
136 .ids = ACPI_ATLAS_BUTTON_HID,
137 .ops = {
138 .add = atlas_acpi_button_add,
139 .remove = atlas_acpi_button_remove,
140 },
141};
142
143static int __init atlas_acpi_init(void)
144{
145 int result;
146
147 if (acpi_disabled)
148 return -ENODEV;
149
150 result = acpi_bus_register_driver(&atlas_acpi_driver);
151 if (result < 0) {
152 printk(KERN_ERR "Atlas ACPI: Unable to register driver\n");
153 return -ENODEV;
154 }
155
156 return 0;
157}
158
159static void __exit atlas_acpi_exit(void)
160{
161 acpi_bus_unregister_driver(&atlas_acpi_driver);
162}
163
164module_init(atlas_acpi_init);
165module_exit(atlas_acpi_exit);
166
167MODULE_AUTHOR("Jaya Kumar");
168MODULE_LICENSE("GPL");
169MODULE_DESCRIPTION("Atlas button driver");
170