crucial_oj: add oj driver and modifications needed in gpio_input/event/matrix
diff --git a/drivers/input/misc/gpio_input.c b/drivers/input/misc/gpio_input.c
index 975f4d1..548b5b5 100644
--- a/drivers/input/misc/gpio_input.c
+++ b/drivers/input/misc/gpio_input.c
@@ -21,6 +21,9 @@
 #include <linux/interrupt.h>
 #include <linux/slab.h>
 #include <linux/wakelock.h>
+#ifdef CONFIG_OPTICALJOYSTICK_CRUCIAL
+#include <linux/curcial_oj.h>
+#endif
 
 #ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_3K
 static uint8_t power_key_state;
@@ -250,9 +253,20 @@
 #ifdef CONFIG_TOUCHSCREEN_SYNAPTICS_3K
 		handle_power_key_state(key_entry->code, pressed);
 #endif
+#ifdef CONFIG_OPTICALJOYSTICK_CRUCIAL
+		if (key_entry->code == BTN_MOUSE) {
+		  pr_info("gpio_keys_scan_keys: OJ action key %d-%d, %d (%d) "
+			  "changed to %d\n", ds->info->type,
+			  key_entry->code, i, key_entry->gpio, pressed);
+		  curcial_oj_send_key(BTN_MOUSE, pressed);
+		} else {
+#endif
 		input_event(ds->input_devs->dev[key_entry->dev], ds->info->type,
 			    key_entry->code, pressed);
 		sync_needed = true;
+#ifdef CONFIG_OPTICALJOYSTICK_CRUCIAL
+                }
+#endif
 	}
 	if (sync_needed) {
 		for (i = 0; i < ds->input_devs->count; i++)
diff --git a/drivers/input/misc/gpio_matrix.c b/drivers/input/misc/gpio_matrix.c
index eaa9e89..cfa6170 100644
--- a/drivers/input/misc/gpio_matrix.c
+++ b/drivers/input/misc/gpio_matrix.c
@@ -20,6 +20,10 @@
 #include <linux/interrupt.h>
 #include <linux/slab.h>
 #include <linux/wakelock.h>
+#ifdef CONFIG_OPTICALJOYSTICK_CRUCIAL
+#include <asm/mach-types.h>
+#include <linux/curcial_oj.h>
+#endif
 
 struct gpio_kp {
 	struct gpio_event_input_devs *input_devs;
@@ -111,6 +115,9 @@
 	unsigned short keyentry = mi->keymap[key_index];
 	unsigned short keycode = keyentry & MATRIX_KEY_MASK;
 	unsigned short dev = keyentry >> MATRIX_CODE_BITS;
+#ifdef CONFIG_OPTICALJOYSTICK_CRUCIAL
+	static unsigned need_send_spec_key = 1;
+#endif
 
 	if (pressed != test_bit(keycode, kp->input_devs->dev[dev]->key)) {
 		if (keycode == KEY_RESERVED) {
@@ -125,9 +132,22 @@
 					"changed to %d\n", keycode,
 					out, in, mi->output_gpios[out],
 					mi->input_gpios[in], pressed);
+#ifdef CONFIG_OPTICALJOYSTICK_CRUCIAL
+			if (!(mi->info.oj_btn && keycode == BTN_MOUSE))
+#endif
 			input_report_key(kp->input_devs->dev[dev], keycode, pressed);
 		}
 	}
+#ifdef CONFIG_OPTICALJOYSTICK_CRUCIAL
+	if (mi->info.oj_btn && keycode == BTN_MOUSE) {
+	  if (need_send_spec_key == pressed) {
+	    curcial_oj_send_key(keycode, pressed);
+	    need_send_spec_key = !pressed;
+	    pr_info("%s: send OJ action key, pressed: %d\n",
+		    __func__, pressed);
+	  }
+	}
+#endif
 }
 
 static void report_sync(struct gpio_kp *kp)