# Bananarchy device tree derivation: nokia-beatles and nokia-coconut start # from the mainline qcom-msm8905-nokia-argon.dts. This patch is documentation # of that derivation; the DTBs in images/ are compiled directly from the # devices/*/qcom-*.dts files by scripts/build-kernel-audio.sh. --- a/devices/nokia-argon/qcom-msm8905-nokia-argon.dts +++ b/devices/nokia-beatles/qcom-msm8905-nokia-beatles.dts @@ -4,10 +4,20 @@ #address-cells = <0x01>; #size-cells = <0x01>; interrupt-parent = <0x01>; - model = "Nokia 8110 4G"; - compatible = "nokia,argon", "qcom,msm8905", "qcom,msm8909"; + model = "Nokia 2720 Flip"; + compatible = "nokia,beatles", "nokia,argon", "qcom,msm8905", "qcom,msm8909"; chassis-type = "handset"; + /* Qualcomm aboot selects an appended DTB by these IDs. All three values + * are copied verbatim from the MSM8905 QRD SKUB DTB (index 33) in the + * stock 2720 recovery image. Keep only that exact board-id pair: older + * aboot revisions inspect the first pair only, so adding lk2nd's + * 0x0b/0x100 variant makes the DTB look like a different board and the + * bootloader never jumps to the kernel. */ + qcom,msm-id = <0x14b 0x00>; + qcom,board-id = <0x1000b 0x100>; + qcom,pmic-id = <0x1000d 0x00 0x00 0x00>; + aliases { mmc0 = "/soc@0/sdhci@7824000"; mmc1 = "/soc@0/sdhci@7864000"; @@ -195,9 +205,13 @@ }; }; + /* Stock aboot rewrites /memory:reg from the SMEM RAM partition table. + * Keep the mainline node name (libfdt resolves /memory to it) but ship the + * real 512 MiB size as a fallback, so a bootloader that fails to patch the + * node still gives Linux usable RAM instead of a zero-sized memory bank. */ memory@80000000 { device_type = "memory"; - reg = <0x80000000 0x00>; + reg = <0x80000000 0x20000000>; }; pmu { @@ -1016,7 +1030,7 @@ }; matrix-keypad-col-default-state { - pins = "gpio52", "gpio56", "gpio7", "gpio99", "gpio6"; + pins = "gpio52", "gpio56", "gpio7", "gpio99", "gpio6", "gpio1"; function = "gpio"; drive-strength = <0x02>; bias-disable; @@ -1030,6 +1044,17 @@ bias-pull-down; phandle = <0x6e>; }; + + /* External (cover) panel: TE gpio21, reset gpio23, + * SPI bus switch gpio13. Used by the cover-panel.dtsi + * fragment and by bananarchy-coverd's spidev backend. */ + cover-panel-gpios-default-state { + pins = "gpio21", "gpio23", "gpio13"; + function = "gpio"; + drive-strength = <0x02>; + bias-pull-down; + phandle = <0x92>; + }; }; clock-controller@1800000 { @@ -1150,7 +1175,7 @@ debounce = <0x3d09>; bias-pull-up; status = "okay"; - linux,code = <0x6c>; + linux,code = <0x72>; /* KEY_VOLUMEDOWN */ }; watchdog { @@ -1838,7 +1863,7 @@ status = "okay"; display@0 { - compatible = "nokia,argon-gc9305-v2-panel", "panel-mipi-dbi-spi"; + compatible = "nokia,beatles-gc9305-panel", "nokia,argon-gc9305-v2-panel", "panel-mipi-dbi-spi"; reg = <0x00>; backlight = <0x6b>; reset-gpios = <0x27 0x19 0x00>; @@ -2287,30 +2312,36 @@ pinctrl-0 = <0x86 0x87>; pinctrl-names = "default"; - key-up { + /* gpio90 is the side volume-up rocker on the 2720 Flip. */ + key-volup { wakeup-source; gpios = <0x27 0x5a 0x01>; - linux,code = <0x67>; + linux,code = <0x73>; /* KEY_VOLUMEUP -> XF86AudioRaiseVolume */ debounce-interval = <0x0f>; linux,can-disable; }; - key-back { + /* gpio98 is the red end/power key. */ + key-end { wakeup-source; gpios = <0x27 0x62 0x01>; - linux,code = <0x0e>; + linux,code = <0x74>; /* KEY_POWER -> XF86PowerOff */ debounce-interval = <0x0f>; linux,can-disable; }; - switch-lid-close { + /* gpio92: closed-lid hall sensor (EV_SW SW_LID = 1). */ + hall-lid-closed { wakeup-source; gpios = <0x27 0x5c 0x01>; linux,input-type = <0x05>; linux,code = <0x00>; }; - switch-lid-open { + /* gpio36: open-lid hall sensor (EV_SW SW_KEYPAD_SLIDE = 1), + * also wired to the internal/external panel SPI switch. */ + hall-lid-open { + wakeup-source; gpios = <0x27 0x24 0x01>; linux,input-type = <0x05>; linux,code = <0x0a>; @@ -2325,8 +2356,36 @@ pinctrl-0 = <0x88 0x89>; pinctrl-names = "default"; row-gpios = <0x27 0x61 0x01 0x27 0x60 0x01 0x27 0x5f 0x01 0x27 0x5e 0x01>; - col-gpios = <0x27 0x34 0x01 0x27 0x38 0x01 0x27 0x07 0x01 0x27 0x63 0x01 0x27 0x06 0x01>; - linux,keymap = <0x1bd 0x10002 0x20005 0x30008 0x4020a 0x1000069 0x1010003 0x1020006 0x1030009 0x104000b 0x20002b8 0x2010004 0x2020007 0x203000a 0x204020b 0x300001c 0x301006a 0x30202b9>; + col-gpios = <0x27 0x34 0x01 0x27 0x38 0x01 0x27 0x07 0x01 0x27 0x63 0x01 0x27 0x06 0x01 0x27 0x01 0x01>; + /* Physical matrix from the KaiOS downstream DTS (4 rows x 6 cols), + * mapped to the canonical keycodes Bananarchy's X11 stack binds: + * soft left -> KEY_COMPOSE (XKB 135, XK_Menu), soft right -> KEY_BACK + * (XKB 166, XF86Back), center -> KEY_ENTER, call -> KEY_PICKUP_PHONE. + * See X_KEYPAD_MAPPING.md and NOKIA-2720-FLIP.md. */ + linux,keymap = < + 0x1bd /* (0,0) call KEY_PICKUP_PHONE */ + 0x10002 /* (0,1) 1 */ + 0x20005 /* (0,2) 4 */ + 0x30008 /* (0,3) 7 */ + 0x4020a /* (0,4) * KEY_NUMERIC_STAR */ + 0x500d4 /* (0,5) extra KEY_CAMERA -> XF86WebCam */ + 0x1000069 /* (1,0) D-pad left KEY_LEFT */ + 0x1010003 /* (1,1) 2 */ + 0x1020006 /* (1,2) 5 */ + 0x1030009 /* (1,3) 8 */ + 0x104000b /* (1,4) 0 */ + 0x105000e /* (1,5) clear KEY_BACKSPACE */ + 0x200007f /* (2,0) soft left KEY_COMPOSE -> XK_Menu */ + 0x2010004 /* (2,1) 3 */ + 0x2020007 /* (2,2) 6 */ + 0x203000a /* (2,3) 9 */ + 0x204020b /* (2,4) # KEY_NUMERIC_POUND */ + 0x300001c /* (3,0) D-pad OK KEY_ENTER -> Return */ + 0x301006a /* (3,1) D-pad right KEY_RIGHT */ + 0x302009e /* (3,2) soft right KEY_BACK -> XF86Back */ + 0x3030067 /* (3,3) D-pad up KEY_UP */ + 0x304006c /* (3,4) D-pad down KEY_DOWN */ + >; }; leds { --- a/devices/nokia-argon/qcom-msm8905-nokia-argon.dts +++ b/devices/nokia-tough/qcom-msm8905-nokia-coconut.dts @@ -4,8 +4,8 @@ #address-cells = <0x01>; #size-cells = <0x01>; interrupt-parent = <0x01>; - model = "Nokia 8110 4G"; - compatible = "nokia,argon", "qcom,msm8905", "qcom,msm8909"; + model = "Nokia 800 Tough"; + compatible = "nokia,coconut", "nokia,argon", "qcom,msm8905", "qcom,msm8909"; chassis-type = "handset"; aliases { @@ -1838,7 +1838,7 @@ status = "okay"; display@0 { - compatible = "nokia,argon-gc9305-v2-panel", "panel-mipi-dbi-spi"; + compatible = "nokia,coconut-gc9305-panel", "nokia,argon-gc9305-v2-panel", "panel-mipi-dbi-spi"; reg = <0x00>; backlight = <0x6b>; reset-gpios = <0x27 0x19 0x00>; @@ -1886,6 +1911,15 @@ clock-frequency = "", "#("; }; }; + + /* External (cover) GC9305 shares the QUP5 SPI lines. + * bananarchy-coverd drives gpio13 to route them to the cover + * panel, then talks to it through /dev/spidev0.1. spi-qup + * has 4 native chip selects and toggles the single physical + * CS line, so reg=1 gives the daemon a second logical device. */ + spidev@1 { + compatible = "rohm,dh2228fv"; + reg = <0x01>; + spi-max-frequency = <0x2faf080>; + status = "okay"; + }; };