From a83ca982cf65b992e21d7d3838322755a9fa6b75 Mon Sep 17 00:00:00 2001 From: pstruebi Date: Wed, 5 Nov 2025 18:06:53 +0100 Subject: [PATCH] add devicetree overlay for i2s and asound.conf --- .gitignore | 3 ++ src/misc/asound.conf | 39 +++++++++++++++++++ src/misc/install_asoundconf.sh | 1 + src/misc/pcm1862-i2s.dts | 10 +++-- .../{list_pw_nodes.py => list_sd_nodes.py} | 0 5 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 src/misc/asound.conf create mode 100644 src/misc/install_asoundconf.sh rename src/scripts/{list_pw_nodes.py => list_sd_nodes.py} (100%) diff --git a/.gitignore b/.gitignore index cd9aa4c..1170d49 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,6 @@ src/auracast/server/certs/ca/ca_cert.srl src/auracast/server/credentials.json pcm1862-i2s.dtbo test.wav +both.wav +vin1.wav +vin2.wav diff --git a/src/misc/asound.conf b/src/misc/asound.conf new file mode 100644 index 0000000..43e72eb --- /dev/null +++ b/src/misc/asound.conf @@ -0,0 +1,39 @@ +# --- raw HW by card ID (no sharing) --- +pcm.adc_hw_stereo { + type hw + card "i2s" # from `arecord -l`: card 2: i2s [pcm1862 on i2s] + device 0 +} + +# --- mono splits (do the routing here) --- +pcm.adc_in1 { + type route + slave.pcm "adc_hw_stereo" + slave.channels 2 + ttable.0.0 1.0 # left -> mono + ttable.1.0 0.0 +} + +pcm.adc_in2 { + type route + slave.pcm "adc_hw_stereo" + slave.channels 2 + ttable.0.0 0.0 + ttable.1.0 1.0 # right -> mono +} + +# --- diagnostics: exact slot taps (bypass any sharing/conversion) --- +pcm.adc_ch0 { + type route + slave.pcm "adc_hw_stereo" + slave.channels 2 + ttable.0.0 1.0 + ttable.1.0 0.0 +} +pcm.adc_ch1 { + type route + slave.pcm "adc_hw_stereo" + slave.channels 2 + ttable.0.0 0.0 + ttable.1.0 1.0 +} diff --git a/src/misc/install_asoundconf.sh b/src/misc/install_asoundconf.sh new file mode 100644 index 0000000..fce13fc --- /dev/null +++ b/src/misc/install_asoundconf.sh @@ -0,0 +1 @@ +sudo cp src/misc/asound.conf /etc/asound.conf \ No newline at end of file diff --git a/src/misc/pcm1862-i2s.dts b/src/misc/pcm1862-i2s.dts index da80468..7c2f30d 100644 --- a/src/misc/pcm1862-i2s.dts +++ b/src/misc/pcm1862-i2s.dts @@ -7,24 +7,28 @@ /* Enable the I²S controller */ fragment@0 { target = <&i2s>; - __overlay__ { status = "okay"; }; + __overlay__ { + status = "okay"; + }; }; - /* PCM1862 on I2C1 at 0x4a */ + /* PCM1862 on I2C1 at 0x4a (change if your bus/address differ) */ fragment@1 { target = <&i2c1>; __overlay__ { #address-cells = <1>; #size-cells = <0>; + pcm1862: adc@4a { compatible = "ti,pcm1862"; reg = <0x4a>; #sound-dai-cells = <0>; + /* Rails are hard-powered on your board, so no regulators here */ }; }; }; - /* Link bcm2835-i2s <-> pcm1862 with simple-audio-card */ + /* Link bcm2835-i2s <-> pcm1862 via simple-audio-card */ fragment@2 { target-path = "/"; __overlay__ { diff --git a/src/scripts/list_pw_nodes.py b/src/scripts/list_sd_nodes.py similarity index 100% rename from src/scripts/list_pw_nodes.py rename to src/scripts/list_sd_nodes.py