What needs to be done to run an I2S DAC/Amplifier board based on MAX98357A (datasheet) that appears to be a clone of this well-documented Adafruit product with the corresponding Device Tree overlay?
Following the Adafruit instructions to modify /boot/config.txt
dtoverlay=hifiberry-dac
dtoverlay=i2s-mmap
#dtparam=audio=on
and creating the recommended /etc/asound.conf, I have audio (on left, right seems to be shut down via GPIO4).
However, the I2S interface in combination with that IC causes pops and crackle and I would like to use the shutdown pin of the chip/board.
The Device Tree Overlay specifically for this chip supports this
https://github.com/raspberrypi/linux/blob/rpi-4.19.y/arch/arm/boot/dts/overlays/max98357a-overlay.dts (not sure if this is the right branch)
But this does not work (no audio, and error, see below):
dtoverlay=max98357a
dtoverlay=i2s-mmap
#dtparam=audio=on
No audio device found
pi@raspberrypi:~ $ speaker-test -c2
speaker-test 1.1.8
Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
Using 16 octaves of pink noise
ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
Playback open error: -2,No such file or directory
Also:
pi@raspberrypi:~ $ aplay -l
aplay: device_list:272: no soundcards found...
pi@raspberrypi:~ $ aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
speakerbonnet
dmixer
softvol
default
There does not appear to be an error in dmesg.
The device tree overlay "binary" is present in:
pi@raspberrypi:~ $ ls /boot/overlays/max98357a.dtbo
/boot/overlays/max98357a.dtbo
https://github.com/raspberrypi/linux/blob/rpi-4.19.y/arch/arm/boot/dts/overlays/README#L1575
Name: max98357a
Info: Configures the Maxim MAX98357A I2S DAC
Load: dtoverlay=max98357a,<param>=<val>
Params: no-sdmode Driver does not manage the state of the DAC's
SD_MODE pin (i.e. chip is always on).
sdmode-pin integer, GPIO pin connected to the SD_MODE input
of the DAC (default GPIO4 if parameter omitted).
I'm assuming this would default to using SD with GPIO4!?
For comparison, the overlay for hifiberry-dac is
Additional docs: