diff --git a/config/boards/ayn-odin2.csc b/config/boards/ayn-odin2.csc index 5aeba9e66c..e20e115a8d 100644 --- a/config/boards/ayn-odin2.csc +++ b/config/boards/ayn-odin2.csc @@ -13,24 +13,20 @@ declare -g BOARD_FIRMWARE_INSTALL="-full" declare -g DESKTOP_AUTOLOGIN="yes" # Check to make sure variants are supported -declare -g BOARD_VARIANT="${BOARD_VARIANT:-odin2}" -declare -g VALID_BOARDS=("odin2" "odin2-grub" "odin2portal" "odin2portal-grub" "thor") -BOARD_VARIANT_WITHOUT_GRUB="${BOARD_VARIANT//-grub/}" +declare -g VALID_BOARDS=("ayn-odin2" "ayn-odin2portal" "ayn-thor") -if [[ -z "${BOARD_VARIANT:-}" ]]; then - exit_with_error "BOARD_VARIANT not set" -fi +declare -g WITH_GRUB="no" -if [[ ! " ${VALID_BOARDS[*]} " =~ " ${BOARD_VARIANT} " ]]; then - exit_with_error "Error: Invalid board_variant '$BOARD_VARIANT'. Valid options are: ${VALID_BOARDS[*]}" >&2 +if [[ ! " ${VALID_BOARDS[*]} " =~ " ${BOARD} " ]]; then + exit_with_error "Error: Invalid board '$BOARD'. Valid options are: ${VALID_BOARDS[*]}" >&2 fi # set grub -if [[ "${BOARD_VARIANT}" == *"-grub"* ]]; then +if [[ "${WITH_GRUB}" == "yes" ]]; then display_alert "GRUB DETECTED" declare -g UEFI_GRUB_TERMINAL="gfxterm" # Use graphics in grub, for the Armbian wallpaper. declare -g GRUB_CMDLINE_LINUX_DEFAULT="clk_ignore_unused pd_ignore_unused arm64.nopauth efi=noruntime fbcon=rotate:1 console=ttyMSM0,115200n8" - declare -g BOOT_FDT_FILE="qcom/qcs8550-ayn-${BOARD_VARIANT_WITHOUT_GRUB}.dtb" + declare -g BOOT_FDT_FILE="qcom/qcs8550-${BOARD}.dtb" declare -g SERIALCON="${SERIALCON:-tty1}" enable_extension "grub" @@ -98,7 +94,7 @@ function post_family_tweaks__ayn-odin2_enable_services() { chroot_sdcard systemctl mask suspend.target chroot_sdcard systemctl enable usbgadget-rndis.service - cp "${SRC}/packages/bsp/ayn-${BOARD_VARIANT_WITHOUT_GRUB}/LinuxLoader.cfg" "${SDCARD}"/boot/ + cp "${SRC}/packages/bsp/${BOARD}/LinuxLoader.cfg" "${SDCARD}"/boot/ return 0 } diff --git a/config/boards/ayn-odin2portal.csc b/config/boards/ayn-odin2portal.csc new file mode 100644 index 0000000000..66e815e39f --- /dev/null +++ b/config/boards/ayn-odin2portal.csc @@ -0,0 +1 @@ +source "${SRC}/config/boards/ayn-odin2.csc" diff --git a/config/boards/ayn-thor.csc b/config/boards/ayn-thor.csc new file mode 100644 index 0000000000..66e815e39f --- /dev/null +++ b/config/boards/ayn-thor.csc @@ -0,0 +1 @@ +source "${SRC}/config/boards/ayn-odin2.csc" diff --git a/packages/bsp/ayn-thor/AYN-Odin2.conf b/packages/bsp/ayn-thor/AYN-Odin2.conf new file mode 100644 index 0000000000..e4054ba63b --- /dev/null +++ b/packages/bsp/ayn-thor/AYN-Odin2.conf @@ -0,0 +1,31 @@ +# Use case configuration for AYN Odin2 +# Author: Teguh Sobirin + +Syntax 4 + +SectionUseCase."HiFi" { + File "/AYN/Odin2/HiFi.conf" + Comment "HiFi quality Music." +} + +BootSequence [ + cset "name='RX_RX0 Digital Volume' 84" + cset "name='RX_RX1 Digital Volume' 84" + cset "name='HPHL Volume' 20" + cset "name='HPHR Volume' 20" + cset "name='ADC2 Volume' 10" +] + +LibraryConfig.remap.Config { + + ctl.default.map { + "name='HP Volume'" { + "name='HPHL Volume'".vindex.0 0 + "name='HPHR Volume'".vindex.1 0 + } + } +} + +Include.card-init.File "/lib/card-init.conf" +Include.ctl-remap.File "/lib/ctl-remap.conf" +Include.wcd-init.File "/codecs/wcd938x/init.conf" diff --git a/packages/bsp/ayn-thor/HiFi.conf b/packages/bsp/ayn-thor/HiFi.conf new file mode 100644 index 0000000000..dc5211e12a --- /dev/null +++ b/packages/bsp/ayn-thor/HiFi.conf @@ -0,0 +1,91 @@ +# Use case configuration for AYN Odin2 +# Author: Teguh Sobirin + +SectionVerb { + EnableSequence [ + cset "name='PRIMARY_MI2S_RX Audio Mixer MultiMedia1' 1" + cset "name='RX_CODEC_DMA_RX_0 Audio Mixer MultiMedia2' 1" + cset "name='DISPLAY_PORT_RX_0 Audio Mixer MultiMedia2' 0" + cset "name='MultiMedia3 Mixer TX_CODEC_DMA_TX_3' 1" + ] + + DisableSequence [ + cset "name='PRIMARY_MI2S_RX Audio Mixer MultiMedia1' 0" + cset "name='RX_CODEC_DMA_RX_0 Audio Mixer MultiMedia2' 0" + cset "name='DISPLAY_PORT_RX_0 Audio Mixer MultiMedia2' 0" + cset "name='MultiMedia3 Mixer TX_CODEC_DMA_TX_3' 0" + ] + + Value { + TQ "HiFi" + } +} + +SectionDevice."Speaker" { + Comment "Speaker playback" + + Value { + PlaybackPriority 150 + PlaybackPCM "hw:${CardId},0" + PlaybackChannels 2 + } +} + +SectionDevice."Headphones" { + Comment "Headphones Playback" + + Include.wcdhpe.File "/codecs/wcd938x/HeadphoneEnableSeq.conf" + Include.wcdhpd.File "/codecs/wcd938x/HeadphoneDisableSeq.conf" + Include.rxmhpe.File "/codecs/qcom-lpass/rx-macro/HeadphoneEnableSeq.conf" + Include.rxmhpd.File "/codecs/qcom-lpass/rx-macro/HeadphoneDisableSeq.conf" + + Value { + PlaybackPriority 200 + PlaybackPCM "hw:${CardId},1" + PlaybackMixer "default:${CardId}" + PlaybackMixerElem "HP" + PlaybackChannels 2 + JackControl "Headphone Jack" + JackHWMute "Speaker" + } +} + +SectionDevice."Headset" { + Comment "Headphone Microphone" + + Include.wcdmice.File "/codecs/wcd938x/HeadphoneMicEnableSeq.conf" + Include.wcdmicd.File "/codecs/wcd938x/HeadphoneMicDisableSeq.conf" + Include.txmhpe.File "/codecs/qcom-lpass/tx-macro/SoundwireMic1EnableSeq.conf" + Include.txmhpd.File "/codecs/qcom-lpass/tx-macro/HeadphoneMicDisableSeq.conf" + + Value { + CapturePriority 200 + CapturePCM "hw:${CardId},2" + CaptureMixerElem "ADC2" + CaptureChannels 1 + JackControl "Mic Jack" + } +} + +SectionDevice."DisplayPort" { + Comment "DisplayPort playback" + + EnableSequence [ + cset "name='PRIMARY_MI2S_RX Audio Mixer MultiMedia1' 0" + cset "name='RX_CODEC_DMA_RX_0 Audio Mixer MultiMedia2' 0" + cset "name='DISPLAY_PORT_RX_0 Audio Mixer MultiMedia2' 1" + ] + + DisableSequence [ + cset "name='PRIMARY_MI2S_RX Audio Mixer MultiMedia1' 1" + cset "name='DISPLAY_PORT_RX_0 Audio Mixer MultiMedia2' 0" + cset "name='RX_CODEC_DMA_RX_0 Audio Mixer MultiMedia2' 1" + ] + + Value { + PlaybackPriority 100 + PlaybackPCM "hw:${CardId},1" + JackControl "DP0 Jack" + JackHWMute "Speaker" + } +} diff --git a/packages/bsp/ayn-thor/LinuxLoader.cfg b/packages/bsp/ayn-thor/LinuxLoader.cfg new file mode 100644 index 0000000000..f14e23f131 --- /dev/null +++ b/packages/bsp/ayn-thor/LinuxLoader.cfg @@ -0,0 +1,58 @@ +# +# Configure the LinuxLoader settings +# + +[LinuxLoader] + +# Controls on-screen logging +# This setting can persist without config file or sdcard being present +Debug = true + +# Boot target. Can be one of the following: +# "default" (ABL default) +# "Linux" (direct Linux Image load) +# "EFI" +# "UEFI Shell" (will execute startup.nsh automatically if found on any FAT partition) +# "Mass Storage" (will mount the UFS LUN specified below as mass storage) +Target = "default" + +# Default UFS LUN to mount as mass storage +# Allowed values: 0, 1, 2, 3, 4, 5 +MassStorageLUN = 0 + +# Volume up boot target. Can be one of the following: +# "BDS Menu" (will enter the UEFI boot menu provided by Qualcomm, don't touch anything there unless you know what you are doing!) +# "UEFI Shell" (will execute startup.nsh automatically if found on any FAT partition) +# "recovery" +# "Linux" +DefaultVolUp = "Linux" + +# Setting this to *true* will enable USB Host mode in UEFI +# This might be useful if you want to play with UEFI. +# Note that you will need an externally powered type-C hub to connect USB devices. (at least for now) +UsbHostMode = false + +# Controls hypervisor UART enablement +# +# Setting *true* here will force enable the hypervisor UART +# Setting *false* here will force disable the hypervisor UART +# Removing this line will avoid changing the default behavior +# Please leave it to *false* unless you know what you are doing +HypUartEnable = false + +# Controls display hardware status during exit boot services +# +# The dispcc driver from mainline Linux kernel has a bug, which +# prevents the display hardware from initializing properly if +# the display hardware is not disabled before exiting boot services. +# +# Set this to *true* if you are trying to boot a mainline kernel. +DisableDisplayHW = true + +[Linux] +# Accept both gzipped and non-gzipped kernel images +Image = "Image" +initrd = "initrd.img-INITRD_PLACEHOLDER" +devicetree = "dtb/qcom/qcs8550-ayn-thor.dtb" +cmdline = "clk_ignore_unused pd_ignore_unused arm64.nopauthfbcon=rotate:3 console=ttyMSM0,115200n8 root=UUID=UUID_PLACEHOLDER" + diff --git a/packages/bsp/ayn-thor/zz-update-abl-kernel b/packages/bsp/ayn-thor/zz-update-abl-kernel new file mode 100755 index 0000000000..1ff4f1c84e --- /dev/null +++ b/packages/bsp/ayn-thor/zz-update-abl-kernel @@ -0,0 +1,20 @@ +#!/bin/bash +set -ex +new_rootfs_image_uuid=$(sed -e 's/^.*root=UUID=//' -e 's/ .*$//' < /proc/cmdline) +gzip -c /boot/vmlinuz-*-sm8550-arm64 > /tmp/Image.gz + +cat /tmp/Image.gz /usr/lib/linux-image-*-sm8550-arm64/qcom/qcs8550-ayn-odin2-hypdtbo.dtb > /tmp/Image.gz-dtb + +source /boot/armbianEnv.txt +/usr/bin/mkbootimg \ + --kernel /tmp/Image.gz-dtb \ + --ramdisk /boot/initrd.img-*-sm8550-arm64 \ + --base 0x0 \ + --second_offset 0x00f00000 \ + --cmdline "clk_ignore_unused pd_ignore_unused panic=30 audit=0 allow_mismatched_32bit_el0 rw mem_sleep_default=s2idle root=UUID=${new_rootfs_image_uuid}" \ + --kernel_offset 0x8000 \ + --ramdisk_offset 0x1000000 \ + --tags_offset 0x100 \ + --pagesize 4096 \ + -o /boot/armbian-kernel.img +rm -f /tmp/Image.gz /tmp/Image.gz-dtb