Author: nick
Date: 2012-03-27 14:30:24 +0100 (Tue, 27 Mar 2012)
New Revision: 1855
Modified:
balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/keyboard-tt.patch
Log:
add atmel kbd_id sysfs entry
Modified: balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/keyboard-tt.patch
===================================================================
--- balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/keyboard-tt.patch 2012-03-22 12:02:53 UTC (rev 1854)
+++ balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/keyboard-tt.patch 2012-03-27 13:30:24 UTC (rev 1855)
@@ -1,7 +1,7 @@
Index: linux-2.6.39.4/drivers/input/keyboard/Kconfig
===================================================================
---- linux-2.6.39.4.orig/drivers/input/keyboard/Kconfig 2011-08-03 20:43:28.000000000 +0100
-+++ linux-2.6.39.4/drivers/input/keyboard/Kconfig 2012-02-21 09:59:05.000000000 +0000
+--- linux-2.6.39.4.orig/drivers/input/keyboard/Kconfig 2012-03-22 11:34:33.000000000 +0000
++++ linux-2.6.39.4/drivers/input/keyboard/Kconfig 2012-03-22 11:34:51.000000000 +0000
@@ -530,4 +530,13 @@
To compile this driver as a module, choose M here: the
module will be called w90p910_keypad.
@@ -18,8 +18,8 @@
endif
Index: linux-2.6.39.4/drivers/input/keyboard/Makefile
===================================================================
---- linux-2.6.39.4.orig/drivers/input/keyboard/Makefile 2011-08-03 20:43:28.000000000 +0100
-+++ linux-2.6.39.4/drivers/input/keyboard/Makefile 2012-02-21 09:59:05.000000000 +0000
+--- linux-2.6.39.4.orig/drivers/input/keyboard/Makefile 2012-03-22 11:34:33.000000000 +0000
++++ linux-2.6.39.4/drivers/input/keyboard/Makefile 2012-03-22 11:34:51.000000000 +0000
@@ -48,3 +48,4 @@
obj-$(CONFIG_KEYBOARD_TWL4030) += twl4030_keypad.o
obj-$(CONFIG_KEYBOARD_XTKBD) += xtkbd.o
@@ -28,8 +28,8 @@
Index: linux-2.6.39.4/drivers/input/keyboard/tt-keyboard.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.39.4/drivers/input/keyboard/tt-keyboard.c 2012-02-21 11:01:44.000000000 +0000
-@@ -0,0 +1,701 @@
++++ linux-2.6.39.4/drivers/input/keyboard/tt-keyboard.c 2012-03-27 14:29:15.000000000 +0100
+@@ -0,0 +1,742 @@
+/*
+ * Balloon3 Bubble TT Keyboard Controller Driver
+ * Based on OpenCores keyboard controller
@@ -98,6 +98,7 @@
+ int joystick_state;
+ int switch_state;
+#endif
++ int read_id;
+ struct work_struct kbd_wq;
+};
+
@@ -111,7 +112,28 @@
+
+#define SAMOSA_KEYBOARD_INT_STATUS 0x0F
+
++static u8 keyboard_id;
+
++static ssize_t
++show_id(struct device *dev, struct device_attribute *attr, char *buf)
++{
++ return sprintf(buf, "0x%x\n", keyboard_id);
++}
++
++static DEVICE_ATTR(kbd_id, S_IRUGO, show_id, NULL);
++
++/*
++static struct attribute *tt_kbd_sysfs_entries[] = {
++ &dev_attr_kbd_id.attr,
++ NULL,
++};
++
++static struct attribute_group tt_kbd_attr_group = {
++ .name = NULL, /* put in device directory */
++ .attrs = tt_kbd_sysfs_entries,
++};
++*/
++
+static inline void Write_Data(unsigned char reg, unsigned char parameter)
+ {
+#if defined(CONFIG_SPI_TT) || defined(CONFIG_SPI_TT_MODULE)
@@ -311,6 +333,13 @@
+ if (key)
+ input_report_key(input, key ,(updown & 0x80) ? 0:1);
+ }
++
++ if (tt_kbd->read_id) {
++ keyboard_id = spiReadReg(tt_kbd->spi,0xf);
++ pr_info("%s: read keyboard id returns 0x%x\n",__func__, keyboard_id);
++ tt_kbd->read_id = 0;
++ }
++
+#else
+ disable_irq(tt_kbd->irq);
+ do {
@@ -561,9 +590,21 @@
+ }
+
+#if defined(CONFIG_SPI_TT) || defined(CONFIG_SPI_TT_MODULE)
-+ pr_info("%s: read keyboard INT_FLAGS returns %d\n",__func__, spiReadReg(dev,0));
++ pr_info("%s: read keyboard INT_FLAGS returns %d\n",__func__, spiReadReg(tt_kbd->spi,0));
+#endif
+
++ keyboard_id = spiReadReg(tt_kbd->spi,0xf);
++ pr_info("%s: read keyboard id returns 0x%x\n",__func__, keyboard_id);
++ // seems to fail to read during modprobe so do it again
++ tt_kbd->read_id = 1;
++// this doesn't seem to work either - returns 255
++// schedule_work(&tt_kbd->kbd_wq);
++
++// error = sysfs_create_group(&dev->dev.kobj, &tt_kbd_attr_group);
++ error = sysfs_create_file(&input->dev.kobj, &dev_attr_kbd_id.attr);
++ if (error)
++ dev_err(&dev->dev, "failed to create sysfs entries\n");
++
+ return 0;
+
+ err_free_irq: