diff --git a/device/testing/device-amazon-biscuit/99-biscuit-hp-switch.rules b/device/testing/device-amazon-biscuit/99-biscuit-hp-switch.rules new file mode 100644 index 0000000000000000000000000000000000000000..89c14ba7995d2455f290bda046604017ff03adba --- /dev/null +++ b/device/testing/device-amazon-biscuit/99-biscuit-hp-switch.rules @@ -0,0 +1,2 @@ +SUBSYSTEM=="switch", ACTION=="change", ENV{SWITCH_NAME}=="h2w", ENV{SWITCH_STATE}=="0", RUN+="/usr/bin/alsaucm -c mt-snd-card set _verb HiFi set _enadev Speaker" +SUBSYSTEM=="switch", ACTION=="change", ENV{SWITCH_NAME}=="h2w", ENV{SWITCH_STATE}=="1", RUN+="/usr/bin/alsaucm -c mt-snd-card set _verb HiFi set _enadev Headphones" diff --git a/device/testing/device-amazon-biscuit/APKBUILD b/device/testing/device-amazon-biscuit/APKBUILD index 6012308ce80434873a7cb381290d4d9307c4d775..28a5bb6f57fcc515cd8b46c77f86218ee0650d42 100644 --- a/device/testing/device-amazon-biscuit/APKBUILD +++ b/device/testing/device-amazon-biscuit/APKBUILD @@ -1,7 +1,7 @@ # Reference: <https://postmarketos.org/devicepkg> pkgname=device-amazon-biscuit pkgdesc="Amazon Echo Dot (2nd gen)" -pkgver=2 +pkgver=3 pkgrel=0 url="https://postmarketos.org" license="MIT" @@ -12,14 +12,26 @@ depends=" mtk-mkimage mkbootimg postmarketos-base + alsa-ucm-conf " makedepends="devicepkg-dev" source=" deviceinfo + asound.conf + 99-biscuit-hp-switch.rules + pulse-daemon-biscuit.conf + pulse-default-biscuit.pa + ucm2/init.conf + ucm2/HiFi.conf + ucm2/mt8163_biscuit.conf led.start led.stop " +subpackages=" + $pkgname-pulseaudio:pulseaudio +" + build() { devicepkg_build $startdir $pkgname } @@ -28,10 +40,41 @@ package() { devicepkg_package $startdir $pkgname install -Dm755 "$srcdir"/led.start "$pkgdir"/etc/local.d/led.start install -Dm755 "$srcdir"/led.stop "$pkgdir"/etc/local.d/led.stop + + # ALSA configs + install -Dm644 "$srcdir"/asound.conf "$pkgdir"/etc/asound.conf + install -Dm644 -t "$pkgdir"/usr/share/alsa/ucm2/MediaTek/mt8163_biscuit/ \ + "$srcdir"/init.conf \ + "$srcdir"/HiFi.conf \ + "$srcdir"/mt8163_biscuit.conf + mkdir -p "$pkgdir"/usr/share/alsa/ucm2/conf.d/mt-snd-card/ + ln -s ../../MediaTek/mt8163_biscuit/mt8163_biscuit.conf \ + "$pkgdir"/usr/share/alsa/ucm2/conf.d/mt-snd-card/mt-snd-card.conf + + # Speaker/HP switch rule + install -Dm644 "$srcdir"/99-biscuit-hp-switch.rules \ + "$pkgdir"/usr/lib/udev/rules.d/99-biscuit-hp-switch.rules +} + +pulseaudio() { + pkgdesc="PulseAudio Configuration Files" + depends="pulseaudio" + install_if="linux-amazon-biscuit" + install -Dm644 "$srcdir"/pulse-daemon-biscuit.conf \ + "$subpkgdir"/etc/pulse/daemon.conf.d/daemon-biscuit.conf + install -Dm644 "$srcdir"/pulse-default-biscuit.pa \ + "$subpkgdir"/etc/pulse/default.pa.d/default-biscuit.pa } sha512sums=" ac9ac01dc69a6434bf0f6210df7960e3dee5ddcec96829cc6e9a5a100fededa1fd9fa935cee364026c6913506b0ff3975087ea786216279c74190d869d1f5150 deviceinfo +dd379fea44560b3b89dc19521096fd8c019ad69f0d06072ae3b9a591db4178d9268fc38ed2e7371d86c4ff5845c857ca0af6932abe205ea38492cf8dd39fd770 asound.conf +68cb37bbd1d8c653a7a20fc641b6041e2b2f60825e77f7ef79856d5624c2a41a5bddfdeaba07dec955e91c024e15d3663e30456df1c73571295183942e486fec 99-biscuit-hp-switch.rules +acc93ffeaa7dc8e57af7432dba2aee5ec339166064d898d0db1c1d8f0ad887fb6ab986168d145b739cabd04e15f59484ec037487511cc1f0a0e31ab94e6189f7 pulse-daemon-biscuit.conf +d66d6f2129f8aef4449137a1506fb3b3a1275c98502238537ac4dd0c174145706bac971e7e100d3599c9b8aa9c62319c302884d39aad5ba99c9bdcbe1e54bc23 pulse-default-biscuit.pa +5f46b2f7f9dbbd445b6a70f8ad7e4753bd105e802a05b8693f38283f6705ce233f4173db3cdd945eaf54caaa08f8d9b8a35266186ad72edcdd34e37901121104 init.conf +e92f07b643ce6e26259038a7b3b1f4a2ac7e6113717b0384fe4cb33946bf6a0e45e6609a5baf7ab2de8c941159e7f11610101609647e817165b07fca72be6e51 HiFi.conf +c93349fc1fb797ecc8bc7756837c970aa83c7d8cf281e5afd8f0a243ea2f3c7772a3f383a3deeecfb140954bbedb34d00b3ae0172ae7814b14af0fcac71355a5 mt8163_biscuit.conf a72f042f5afdb4d47d22c46906cee4d84a23584bc719bfec99678251a6e7784fdfb67c284ecafd11721f7c90783a93283957c43ad845a1ff586b0610234523a3 led.start d10a06899a48a090042047a9b4917604a0d408701f6e15fc559a5f8444d61f91a3b6c201cbdb227ae0f19d1dff3424e40c41e32e2e91f37b9a69f6e0bd67eb30 led.stop " diff --git a/device/testing/device-amazon-biscuit/asound.conf b/device/testing/device-amazon-biscuit/asound.conf new file mode 100644 index 0000000000000000000000000000000000000000..cf6a0b8dc0fca8e3f46780d61503eccdaa9e3e6e --- /dev/null +++ b/device/testing/device-amazon-biscuit/asound.conf @@ -0,0 +1,9 @@ +pcm.!default { + type asym + playback.pcm "hw:0,23" +} + +ctl.!default { + type hw + card 0 +} diff --git a/device/testing/device-amazon-biscuit/pulse-daemon-biscuit.conf b/device/testing/device-amazon-biscuit/pulse-daemon-biscuit.conf new file mode 100644 index 0000000000000000000000000000000000000000..8a17b92f83e9ac3e0e96f68dc657ac5a5c86cd3f --- /dev/null +++ b/device/testing/device-amazon-biscuit/pulse-daemon-biscuit.conf @@ -0,0 +1,5 @@ +resample-method = trivial +exit-idle-time = -1 +default-sample-rate = 48000 +default-fragments = 16 +default-fragment-size-msec = 50 diff --git a/device/testing/device-amazon-biscuit/pulse-default-biscuit.pa b/device/testing/device-amazon-biscuit/pulse-default-biscuit.pa new file mode 100644 index 0000000000000000000000000000000000000000..7397be65cf5987e79ee5213f754d9ead793c0348 --- /dev/null +++ b/device/testing/device-amazon-biscuit/pulse-default-biscuit.pa @@ -0,0 +1 @@ +unload-module module-suspend-on-idle diff --git a/device/testing/device-amazon-biscuit/ucm2/HiFi.conf b/device/testing/device-amazon-biscuit/ucm2/HiFi.conf new file mode 100644 index 0000000000000000000000000000000000000000..e6f6a0f326991686fbc7f40831d7dc79e385d0d5 --- /dev/null +++ b/device/testing/device-amazon-biscuit/ucm2/HiFi.conf @@ -0,0 +1,36 @@ +SectionDevice."Speaker" { + Comment "Speaker" + + Value { + PlaybackPriority 200 + PlaybackPCM "hw:${CardId},23" + PlaybackRate 48000 + } + + EnableSequence [ + cset "name='Ext_Speaker_Amp_Switch' On" + cset "name='Ignore Ramp Up' Off" + cset "name='Audio_DacMux_Setting' Off" + cset "name='Right Channel Only' On" + cset "name='HP Driver Gain Volume' 6" + cset "name='PCM Playback Volume' 127,127" + ] +} + +SectionDevice."Headphones" { + Comment "Headphones/Line Out" + + Value { + PlaybackPriority 100 + PlaybackPCM "hw:${CardId},23" + } + + EnableSequence [ + cset "name='Ext_Speaker_Amp_Switch' Off" + cset "name='Ignore Ramp Up' On" + cset "name='HP Driver Gain Volume' 11" + cset "name='Audio_DacMux_Setting' On" + cset "name='Right Channel Only' Off" + ] +} + diff --git a/device/testing/device-amazon-biscuit/ucm2/init.conf b/device/testing/device-amazon-biscuit/ucm2/init.conf new file mode 100644 index 0000000000000000000000000000000000000000..3dbe341c7985a8cda41d349ec5a92feca6a081aa --- /dev/null +++ b/device/testing/device-amazon-biscuit/ucm2/init.conf @@ -0,0 +1,35 @@ +FixedBootSequence [ + cset "name='ADC_A Left Ip Select ADC_A DIF1_L switch' 1" + cset "name='ADC_A Right Ip Select ADC_A DIF1_R switch' 1" + cset "name='ADC_B Left Ip Select ADC_B DIF1_L switch' 1" + cset "name='ADC_B Right Ip Select ADC_B DIF1_R switch' 1" + cset "name='ADC_C Left Ip Select ADC_C DIF1_L switch' 1" + cset "name='ADC_C Right Ip Select ADC_C DIF1_R switch' 1" + cset "name='ADC_D Left Ip Select ADC_D DIF1_L switch' 1" + cset "name='ADC_D Right Ip Select ADC_D DIF1_R switch' 1" + + cset "name='ADC_A MICPGA Volume Ctrl' 40" + cset "name='ADC_B MICPGA Volume Ctrl' 40" + cset "name='ADC_C MICPGA Volume Ctrl' 40" + cset "name='ADC_D MICPGA Volume Ctrl' 40" + + cset "name='ADC_A DIF1_L Input Gain' 0" + cset "name='ADC_A DIF1_R Input Gain' 0" + cset "name='ADC_B DIF1_L Input Gain' 0" + cset "name='ADC_B DIF1_R Input Gain' 0" + cset "name='ADC_C DIF1_L Input Gain' 0" + cset "name='ADC_C DIF1_R Input Gain' 0" + cset "name='ADC_D DIF1_L Input Gain' 0" + cset "name='ADC_D DIF1_R Input Gain' 0" + + cset "name='SpiTimeStamps' 0" + + cset "name='HPL Output Mixer L_DAC Switch' 1" + cset "name='HPR Output Mixer R_DAC Switch' 1" + + cset "name='Ext_Speaker_Amp_Switch' Off" + cset "name='Audio_DacMux_Setting' On" + cset "name='Ignore Ramp Up' Off" + cset "name='HP Driver Gain Volume' 0" + cset "name='biquad coefficients' 128,0,1,0,0,0,0,0,0,0,0,0,0,0,0,128,0,1,0,0,0,0,0,0,0,0,0,0,0,0,128,0,1,0,0,0,0,0,0,0,0,0,0,0,0,128,0,1,0,0,0,0,0,0,0,0,0,0,0,0,128,0,1,0,0,0,0,0,0,0,0,0,0,0,0,128,0,1,0,0,0,0,0,0,0,0,0,0,0,0,127,247,0,0,128,9,0,0,127,239,0,0,0,17,0,0,0,17,0,0,127,222,0,0,15,0,0" +] diff --git a/device/testing/device-amazon-biscuit/ucm2/mt8163_biscuit.conf b/device/testing/device-amazon-biscuit/ucm2/mt8163_biscuit.conf new file mode 100644 index 0000000000000000000000000000000000000000..d1fd504aa9e6b65a76ba96b90858cb6ef42fbeeb --- /dev/null +++ b/device/testing/device-amazon-biscuit/ucm2/mt8163_biscuit.conf @@ -0,0 +1,12 @@ +Comment "MT8163 sound card for Amazon Echo Dot 2G (biscuit)" +Syntax 4 + +SectionUseCase."HiFi" { + File "/MediaTek/mt8163_biscuit/HiFi.conf" + Comment "Default" +} + +Include.card-init.File "/lib/card-init.conf" +Include.ctl-remap.File "/lib/ctl-remap.conf" +Include.init.File "/MediaTek/mt8163_biscuit/init.conf" +