amediatech-x96-mini: new device (MR 3985)

[ci:skip-build]: already built successfully in CI
This commit is contained in:
@exkc 2023-04-01 13:22:23 +08:00 committed by Oliver Smith
parent c34344108f
commit fe07d7f9f4
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
5 changed files with 471 additions and 0 deletions

View file

@ -0,0 +1,36 @@
# Reference: <https://postmarketos.org/devicepkg>
# Maintainer: exkc <exxxxkc@getgoogleoff.me>
pkgname=device-amediatech-x96-mini
pkgver=1
pkgrel=0
pkgdesc="Amediatech X96 mini"
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="postmarketos-base u-boot-amediatech-x96-mini soc-amlogic-s905 linux-postmarketos-amlogic"
makedepends="devicepkg-dev"
subpackages="$pkgname-nonfree-firmware:nonfree_firmware"
source="asound.state deviceinfo"
build() {
devicepkg_build $startdir $pkgname
}
package() {
devicepkg_package $startdir $pkgname
install -Dm644 "$srcdir"/asound.state \
"$pkgdir"/var/lib/alsa/asound.state
}
nonfree_firmware() {
pkgdesc="Amediatech X96 mini firmware"
depends="linux-firmware-meson"
mkdir "$subpkgdir"
}
sha512sums="
9bdfda8a513a4bb42aefcc3721388a5abdbf3f4ccd820f6a8f3e3ce282351aa7ceca012df64e2152a67139e792601e29cdc78f76a5812177302cd41c8ae680cf deviceinfo
981ef458837524b2b1922e7bc5abd4936d629e3f83e92062b46597cef985b65fdb90900de1ef93a7d741b9b0ac4b41cef9c3c2625181ff0e10effc22cb2fa3a3 asound.state
"

View file

@ -0,0 +1,217 @@
state.P230Q200 {
control.1 {
iface MIXER
name 'AIU ACODEC I2S Lane Select'
value 3
comment {
access 'read write'
type INTEGER
count 1
range '0 - 3'
}
}
control.2 {
iface MIXER
name 'ACODEC Playback Channel Mode'
value Stereo
comment {
access 'read write'
type ENUMERATED
count 1
item.0 Stereo
item.1 Mono
}
}
control.3 {
iface MIXER
name 'ACODEC Playback Switch'
value true
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.4 {
iface MIXER
name 'ACODEC Playback Volume'
value.0 255
value.1 255
comment {
access 'read write'
type INTEGER
count 2
range '0 - 255'
dbmin -9999999
dbmax 0
dbvalue.0 0
dbvalue.1 0
}
}
control.5 {
iface MIXER
name 'ACODEC Ramp Rate'
value Fast
comment {
access 'read write'
type ENUMERATED
count 1
item.0 Fast
item.1 Slow
}
}
control.6 {
iface MIXER
name 'ACODEC Volume Ramp Switch'
value false
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.7 {
iface MIXER
name 'ACODEC Mute Ramp Switch'
value false
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.8 {
iface MIXER
name 'ACODEC Unmute Ramp Switch'
value false
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.9 {
iface PCM
device 4
name 'Playback Channel Map'
value.0 0
value.1 0
value.2 0
value.3 0
value.4 0
value.5 0
value.6 0
value.7 0
comment {
access read
type INTEGER
count 8
range '0 - 36'
}
}
control.10 {
iface PCM
device 4
name 'IEC958 Playback Mask'
value ffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
comment {
access read
type IEC958
count 1
}
}
control.11 {
iface PCM
device 4
name 'IEC958 Playback Default'
value '0400000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
comment {
access 'read write'
type IEC958
count 1
}
}
control.12 {
iface PCM
device 4
name ELD
value '0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
comment {
access 'read volatile'
type BYTES
count 128
}
}
control.13 {
iface MIXER
name 'AIU SPDIF SRC SEL'
value SPDIF
comment {
access 'read write'
type ENUMERATED
count 1
item.0 SPDIF
item.1 I2S
}
}
control.14 {
iface MIXER
name 'AIU HDMI CTRL SRC'
value I2S
comment {
access 'read write'
type ENUMERATED
count 1
item.0 DISABLED
item.1 PCM
item.2 I2S
}
}
control.15 {
iface MIXER
name 'AIU ACODEC SRC'
value I2S
comment {
access 'read write'
type ENUMERATED
count 1
item.0 DISABLED
item.1 I2S
item.2 PCM
}
}
control.16 {
iface MIXER
name 'AIU ACODEC OUT EN Switch'
value false
comment {
access 'read write'
type BOOLEAN
count 1
}
}
control.17 {
iface MIXER
name 'ACODEC Right DAC Sel'
value Right
comment {
access 'read write'
type ENUMERATED
count 1
item.0 Right
item.1 Left
}
}
control.18 {
iface MIXER
name 'ACODEC Left DAC Sel'
value Left
comment {
access 'read write'
type ENUMERATED
count 1
item.0 Left
item.1 Right
}
}
}

View file

@ -0,0 +1,29 @@
# Reference: <https://postmarketos.org/deviceinfo>
# Please use double quotes only. You can source this file in shell scripts.
deviceinfo_format_version="0"
deviceinfo_name="Amediatech X96 mini"
deviceinfo_manufacturer="Amediatech"
deviceinfo_codename="amediatech-x96-mini"
deviceinfo_dtb="amlogic/meson-gxl-s905w-x96-mini"
deviceinfo_year="2017"
deviceinfo_arch="aarch64"
deviceinfo_disable_dhcpd="true"
# Device related
deviceinfo_gpu_accelerated="true"
deviceinfo_chassis="desktop"
deviceinfo_keyboard="true"
deviceinfo_external_storage="true"
deviceinfo_screen_width="1920"
deviceinfo_screen_height="1080"
# Bootloader related
deviceinfo_flash_method="none"
deviceinfo_sd_embed_firmware_step_size="512"
deviceinfo_sd_embed_firmware="u-boot/amediatech-x96-mini/u-boot.bin.sd-stripped.bin:1"
deviceinfo_boot_part_start="4096"
deviceinfo_generate_extlinux_config="true"
# Kernel options
deviceinfo_kernel_cmdline="console=null PMOS_NO_OUTPUT_REDIRECT"
deviceinfo_modules_initfs="fixed meson_gxbb_wdt meson_wdt meson-gx-mmc dw_hdmi drm_display_helper cec display_connector drm_kms_helper drm meson_drm meson_dw_hdmi"

View file

@ -0,0 +1,127 @@
From 6a40398dee7a21df9da032aa2f8b6c5cc08453c0 Mon Sep 17 00:00:00 2001
From: "@exkc" <exkc@exkc.moe>
Date: Thu, 30 Mar 2023 19:58:52 +0800
Subject: [PATCH] add x96-mini support
---
arch/arm/dts/meson-gxl-s905w-x96-mini.dts | 38 ++++++++++++++
configs/x96_mini_defconfig | 62 +++++++++++++++++++++++
2 files changed, 100 insertions(+)
create mode 100644 arch/arm/dts/meson-gxl-s905w-x96-mini.dts
create mode 100644 configs/x96_mini_defconfig
diff --git a/arch/arm/dts/meson-gxl-s905w-x96-mini.dts b/arch/arm/dts/meson-gxl-s905w-x96-mini.dts
new file mode 100644
index 0000000000..bd69f88973
--- /dev/null
+++ b/arch/arm/dts/meson-gxl-s905w-x96-mini.dts
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2023 Karl Chan <exxxxkc@getgoogleoff.me>.
+ * Based on meson-gxl-s905w-tx3-mini.dts:
+ *
+ */
+
+/dts-v1/;
+
+#include <dt-bindings/leds/common.h>
+
+#include "meson-gxl-s905x.dtsi"
+#include "meson-gx-p23x-q20x.dtsi"
+
+/ {
+ compatible = "amediatech,x96-mini", "amlogic,s905w", "amlogic,meson-gxl";
+ model = "Shenzhen Amediatech Technology Co., X96 Mini";
+
+ memory@0 {
+ device_type = "memory";
+ reg = <0x0 0x0 0x0 0x40000000>; /* 1 GiB or 2 GiB */
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ led-0 {
+ label = "x96-mini:blue:power";
+ gpios = <&gpio GPIODV_24 GPIO_ACTIVE_HIGH>;
+ default-state = "on";
+ };
+ };
+
+};
+
+&usb {
+ dr_mode = "host";
+};
diff --git a/configs/x96_mini_defconfig b/configs/x96_mini_defconfig
new file mode 100644
index 0000000000..5d88b83067
--- /dev/null
+++ b/configs/x96_mini_defconfig
@@ -0,0 +1,62 @@
+CONFIG_ARM=y
+CONFIG_ARCH_MESON=y
+CONFIG_TEXT_BASE=0x01000000
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20000000
+CONFIG_ENV_SIZE=0x2000
+CONFIG_DM_GPIO=y
+CONFIG_DEFAULT_DEVICE_TREE="meson-gxl-s905w-x96-mini"
+CONFIG_DM_RESET=y
+CONFIG_MESON_GXL=y
+CONFIG_DEBUG_UART_BASE=0xc81004c0
+CONFIG_DEBUG_UART_CLOCK=24000000
+CONFIG_IDENT_STRING=" x96-mini"
+CONFIG_SYS_LOAD_ADDR=0x1000000
+CONFIG_DEBUG_UART=y
+CONFIG_REMAKE_ELF=y
+CONFIG_OF_BOARD_SETUP=y
+CONFIG_CONSOLE_MUX=y
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_MISC_INIT_R=y
+CONFIG_SYS_MAXARGS=32
+# CONFIG_CMD_BDI is not set
+# CONFIG_CMD_IMI is not set
+CONFIG_CMD_ADC=y
+CONFIG_CMD_GPIO=y
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_REGULATOR=y
+CONFIG_OF_CONTROL=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_SARADC_MESON=y
+CONFIG_MMC_MESON_GX=y
+CONFIG_PHY_MESON_GXL=y
+CONFIG_DM_MDIO=y
+CONFIG_DM_MDIO_MUX=y
+CONFIG_ETH_DESIGNWARE_MESON8B=y
+CONFIG_MDIO_MUX_MMIOREG=y
+CONFIG_MESON_GXL_USB_PHY=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_MESON_GXL=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_DEBUG_UART_SKIP_INIT=y
+CONFIG_MESON_SERIAL=y
+CONFIG_SYSINFO=y
+CONFIG_SYSINFO_SMBIOS=y
+CONFIG_USB=y
+CONFIG_DM_USB_GADGET=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_DWC3=y
+# CONFIG_USB_DWC3_GADGET is not set
+CONFIG_USB_DWC3_MESON_GXL=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_VENDOR_NUM=0x1b8e
+CONFIG_USB_GADGET_PRODUCT_NUM=0xfada
+CONFIG_OF_LIBFDT_OVERLAY=y
--
2.39.2

View file

@ -0,0 +1,62 @@
# Reference: <https://u-boot.readthedocs.io/en/latest/board/amlogic/radxa-zero.html>
# Maintainer: exkc <exxxxkc@getgoogleoff.me>
pkgname=u-boot-amediatech-x96-mini
pkgver=2023.04
pkgrel=0
pkgdesc="U-Boot bootloader for Amediatech x96 mini"
url="https://source.denx.de/u-boot"
arch="aarch64"
_ubootver=2023.04-rc3
license="GPL-2.0-or-later OFL-1.1 BSD-2-Clause BSD-3-Clause eCos-2.0 IBM-pibs
ISC LGPL-2.0-only LGPL-2.1-only X11 proprietary"
makedepends="$depends_dev
bc
bison
crust
dtc
flex
openssl-dev
py3-setuptools
python3-dev
swig
bash
"
options="!check"
# https://u-boot.readthedocs.io/en/latest/board/amlogic/pre-generated-fip.html
_amlogicblob_commit="e96b6a694380ff07d5a9e4be644ffe254bd18512"
source="https://source.denx.de/u-boot/u-boot/-/archive/v$_ubootver/u-boot-v$_ubootver.tar.gz
0001-add-x96-mini-support.patch
amlogicblob_amediatech_x96_mini.tar.gz::https://github.com/LibreELEC/amlogic-boot-fip/archive/$_amlogicblob_commit.tar.gz
"
builddir="$srcdir/u-boot-v$_ubootver"
_fipbuilddir="$srcdir/amlogic-boot-fip-$_amlogicblob_commit"
build() {
touch include/config.h
LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"' > include/timestamp_autogenerated.h
LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> include/timestamp_autogenerated.h
make x96_mini_defconfig
make all
cd $_fipbuilddir
mkdir build
# We dont have the fip for x96 mini so we use jethub j80's fip
./build-fip.sh jethub-j80 $builddir/u-boot.bin ./build
cd ./build
dd if=u-boot.bin.sd.bin of=u-boot.bin.sd-stripped.bin conv=fsync,notrunc bs=512 skip=1
}
package() {
_installdir="$pkgdir/usr/share/u-boot/amediatech-x96-mini"
install -Dm644 "$_fipbuilddir/build/u-boot.bin.sd-stripped.bin" -t "$_installdir"
install -Dm644 "$_fipbuilddir/build/u-boot.bin.sd.bin" -t "$_installdir"
install -Dm644 "$_fipbuilddir/build/u-boot.bin" -t "$_installdir"
install -Dm644 "$_fipbuilddir/build/u-boot.bin.usb.bl2" -t "$_installdir"
install -Dm644 "$_fipbuilddir/build/u-boot.bin.usb.tpl" -t "$_installdir"
}
sha512sums="
4d2afc652d1431f17694bb41493c699dd477c82b466282a24094c59fada558df7c8a79518c1804729a73dd901d2e24beb1643313cb2d93d348559410182bc67b u-boot-v2023.04-rc3.tar.gz
3d78bbf9f945acce5bc9a54cc67b62a5958b5ff66e252cfced46efba05cf9e442086692b8d8c056b8e42bfff28ede1ad6069e9437c96883d38f2fd6dbf01b2dc 0001-add-x96-mini-support.patch
98ecbbc56e8326ce11db4e316a7bb3812d713fbe630235825ddb657b28419eb406f7117208a5c0360653ebdccb9af1a48357d0c257cd61f11a8c3cdaa78548b5 amlogicblob_amediatech_x96_mini.tar.gz
"