[Raspberry Pi Original Development] JohnMolton94:
Thanks a lot Konsta! With your continued support, I have managed to get sound via the Waveshare Audio HAT Speakers, through the SSH terminal as of now! Able to play .wav files, couldn't be happier!

For anyone trying to do the same in the future, here are the consolidated steps for driver setup:

- Choose a compatible kernel (I chose: https://github.com/raspberry-vanilla/android_kernel_manifest/tree/android-13.0)
- Follow steps upto "repo sync"
- Before running the "build" step, we have to replace potentially out-dated files inside of our kernel folder, with our latest driver files. In my case, the latest files can be found here: https://github.com/waveshare/WM8960-Audio-HAT
- We will replace wm8960.c, wm8960.h (sound/soc/codecs) and wm8960-soundcard-overlay.dts (arch/arm64/boot/dts/overlays) [Waveshare calls this file wm8960-soundcard.dts, but you have to rename it to wm8960-soundcard-overlay.dts before replacing] in our kernel folder with files from waveshare.
- You would need to modify the defconfig (arch/arm64/configs/lineageos_rpi4_defconfig) before compiling the kernel. Change '# CONFIG_SND_SOC_WM8960 is not set' to 'CONFIG_SND_SOC_WM8960=y'.
- Change '# CONFIG_SND_SIMPLE_CARD is not set' to 'CONFIG_SND_SIMPLE_CARD=y'
- Build the kernel by executing the build script provided in the kernel instructions link
- If you are looking to add these kernel updates to an already up and running AOSP 13 image from Konsta, you can simply mount the sdcard on your computer and replace existing files in their appropriate locations. Kernel you've built can be found in 'out/common/arch/arm64/boot' directory as mentioned in the kernel build instructions.
- Lastly, you need to update your 'boot/config.txt' to include "dtoverlay=wm8960-soundcard". You can refer to the config1.txt I shared earlier in this thread.

To test playback:

- Put a 16-bit or 32-bit wav file on your image sdcard, in any folder of your choice. I used data/ folder.
- Once you have your android device running, you need to follow instructions to SSH into your machine from https://konstakang.com/devices/rpi4/AOSP13/
- Once ssh, you can use tinymix and tinyplay to test your audio devices (I was unable to find documentation on these, so it was trial and error for me)
- Run cat /proc/asound/cards in the ssh terminal to see connected devices, you should see an entry for 'wm8960soundcard'. Note the number for it (Mine was '3')
- Run tinymix -D 3. It will show you a lot of controls to set your sound/volume values. You can set a value using "tinymix 'your control name here' value". Please refer to https://github.com/waveshare/WM8960-Audio-HAT/blob/master/wm8960_asound.state to figure out default values and value ranges. You will need to set your tinymix values to match what waveshare has
- Run "tinyplay data/your-file-name.wav -D 3", and you should hear sound play from your speakers! and/or headphones depending on what you've set in tinymix

Once again, I cannot thank Konsta and the rest of the open source community enough for providing constant support and value to all of us!

Update:

By selecting “DAC” from Rasberry Pi Settings for the audio device, I am able to use the speakers as intended!

Update 2:

It seems the changes made to the sound device via tinymix are lost on system reboot. What is the best way to make them persist?

Future Work:

It seems that the wm8960 drivers from waveshare don’t implement the Headphone jack detect and auto mute speakers feature that the wm8960 hardware has, so I will probably look into adding that functionality myself, looking into the wm8960 datasheet and modifying .c and .h files accordingly.

It would also be great to know how can one edit System/Raspberry Pi Settings/Audio so that I can only see the Waveshare speakers and microphone as a selectable option (along with any possible bluetooth headphones that one may connect). Is this doable from my end/ how to go about this?