From 779cd577ab23bb96bee289e78dcb697d0120ca4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jeremy=20Lain=C3=A9?= Date: Thu, 18 Dec 2008 19:22:32 +0100 Subject: linux-2.6.26: improve keyboard driver for boc01 --- .../boc01/012-081121-cy3218-btns.patch | 243 --------------------- .../boc01/012-081218-cy3218-btns.patch | 243 +++++++++++++++++++++ packages/linux/linux_2.6.26.bb | 4 +- 3 files changed, 245 insertions(+), 245 deletions(-) delete mode 100644 packages/linux/linux-2.6.26/boc01/012-081121-cy3218-btns.patch create mode 100644 packages/linux/linux-2.6.26/boc01/012-081218-cy3218-btns.patch (limited to 'packages') diff --git a/packages/linux/linux-2.6.26/boc01/012-081121-cy3218-btns.patch b/packages/linux/linux-2.6.26/boc01/012-081121-cy3218-btns.patch deleted file mode 100644 index 51d092c528..0000000000 --- a/packages/linux/linux-2.6.26/boc01/012-081121-cy3218-btns.patch +++ /dev/null @@ -1,243 +0,0 @@ -diff -Nru 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-11-21 12:11:43.000000000 +0100 -@@ -0,0 +1,215 @@ -+/* -+ * CAPSENSE Interface driver -+ * -+ * -+ * Copyright (C) 2007, CenoSYS (www.cenosys.com). -+ * Guillaume Ligneul -+ * Guillaume.ligneul@gmail.com -+ * -+ * This software program is licensed subject to the GNU General Public License -+ * (GPL).Version 2,June 1991, available at http://www.fsf.org/copyleft/gpl.html -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+static int capsense_attach_adapter(struct i2c_adapter *adapter); -+static int capsense_detach_client(struct i2c_client *client); -+ -+#define CAPSENSE_NAME "Capsense" -+/* i2c configuration */ -+#define CAPSENSE_I2C_ADDR 0x25 -+// To debug (may be add in include/linux/i2c-id.h) -+#define I2C_DRIVERID_CAPSENSE 98 -+#define BUTTONS_POLL_INTERVAL 30 /* msec */ -+#define CAP_STATE_GP0 0x88 -+#define CAP_STATE_GP1 0x89 -+#define MASK0 0x10 -+#define MASK1 0x4 -+#define MASK2 0x8 -+#define MASK3 0x1 -+ -+ -+static int poll_interval = BUTTONS_POLL_INTERVAL; -+module_param_named(poll, poll_interval, uint, 0); -+MODULE_PARM_DESC(poll, "poll interval in msec (30=default)"); -+ -+static const unsigned short normal_i2c[] = { -+ CAPSENSE_I2C_ADDR , I2C_CLIENT_END -+}; -+I2C_CLIENT_INSMOD; -+ -+static struct i2c_driver capsense_driver = { -+ .driver = { -+ .name = CAPSENSE_NAME, -+ }, -+ .id = I2C_DRIVERID_CAPSENSE, -+ .attach_adapter = &capsense_attach_adapter, -+ .detach_client = &capsense_detach_client, -+}; -+ -+struct cy3218 { -+ struct input_polled_dev *ipdev; -+ struct i2c_client client; -+}; -+ -+static void report_key(struct input_dev *input, unsigned keycode) -+{ -+ input_report_key(input, keycode, 1); -+ input_sync(input); -+ -+ input_report_key(input, keycode, 0); -+ input_sync(input); -+} -+ -+unsigned short keymap[5] = { -+ KEY_A, -+ KEY_B, -+ KEY_C, -+ KEY_D, -+ KEY_E, -+}; -+ -+static void handle_buttons(struct input_polled_dev *dev) -+{ -+ u8 uValue; -+ struct cy3218 *capsense = dev->private; -+ struct input_dev *idev = dev->input; -+ -+ -+ uValue = i2c_smbus_read_byte_data(&capsense->client, CAP_STATE_GP1); -+ -+ if(uValue == MASK0) -+ { -+ report_key(idev, keymap[0]); -+ printk("Bouton A\n"); -+ } -+ -+ uValue = i2c_smbus_read_byte_data(&capsense->client, CAP_STATE_GP0); -+ -+ if(uValue == MASK0) -+ { -+ report_key(idev, keymap[1]); -+ printk("Bouton E\n"); -+ } -+ -+ if(uValue == MASK1) -+ { -+ report_key(idev, keymap[2]); -+ printk("Bouton B\n"); -+ } -+ -+ if(uValue == MASK2) -+ { -+ report_key(idev, keymap[3]); -+ printk("Bouton C\n"); -+ } -+ if(uValue == MASK3) -+ { -+ report_key(idev, keymap[4]); -+ printk("Bouton D\n"); -+ } -+} -+ -+static int -+capsense_probe(struct i2c_adapter *adapter, int addr, int kind) -+{ -+ struct cy3218 *capsense; -+ struct input_polled_dev *ipdev; -+ struct input_dev *input; -+ int rc = 0, err = -ENOMEM, i=0; -+ -+ capsense = kzalloc(sizeof(*capsense), GFP_KERNEL); -+ if (!capsense) -+ goto failout; -+ -+ if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) { -+ goto failout; -+ } -+ -+ ipdev = input_allocate_polled_device(); -+ if (!ipdev) -+ goto failout; -+ -+ capsense->ipdev = ipdev; -+ capsense->client.adapter = adapter; -+ capsense->client.addr = addr; -+ capsense->client.driver = &capsense_driver; -+ strlcpy(capsense->client.name, CAPSENSE_NAME, I2C_NAME_SIZE); -+ i2c_set_clientdata(&capsense->client, capsense); -+ -+ rc = i2c_attach_client(&capsense->client); -+ if (rc) -+ goto out_attach; -+ -+ ipdev->poll = handle_buttons; -+ ipdev->private = capsense; -+ ipdev->poll_interval = poll_interval; -+ -+ input = ipdev->input; -+ input->name = "Capsense buttons"; -+ input->phys = "capsense/input0"; -+ input->id.bustype = BUS_I2C; -+ input->dev.parent = &capsense->client.dev; -+ -+ input->keycode = keymap; -+ input->keycodemax = ARRAY_SIZE(keymap); -+ input->keycodesize = sizeof(unsigned short); -+ -+ input_set_capability(input, EV_MSC, MSC_SCAN); -+ set_bit(EV_KEY, ipdev->input->evbit); -+ -+ -+ for (i = 0; i < 3; i++) -+ set_bit(keymap[i], ipdev->input->keybit); -+ -+ rc = input_register_polled_device(ipdev); -+ if(rc) -+ goto out_polled; -+ -+ return 0; -+ -+out_polled: -+ i2c_detach_client(&capsense->client); -+out_attach: -+ input_free_polled_device(ipdev); -+failout: -+ return err; -+} -+ -+ -+static int -+capsense_attach_adapter (struct i2c_adapter *adapter) -+{ -+ return i2c_probe(adapter, &addr_data, capsense_probe); -+} -+ -+static int -+capsense_detach_client(struct i2c_client *client) -+{ -+ struct cy3218 *capsense = i2c_get_clientdata(client); -+ -+ input_unregister_polled_device(capsense->ipdev); -+ i2c_detach_client(&capsense->client); -+ input_free_polled_device(capsense->ipdev); -+ return 0; -+} -+ -+static int __init capsense_buttons_init(void) -+{ -+ return i2c_add_driver(&capsense_driver); -+} -+ -+static void __exit capsense_buttons_exit(void) -+{ -+ i2c_del_driver(&capsense_driver); -+} -+ -+MODULE_AUTHOR("Guillaume Ligneul "); -+MODULE_DESCRIPTION("Capsense CY3218 Input driver"); -+MODULE_LICENSE("GPL"); -+module_init(capsense_buttons_init); -+module_exit(capsense_buttons_exit); -diff -Nru linux-2.6.26.orig/drivers/input/misc/Kconfig linux-2.6.26/drivers/input/misc/Kconfig ---- linux-2.6.26.orig/drivers/input/misc/Kconfig 2008-07-13 23:51:29.000000000 +0200 -+++ linux-2.6.26/drivers/input/misc/Kconfig 2008-11-21 10:50:56.000000000 +0100 -@@ -197,4 +197,12 @@ - Say Y here if you want to support the built-in real time clock - of the HP SDC controller. - -+config INPUT_CAPSENSE_BTNS -+ tristate "CAPSENSE CY3218 button interface" -+ select INPUT_POLLDEV -+ help -+ To compile this driver as a module, choose M here: the -+ module will be called cy3218-btns. -+ To change poll interval, invoque poll parameter in msecs. -+ - endif -diff -Nru linux-2.6.26.orig/drivers/input/misc/Makefile linux-2.6.26/drivers/input/misc/Makefile ---- linux-2.6.26.orig/drivers/input/misc/Makefile 2008-07-13 23:51:29.000000000 +0200 -+++ linux-2.6.26/drivers/input/misc/Makefile 2008-11-21 10:50:56.000000000 +0100 -@@ -19,3 +19,4 @@ - obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o - obj-$(CONFIG_INPUT_UINPUT) += uinput.o - obj-$(CONFIG_INPUT_APANEL) += apanel.o -+obj-$(CONFIG_INPUT_CAPSENSE_BTNS) +=cy3218-btns.o diff --git a/packages/linux/linux-2.6.26/boc01/012-081218-cy3218-btns.patch b/packages/linux/linux-2.6.26/boc01/012-081218-cy3218-btns.patch new file mode 100644 index 0000000000..d5985f3f0a --- /dev/null +++ b/packages/linux/linux-2.6.26/boc01/012-081218-cy3218-btns.patch @@ -0,0 +1,243 @@ +diff -Nru 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-11-21 12:11:43.000000000 +0100 +@@ -0,0 +1,215 @@ ++/* ++ * CAPSENSE Interface driver ++ * ++ * ++ * Copyright (C) 2007, CenoSYS (www.cenosys.com). ++ * Guillaume Ligneul ++ * Guillaume.ligneul@gmail.com ++ * ++ * This software program is licensed subject to the GNU General Public License ++ * (GPL).Version 2,June 1991, available at http://www.fsf.org/copyleft/gpl.html ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++static int capsense_attach_adapter(struct i2c_adapter *adapter); ++static int capsense_detach_client(struct i2c_client *client); ++ ++#define CAPSENSE_NAME "Capsense" ++/* i2c configuration */ ++#define CAPSENSE_I2C_ADDR 0x25 ++// To debug (may be add in include/linux/i2c-id.h) ++#define I2C_DRIVERID_CAPSENSE 98 ++#define BUTTONS_POLL_INTERVAL 30 /* msec */ ++#define CAP_STATE_GP0 0x88 ++#define CAP_STATE_GP1 0x89 ++#define MASK0 0x10 ++#define MASK1 0x4 ++#define MASK2 0x8 ++#define MASK3 0x1 ++ ++ ++static int poll_interval = BUTTONS_POLL_INTERVAL; ++module_param_named(poll, poll_interval, uint, 0); ++MODULE_PARM_DESC(poll, "poll interval in msec (30=default)"); ++ ++static const unsigned short normal_i2c[] = { ++ CAPSENSE_I2C_ADDR , I2C_CLIENT_END ++}; ++I2C_CLIENT_INSMOD; ++ ++static struct i2c_driver capsense_driver = { ++ .driver = { ++ .name = CAPSENSE_NAME, ++ }, ++ .id = I2C_DRIVERID_CAPSENSE, ++ .attach_adapter = &capsense_attach_adapter, ++ .detach_client = &capsense_detach_client, ++}; ++ ++struct cy3218 { ++ struct input_polled_dev *ipdev; ++ struct i2c_client client; ++}; ++ ++static void report_key(struct input_dev *input, unsigned keycode) ++{ ++ input_report_key(input, keycode, 1); ++ input_sync(input); ++ ++ input_report_key(input, keycode, 0); ++ input_sync(input); ++} ++ ++unsigned short keymap[5] = { ++ KEY_UP, ++ KEY_F1, ++ KEY_ENTER, ++ KEY_DOWN, ++ KEY_BACKSPACE, ++}; ++ ++static void handle_buttons(struct input_polled_dev *dev) ++{ ++ u8 uValue; ++ struct cy3218 *capsense = dev->private; ++ struct input_dev *idev = dev->input; ++ ++ ++ uValue = i2c_smbus_read_byte_data(&capsense->client, CAP_STATE_GP1); ++ ++ if(uValue == MASK0) ++ { ++ report_key(idev, keymap[0]); ++ printk("Bouton UP\n"); ++ } ++ ++ uValue = i2c_smbus_read_byte_data(&capsense->client, CAP_STATE_GP0); ++ ++ if(uValue == MASK0) ++ { ++ report_key(idev, keymap[1]); ++ printk("Bouton HELP\n"); ++ } ++ ++ if(uValue == MASK1) ++ { ++ report_key(idev, keymap[2]); ++ printk("Bouton OK\n"); ++ } ++ ++ if(uValue == MASK2) ++ { ++ report_key(idev, keymap[3]); ++ printk("Bouton DOWN\n"); ++ } ++ if(uValue == MASK3) ++ { ++ report_key(idev, keymap[4]); ++ printk("Bouton BACK\n"); ++ } ++} ++ ++static int ++capsense_probe(struct i2c_adapter *adapter, int addr, int kind) ++{ ++ struct cy3218 *capsense; ++ struct input_polled_dev *ipdev; ++ struct input_dev *input; ++ int rc = 0, err = -ENOMEM, i=0; ++ ++ capsense = kzalloc(sizeof(*capsense), GFP_KERNEL); ++ if (!capsense) ++ goto failout; ++ ++ if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) { ++ goto failout; ++ } ++ ++ ipdev = input_allocate_polled_device(); ++ if (!ipdev) ++ goto failout; ++ ++ capsense->ipdev = ipdev; ++ capsense->client.adapter = adapter; ++ capsense->client.addr = addr; ++ capsense->client.driver = &capsense_driver; ++ strlcpy(capsense->client.name, CAPSENSE_NAME, I2C_NAME_SIZE); ++ i2c_set_clientdata(&capsense->client, capsense); ++ ++ rc = i2c_attach_client(&capsense->client); ++ if (rc) ++ goto out_attach; ++ ++ ipdev->poll = handle_buttons; ++ ipdev->private = capsense; ++ ipdev->poll_interval = poll_interval; ++ ++ input = ipdev->input; ++ input->name = "Capsense buttons"; ++ input->phys = "capsense/input0"; ++ input->id.bustype = BUS_I2C; ++ input->dev.parent = &capsense->client.dev; ++ ++ input->keycode = keymap; ++ input->keycodemax = ARRAY_SIZE(keymap); ++ input->keycodesize = sizeof(unsigned short); ++ ++ input_set_capability(input, EV_MSC, MSC_SCAN); ++ set_bit(EV_KEY, ipdev->input->evbit); ++ ++ ++ for (i = 0; i < ARRAY_SIZE(keymap); i++) ++ set_bit(keymap[i], ipdev->input->keybit); ++ ++ rc = input_register_polled_device(ipdev); ++ if(rc) ++ goto out_polled; ++ ++ return 0; ++ ++out_polled: ++ i2c_detach_client(&capsense->client); ++out_attach: ++ input_free_polled_device(ipdev); ++failout: ++ return err; ++} ++ ++ ++static int ++capsense_attach_adapter (struct i2c_adapter *adapter) ++{ ++ return i2c_probe(adapter, &addr_data, capsense_probe); ++} ++ ++static int ++capsense_detach_client(struct i2c_client *client) ++{ ++ struct cy3218 *capsense = i2c_get_clientdata(client); ++ ++ input_unregister_polled_device(capsense->ipdev); ++ i2c_detach_client(&capsense->client); ++ input_free_polled_device(capsense->ipdev); ++ return 0; ++} ++ ++static int __init capsense_buttons_init(void) ++{ ++ return i2c_add_driver(&capsense_driver); ++} ++ ++static void __exit capsense_buttons_exit(void) ++{ ++ i2c_del_driver(&capsense_driver); ++} ++ ++MODULE_AUTHOR("Guillaume Ligneul "); ++MODULE_DESCRIPTION("Capsense CY3218 Input driver"); ++MODULE_LICENSE("GPL"); ++module_init(capsense_buttons_init); ++module_exit(capsense_buttons_exit); +diff -Nru linux-2.6.26.orig/drivers/input/misc/Kconfig linux-2.6.26/drivers/input/misc/Kconfig +--- linux-2.6.26.orig/drivers/input/misc/Kconfig 2008-07-13 23:51:29.000000000 +0200 ++++ linux-2.6.26/drivers/input/misc/Kconfig 2008-11-21 10:50:56.000000000 +0100 +@@ -197,4 +197,12 @@ + Say Y here if you want to support the built-in real time clock + of the HP SDC controller. + ++config INPUT_CAPSENSE_BTNS ++ tristate "CAPSENSE CY3218 button interface" ++ select INPUT_POLLDEV ++ help ++ To compile this driver as a module, choose M here: the ++ module will be called cy3218-btns. ++ To change poll interval, invoque poll parameter in msecs. ++ + endif +diff -Nru linux-2.6.26.orig/drivers/input/misc/Makefile linux-2.6.26/drivers/input/misc/Makefile +--- linux-2.6.26.orig/drivers/input/misc/Makefile 2008-07-13 23:51:29.000000000 +0200 ++++ linux-2.6.26/drivers/input/misc/Makefile 2008-11-21 10:50:56.000000000 +0100 +@@ -19,3 +19,4 @@ + obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o + obj-$(CONFIG_INPUT_UINPUT) += uinput.o + obj-$(CONFIG_INPUT_APANEL) += apanel.o ++obj-$(CONFIG_INPUT_CAPSENSE_BTNS) +=cy3218-btns.o diff --git a/packages/linux/linux_2.6.26.bb b/packages/linux/linux_2.6.26.bb index c3fa981292..d15b22098d 100644 --- a/packages/linux/linux_2.6.26.bb +++ b/packages/linux/linux_2.6.26.bb @@ -1,6 +1,6 @@ require linux.inc -PR = "r4" +PR = "r5" # Mark archs/machines that this kernel supports DEFAULT_PREFERENCE = "-1" @@ -23,7 +23,7 @@ SRC_URI_append_boc01 = "\ file://008-081127-spi.patch;patch=1 \ file://010-081105-mii.patch;patch=1 \ file://011-081202-gpio.patch;patch=1 \ - file://012-081121-cy3218-btns.patch;patch=1 \ + file://012-081218-cy3218-btns.patch;patch=1 \ file://013-081212-lcd.patch;patch=1 \ " -- cgit v1.2.3