summaryrefslogtreecommitdiff
path: root/drivers/input/misc/atlas_btns.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-07 12:57:44 -0800
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-07 12:57:44 -0800
commit6e5565f949af1322f8f3d3f43d044645ae448499 (patch)
tree92868f6d3dcc6c105a0d35f9412f75c07139402e /drivers/input/misc/atlas_btns.c
parente5a9e8e6890d9b9c7a0f25b03ffdaf28614a9a4c (diff)
parent03366e7b9bf1544cb0b98f1a5cd6d340654f486a (diff)
downloadlwn-6e5565f949af1322f8f3d3f43d044645ae448499.tar.gz
lwn-6e5565f949af1322f8f3d3f43d044645ae448499.zip
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (34 commits) Input: i8042 - non-x86 build fix Input: pxa27x_keypad - also enable on PXA3xx Input: pxa27x_keypad - add debounce_interval to the keypad platform data Input: pxa27x_keypad - use device resources for I/O memory mapping and IRQ Input: pxa27x_keypad - enable rotary encoders and direct keys Input: pxa27x_keypad - introduce pxa27x_keypad_config() Input: pxa27x_keypad - introduce driver structure and use KEY() to define matrix keys Input: pxa27x_keypad - remove pin configuration from the driver Input: pxa27x_keypad - rename the driver (was pxa27x_keyboard) Input: constify function pointer tables (seq_operations) Input: i8042 - add Fujitsu-Siemens Amilo Pro 2010 to nomux list Input: i8042 - enable DMI quirks on x86-64 Input: i8042 - add Dritek quirk for Acer Aspire 9110 Input: add input event to APM event bridge Input: mousedev - use BIT_MASK instead of BIT Input: remove duplicate includes Input: remove cdev from input_dev structure Input: remove duplicated headers in drivers/char/keyboard.c Input: i8042 - add Dritek keyboard extension quirk Input: add Tosa keyboard driver ...
Diffstat (limited to 'drivers/input/misc/atlas_btns.c')
-rw-r--r--drivers/input/misc/atlas_btns.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/drivers/input/misc/atlas_btns.c b/drivers/input/misc/atlas_btns.c
index 4e3ad657ed80..1b871917340a 100644
--- a/drivers/input/misc/atlas_btns.c
+++ b/drivers/input/misc/atlas_btns.c
@@ -29,9 +29,10 @@
#include <asm/uaccess.h>
#include <acpi/acpi_drivers.h>
-#define ACPI_ATLAS_NAME "Atlas ACPI"
-#define ACPI_ATLAS_CLASS "Atlas"
+#define ACPI_ATLAS_NAME "Atlas ACPI"
+#define ACPI_ATLAS_CLASS "Atlas"
+static unsigned short atlas_keymap[16];
static struct input_dev *input_dev;
/* button handling code */
@@ -50,12 +51,15 @@ static acpi_status acpi_atlas_button_handler(u32 function,
void *handler_context, void *region_context)
{
acpi_status status;
- int keycode;
if (function == ACPI_WRITE) {
- keycode = KEY_F1 + (address & 0x0F);
- input_report_key(input_dev, keycode, !(address & 0x10));
+ int code = address & 0x0f;
+ int key_down = !(address & 0x10);
+
+ input_event(input_dev, EV_MSC, MSC_SCAN, code);
+ input_report_key(input_dev, atlas_keymap[code], key_down);
input_sync(input_dev);
+
status = 0;
} else {
printk(KERN_WARNING "atlas: shrugged on unexpected function"
@@ -70,6 +74,7 @@ static acpi_status acpi_atlas_button_handler(u32 function,
static int atlas_acpi_button_add(struct acpi_device *device)
{
acpi_status status;
+ int i;
int err;
input_dev = input_allocate_device();
@@ -81,17 +86,19 @@ static int atlas_acpi_button_add(struct acpi_device *device)
input_dev->name = "Atlas ACPI button driver";
input_dev->phys = "ASIM0000/atlas/input0";
input_dev->id.bustype = BUS_HOST;
- input_dev->evbit[BIT_WORD(EV_KEY)] = BIT_MASK(EV_KEY);
-
- set_bit(KEY_F1, input_dev->keybit);
- set_bit(KEY_F2, input_dev->keybit);
- set_bit(KEY_F3, input_dev->keybit);
- set_bit(KEY_F4, input_dev->keybit);
- set_bit(KEY_F5, input_dev->keybit);
- set_bit(KEY_F6, input_dev->keybit);
- set_bit(KEY_F7, input_dev->keybit);
- set_bit(KEY_F8, input_dev->keybit);
- set_bit(KEY_F9, input_dev->keybit);
+ input_dev->keycode = atlas_keymap;
+ input_dev->keycodesize = sizeof(unsigned short);
+ input_dev->keycodemax = ARRAY_SIZE(atlas_keymap);
+
+ input_set_capability(input_dev, EV_MSC, MSC_SCAN);
+ __set_bit(EV_KEY, input_dev->evbit);
+ for (i = 0; i < ARRAY_SIZE(atlas_keymap); i++) {
+ if (i < 9) {
+ atlas_keymap[i] = KEY_F1 + i;
+ __set_bit(KEY_F1 + i, input_dev->keybit);
+ } else
+ atlas_keymap[i] = KEY_RESERVED;
+ }
err = input_register_device(input_dev);
if (err) {