177 lines
5.9 KiB
Diff
177 lines
5.9 KiB
Diff
From d1d849cae12db71aa81ceedaedc1b17a34790367 Mon Sep 17 00:00:00 2001
|
|
From: Samuel Holland <samuel@sholland.org>
|
|
Date: Sat, 19 Jun 2021 18:36:05 -0500
|
|
Subject: [PATCH] Input: kb151 - Add a driver for the KB151 keyboard
|
|
|
|
This keyboard is found in the official Pine64 PinePhone keyboard case.
|
|
It is connected over I2C and runs a libre firmware.
|
|
|
|
Signed-off-by: Samuel Holland <samuel@sholland.org>
|
|
---
|
|
.../dts/allwinner/sun50i-a64-pinephone.dtsi | 64 +++++
|
|
drivers/input/keyboard/Kconfig | 10 +
|
|
drivers/input/keyboard/Makefile | 1 +
|
|
drivers/input/keyboard/kb151.c | 246 ++++++++++++++++++
|
|
4 files changed, 321 insertions(+)
|
|
create mode 100644 drivers/input/keyboard/kb151.c
|
|
|
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
|
|
index 4ede9fe66020c..0bdc6eceec609 100644
|
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
|
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
|
|
@@ -551,6 +551,70 @@
|
|
/* Connected to pogo pins (external spring based pinheader for user addons) */
|
|
&i2c2 {
|
|
status = "okay";
|
|
+
|
|
+ keyboard@15 {
|
|
+ compatible = "pine64,kb151";
|
|
+ reg = <0x15>;
|
|
+ interrupt-parent = <&r_pio>;
|
|
+ interrupts = <0 12 IRQ_TYPE_EDGE_FALLING>; /* PL12 */
|
|
+ keypad,num-rows = <6>;
|
|
+ keypad,num-columns = <12>;
|
|
+ linux,keymap = <MATRIX_KEY(0, 0, KEY_ESC)
|
|
+ MATRIX_KEY(0, 1, KEY_1)
|
|
+ MATRIX_KEY(0, 2, KEY_2)
|
|
+ MATRIX_KEY(0, 3, KEY_3)
|
|
+ MATRIX_K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Y_V)
|
|
+ MATRIX_KEY(3, 5, KEY_B)
|
|
+ MATRIX_KEY(3, 6, KEY_N)
|
|
+ MATRIX_KEY(3, 7, KEY_M)
|
|
+ MATRIX_KEY(3, 8, KEY_COMMA)
|
|
+ MATRIX_KEY(3, 9, KEY_DOT)
|
|
+ MATRIX_KEY(3, 10, KEY_SLASH)
|
|
+ MATRIX_KEY(4, 1, KEY_LEFTCTRL)
|
|
+ MATRIX_KEY(4, 4, KEY_SPACE)
|
|
+ MATRIX_KEY(4, 6, KEY_APOSTROPHE)
|
|
+ MATRIX_KEY(4, 8, KEY_RIGHTBRACE)
|
|
+ MATRIX_KEY(4, 9, KEY_LEFTBRACE)
|
|
+ MATRIX_KEY(5, 2, KEY_FN)
|
|
+ MATRIX_KEY(5, 3, KEY_LEFTALT)
|
|
+ MATRIX_KEY(5, 5, KEY_RIGHTALT)>;
|
|
+ wakeup-source;
|
|
+ };
|
|
};
|
|
|
|
&i2s2 {
|
|
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
|
|
index 40a070a2e7f5b..0259e9133f469 100644
|
|
--- a/drivers/input/keyboard/Kconfig
|
|
+++ b/drivers/input/keyboard/Kconfig
|
|
@@ -353,6 +353,16 @@ config KEYBOARD_HP7XX
|
|
To compile this driver as a module, choose M here: the
|
|
module will be called jornada720_kbd.
|
|
|
|
+config KEYBOARD_KB151
|
|
+ tristate "Pine64 KB151 Keyboard"
|
|
+ depends on I2C
|
|
+ select CRC8
|
|
+ select INPUT_MATRIXKMAP
|
|
+ help
|
|
+ Say Y here to enable support for the KB151 keyboard used in the
|
|
+ Pine64 PinePhone keyboard case. This driver supports the FLOSS
|
|
+ firmware available at https://megous.com/git/pinephone-keyboard/
|
|
+
|
|
config KEYBOARD_LM8323
|
|
tristate "LM8323 keypad chip"
|
|
depends on I2C
|
|
From 2423aac2d6f5db55da99e11fd799ee66fe6f54c6 Mon Sep 17 00:00:00 2001
|
|
From: Samuel Holland <samuel@sholland.org>
|
|
Date: Mon, 9 Aug 2021 19:30:18 -0500
|
|
Subject: [PATCH] Input: kb151 - Add support for the FN layer
|
|
|
|
Signed-off-by: Samuel Holland <samuel@sholland.org>
|
|
---
|
|
.../dts/allwinner/sun50i-a64-pinephone.dtsi | 34 +++++++++++++++++--
|
|
drivers/input/keyboard/kb151.c | 33 ++++++++++--------
|
|
2 files changed, 51 insertions(+), 16 deletions(-)
|
|
|
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
|
|
index 0bdc6eceec609..68f5730cf164c 100644
|
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
|
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
|
|
@@ -557,7 +557,7 @@
|
|
reg = <0x15>;
|
|
interrupt-parent = <&r_pio>;
|
|
interrupts = <0 12 IRQ_TYPE_EDGE_FALLING>; /* PL12 */
|
|
- keypad,num-rows = <6>;
|
|
+ keypad,num-rows = <12>;
|
|
keypad,num-columns = <12>;
|
|
linux,keymap = <MATRIX_KEY(0, 0, KEY_ESC)
|
|
MATRIX_KEY(0, 1, KEY_1)
|
|
@@ -612,7 +612,37 @@
|
|
MATRIX_KEY(4, 9, KEY_LEFTBRACE)
|
|
MATRIX_KEY(5, 2, KEY_FN)
|
|
MATRIX_KEY(5, 3, KEY_LEFTALT)
|
|
- MATRIX_KEY(5, 5, KEY_RIGHTALT)>;
|
|
+ MATRIX_KEY(5, 5, KEY_RIGHTALT)
|
|
+
|
|
+ /* FN layer */
|
|
+ MATRIX_KEY(6, 1, KEY_BACKSLASH)
|
|
+ MATRIX_KEY(6, 2, KEY_BACKSLASH)
|
|
+ MATRIX_KEY(6, 3, KEY_DOLLAR)
|
|
+ MATRIX_KEY(6, 4, KEY_EURO)
|
|
+ MATRIX_KEY(6, 5, KEY_GRAVE)
|
|
+ MATRIX_KEY(6, 6, KEY_GRAVE)
|
|
+ MATRIX_KEY(6, 7, KEY_MINUS)
|
|
+ MATRIX_KEY(6, 8, KEY_EQUAL)
|
|
+ MATRIX_KEY(6, 9, KEY_MINUS)
|
|
+ MATRIX_KEY(6, 10, KEY_EQUAL)
|
|
+ MATRIX_KEY(6, 11, KEY_DELETE)
|
|
+
|
|
+ MATRIX_KEY(8, 0, KEY_SYSRQ)
|
|
+ MATRIX_KEY(8, 10, KEY_INSERT)
|
|
+
|
|
+ MATRIX_KEY(9, 0, KEY_LEFTSHIFT)
|
|
+ MATRIX_KEY(9, 8, KEY_HOME)
|
|
+ MATRIX_KEY(9, 9, KEY_UP)
|
|
+ MATRIX_KEY(9, 10, KEY_END)
|
|
+
|
|
+ MATRIX_KEY(10, 1, KEY_LEFTCTRL)
|
|
+ MATRIX_KEY(10, 6, KEY_LEFT)
|
|
+ MATRIX_KEY(10, 8, KEY_RIGHT)
|
|
+ MATRIX_KEY(10, 9, KEY_DOWN)
|
|
+
|
|
+ MATRIX_KEY(11, 2, KEY_FN)
|
|
+ MATRIX_KEY(11, 3, KEY_LEFTALT)
|
|
+ MATRIX_KEY(11, 5, KEY_RIGHTALT)>;
|
|
wakeup-source;
|
|
};
|
|
};
|