xiaomi-once: new device (MR 3955)

This commit is contained in:
exkc 2023-03-16 03:24:56 +08:00 committed by Newbyte
parent 611ead9cf1
commit bcd0b35ae0
No known key found for this signature in database
GPG key ID: 990600ED1DB95E02
6 changed files with 716 additions and 1 deletions

View file

@ -0,0 +1,43 @@
# Reference: <https://postmarketos.org/devicepkg>
# Maintainer: exkc <exxxxkc@getgoogleoff.me>
pkgname=device-xiaomi-once
pkgdesc="Xiaomi Mi Box 3"
pkgver=1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="aarch64"
options="!check !archcheck"
depends="
postmarketos-base
linux-postmarketos-amlogic
soc-amlogic-s905
u-boot-amlogic-s905x-tv
"
makedepends="devicepkg-dev"
source="
deviceinfo
asound.state"
subpackages="$pkgname-nonfree-firmware:nonfree_firmware"
build() {
devicepkg_build $startdir $pkgname
}
package() {
devicepkg_package $startdir $pkgname
install -D -m644 "$srcdir"/asound.state \
"$pkgdir"/var/lib/alsa/asound.state
}
nonfree_firmware() {
pkgdesc="Wi-Fi firmware, Bluetooth firmware, vdec firmware"
depends="firmware-xiaomi-once linux-firmware-meson"
mkdir "$subpkgdir"
}
sha512sums="
4030119277a6dd2199d29e069fd8bc0331b97cd732254eb0e67f12f2f1418814f4480643b86f9d5896aa091c48d7b43eabdc9e470dc8030c3c78836c3a2ee58d deviceinfo
d17c248b7ac02450143965e9b8a506b54ac6e73413fd62b55fa356f5c7304acb1a831c7f8f8ce457d9aba097f6823d6ee97285657e07b667f8d0046435a0c45a asound.state
"

View file

@ -0,0 +1,434 @@
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 DISABLED
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
}
}
}
state.XIAOMIONCE {
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 233
value.1 233
comment {
access 'read write'
type INTEGER
count 2
range '0 - 255'
dbmin -9999999
dbmax 0
dbvalue.0 -822
dbvalue.1 -822
}
}
control.5 {
iface MIXER
name 'ACODEC Ramp Rate'
value Slow
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 2
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 2
name 'IEC958 Playback Mask'
value ffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
comment {
access read
type IEC958
count 1
}
}
control.11 {
iface PCM
device 2
name 'IEC958 Playback Default'
value '0400000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
comment {
access 'read write'
type IEC958
count 1
}
}
control.12 {
iface PCM
device 2
name ELD
value '100008006c1000010000000000000000215736184d4143524f53494c49434f4e097f07000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
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 DISABLED
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,26 @@
# Maintainer: exkc <exxxxkc@getgoogleoff.me>
# Reference: <https://postmarketos.org/deviceinfo>
# Please use double quotes only. You can source this file in shell
# scripts.
deviceinfo_format_version="0"
deviceinfo_name="Xiaomi Mi Box 3"
deviceinfo_manufacturer="Xiaomi"
deviceinfo_codename="xiaomi-once"
deviceinfo_year="2016"
deviceinfo_dtb="amlogic/meson-gxl-s905x-xiaomi-once"
deviceinfo_modules_initfs="meson_drm meson_dw_hdmi display_connector"
deviceinfo_arch="aarch64"
# Device related
deviceinfo_chassis="desktop"
deviceinfo_keyboard="false"
deviceinfo_external_storage="true"
deviceinfo_screen_width="800"
deviceinfo_screen_height="600"
deviceinfo_gpu_accelerated="true"
# Bootloader related
deviceinfo_flash_method="none"
deviceinfo_generate_extlinux_config="true"
deviceinfo_kernel_cmdline="rw console=ttyAML0,115200 PMOS_NO_OUTPUT_REDIRECT no_console_suspend"

View file

@ -0,0 +1,24 @@
# Maintainer: exkc <exxxxkc@getgoogleoff.me>
pkgname=firmware-xiaomi-once
pkgver=1
pkgrel=0
pkgdesc="Broadcom firmware for Xiaomi Mi Box 3"
url="https://github.com/LibreELEC/brcmfmac_sdio-firmware"
arch="aarch64"
license="proprietary"
options="!check !strip !archcheck !tracedeps pmb:cross-native"
_commit="c70355f9ec6d015b91a5c3199aa08b433e2f7caf"
source="$pkgname-$_commit.tar.gz::$url/archive/$_commit.tar.gz"
_fwdir="/lib/firmware/postmarketos/brcm"
builddir="$srcdir/brcmfmac_sdio-firmware-$_commit"
package() {
install -Dm644 brcmfmac43455-sdio.bin "$pkgdir/$_fwdir"/brcmfmac43455-sdio.xiaomi,once.bin
install -Dm644 brcmfmac43455-sdio.txt "$pkgdir/$_fwdir"/brcmfmac43455-sdio.xiaomi,once.txt
}
sha512sums="
e9d358d6942e361b9019a8d50c744826e2e6cb42326241e6b9f8b8fb50ac1567de8a9ef36204e7b39c935efd7b17a8c1e918243ba5813595b1652b870aff2ce6 firmware-xiaomi-once-c70355f9ec6d015b91a5c3199aa08b433e2f7caf.tar.gz
"

View file

@ -0,0 +1,186 @@
From efd1039ff812f1d6bb58d57ea84802a428b58ccd Mon Sep 17 00:00:00 2001
From: "@exkc" <exkc@exkc.moe>
Date: Tue, 14 Mar 2023 23:08:03 +0800
Subject: [PATCH] ARM64: dts: meson-gxl: add support for the Xiaomi Mi Box 3
The Xiaomi Mi Box 3 is a TV box based on the Amlogic S905X chipset.
There are two variants:
- 2 GiB of DDR3 memory
- 8 GB eMMC flash
Both variants come with:
- 802.11a/b/g/n/ac wifi (BCM4345)
- HDMI and AV (CVBS) output
- 1x USB (utilizing both USB ports provided by the SoC)
The board seems to be very similar to the P212 reference
boards, which is why it includes meson-gxl-s905x-p212.dtsi:
---
arch/arm64/boot/dts/amlogic/Makefile | 1 +
.../amlogic/meson-gxl-s905x-xiaomi-once.dts | 142 ++++++++++++++++++
2 files changed, 143 insertions(+)
create mode 100644 arch/arm64/boot/dts/amlogic/meson-gxl-s905x-xiaomi-once.dts
diff --git a/arch/arm64/boot/dts/amlogic/Makefile b/arch/arm64/boot/dts/amlogic/Makefile
index e213aeebb..904bb1e19 100644
--- a/arch/arm64/boot/dts/amlogic/Makefile
+++ b/arch/arm64/boot/dts/amlogic/Makefile
@@ -45,6 +45,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905x-libretech-cc-v2.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905x-libretech-cc.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905x-nexbox-a95x.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905x-p212.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905x-xiaomi-once.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-gxm-gt1-ultimate.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-gxm-khadas-vim2.dtb
dtb-$(CONFIG_ARCH_MESON) += meson-gxm-mecool-kiii-pro.dtb
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-xiaomi-once.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-xiaomi-once.dts
new file mode 100644
index 000000000..6169c0dc0
--- /dev/null
+++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-xiaomi-once.dts
@@ -0,0 +1,142 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2023 exkc <exxxxkc@getgoogleoff.me>
+ * Based on meson-gxl-s905x-p212.dts
+ *
+ */
+
+/dts-v1/;
+
+#include "meson-gxl-s905x-p212.dtsi"
+#include <dt-bindings/sound/meson-aiu.h>
+
+/ {
+ compatible = "xiaomi,once", "amlogic,s905x", "amlogic,meson-gxl";
+ model = "Xiaomi Mi Box 3";
+
+ dio2133: analog-amplifier {
+ compatible = "simple-audio-amplifier";
+ sound-name-prefix = "AU2";
+ VCC-supply = <&hdmi_5v>;
+ enable-gpios = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>;
+ };
+
+ cvbs-connector {
+ compatible = "composite-video-connector";
+
+ port {
+ cvbs_connector_in: endpoint {
+ remote-endpoint = <&cvbs_vdac_out>;
+ };
+ };
+ };
+
+ hdmi-connector {
+ compatible = "hdmi-connector";
+ type = "a";
+
+ port {
+ hdmi_connector_in: endpoint {
+ remote-endpoint = <&hdmi_tx_tmds_out>;
+ };
+ };
+ };
+
+ sound {
+ compatible = "amlogic,gx-sound-card";
+ model = "XIAOMI-ONCE";
+ audio-aux-devs = <&dio2133>;
+ audio-widgets = "Line", "Lineout";
+ audio-routing = "Lineout", "AU2 OUTL",
+ "Lineout", "AU2 OUTR";
+ assigned-clocks = <&clkc CLKID_MPLL0>,
+ <&clkc CLKID_MPLL1>,
+ <&clkc CLKID_MPLL2>;
+ assigned-clock-parents = <0>, <0>, <0>;
+ assigned-clock-rates = <294912000>,
+ <270950400>,
+ <393216000>;
+ dai-link-0 {
+ sound-dai = <&aiu AIU_CPU CPU_I2S_FIFO>;
+ };
+
+ dai-link-1 {
+ sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>;
+ dai-format = "i2s";
+ mclk-fs = <256>;
+
+ codec-0 {
+ sound-dai = <&aiu AIU_HDMI CTRL_I2S>;
+ };
+
+ codec-1 {
+ sound-dai = <&aiu AIU_ACODEC CTRL_I2S>;
+ };
+ };
+
+ dai-link-2 {
+ sound-dai = <&aiu AIU_HDMI CTRL_OUT>;
+
+ codec-0 {
+ sound-dai = <&hdmi_tx>;
+ };
+ };
+
+ dai-link-3 {
+ sound-dai = <&aiu AIU_ACODEC CTRL_OUT>;
+
+ codec-0 {
+ sound-dai = <&acodec>;
+ };
+ };
+ };
+};
+
+&acodec {
+ AVDD-supply = <&vddio_ao18>;
+ status = "okay";
+};
+
+&aiu {
+ status = "okay";
+};
+
+&cec_AO {
+ status = "okay";
+ pinctrl-0 = <&ao_cec_pins>;
+ pinctrl-names = "default";
+ hdmi-phandle = <&hdmi_tx>;
+};
+
+&cvbs_vdac_port {
+ cvbs_vdac_out: endpoint {
+ remote-endpoint = <&cvbs_connector_in>;
+ };
+};
+
+&hdmi_tx {
+ status = "okay";
+ pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
+ pinctrl-names = "default";
+ hdmi-supply = <&hdmi_5v>;
+};
+
+&hdmi_tx_tmds_port {
+ hdmi_tx_tmds_out: endpoint {
+ remote-endpoint = <&hdmi_connector_in>;
+ };
+};
+
+&ethmac {
+ status = "disabled";
+};
+
+&usb {
+ status = "okay";
+ dr_mode = "host";
+};
+
+/* This UART is brought out to the uarl pad on the pcb*/
+&uart_AO {
+ status = "okay";
+};
--
2.39.2

View file

@ -4,7 +4,7 @@
# Co-Maintainer: exkc <exxxxkc@getgoogleoff.me>
pkgname=linux-postmarketos-amlogic
pkgver=6.1.10
pkgrel=2
pkgrel=3
pkgdesc="Mainline kernel for Amlogic devices"
arch="aarch64"
_carch="arm64"
@ -37,6 +37,7 @@ source="
0001-WIP-arm64-dts-meson-gxbb-kii-pro-sort-and-tidy-the-d.patch
0002-WIP-arm64-dts-meson-gxbb-kii-pro-complete-the-blueto.patch
0003-WIP-arm64-dts-meson-gxbb-kii-pro-add-initial-audio-s.patch
0004-add-xiaomi-once-support.patch
"
builddir="$srcdir/linux-$pkgver"
@ -72,4 +73,5 @@ sha512sums="
182d779a91acd47dcd865eba919b404db24840493f54775dcf4508237edf65ff8aae9f84d8aa673d7aa2414934325ea972491cbf6d590434a6a5aad33eb8e20c 0001-WIP-arm64-dts-meson-gxbb-kii-pro-sort-and-tidy-the-d.patch
2a772de080dda5100a653a9806ee60130228dd2e232055362fa330ee42644374161aa032b1838f12555e952214ac29eb4ef664c587af2363796ba9f70d95dee3 0002-WIP-arm64-dts-meson-gxbb-kii-pro-complete-the-blueto.patch
a497d042112e1f6bf4b4793992907b25b99b9b6d5f77b051261b80ed90ef70022c647ef2db2385bb9dccf31e94b23fa9f3d9bc42b4d1ff1049bcf8cafb7a6b6d 0003-WIP-arm64-dts-meson-gxbb-kii-pro-add-initial-audio-s.patch
9d664c9cc6168a7aa4804662886941744e92c0748e7b7b4fad2472740a4931c89a60cbc4a519913b58933718d02f33f48ff72ea182d912bcd50014ca8d7ff110 0004-add-xiaomi-once-support.patch
"