Parcourir la source

Take the key overlay from radio-keyboard-tca

k4be il y a 2 semaines
Parent
commit
6cea733cf7
4 fichiers modifiés avec 24 ajouts et 19 suppressions
  1. 12 9
      README.md
  2. 9 8
      build-kernel.sh
  3. 1 0
      config.sh
  4. 2 2
      files/dts/sun8i-h2-plus-orangepi-zero-radio.dts

+ 12 - 9
README.md

@@ -237,7 +237,7 @@ includes the mainline board file and adds:
   that is expected.
 - the key expander U2 `gpio@76` (`ti,tca9539`) on i2c1, INT on PA6/PWM1
   (level low, SoC pull-up on), and a `gpio-keys` device named `radio-keys`
-  with the 13 keys. s1d13700-tca's `dts/radio-panel.dts` has the same table.
+  with the 13 keys. radio-keyboard-tca's `dts/radio-keys.dts` has the same table.
   It avoids `#include` so that it also works with `armbian-add-overlay`, so
   the two files cannot share a `.dtsi`. Instead `build-kernel.sh` compares the
   compiled tables (label, U2 pin, flags, key code) and stops if they differ.
@@ -258,11 +258,14 @@ drivers: this board has no display output. Built in and checked by `config`:
 - the sunxi watchdog and the sun6i RTC
 - `FONT_6x8` for `fbcon=font:6x8`
 
-### Drivers for the radio panel (`$PANEL_DIR`, default `/home/k4be/git/radio/s1d13700-tca`)
+### Drivers for the radio panel and keys
 
-The panel driver and its overlay come from the s1d13700-tca repository. The
-application on the board, radio-ui (`/home/k4be/git/radio/radio-ui`, with
-s1d13700-tca as a submodule), is not built here.
+The panel driver and its overlay come from the s1d13700-tca repository
+(`$PANEL_DIR`, default `/home/k4be/git/radio/s1d13700-tca`), the key overlay
+from radio-keyboard-tca (`$KEYBOARD_DIR`, default
+`/home/k4be/git/radio/radio-keyboard-tca`). The application on the board, radio-ui
+(`/home/k4be/git/radio/radio-ui`, with both as submodules), is not built
+here.
 
 - `s1d13700-tca` DRM driver: copied from `$PANEL_DIR/driver` into
   `drivers/gpu/drm/tiny/s1d13700-tca/` on every build and **built in**, so
@@ -272,10 +275,10 @@ s1d13700-tca as a submodule), is not built here.
 - gpio-pca953x (TCA9539, with IRQ) and gpio-keys, built in. `radio-ui drm`
   finds the `radio-keys` evdev device by itself.
 - i2c-dev, i2c-tiny-usb, gpio-keys-polled, evdev, uinput, backlight class
-- s1d13700-tca's `dts/*.dts` overlays are compiled into
-  `/boot/opi0/<release>/overlay/` and can be enabled with `BOOT_OVERLAYS`.
-  They aren't needed: the board DTB already has everything. `radio-panel`
-  would add a second panel and U2 on i2c0.
+- the `dts/*.dts` overlays of s1d13700-tca and radio-keyboard-tca are
+  compiled into `/boot/opi0/<release>/overlay/` and can be enabled with
+  `BOOT_OVERLAYS`. They aren't needed: the board DTB already has everything.
+  `radio-panel` would add a second panel on i2c0, `radio-keys` a second U2.
 
 The driver also registers the panel's backlight as
 `/sys/class/backlight/radio-backlight` (brightness 0 or 1, on at boot), and

+ 9 - 8
build-kernel.sh

@@ -1,7 +1,7 @@
 #!/bin/bash
 # Download, configure and build the mainline kernel for the Orange Pi Zero,
 # plus the out-of-tree modules (xradio Wi-Fi, s1d13700-tca radio panel) and
-# the radio device tree overlays. Result: out/opi0-kernel-<release>.tar.gz
+# the radio device tree overlays (s1d13700-tca, radio-keyboard-tca). Result: out/opi0-kernel-<release>.tar.gz
 # with boot/opi0/<release>/ and lib/modules/<release>/, ready for
 # install-kernel.sh.
 #
@@ -162,18 +162,18 @@ keys_of() {
 	done | sort
 }
 
-# The key table exists twice: in files/dts (board DTB) and in s1d13700-tca's
-# dts/radio-panel.dts, which deliberately avoids #include so it
+# The key table exists twice: in files/dts (board DTB) and in radio-keyboard-tca's
+# dts/radio-keys.dts, which deliberately avoids #include so it
 # also works with armbian-add-overlay. Compare the compiled tables instead
 # of sharing a .dtsi: label, U2 pin, flags and key code must all match.
 check_key_tables() {
-	local boot="$1" ov="$1/overlay/radio-panel.dtbo"
+	local boot="$1" ov="$1/overlay/radio-keys.dtbo"
 	[ -f "$ov" ] || return 0
 	if ! diff -u <(keys_of "$boot/$BOARD_DTB" /radio-keys) \
 		<(keys_of "$ov" /fragment@1/__overlay__/radio-keys) >&2; then
-		die "key tables differ: files/dts/$(basename "$BOARD_DTS") vs $PANEL_DIR/dts/radio-panel.dts (-board +overlay)"
+		die "key tables differ: files/dts/$(basename "$BOARD_DTS") vs $KEYBOARD_DIR/dts/radio-keys.dts (-board +overlay)"
 	fi
-	info "key tables match (board DTB and radio-panel overlay)"
+	info "key tables match (board DTB and radio-keys overlay)"
 }
 
 do_package() {
@@ -195,9 +195,10 @@ do_package() {
 	cp "$KBUILD/.config" "$boot/config"
 	cp "$KBUILD/System.map" "$boot/System.map"
 
-	# Panel overlays (dts/*.dts in s1d13700-tca), for extlinux fdtoverlays.
+	# Panel and key overlays (dts/*.dts in s1d13700-tca and
+	# radio-keyboard-tca), for extlinux fdtoverlays.
 	local d
-	for d in "$PANEL_DIR"/dts/*.dts; do
+	for d in "$PANEL_DIR"/dts/*.dts "$KEYBOARD_DIR"/dts/*.dts; do
 		[ -e "$d" ] || continue
 		dtc -q -@ -I dts -O dtb -o "$boot/overlay/$(basename "${d%.dts}").dtbo" "$d"
 	done

+ 1 - 0
config.sh

@@ -48,6 +48,7 @@ SRC="$TOP/src"          # extracted sources
 OUT="$TOP/out"          # build results
 FILES="$TOP/files"      # config fragments, overlays, boot config templates
 PANEL_DIR="${PANEL_DIR:-/home/k4be/git/radio/s1d13700-tca}"   # s1d13700-tca: panel driver, overlay
+KEYBOARD_DIR="${KEYBOARD_DIR:-/home/k4be/git/radio/radio-keyboard-tca}"   # radio-keyboard-tca: key overlay
 
 KSRC="$SRC/linux-$KERNEL_VERSION"
 USRC="$SRC/u-boot-${UBOOT_VERSION#v}"

+ 2 - 2
files/dts/sun8i-h2-plus-orangepi-zero-radio.dts

@@ -102,8 +102,8 @@
 	/*
 	 * Keys are active high, read directly: one pin each to the supply,
 	 * with an external pull-down. Pins 0-7 are P0.0-7, 8-15 are P1.0-7;
-	 * P0.0-P0.2 are unused. Same table as s1d13700-tca's
-	 * dts/radio-panel.dts and radio-ui's radio/keypad.py; build-kernel.sh compares
+	 * P0.0-P0.2 are unused. Same table as radio-keyboard-tca's
+	 * dts/radio-keys.dts and radio-ui's radio/keypad.py; build-kernel.sh compares
 	 * the compiled tables and stops if they differ. The input device is
 	 * named "radio-keys", which radio-ui looks for.
 	 */