diff options
author | Jeremy Lainé <jeremy.laine@m4x.org> | 2008-12-22 13:03:56 +0100 |
---|---|---|
committer | Jeremy Lainé <jeremy.laine@m4x.org> | 2008-12-22 13:03:56 +0100 |
commit | dca7dad0bd67fa1a6c060876d88edc54b2198623 (patch) | |
tree | 1fe639824fbe31584bfaa118f2d66f9307526a79 /packages/linux/linux-2.6.26/boc01/012-081222-cy3218-btns.patch | |
parent | bc01e920ab6319679ab1f29f3b3e2e0258c2ab55 (diff) |
linux-2.6.26: cleanup boc01 keyboard driver
Diffstat (limited to 'packages/linux/linux-2.6.26/boc01/012-081222-cy3218-btns.patch')
-rw-r--r-- | packages/linux/linux-2.6.26/boc01/012-081222-cy3218-btns.patch | 44 |
1 files changed, 19 insertions, 25 deletions
diff --git a/packages/linux/linux-2.6.26/boc01/012-081222-cy3218-btns.patch b/packages/linux/linux-2.6.26/boc01/012-081222-cy3218-btns.patch index 91211e301f..b3cb9b461b 100644 --- a/packages/linux/linux-2.6.26/boc01/012-081222-cy3218-btns.patch +++ b/packages/linux/linux-2.6.26/boc01/012-081222-cy3218-btns.patch @@ -1,7 +1,7 @@ diff -urN linux-2.6.26.orig/drivers/input/misc/cy3218-btns.c linux-2.6.26/drivers/input/misc/cy3218-btns.c --- linux-2.6.26.orig/drivers/input/misc/cy3218-btns.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.26/drivers/input/misc/cy3218-btns.c 2008-12-22 07:50:48.000000000 +0100 -@@ -0,0 +1,201 @@ ++++ linux-2.6.26/drivers/input/misc/cy3218-btns.c 2008-12-22 12:54:47.000000000 +0100 +@@ -0,0 +1,195 @@ +/* + * CAPSENSE Interface driver + * @@ -43,7 +43,7 @@ diff -urN linux-2.6.26.orig/drivers/input/misc/cy3218-btns.c linux-2.6.26/driver +MODULE_PARM_DESC(poll, "poll interval in msec (30=default)"); + +static const unsigned short normal_i2c[] = { -+ CAPSENSE_I2C_ADDR , I2C_CLIENT_END ++ CAPSENSE_I2C_ADDR , I2C_CLIENT_END +}; +I2C_CLIENT_INSMOD; + @@ -62,41 +62,35 @@ diff -urN linux-2.6.26.orig/drivers/input/misc/cy3218-btns.c linux-2.6.26/driver + unsigned char key_state; +}; + -+unsigned short keymap[5] = { -+ KEY_UP, ++unsigned short keymap[] = { ++ // GP0 + KEY_F1, + KEY_ENTER, + KEY_DOWN, + KEY_BACKSPACE, ++ // GP1 ++ KEY_UP, +}; + +static void handle_buttons(struct input_polled_dev *dev) +{ -+ u8 uValue; + struct cy3218 *capsense = dev->private; -+ unsigned char new_state = 0; -+ unsigned char changed; ++ u8 port_value; ++ u8 new_state = 0; ++ u8 changed; + int i; + -+ uValue = i2c_smbus_read_byte_data(&capsense->client, CAP_STATE_GP1); -+ -+ if(uValue == MASK0) -+ new_state |= 1; -+ -+ uValue = i2c_smbus_read_byte_data(&capsense->client, CAP_STATE_GP0); -+ -+ if(uValue == MASK0) -+ new_state |= 2; -+ -+ if(uValue == MASK1) -+ new_state |= 4; -+ -+ if(uValue == MASK2) -+ new_state |= 8; ++ // read status ++ port_value = i2c_smbus_read_byte_data(&capsense->client, CAP_STATE_GP0); ++ if (port_value & MASK0) new_state |= 0x01; ++ if (port_value & MASK1) new_state |= 0x02; ++ if (port_value & MASK2) new_state |= 0x04; ++ if (port_value & MASK3) new_state |= 0x08; + -+ if(uValue == MASK3) -+ new_state |= 16; ++ port_value = i2c_smbus_read_byte_data(&capsense->client, CAP_STATE_GP1); ++ if (port_value & MASK0) new_state |= 0x10; + ++ // update keyboard state + changed = capsense->key_state ^ new_state; + for (i = 0; i < ARRAY_SIZE(keymap); i++) + if (changed & (1 << i)) |