gjdwebserver-overlay/sys-kernel/pinephone-pro-sources/files/ppp-keyboard.patch
2022-01-14 17:01:30 +01:00

144 lines
4.0 KiB
Diff

commit 4f4db49e9fc5a3c7b7db1b87f9c815e376a05314
Author: Zhaofeng Li <hello@zhaofeng.li>
Date: Wed Jan 12 21:52:18 2022 -0800
arm64: dts: rk3399-pinephone-pro: Add keyboard accessory
The pogo pins are connected to i2c5.
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-pinephone-pro.dts b/arch/arm64/boot/dts/rockchip/rk3399-pinephone-pro.dts
index e6c738e02..873d70bc6 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-pinephone-pro.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3399-pinephone-pro.dts
@@ -6,6 +6,7 @@
/dts-v1/;
#include <dt-bindings/input/gpio-keys.h>
+#include <dt-bindings/input/input.h>
#include <dt-bindings/input/linux-event-codes.h>
#include <dt-bindings/usb/pd.h>
#include <dt-bindings/leds/common.h>
@@ -981,6 +982,109 @@ ak09911: compass@c {
};
};
+&i2c5 {
+ clock-frequency = <400000>;
+ i2c-scl-rising-time-ns = <450>;
+ i2c-scl-falling-time-ns = <15>;
+ status = "okay";
+
+ keyboard@15 {
+ compatible = "pine64,kb151";
+ reg = <0x15>;
+ interrupt-parent = <&gpio3>;
+ interrupts = <RK_PA0 IRQ_TYPE_EDGE_FALLING>; /* FIXME */
+ pinctrl-names = "default";
+ pinctrl-0 = <&pogo_int>;
+ keypad,num-rows = <12>;
+ 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_KEY(0, 4, KEY_4)
+ MATRIX_KEY(0, 5, KEY_5)
+ MATRIX_KEY(0, 6, KEY_6)
+ MATRIX_KEY(0, 7, KEY_7)
+ MATRIX_KEY(0, 8, KEY_8)
+ MATRIX_KEY(0, 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_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)
+
+ /* 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;
+ };
+};
+
&i2s0 {
rockchip,playback-channels = <2>;
rockchip,capture-channels = <2>;
@@ -1193,6 +1297,12 @@ spk_en: spk-en {
rockchip,pins = <0 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
};
};
+
+ keyboard {
+ pogo_int: pogo-int {
+ rockchip,pins = <3 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>;
+ };
+ };
};
&pwm0 {