From 6debcd5420b798dd8c0b3052620cc5d8f3bcbff7 Mon Sep 17 00:00:00 2001
From: Naoto Yamaguchi <naoto.yamaguchi@aisin.co.jp>
Date: Wed, 24 Jul 2024 07:18:48 +0900
Subject: Add support NanoPC-T6(RK3588) board

This patch add NanoPC-T6 board support to AGL that board is
manufactured by FriendlyElec.

Board info.
https://wiki.friendlyelec.com/wiki/index.php/NanoPC-T6

Bug-AGL: SPEC-5208

Change-Id: Id1b6d9c6f73ece2b3a2f602405f534473e8bcbf2
Signed-off-by: Naoto Yamaguchi <naoto.yamaguchi@aisin.co.jp>
Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/30168
Reviewed-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
ci-image-build: Jenkins Job builder account
ci-image-boot-test: Jenkins Job builder account
Tested-by: Jenkins Job builder account
---
 meta-agl-bsp/conf/include/agl_rk3588.inc           |  12 +
 .../recipes-bsp/alsa-state/alsa-state.bbappend     |   3 +
 .../recipes-bsp/alsa-state/alsa-state/asound.state | 525 +++++++++++++++++++++
 .../wayland/agl-compositor-init.bbappend           |   7 +
 .../agl-compositor-rockchip.conf                   |   2 +
 .../wayland/weston-ini-conf.bbappend               |   7 +
 .../wayland/weston-ini-conf/nanopct6_output.cfg    |   7 +
 7 files changed, 563 insertions(+)
 create mode 100644 meta-agl-bsp/conf/include/agl_rk3588.inc
 create mode 100644 meta-agl-bsp/meta-rockchip/recipes-bsp/alsa-state/alsa-state.bbappend
 create mode 100644 meta-agl-bsp/meta-rockchip/recipes-bsp/alsa-state/alsa-state/asound.state
 create mode 100644 meta-agl-bsp/meta-rockchip/recipes-graphics/wayland/agl-compositor-init.bbappend
 create mode 100644 meta-agl-bsp/meta-rockchip/recipes-graphics/wayland/agl-compositor-init/agl-compositor-rockchip.conf
 create mode 100644 meta-agl-bsp/meta-rockchip/recipes-graphics/wayland/weston-ini-conf.bbappend
 create mode 100644 meta-agl-bsp/meta-rockchip/recipes-graphics/wayland/weston-ini-conf/nanopct6_output.cfg

(limited to 'meta-agl-bsp')

diff --git a/meta-agl-bsp/conf/include/agl_rk3588.inc b/meta-agl-bsp/conf/include/agl_rk3588.inc
new file mode 100644
index 000000000..4c3f6990f
--- /dev/null
+++ b/meta-agl-bsp/conf/include/agl_rk3588.inc
@@ -0,0 +1,12 @@
+# Add for gstreamer plugins ugly
+LICENSE_FLAGS_ACCEPTED:append = " commercial"
+MACHINE_FEATURES:append:rk3588 = " multimedia"
+
+BBMASK += " \
+    meta-rockchip/recipes-multimedia/gstreamer \
+    meta-rockchip/recipes-graphics/wayland/weston_%.bbappend \
+    "
+
+MACHINE_EXTRA_RRECOMMENDS:append = " \
+    alsa-state \
+"
diff --git a/meta-agl-bsp/meta-rockchip/recipes-bsp/alsa-state/alsa-state.bbappend b/meta-agl-bsp/meta-rockchip/recipes-bsp/alsa-state/alsa-state.bbappend
new file mode 100644
index 000000000..784560131
--- /dev/null
+++ b/meta-agl-bsp/meta-rockchip/recipes-bsp/alsa-state/alsa-state.bbappend
@@ -0,0 +1,3 @@
+FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
diff --git a/meta-agl-bsp/meta-rockchip/recipes-bsp/alsa-state/alsa-state/asound.state b/meta-agl-bsp/meta-rockchip/recipes-bsp/alsa-state/alsa-state/asound.state
new file mode 100644
index 000000000..c4039455a
--- /dev/null
+++ b/meta-agl-bsp/meta-rockchip/recipes-bsp/alsa-state/alsa-state/asound.state
@@ -0,0 +1,525 @@
+state.realtekrt5616co {
+	control.1 {
+		iface CARD
+		name 'Headphone Jack'
+		value true
+		comment {
+			access read
+			type BOOLEAN
+			count 1
+		}
+	}
+	control.2 {
+		iface MIXER
+		name 'I2STDM Digital Loopback Mode'
+		value Disabled
+		comment {
+			access 'read write'
+			type ENUMERATED
+			count 1
+			item.0 Disabled
+			item.1 Mode1
+			item.2 Mode2
+			item.3 'Mode2 Swap'
+		}
+	}
+	control.3 {
+		iface MIXER
+		name 'HP Playback Switch'
+		value.0 true
+		value.1 true
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 2
+		}
+	}
+	control.4 {
+		iface MIXER
+		name 'HPVOL Playback Switch'
+		value.0 false
+		value.1 false
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 2
+		}
+	}
+	control.5 {
+		iface MIXER
+		name 'HP Playback Volume'
+		value.0 0
+		value.1 0
+		comment {
+			access 'read write'
+			type INTEGER
+			count 2
+			range '0 - 39'
+			dbmin -4650
+			dbmax 1200
+			dbvalue.0 -4650
+			dbvalue.1 -4650
+		}
+	}
+	control.6 {
+		iface MIXER
+		name 'OUT Playback Switch'
+		value.0 false
+		value.1 false
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 2
+		}
+	}
+	control.7 {
+		iface MIXER
+		name 'OUT Channel Switch'
+		value.0 false
+		value.1 false
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 2
+		}
+	}
+	control.8 {
+		iface MIXER
+		name 'OUT Playback Volume'
+		value.0 31
+		value.1 31
+		comment {
+			access 'read write'
+			type INTEGER
+			count 2
+			range '0 - 39'
+			dbmin -4650
+			dbmax 1200
+			dbvalue.0 0
+			dbvalue.1 0
+		}
+	}
+	control.9 {
+		iface MIXER
+		name 'DAC1 Playback Volume'
+		value.0 175
+		value.1 175
+		comment {
+			access 'read write'
+			type INTEGER
+			count 2
+			range '0 - 175'
+			dbmin -65625
+			dbmax 0
+			dbvalue.0 0
+			dbvalue.1 0
+		}
+	}
+	control.10 {
+		iface MIXER
+		name 'IN1 Boost Volume'
+		value 0
+		comment {
+			access 'read write'
+			type INTEGER
+			count 1
+			range '0 - 8'
+			dbmin 0
+			dbmax 5200
+			dbvalue.0 0
+		}
+	}
+	control.11 {
+		iface MIXER
+		name 'IN2 Boost Volume'
+		value 0
+		comment {
+			access 'read write'
+			type INTEGER
+			count 1
+			range '0 - 8'
+			dbmin 0
+			dbmax 5200
+			dbvalue.0 0
+		}
+	}
+	control.12 {
+		iface MIXER
+		name 'IN Capture Volume'
+		value.0 23
+		value.1 23
+		comment {
+			access 'read write'
+			type INTEGER
+			count 2
+			range '0 - 31'
+			dbmin -3450
+			dbmax 1200
+			dbvalue.0 0
+			dbvalue.1 0
+		}
+	}
+	control.13 {
+		iface MIXER
+		name 'ADC Capture Switch'
+		value.0 false
+		value.1 false
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 2
+		}
+	}
+	control.14 {
+		iface MIXER
+		name 'ADC Capture Volume'
+		value.0 47
+		value.1 47
+		comment {
+			access 'read write'
+			type INTEGER
+			count 2
+			range '0 - 127'
+			dbmin -17625
+			dbmax 30000
+			dbvalue.0 0
+			dbvalue.1 0
+		}
+	}
+	control.15 {
+		iface MIXER
+		name 'ADC Boost Volume'
+		value.0 0
+		value.1 0
+		comment {
+			access 'read write'
+			type INTEGER
+			count 2
+			range '0 - 3'
+			dbmin 0
+			dbmax 3600
+			dbvalue.0 0
+			dbvalue.1 0
+		}
+	}
+	control.16 {
+		iface MIXER
+		name 'RECMIXL INL1 Switch'
+		value false
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 1
+		}
+	}
+	control.17 {
+		iface MIXER
+		name 'RECMIXL BST2 Switch'
+		value false
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 1
+		}
+	}
+	control.18 {
+		iface MIXER
+		name 'RECMIXL BST1 Switch'
+		value false
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 1
+		}
+	}
+	control.19 {
+		iface MIXER
+		name 'RECMIXR INR1 Switch'
+		value false
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 1
+		}
+	}
+	control.20 {
+		iface MIXER
+		name 'RECMIXR BST2 Switch'
+		value false
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 1
+		}
+	}
+	control.21 {
+		iface MIXER
+		name 'RECMIXR BST1 Switch'
+		value false
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 1
+		}
+	}
+	control.22 {
+		iface MIXER
+		name 'Stereo1 ADC MIXL ADC1 Switch'
+		value false
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 1
+		}
+	}
+	control.23 {
+		iface MIXER
+		name 'Stereo1 ADC MIXR ADC1 Switch'
+		value false
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 1
+		}
+	}
+	control.24 {
+		iface MIXER
+		name 'DAC MIXL Stereo ADC Switch'
+		value false
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 1
+		}
+	}
+	control.25 {
+		iface MIXER
+		name 'DAC MIXL INF1 Switch'
+		value true
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 1
+		}
+	}
+	control.26 {
+		iface MIXER
+		name 'DAC MIXR Stereo ADC Switch'
+		value false
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 1
+		}
+	}
+	control.27 {
+		iface MIXER
+		name 'DAC MIXR INF1 Switch'
+		value false
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 1
+		}
+	}
+	control.28 {
+		iface MIXER
+		name 'Stereo DAC MIXL DAC L1 Switch'
+		value true
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 1
+		}
+	}
+	control.29 {
+		iface MIXER
+		name 'Stereo DAC MIXL DAC R1 Switch'
+		value true
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 1
+		}
+	}
+	control.30 {
+		iface MIXER
+		name 'Stereo DAC MIXR DAC R1 Switch'
+		value true
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 1
+		}
+	}
+	control.31 {
+		iface MIXER
+		name 'Stereo DAC MIXR DAC L1 Switch'
+		value true
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 1
+		}
+	}
+	control.32 {
+		iface MIXER
+		name 'OUT MIXL BST1 Switch'
+		value false
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 1
+		}
+	}
+	control.33 {
+		iface MIXER
+		name 'OUT MIXL BST2 Switch'
+		value false
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 1
+		}
+	}
+	control.34 {
+		iface MIXER
+		name 'OUT MIXL INL1 Switch'
+		value false
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 1
+		}
+	}
+	control.35 {
+		iface MIXER
+		name 'OUT MIXL REC MIXL Switch'
+		value false
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 1
+		}
+	}
+	control.36 {
+		iface MIXER
+		name 'OUT MIXL DAC L1 Switch'
+		value false
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 1
+		}
+	}
+	control.37 {
+		iface MIXER
+		name 'OUT MIXR BST2 Switch'
+		value false
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 1
+		}
+	}
+	control.38 {
+		iface MIXER
+		name 'OUT MIXR BST1 Switch'
+		value false
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 1
+		}
+	}
+	control.39 {
+		iface MIXER
+		name 'OUT MIXR INR1 Switch'
+		value false
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 1
+		}
+	}
+	control.40 {
+		iface MIXER
+		name 'OUT MIXR REC MIXR Switch'
+		value false
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 1
+		}
+	}
+	control.41 {
+		iface MIXER
+		name 'OUT MIXR DAC R1 Switch'
+		value false
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 1
+		}
+	}
+	control.42 {
+		iface MIXER
+		name 'HPO MIX DAC1 Switch'
+		value true
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 1
+		}
+	}
+	control.43 {
+		iface MIXER
+		name 'HPO MIX HPVOL Switch'
+		value false
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 1
+		}
+	}
+	control.44 {
+		iface MIXER
+		name 'LOUT MIX DAC L1 Switch'
+		value false
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 1
+		}
+	}
+	control.45 {
+		iface MIXER
+		name 'LOUT MIX DAC R1 Switch'
+		value false
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 1
+		}
+	}
+	control.46 {
+		iface MIXER
+		name 'LOUT MIX OUTVOL L Switch'
+		value false
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 1
+		}
+	}
+	control.47 {
+		iface MIXER
+		name 'LOUT MIX OUTVOL R Switch'
+		value false
+		comment {
+			access 'read write'
+			type BOOLEAN
+			count 1
+		}
+	}
+}
diff --git a/meta-agl-bsp/meta-rockchip/recipes-graphics/wayland/agl-compositor-init.bbappend b/meta-agl-bsp/meta-rockchip/recipes-graphics/wayland/agl-compositor-init.bbappend
new file mode 100644
index 000000000..ab14bdbc2
--- /dev/null
+++ b/meta-agl-bsp/meta-rockchip/recipes-graphics/wayland/agl-compositor-init.bbappend
@@ -0,0 +1,7 @@
+FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
+
+SRC_URI:append = " file://agl-compositor-rockchip.conf "
+
+do_install:append() {
+    install -m644 ${WORKDIR}/agl-compositor-rockchip.conf ${D}/${systemd_system_unitdir}/agl-compositor.service.d/agl-compositor-rockchip.conf
+}
diff --git a/meta-agl-bsp/meta-rockchip/recipes-graphics/wayland/agl-compositor-init/agl-compositor-rockchip.conf b/meta-agl-bsp/meta-rockchip/recipes-graphics/wayland/agl-compositor-init/agl-compositor-rockchip.conf
new file mode 100644
index 000000000..e85d7fa91
--- /dev/null
+++ b/meta-agl-bsp/meta-rockchip/recipes-graphics/wayland/agl-compositor-init/agl-compositor-rockchip.conf
@@ -0,0 +1,2 @@
+[Service]
+Environment=LD_PRELOAD=/usr/lib/libmali.so.1
diff --git a/meta-agl-bsp/meta-rockchip/recipes-graphics/wayland/weston-ini-conf.bbappend b/meta-agl-bsp/meta-rockchip/recipes-graphics/wayland/weston-ini-conf.bbappend
new file mode 100644
index 000000000..a7bebe3fc
--- /dev/null
+++ b/meta-agl-bsp/meta-rockchip/recipes-graphics/wayland/weston-ini-conf.bbappend
@@ -0,0 +1,7 @@
+FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
+
+SRC_URI:append = " \
+	file://nanopct6_output.cfg \
+"
+
+WESTON_FRAGMENTS:append:nanopct6 = " nanopct6_output"
diff --git a/meta-agl-bsp/meta-rockchip/recipes-graphics/wayland/weston-ini-conf/nanopct6_output.cfg b/meta-agl-bsp/meta-rockchip/recipes-graphics/wayland/weston-ini-conf/nanopct6_output.cfg
new file mode 100644
index 000000000..fbee86693
--- /dev/null
+++ b/meta-agl-bsp/meta-rockchip/recipes-graphics/wayland/weston-ini-conf/nanopct6_output.cfg
@@ -0,0 +1,7 @@
+[output]
+name=HDMI-A-2
+mode=off
+
+[output]
+name=DP-1
+transform=rotate-90
-- 
cgit