From 91671ef55492f73ef55f9fe84ae6704424f4b1db Mon Sep 17 00:00:00 2001 From: talksik Date: Sat, 22 Apr 2023 16:30:44 -0700 Subject: [PATCH] adding in actual forked version --- .../LICENSE | 0 .../Makefile | 0 .../README.md | 7 +- .../ac101.c | 0 .../ac101_regs.h | 0 .../ac108.c | 4 +- .../ac108.h | 0 .../ac108_6mic.state | 0 .../ac108_asound.state | 0 .../ac108_plugin/Makefile | 0 .../ac108_plugin/README.md | 0 .../ac108_plugin/ac108_help.c | 0 .../ac108_plugin/ac108_help.h | 0 .../ac108_plugin/pcm_ac108.c | 0 .../ac10x.h | 0 .../asound_2mic.conf | 0 .../asound_4mic.conf | 0 .../asound_6mic.conf | 0 .../builddtbo.sh | 0 .../default.pa | 0 .../dkms.conf | 6 +- .../install.sh | 22 +- .../patches/back-to-v4.19.diff | 0 .../patches/back-to-v5.4.diff | 0 .../patches/back-to-v5.8.diff | 0 .../pulseaudio/91-seeedvoicecard.rules | 0 .../pulseaudio/README.md | 0 .../pulseaudio/pulse_config_4mic/daemon.conf | 0 .../pulseaudio/pulse_config_4mic/default.pa | 0 .../pulse_config_4mic/seeed-voicecard.conf | 0 .../pulseaudio/pulse_config_6mic/daemon.conf | 0 .../pulseaudio/pulse_config_6mic/default.pa | 0 .../pulse_config_6mic/seeed-voicecard.conf | 0 .../pulseaudio/udev_rules_4mic.png | Bin .../pulseaudio/udev_rules_6mic.png | Bin .../seeed-2mic-voicecard-overlay.dts | 0 .../seeed-2mic-voicecard.dtbo | Bin .../seeed-4mic-voicecard-overlay.dts | 0 .../seeed-4mic-voicecard.dtbo | Bin .../seeed-8mic-voicecard-overlay.dts | 0 .../seeed-8mic-voicecard.dtbo | Bin .../seeed-voicecard | 4 +- .../seeed-voicecard.c | 34 ++- .../seeed-voicecard.service | 0 .../sound-compatible-4.18.h | 0 .../tools/coherence.py | 0 .../tools/phase_test.py | 0 .../ubuntu-prerequisite.sh | 0 .../uninstall.sh | 0 .../wm8960.c | 4 +- .../wm8960.h | 0 .../wm8960_asound.state | 0 .../.github/ISSUE_TEMPLATE/BUG_ISSUE.yml | 53 ---- .../.github/ISSUE_TEMPLATE/config.yml | 5 - .../.github/workflows/stale.yml | 23 -- .../install_arm64.sh | 236 ------------------ 56 files changed, 47 insertions(+), 351 deletions(-) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/LICENSE (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/Makefile (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/README.md (89%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/ac101.c (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/ac101_regs.h (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/ac108.c (99%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/ac108.h (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/ac108_6mic.state (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/ac108_asound.state (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/ac108_plugin/Makefile (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/ac108_plugin/README.md (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/ac108_plugin/ac108_help.c (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/ac108_plugin/ac108_help.h (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/ac108_plugin/pcm_ac108.c (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/ac10x.h (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/asound_2mic.conf (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/asound_4mic.conf (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/asound_6mic.conf (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/builddtbo.sh (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/default.pa (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/dkms.conf (84%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/install.sh (91%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/patches/back-to-v4.19.diff (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/patches/back-to-v5.4.diff (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/patches/back-to-v5.8.diff (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/pulseaudio/91-seeedvoicecard.rules (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/pulseaudio/README.md (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/pulseaudio/pulse_config_4mic/daemon.conf (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/pulseaudio/pulse_config_4mic/default.pa (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/pulseaudio/pulse_config_4mic/seeed-voicecard.conf (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/pulseaudio/pulse_config_6mic/daemon.conf (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/pulseaudio/pulse_config_6mic/default.pa (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/pulseaudio/pulse_config_6mic/seeed-voicecard.conf (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/pulseaudio/udev_rules_4mic.png (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/pulseaudio/udev_rules_6mic.png (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/seeed-2mic-voicecard-overlay.dts (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/seeed-2mic-voicecard.dtbo (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/seeed-4mic-voicecard-overlay.dts (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/seeed-4mic-voicecard.dtbo (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/seeed-8mic-voicecard-overlay.dts (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/seeed-8mic-voicecard.dtbo (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/seeed-voicecard (95%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/seeed-voicecard.c (95%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/seeed-voicecard.service (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/sound-compatible-4.18.h (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/tools/coherence.py (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/tools/phase_test.py (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/ubuntu-prerequisite.sh (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/uninstall.sh (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/wm8960.c (99%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/wm8960.h (100%) rename yudai/{seeed-voicecard-fork-for-higher-kernels => seeed-voicecard-fork-for-higher-kernel}/wm8960_asound.state (100%) delete mode 100644 yudai/seeed-voicecard-fork-for-higher-kernels/.github/ISSUE_TEMPLATE/BUG_ISSUE.yml delete mode 100644 yudai/seeed-voicecard-fork-for-higher-kernels/.github/ISSUE_TEMPLATE/config.yml delete mode 100644 yudai/seeed-voicecard-fork-for-higher-kernels/.github/workflows/stale.yml delete mode 100755 yudai/seeed-voicecard-fork-for-higher-kernels/install_arm64.sh diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/LICENSE b/yudai/seeed-voicecard-fork-for-higher-kernel/LICENSE similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/LICENSE rename to yudai/seeed-voicecard-fork-for-higher-kernel/LICENSE diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/Makefile b/yudai/seeed-voicecard-fork-for-higher-kernel/Makefile similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/Makefile rename to yudai/seeed-voicecard-fork-for-higher-kernel/Makefile diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/README.md b/yudai/seeed-voicecard-fork-for-higher-kernel/README.md similarity index 89% rename from yudai/seeed-voicecard-fork-for-higher-kernels/README.md rename to yudai/seeed-voicecard-fork-for-higher-kernel/README.md index d6f5d0d..ce9d634 100644 --- a/yudai/seeed-voicecard-fork-for-higher-kernels/README.md +++ b/yudai/seeed-voicecard-fork-for-higher-kernel/README.md @@ -10,9 +10,6 @@ cd seeed-voicecard sudo ./install.sh sudo reboot ``` - -**Note** If you have 64-bit version of Rasperry Pi OS, use install_arm64.sh script for driver installation. - ## ReSpeaker Documentation Up to date documentation for reSpeaker products can be found in [Seeed Studio Wiki](https://wiki.seeedstudio.com/ReSpeaker/)! @@ -55,10 +52,10 @@ For hardware testing purposes we made a Rasperry Pi OS 5.10.17-v7l+ 32-bit image We provide official support for using reSpeaker with the following OS: - 32-bit Raspberry Pi OS -- 64-bit Raspberry Pi OS (experimental support) +- 64-bit Raspberry Pi OS And following hardware platforms: -- Raspberry Pi 3 (all models), Raspberry Pi 4 (all models), Raspberry Pi Zero and Zero W +- Raspberry Pi 3 (all models), Raspberry Pi 4 (all models) Anything beyond the scope of official support is considered to be community supported. Support for other OS/hardware platforms can be added, provided MOQ requirements can be met. diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/ac101.c b/yudai/seeed-voicecard-fork-for-higher-kernel/ac101.c similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/ac101.c rename to yudai/seeed-voicecard-fork-for-higher-kernel/ac101.c diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/ac101_regs.h b/yudai/seeed-voicecard-fork-for-higher-kernel/ac101_regs.h similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/ac101_regs.h rename to yudai/seeed-voicecard-fork-for-higher-kernel/ac101_regs.h diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/ac108.c b/yudai/seeed-voicecard-fork-for-higher-kernel/ac108.c similarity index 99% rename from yudai/seeed-voicecard-fork-for-higher-kernels/ac108.c rename to yudai/seeed-voicecard-fork-for-higher-kernel/ac108.c index d5dd12d..9709cb8 100644 --- a/yudai/seeed-voicecard-fork-for-higher-kernels/ac108.c +++ b/yudai/seeed-voicecard-fork-for-higher-kernel/ac108.c @@ -1329,7 +1329,6 @@ static struct snd_soc_codec_driver ac10x_soc_codec_driver = { .idle_bias_on = 1, .use_pmdown_time = 1, .endianness = 1, - .non_legacy_dai_naming = 1, #endif }; @@ -1494,7 +1493,7 @@ __ret: return ret; } -static int ac108_i2c_remove(struct i2c_client *i2c) { +static void ac108_i2c_remove(struct i2c_client *i2c) { if (ac10x->codec != NULL) { snd_soc_unregister_codec(&ac10x->i2c[_MASTER_INDEX]->dev); ac10x->codec = NULL; @@ -1519,7 +1518,6 @@ __ret: kfree(ac10x); ac10x = NULL; } - return 0; } static const struct i2c_device_id ac108_i2c_id[] = { diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/ac108.h b/yudai/seeed-voicecard-fork-for-higher-kernel/ac108.h similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/ac108.h rename to yudai/seeed-voicecard-fork-for-higher-kernel/ac108.h diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/ac108_6mic.state b/yudai/seeed-voicecard-fork-for-higher-kernel/ac108_6mic.state similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/ac108_6mic.state rename to yudai/seeed-voicecard-fork-for-higher-kernel/ac108_6mic.state diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/ac108_asound.state b/yudai/seeed-voicecard-fork-for-higher-kernel/ac108_asound.state similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/ac108_asound.state rename to yudai/seeed-voicecard-fork-for-higher-kernel/ac108_asound.state diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/ac108_plugin/Makefile b/yudai/seeed-voicecard-fork-for-higher-kernel/ac108_plugin/Makefile similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/ac108_plugin/Makefile rename to yudai/seeed-voicecard-fork-for-higher-kernel/ac108_plugin/Makefile diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/ac108_plugin/README.md b/yudai/seeed-voicecard-fork-for-higher-kernel/ac108_plugin/README.md similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/ac108_plugin/README.md rename to yudai/seeed-voicecard-fork-for-higher-kernel/ac108_plugin/README.md diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/ac108_plugin/ac108_help.c b/yudai/seeed-voicecard-fork-for-higher-kernel/ac108_plugin/ac108_help.c similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/ac108_plugin/ac108_help.c rename to yudai/seeed-voicecard-fork-for-higher-kernel/ac108_plugin/ac108_help.c diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/ac108_plugin/ac108_help.h b/yudai/seeed-voicecard-fork-for-higher-kernel/ac108_plugin/ac108_help.h similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/ac108_plugin/ac108_help.h rename to yudai/seeed-voicecard-fork-for-higher-kernel/ac108_plugin/ac108_help.h diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/ac108_plugin/pcm_ac108.c b/yudai/seeed-voicecard-fork-for-higher-kernel/ac108_plugin/pcm_ac108.c similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/ac108_plugin/pcm_ac108.c rename to yudai/seeed-voicecard-fork-for-higher-kernel/ac108_plugin/pcm_ac108.c diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/ac10x.h b/yudai/seeed-voicecard-fork-for-higher-kernel/ac10x.h similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/ac10x.h rename to yudai/seeed-voicecard-fork-for-higher-kernel/ac10x.h diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/asound_2mic.conf b/yudai/seeed-voicecard-fork-for-higher-kernel/asound_2mic.conf similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/asound_2mic.conf rename to yudai/seeed-voicecard-fork-for-higher-kernel/asound_2mic.conf diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/asound_4mic.conf b/yudai/seeed-voicecard-fork-for-higher-kernel/asound_4mic.conf similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/asound_4mic.conf rename to yudai/seeed-voicecard-fork-for-higher-kernel/asound_4mic.conf diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/asound_6mic.conf b/yudai/seeed-voicecard-fork-for-higher-kernel/asound_6mic.conf similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/asound_6mic.conf rename to yudai/seeed-voicecard-fork-for-higher-kernel/asound_6mic.conf diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/builddtbo.sh b/yudai/seeed-voicecard-fork-for-higher-kernel/builddtbo.sh similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/builddtbo.sh rename to yudai/seeed-voicecard-fork-for-higher-kernel/builddtbo.sh diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/default.pa b/yudai/seeed-voicecard-fork-for-higher-kernel/default.pa similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/default.pa rename to yudai/seeed-voicecard-fork-for-higher-kernel/default.pa diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/dkms.conf b/yudai/seeed-voicecard-fork-for-higher-kernel/dkms.conf similarity index 84% rename from yudai/seeed-voicecard-fork-for-higher-kernels/dkms.conf rename to yudai/seeed-voicecard-fork-for-higher-kernel/dkms.conf index 3079ecb..d48ea70 100644 --- a/yudai/seeed-voicecard-fork-for-higher-kernels/dkms.conf +++ b/yudai/seeed-voicecard-fork-for-higher-kernel/dkms.conf @@ -9,7 +9,7 @@ DEST_MODULE_LOCATION[2]="/kernel/sound/soc/bcm" PATCH[0]="back-to-v4.19.diff" PATCH[1]="back-to-v5.4.diff" PATCH[2]="back-to-v5.8.diff" -PATCH_MATCH[0]="4\.19\.*" -PATCH_MATCH[1]="5\.4\.*" -PATCH_MATCH[2]="5\.8\.*" +PATCH_MATCH[0]="^4\.19\.*" +PATCH_MATCH[1]="^5\.4\.*" +PATCH_MATCH[2]="^5\.8\.*" AUTOINSTALL="yes" diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/install.sh b/yudai/seeed-voicecard-fork-for-higher-kernel/install.sh similarity index 91% rename from yudai/seeed-voicecard-fork-for-higher-kernels/install.sh rename to yudai/seeed-voicecard-fork-for-higher-kernel/install.sh index a8f3279..0e65d9e 100755 --- a/yudai/seeed-voicecard-fork-for-higher-kernels/install.sh +++ b/yudai/seeed-voicecard-fork-for-higher-kernel/install.sh @@ -1,9 +1,5 @@ #!/bin/bash -# Color -RED='\033[0;31m' -NC='\033[0m' # No Color - if [[ $EUID -ne 0 ]]; then echo "This script must be run as root (use sudo)" 1>&2 exit 1 @@ -56,7 +52,6 @@ if [ $errorFound = 1 ] ; then exit 1 fi - ver="0.3" uname_r=$(uname -r) @@ -72,8 +67,10 @@ function get_kernel_version() { [ -z "$_VER_RUN" ] && { ZIMAGE=/boot/kernel.img [ -f /boot/firmware/vmlinuz ] && ZIMAGE=/boot/firmware/vmlinuz + # 64-bit-only kernel package + [ ! -f /boot/kernel.img ] && [ -f /boot/kernel8.img ] && ZIMAGE=/boot/kernel8.img IMG_OFFSET=$(LC_ALL=C grep -abo $'\x1f\x8b\x08\x00' $ZIMAGE | head -n 1 | cut -d ':' -f 1) - _VER_RUN=$(dd if=$ZIMAGE obs=64K ibs=4 skip=$(( IMG_OFFSET / 4)) 2>/dev/null | zcat | grep -a -m1 "Linux version" | strings | awk '{ print $3; }') + _VER_RUN=$(dd if=$ZIMAGE obs=64K ibs=4 skip=$(( IMG_OFFSET / 4)) 2>/dev/null | zcat | grep -a -m1 "Linux version" | LC_ALL=C sed -e 's/^.*Linux/Linux/' | strings | awk '{ print $3; }') } echo "$_VER_RUN" return 0 @@ -111,6 +108,8 @@ if [[ $? -eq 0 ]]; then apt update -y # Raspbian kernel packages apt-get -y install raspberrypi-kernel-headers raspberrypi-kernel + # Recent Raspbian has 64-bit kernel on 32-bit userspace + apt-get -y install gcc-aarch64-linux-gnu # Ubuntu kernel packages apt-get -y install linux-raspi linux-headers-raspi linux-image-raspi apt-get -y install dkms git i2c-tools libasound2-plugins @@ -130,16 +129,6 @@ base_ver=$(get_kernel_version) base_ver=${base_ver%%[-+]*} #kernels="${base_ver}+ ${base_ver}-v7+ ${base_ver}-v7l+" kernels=$(uname -r) -kernel_base_ver=${kernels%%[-+]*} - -if [[ "$base_ver" != "$kernel_base_ver" ]] ; then - echo "------------------------------------------------------" - echo -e " ${RED}WARNING${NC} Your loaded kernel version is $kernel_base_ver" - echo " Not matching the updated version $base_ver." - echo " Kernel was updated, but new kernel was not loaded yet" - echo -e " Please ${RED}reboot${NC} your machine AND THEN run this script ${RED}again" - exit 1; -fi function install_module { local _i @@ -171,6 +160,7 @@ function install_module { install_module "./" "seeed-voicecard" + # install dtbos cp seeed-2mic-voicecard.dtbo $OVERLAYS cp seeed-4mic-voicecard.dtbo $OVERLAYS diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/patches/back-to-v4.19.diff b/yudai/seeed-voicecard-fork-for-higher-kernel/patches/back-to-v4.19.diff similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/patches/back-to-v4.19.diff rename to yudai/seeed-voicecard-fork-for-higher-kernel/patches/back-to-v4.19.diff diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/patches/back-to-v5.4.diff b/yudai/seeed-voicecard-fork-for-higher-kernel/patches/back-to-v5.4.diff similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/patches/back-to-v5.4.diff rename to yudai/seeed-voicecard-fork-for-higher-kernel/patches/back-to-v5.4.diff diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/patches/back-to-v5.8.diff b/yudai/seeed-voicecard-fork-for-higher-kernel/patches/back-to-v5.8.diff similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/patches/back-to-v5.8.diff rename to yudai/seeed-voicecard-fork-for-higher-kernel/patches/back-to-v5.8.diff diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/pulseaudio/91-seeedvoicecard.rules b/yudai/seeed-voicecard-fork-for-higher-kernel/pulseaudio/91-seeedvoicecard.rules similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/pulseaudio/91-seeedvoicecard.rules rename to yudai/seeed-voicecard-fork-for-higher-kernel/pulseaudio/91-seeedvoicecard.rules diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/pulseaudio/README.md b/yudai/seeed-voicecard-fork-for-higher-kernel/pulseaudio/README.md similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/pulseaudio/README.md rename to yudai/seeed-voicecard-fork-for-higher-kernel/pulseaudio/README.md diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/pulseaudio/pulse_config_4mic/daemon.conf b/yudai/seeed-voicecard-fork-for-higher-kernel/pulseaudio/pulse_config_4mic/daemon.conf similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/pulseaudio/pulse_config_4mic/daemon.conf rename to yudai/seeed-voicecard-fork-for-higher-kernel/pulseaudio/pulse_config_4mic/daemon.conf diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/pulseaudio/pulse_config_4mic/default.pa b/yudai/seeed-voicecard-fork-for-higher-kernel/pulseaudio/pulse_config_4mic/default.pa similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/pulseaudio/pulse_config_4mic/default.pa rename to yudai/seeed-voicecard-fork-for-higher-kernel/pulseaudio/pulse_config_4mic/default.pa diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/pulseaudio/pulse_config_4mic/seeed-voicecard.conf b/yudai/seeed-voicecard-fork-for-higher-kernel/pulseaudio/pulse_config_4mic/seeed-voicecard.conf similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/pulseaudio/pulse_config_4mic/seeed-voicecard.conf rename to yudai/seeed-voicecard-fork-for-higher-kernel/pulseaudio/pulse_config_4mic/seeed-voicecard.conf diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/pulseaudio/pulse_config_6mic/daemon.conf b/yudai/seeed-voicecard-fork-for-higher-kernel/pulseaudio/pulse_config_6mic/daemon.conf similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/pulseaudio/pulse_config_6mic/daemon.conf rename to yudai/seeed-voicecard-fork-for-higher-kernel/pulseaudio/pulse_config_6mic/daemon.conf diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/pulseaudio/pulse_config_6mic/default.pa b/yudai/seeed-voicecard-fork-for-higher-kernel/pulseaudio/pulse_config_6mic/default.pa similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/pulseaudio/pulse_config_6mic/default.pa rename to yudai/seeed-voicecard-fork-for-higher-kernel/pulseaudio/pulse_config_6mic/default.pa diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/pulseaudio/pulse_config_6mic/seeed-voicecard.conf b/yudai/seeed-voicecard-fork-for-higher-kernel/pulseaudio/pulse_config_6mic/seeed-voicecard.conf similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/pulseaudio/pulse_config_6mic/seeed-voicecard.conf rename to yudai/seeed-voicecard-fork-for-higher-kernel/pulseaudio/pulse_config_6mic/seeed-voicecard.conf diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/pulseaudio/udev_rules_4mic.png b/yudai/seeed-voicecard-fork-for-higher-kernel/pulseaudio/udev_rules_4mic.png similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/pulseaudio/udev_rules_4mic.png rename to yudai/seeed-voicecard-fork-for-higher-kernel/pulseaudio/udev_rules_4mic.png diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/pulseaudio/udev_rules_6mic.png b/yudai/seeed-voicecard-fork-for-higher-kernel/pulseaudio/udev_rules_6mic.png similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/pulseaudio/udev_rules_6mic.png rename to yudai/seeed-voicecard-fork-for-higher-kernel/pulseaudio/udev_rules_6mic.png diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/seeed-2mic-voicecard-overlay.dts b/yudai/seeed-voicecard-fork-for-higher-kernel/seeed-2mic-voicecard-overlay.dts similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/seeed-2mic-voicecard-overlay.dts rename to yudai/seeed-voicecard-fork-for-higher-kernel/seeed-2mic-voicecard-overlay.dts diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/seeed-2mic-voicecard.dtbo b/yudai/seeed-voicecard-fork-for-higher-kernel/seeed-2mic-voicecard.dtbo similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/seeed-2mic-voicecard.dtbo rename to yudai/seeed-voicecard-fork-for-higher-kernel/seeed-2mic-voicecard.dtbo diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/seeed-4mic-voicecard-overlay.dts b/yudai/seeed-voicecard-fork-for-higher-kernel/seeed-4mic-voicecard-overlay.dts similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/seeed-4mic-voicecard-overlay.dts rename to yudai/seeed-voicecard-fork-for-higher-kernel/seeed-4mic-voicecard-overlay.dts diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/seeed-4mic-voicecard.dtbo b/yudai/seeed-voicecard-fork-for-higher-kernel/seeed-4mic-voicecard.dtbo similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/seeed-4mic-voicecard.dtbo rename to yudai/seeed-voicecard-fork-for-higher-kernel/seeed-4mic-voicecard.dtbo diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/seeed-8mic-voicecard-overlay.dts b/yudai/seeed-voicecard-fork-for-higher-kernel/seeed-8mic-voicecard-overlay.dts similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/seeed-8mic-voicecard-overlay.dts rename to yudai/seeed-voicecard-fork-for-higher-kernel/seeed-8mic-voicecard-overlay.dts diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/seeed-8mic-voicecard.dtbo b/yudai/seeed-voicecard-fork-for-higher-kernel/seeed-8mic-voicecard.dtbo similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/seeed-8mic-voicecard.dtbo rename to yudai/seeed-voicecard-fork-for-higher-kernel/seeed-8mic-voicecard.dtbo diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/seeed-voicecard b/yudai/seeed-voicecard-fork-for-higher-kernel/seeed-voicecard similarity index 95% rename from yudai/seeed-voicecard-fork-for-higher-kernels/seeed-voicecard rename to yudai/seeed-voicecard-fork-for-higher-kernel/seeed-voicecard index 55d6b39..94ccd13 100755 --- a/yudai/seeed-voicecard-fork-for-higher-kernels/seeed-voicecard +++ b/yudai/seeed-voicecard-fork-for-higher-kernel/seeed-voicecard @@ -42,7 +42,9 @@ function get_kernel_version() { [ -z "$_VER_RUN" ] && { ZIMAGE=/boot/kernel.img IMG_OFFSET=$(LC_ALL=C grep -abo $'\x1f\x8b\x08\x00' $ZIMAGE | head -n 1 | cut -d ':' -f 1) - _VER_RUN=$(dd if=$ZIMAGE obs=64K ibs=4 skip=$(( IMG_OFFSET / 4)) | zcat | grep -a -m1 "Linux version" | strings | awk '{ print $3; }') + # 64-bit-only kernel package + [ ! -f /boot/kernel.img ] && [ -f /boot/kernel8.img ] && ZIMAGE=/boot/kernel8.img + _VER_RUN=$(dd if=$ZIMAGE obs=64K ibs=4 skip=$(( IMG_OFFSET / 4)) 2>/dev/null | zcat | grep -a -m1 "Linux version" | LC_ALL=C sed -e 's/^.*Linux/Linux/' | strings | awk '{ print $3; }') } echo "$_VER_RUN" return 0 diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/seeed-voicecard.c b/yudai/seeed-voicecard-fork-for-higher-kernel/seeed-voicecard.c similarity index 95% rename from yudai/seeed-voicecard-fork-for-higher-kernels/seeed-voicecard.c rename to yudai/seeed-voicecard-fork-for-higher-kernel/seeed-voicecard.c index ebfd780..886eb0e 100644 --- a/yudai/seeed-voicecard-fork-for-higher-kernels/seeed-voicecard.c +++ b/yudai/seeed-voicecard-fork-for-higher-kernel/seeed-voicecard.c @@ -30,6 +30,20 @@ #define LINUX_VERSION_IS_GEQ(x1,x2,x3) (LINUX_VERSION_CODE >= KERNEL_VERSION(x1,x2,x3)) + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,13,0) +#define asoc_simple_parse_clk_cpu(dev, node, dai_link, simple_dai) \ + asoc_simple_parse_clk(dev, node, simple_dai, dai_link->cpus) +#define asoc_simple_parse_clk_codec(dev, node, dai_link, simple_dai) \ + asoc_simple_parse_clk(dev, node, simple_dai, dai_link->codecs) +#define asoc_simple_parse_cpu(node, dai_link, is_single_link) \ + asoc_simple_parse_dai(node, dai_link->cpus, is_single_link) +#define asoc_simple_parse_codec(node, dai_link) \ + asoc_simple_parse_dai(node, dai_link->codecs, NULL) +#define asoc_simple_parse_platform(node, dai_link) \ + asoc_simple_parse_dai(node, dai_link->platforms, NULL) +#endif + /* * single codec: * 0 - allow multi codec @@ -340,6 +354,11 @@ static int asoc_simple_init_dai(struct snd_soc_dai *dai, } #if LINUX_VERSION_CODE >= KERNEL_VERSION(5,7,0) +static inline int asoc_simple_component_is_codec(struct snd_soc_component *component) +{ + return component->driver->endianness; +} + static int asoc_simple_init_dai_link_params(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_dai_link *dai_link = rtd->dai_link; @@ -348,9 +367,9 @@ static int asoc_simple_init_dai_link_params(struct snd_soc_pcm_runtime *rtd) struct snd_pcm_hardware hw; int i, ret, stream; - /* Only codecs should have non_legacy_dai_naming set. */ + /* Only Codecs */ for_each_rtd_components(rtd, i, component) { - if (!component->driver->non_legacy_dai_naming) + if (!asoc_simple_component_is_codec(component)) return 0; } @@ -543,10 +562,17 @@ static int seeed_voice_card_dai_link_of(struct device_node *node, #endif dai_props->codec_dai.sysclk); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,13,0) + asoc_simple_canonicalize_cpu(dai_link->cpus, single_cpu); + #if _SINGLE_CODEC + asoc_simple_canonicalize_platform(dai_link->platforms, dai_link->cpus); + #endif +#else asoc_simple_canonicalize_cpu(dai_link, single_cpu); #if _SINGLE_CODEC asoc_simple_canonicalize_platform(dai_link); #endif +#endif dai_link_of_err: of_node_put(cpu); @@ -865,7 +891,9 @@ static int seeed_voice_card_remove(struct platform_device *pdev) if (cancel_work_sync(&priv->work_codec_clk) != 0) { } - return asoc_simple_clean_reference(card); + asoc_simple_clean_reference(card); + + return 0; } static const struct of_device_id seeed_voice_of_match[] = { diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/seeed-voicecard.service b/yudai/seeed-voicecard-fork-for-higher-kernel/seeed-voicecard.service similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/seeed-voicecard.service rename to yudai/seeed-voicecard-fork-for-higher-kernel/seeed-voicecard.service diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/sound-compatible-4.18.h b/yudai/seeed-voicecard-fork-for-higher-kernel/sound-compatible-4.18.h similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/sound-compatible-4.18.h rename to yudai/seeed-voicecard-fork-for-higher-kernel/sound-compatible-4.18.h diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/tools/coherence.py b/yudai/seeed-voicecard-fork-for-higher-kernel/tools/coherence.py similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/tools/coherence.py rename to yudai/seeed-voicecard-fork-for-higher-kernel/tools/coherence.py diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/tools/phase_test.py b/yudai/seeed-voicecard-fork-for-higher-kernel/tools/phase_test.py similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/tools/phase_test.py rename to yudai/seeed-voicecard-fork-for-higher-kernel/tools/phase_test.py diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/ubuntu-prerequisite.sh b/yudai/seeed-voicecard-fork-for-higher-kernel/ubuntu-prerequisite.sh similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/ubuntu-prerequisite.sh rename to yudai/seeed-voicecard-fork-for-higher-kernel/ubuntu-prerequisite.sh diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/uninstall.sh b/yudai/seeed-voicecard-fork-for-higher-kernel/uninstall.sh similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/uninstall.sh rename to yudai/seeed-voicecard-fork-for-higher-kernel/uninstall.sh diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/wm8960.c b/yudai/seeed-voicecard-fork-for-higher-kernel/wm8960.c similarity index 99% rename from yudai/seeed-voicecard-fork-for-higher-kernels/wm8960.c rename to yudai/seeed-voicecard-fork-for-higher-kernel/wm8960.c index 375d1a7..28ade11 100644 --- a/yudai/seeed-voicecard-fork-for-higher-kernels/wm8960.c +++ b/yudai/seeed-voicecard-fork-for-higher-kernel/wm8960.c @@ -1291,7 +1291,6 @@ static const struct snd_soc_codec_driver soc_codec_dev_wm8960 = { .idle_bias_on = 1, .use_pmdown_time = 1, .endianness = 1, - .non_legacy_dai_naming = 1, #endif }; @@ -1385,10 +1384,9 @@ static int wm8960_i2c_probe(struct i2c_client *i2c, return ret; } -static int wm8960_i2c_remove(struct i2c_client *client) +static void wm8960_i2c_remove(struct i2c_client *client) { snd_soc_unregister_codec(&client->dev); - return 0; } static const struct i2c_device_id wm8960_i2c_id[] = { diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/wm8960.h b/yudai/seeed-voicecard-fork-for-higher-kernel/wm8960.h similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/wm8960.h rename to yudai/seeed-voicecard-fork-for-higher-kernel/wm8960.h diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/wm8960_asound.state b/yudai/seeed-voicecard-fork-for-higher-kernel/wm8960_asound.state similarity index 100% rename from yudai/seeed-voicecard-fork-for-higher-kernels/wm8960_asound.state rename to yudai/seeed-voicecard-fork-for-higher-kernel/wm8960_asound.state diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/.github/ISSUE_TEMPLATE/BUG_ISSUE.yml b/yudai/seeed-voicecard-fork-for-higher-kernels/.github/ISSUE_TEMPLATE/BUG_ISSUE.yml deleted file mode 100644 index bec6291..0000000 --- a/yudai/seeed-voicecard-fork-for-higher-kernels/.github/ISSUE_TEMPLATE/BUG_ISSUE.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: Bug Report -description: File a bug report -title: "[Bug]: " -labels: [bug, triage] -assignees: - - Pillar1989 -body: - - type: markdown - attributes: - value: | - Thanks for taking the time to fill out this bug report! - - - type: textarea - id: what-happened - attributes: - label: Describe the bug - description: A clear and concise description of what the bug is. - value: | - **To Reproduce** - Steps to reproduce the behavior: - 1. Go to '...' - 2. Click on '....' - 3. Scroll down to '....' - 4. See error - validations: - required: true - - - type: textarea - id: what-expected - attributes: - label: Expected behavior - description: A clear and concise description of what you expected to happen. - validations: - required: true - - - type: textarea - id: platform - attributes: - label: Platform - description: What platform are you running the code on. - value: | - - Device: [e.g. Raspberry Pi 4] - - OS: [e.g. Raspbian OS 32bit kernel version ...] - - Version/commit number [e.g. d1816f5] - validations: - required: true - - - type: textarea - id: logs - attributes: - label: Relevant log output - description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. - render: shell diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/.github/ISSUE_TEMPLATE/config.yml b/yudai/seeed-voicecard-fork-for-higher-kernels/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index bc35e9c..0000000 --- a/yudai/seeed-voicecard-fork-for-higher-kernels/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1,5 +0,0 @@ -blank_issues_enabled: false -contact_links: - - name: Seeed Tech Support Forum - url: https://forum.seeedstudio.com/ - about: Please ask and answer general questions here. \ No newline at end of file diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/.github/workflows/stale.yml b/yudai/seeed-voicecard-fork-for-higher-kernels/.github/workflows/stale.yml deleted file mode 100644 index c2e15cd..0000000 --- a/yudai/seeed-voicecard-fork-for-higher-kernels/.github/workflows/stale.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Mark stale issues and pull requests - -on: - schedule: - - cron: '20 0 * * *' - -jobs: - stale: - - runs-on: ubuntu-latest - permissions: - issues: write - pull-requests: write - - steps: - - uses: actions/stale@v4.0.0 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - stale-issue-message: 'Stale issue message' - stale-pr-message: 'Stale pull request message' - stale-issue-label: 'no-issue-activity' - stale-pr-label: 'no-pr-activity' - days-before-stale: 15 diff --git a/yudai/seeed-voicecard-fork-for-higher-kernels/install_arm64.sh b/yudai/seeed-voicecard-fork-for-higher-kernels/install_arm64.sh deleted file mode 100755 index 45597e9..0000000 --- a/yudai/seeed-voicecard-fork-for-higher-kernels/install_arm64.sh +++ /dev/null @@ -1,236 +0,0 @@ -#!/bin/bash - -# Color -RED='\033[0;31m' -NC='\033[0m' # No Color - -if [[ $EUID -ne 0 ]]; then - echo "This script must be run as root (use sudo)" 1>&2 - exit 1 -fi - -# Check for enough space on /boot volume -boot_line=$(df -h | grep /boot | head -n 1) -if [ "x${boot_line}" = "x" ]; then - echo "Warning: /boot volume not found .." -else - boot_space=$(echo $boot_line | awk '{print $4;}') - free_space=$(echo "${boot_space%?}") - unit="${boot_space: -1}" - if [[ "$unit" = "K" ]]; then - echo "Error: Not enough space left ($boot_space) on /boot" - exit 1 - elif [[ "$unit" = "M" ]]; then - if [ "$free_space" -lt "25" ]; then - echo "Error: Not enough space left ($boot_space) on /boot" - exit 1 - fi - fi -fi - -# -# make sure that we are on something ARM/Raspberry related -# either a bare metal Raspberry or a qemu session with -# Raspberry stuff available -# - check for /boot/overlays -# - dtparam and dtoverlay is available -errorFound=0 -OVERLAYS=/boot/overlays -[ -d /boot/firmware/overlays ] && OVERLAYS=/boot/firmware/overlays - -if [ ! -d $OVERLAYS ] ; then - echo "$OVERLAYS not found or not a directory" 1>&2 - errorFound=1 -fi -# should we also check for alsactl and amixer used in seeed-voicecard? -PATH=$PATH:/opt/vc/bin -for cmd in dtparam dtoverlay ; do - if ! which $cmd &>/dev/null ; then - echo "$cmd not found" 1>&2 - echo "You may need to run ./ubuntu-prerequisite.sh" - errorFound=1 - fi -done -if [ $errorFound = 1 ] ; then - echo "Errors found, exiting." 1>&2 - exit 1 -fi - - -ver="0.3" -uname_r=$(uname -r) - -# we create a dir with this version to ensure that 'dkms remove' won't delete -# the sources during kernel updates -marker="0.0.0" - -_VER_RUN= -function get_kernel_version() { - local ZIMAGE IMG_OFFSET - - _VER_RUN="" - [ -z "$_VER_RUN" ] && { - ZIMAGE=/boot/kernel8.img - [ -f /boot/firmware/vmlinuz ] && ZIMAGE=/boot/firmware/vmlinuz - IMG_OFFSET=$(LC_ALL=C grep -abo $'\x1f\x8b\x08\x00' $ZIMAGE | head -n 1 | cut -d ':' -f 1) - _VER_RUN=$(dd if=$ZIMAGE obs=64K ibs=4 skip=$(( IMG_OFFSET / 4)) 2>/dev/null | zcat | grep -a -m1 "Linux version" | strings | awk '{ print $3; }') - } - echo "$_VER_RUN" - return 0 -} - -function check_kernel_headers() { - VER_RUN=$(get_kernel_version) - VER_HDR=$(dpkg -L raspberrypi-kernel-headers | egrep -m1 "/lib/modules/[[:print:]]+/build" | awk -F'/' '{ print $4; }') - echo $VER_RUN - echo $VER_HDR - [ "X$VER_RUN" == "X$VER_HDR" ] && { - return 0 - } - VER_HDR=$(dpkg -L linux-headers-$VER_RUN | egrep -m1 "/lib/modules/[[:print:]]+/build" | awk -F'/' '{ print $4; }') - echo $VER_RUN - echo $VER_HDR - [ "X$VER_RUN" == "X$VER_HDR" ] && { - return 0 - } - - # echo RUN=$VER_RUN HDR=$VER_HDR - echo " !!! Your kernel version is $VER_RUN" - echo " Not found *** corresponding *** kernel headers with apt-get." - echo " This may occur if you have ran 'rpi-update'." - echo " Choose *** y *** will revert the kernel to version $VER_HDR then continue." - echo " Choose *** N *** will exit without this driver support, by default." - read -p "Would you like to proceed? (y/N)" -n 1 -r -s - echo - if ! [[ $REPLY =~ ^[Yy]$ ]]; then - exit 1; - fi - - apt-get -y --reinstall install raspberrypi-kernel -} - -# update and install required packages -which apt &>/dev/null -if [[ $? -eq 0 ]]; then - #apt update -y - # Raspbian kernel packages - apt-get -y install raspberrypi-kernel-headers raspberrypi-kernel - # Ubuntu kernel packages - apt-get -y install linux-raspi linux-headers-raspi linux-image-raspi - apt-get -y install dkms git i2c-tools libasound2-plugins - # rpi-update checker - check_kernel_headers -fi - -# Arch Linux -which pacman &>/dev/null -if [[ $? -eq 0 ]]; then - pacman -Syu --needed git gcc automake make dkms linux-raspberrypi-headers i2c-tools -fi - -# locate currently installed kernels (may be different to running kernel if -# it's just been updated) -base_ver=$(get_kernel_version) -base_ver=${base_ver%%[-+]*} -#kernels="${base_ver}+ ${base_ver}-v7+ ${base_ver}-v7l+" -kernels=$(uname -r) -kernel_base_ver=${kernels%%[-+]*} - -if [[ "$base_ver" != "$kernel_base_ver" ]] ; then - echo "------------------------------------------------------" - echo -e " ${RED}WARNING${NC} Your loaded kernel version is $kernel_base_ver" - echo " Not matching the updated version $base_ver." - echo " Kernel was updated, but new kernel was not loaded yet" - echo -e " Please ${RED}reboot${NC} your machine AND THEN run this script ${RED}again" - exit 1; -fi - -function install_module { - local _i - - src=$1 - mod=$2 - - if [[ -d /var/lib/dkms/$mod/$ver/$marker ]]; then - rmdir /var/lib/dkms/$mod/$ver/$marker - fi - - if [[ -e /usr/src/$mod-$ver || -e /var/lib/dkms/$mod/$ver ]]; then - dkms remove --force -m $mod -v $ver --all - rm -rf /usr/src/$mod-$ver - fi - - mkdir -p /usr/src/$mod-$ver - cp -a $src/* /usr/src/$mod-$ver/ - - dkms add -m $mod -v $ver - for _i in $kernels; do - dkms build -k $_i -m $mod -v $ver && { - dkms install --force -k $_i -m $mod -v $ver - } - done - - mkdir -p /var/lib/dkms/$mod/$ver/$marker -} - -install_module "./" "seeed-voicecard" - -# install dtbos -cp seeed-2mic-voicecard.dtbo $OVERLAYS -cp seeed-4mic-voicecard.dtbo $OVERLAYS -cp seeed-8mic-voicecard.dtbo $OVERLAYS - -#install alsa plugins -# no need this plugin now -# install -D ac108_plugin/libasound_module_pcm_ac108.so /usr/lib/arm-linux-gnueabihf/alsa-lib/ -rm -f /usr/lib/arm-linux-gnueabihf/alsa-lib/libasound_module_pcm_ac108.so - -#set kernel modules -grep -q "^snd-soc-seeed-voicecard$" /etc/modules || \ - echo "snd-soc-seeed-voicecard" >> /etc/modules -grep -q "^snd-soc-ac108$" /etc/modules || \ - echo "snd-soc-ac108" >> /etc/modules -grep -q "^snd-soc-wm8960$" /etc/modules || \ - echo "snd-soc-wm8960" >> /etc/modules - -#set dtoverlays -CONFIG=/boot/config.txt -[ -f /boot/firmware/usercfg.txt ] && CONFIG=/boot/firmware/usercfg.txt - -sed -i -e 's:#dtparam=i2c_arm=on:dtparam=i2c_arm=on:g' $CONFIG || true -grep -q "^dtoverlay=i2s-mmap$" $CONFIG || \ - echo "dtoverlay=i2s-mmap" >> $CONFIG - - -grep -q "^dtparam=i2s=on$" $CONFIG || \ - echo "dtparam=i2s=on" >> $CONFIG - -#install config files -mkdir /etc/voicecard || true -cp *.conf /etc/voicecard -cp *.state /etc/voicecard - -#create git repo -git_email=$(git config --global --get user.email) -git_name=$(git config --global --get user.name) -if [ "x${git_email}" == "x" ] || [ "x${git_name}" == "x" ] ; then - echo "setup git config" - git config --global user.email "respeaker@seeed.cc" - git config --global user.name "respeaker" -fi -echo "git init" -git --git-dir=/etc/voicecard/.git init -echo "git add --all" -git --git-dir=/etc/voicecard/.git --work-tree=/etc/voicecard/ add --all -echo "git commit -m \"origin configures\"" -git --git-dir=/etc/voicecard/.git --work-tree=/etc/voicecard/ commit -m "origin configures" - -cp seeed-voicecard /usr/bin/ -cp seeed-voicecard.service /lib/systemd/system/ -systemctl enable seeed-voicecard.service -systemctl start seeed-voicecard - -echo "------------------------------------------------------" -echo "Please reboot your raspberry pi to apply all settings" -echo "Enjoy!" -echo "------------------------------------------------------"