Cross Install Gentoo kernel-patch-Fn-keys.txt

From Pandora Wiki
Revision as of 06:41, 5 June 2018 by Jgeiss (talk | contribs) (Patch file released)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
diff --git a/arch/arm/boot/dts/omap3-pandora-common.dtsi b/arch/arm/boot/dts/omap3-pandora-common.dtsi
index c3db2086be41..beed98eee1d3 100644
--- a/arch/arm/boot/dts/omap3-pandora-common.dtsi
+++ b/arch/arm/boot/dts/omap3-pandora-common.dtsi
@@ -483,13 +483,56 @@
 		MATRIX_KEY(6, 1, KEY_2)
 		MATRIX_KEY(6, 2, KEY_W)
 		MATRIX_KEY(6, 3, KEY_A)
-		MATRIX_KEY(6, 4, KEY_RIGHTBRACE)
+		MATRIX_KEY(6, 4, KEY_DOT)
 		MATRIX_KEY(7, 0, KEY_ENTER)
 		MATRIX_KEY(7, 1, KEY_1)
 		MATRIX_KEY(7, 2, KEY_Q)
 		MATRIX_KEY(7, 3, KEY_LEFTSHIFT)
-		MATRIX_KEY(7, 4, KEY_LEFTBRACE )
-	 >;
+		MATRIX_KEY(7, 4, KEY_COMMA)
+		MATRIX_KEY(8, 0, KEY_F9)
+		MATRIX_KEY(8, 1, KEY_F8)
+		MATRIX_KEY(8, 2, KEY_BRIGHTNESSUP)
+		MATRIX_KEY(8, 3, KEY_F13)           /* apostrophe, differs from Fn-A? */
+		MATRIX_KEY(8, 4, KEY_F22)
+		MATRIX_KEY(8, 5, KEY_F23)
+		MATRIX_KEY(9, 0, KEY_F10)
+		MATRIX_KEY(9, 1, KEY_F7)
+		MATRIX_KEY(9, 2, KEY_BRIGHTNESSDOWN)
+		MATRIX_KEY(9, 3, KEY_GRAVE)
+		MATRIX_KEY(9, 4, KEY_F14)           /* pipe/bar */
+		MATRIX_KEY(9, 5, KEY_TAB)
+		MATRIX_KEY(10, 0, KEY_INSERT)
+		MATRIX_KEY(10, 1, KEY_F6)
+		MATRIX_KEY(10, 2, KEY_F15)           /* dash */
+		MATRIX_KEY(10, 3, KEY_EQUAL)
+		MATRIX_KEY(10, 4, KEY_F16)           /* # (pound/hash) */
+		MATRIX_KEY(10, 5, KEY_FN)
+		MATRIX_KEY(11, 0, KEY_F11)
+		MATRIX_KEY(11, 1, KEY_F5)
+		MATRIX_KEY(11, 2, KEY_F17)           /* ! */
+		MATRIX_KEY(11, 3, KEY_KPPLUS)
+		MATRIX_KEY(11, 4, KEY_BACKSLASH)
+		MATRIX_KEY(12, 0, KEY_F12)
+		MATRIX_KEY(12, 1, KEY_F4)
+		MATRIX_KEY(12, 2, KEY_RIGHTBRACE)
+		MATRIX_KEY(12, 3, KEY_KPMINUS)
+		MATRIX_KEY(12, 4, KEY_QUESTION)
+		MATRIX_KEY(13, 0, KEY_F18)           /* £ (pound) */
+		MATRIX_KEY(13, 1, KEY_F3)
+		MATRIX_KEY(13, 2, KEY_LEFTBRACE)
+		MATRIX_KEY(13, 3, KEY_F19)           /* " */
+		MATRIX_KEY(13, 4, KEY_SLASH)
+		MATRIX_KEY(14, 0, KEY_YEN)
+		MATRIX_KEY(14, 1, KEY_F2)
+		MATRIX_KEY(14, 2, KEY_F20)           /* @ */
+		MATRIX_KEY(14, 3, KEY_APOSTROPHE)
+		MATRIX_KEY(14, 4, KEY_F21)           /* : */
+		MATRIX_KEY(15, 0, KEY_ENTER)
+		MATRIX_KEY(15, 1, KEY_F1)
+		MATRIX_KEY(15, 2, KEY_ESC)
+		MATRIX_KEY(15, 3, KEY_CAPSLOCK)
+		MATRIX_KEY(15, 4, KEY_SEMICOLON)
+	>;
 };
 
 /* backup battery charger */
diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c
index 323a0fb575a4..b9e19aa3d4e4 100644
--- a/drivers/input/keyboard/twl4030_keypad.c
+++ b/drivers/input/keyboard/twl4030_keypad.c
@@ -55,7 +55,7 @@
  * row lines connected to the gnd (see twl4030_col_xlate()).
  */
 #define TWL4030_ROW_SHIFT	4
-#define TWL4030_KEYMAP_SIZE	(TWL4030_MAX_ROWS << TWL4030_ROW_SHIFT)
+#define TWL4030_KEYMAP_SIZE	((TWL4030_MAX_ROWS << TWL4030_ROW_SHIFT)*2)
 
 struct twl4030_keypad {
 	unsigned short	keymap[TWL4030_KEYMAP_SIZE];
@@ -65,6 +65,9 @@ struct twl4030_keypad {
 	unsigned int	n_cols;
 	unsigned int	irq;
 
+	unsigned	fn_down:1;
+	unsigned	fn_sticked:1;
+
 	struct device *dbg_dev;
 	struct input_dev *input;
 };
@@ -233,6 +236,7 @@ static void twl4030_kp_scan(struct twl4030_keypad *kp, bool release_all)
 		/* Extra column handles "all gnd" rows */
 		for (col = 0; col < kp->n_cols + 1; col++) {
 			int code;
+			int code2, kcode, is_down;
 
 			if (!(changed & (1 << col)))
 				continue;
@@ -242,9 +246,34 @@ static void twl4030_kp_scan(struct twl4030_keypad *kp, bool release_all)
 				"press" : "release");
 
 			code = MATRIX_SCAN_CODE(row, col, TWL4030_ROW_SHIFT);
+			kcode = kp->keymap[code];
+			is_down = (new_state[row] & (1 << col)) ? 1 : 0;
+
+			dev_dbg(kp->dbg_dev, "code:     %d %d\n", code, kcode);
+			/* Fn handling */
+			if (kcode == KEY_FN) {
+			    kp->fn_down = is_down;
+			    kp->fn_sticked |= is_down;
+			} else if (kp->fn_down || kp->fn_sticked) {
+			    /* make sure other function is up */
+			    input_event(input, EV_MSC, MSC_SCAN, code);
+			    input_report_key(input, kcode, 0);
+
+			    code = MATRIX_SCAN_CODE(row + TWL4030_MAX_ROWS,
+			        col, TWL4030_ROW_SHIFT);
+			    kcode = kp->keymap[code];
+
+			    kp->fn_sticked = 0;
+			} else {
+			    code2 = MATRIX_SCAN_CODE(row + TWL4030_MAX_ROWS,
+			        col, TWL4030_ROW_SHIFT);
+			    input_event(input, EV_MSC, MSC_SCAN, code2);
+			    input_report_key(input, kp->keymap[code2], 0);
+			}
+
+			dev_dbg(kp->dbg_dev, "code(fn): %d %d\n", code, kcode);
 			input_event(input, EV_MSC, MSC_SCAN, code);
-			input_report_key(input, kp->keymap[code],
-					 new_state[row] & (1 << col));
+			input_report_key(input, kcode, is_down);
 		}
 		kp->kp_state[row] = new_state[row];
 	}
@@ -395,7 +424,7 @@ static int twl4030_kp_probe(struct platform_device *pdev)
 	}
 
 	error = matrix_keypad_build_keymap(keymap_data, NULL,
-					   TWL4030_MAX_ROWS,
+					   TWL4030_MAX_ROWS << 1,
 					   1 << TWL4030_ROW_SHIFT,
 					   kp->keymap, input);
 	if (error) {