24bits via Alsa driver on the Raspberry Pi 2,3,4 is a very dark chapter in the history of the raspberry pi.
There are no technical restrictions but since over 6 years nobody cared to enable this in the stable version of the Raspbian linux kernel and as it looks like neither with the DietPi based Linux kernel.
However it is possible to recompile the kernel with activated 24bit and support for sample rates up to 192khz. I just tried this with a RPI 2 and a RPI 4 last week and was successful for Stereo 2 channel signals. With multichannel 5.1 setup and Flac 24/96 6 channel files I got crackling and wrong channel assignments out of the box.
Here a careful fine tuning of buffer sizes seems necessary by the “kernel guys” which are obviously not in a hurry to get active since more than 5 years!
If 2 channel support is sufficient for you I can point you to the steps necessary for the RPI 2 and 3:
see here: https://www.diyaudio.com/forums/pc-based/334443-2-8-dsp-platform-using-raspberry-pi-hats.html#post5710184
I verified last week that these steps worked on a RPI 2 with Raspbian Lite. I assume that this also works with DietPI
To do this with a RPI 4 you have to make some changes:
the section in bcm2835-pcm.c has to look like this
static const struct snd_pcm_hardware snd_bcm2835_playback_spdif_hw = {
.info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER |
SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_DRAIN_TRIGGER | SNDRV_PCM_INFO_SYNC_APPLPTR),
.formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_3LE,
.rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_44100 |
SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000,
.rate_min = 44100,
.rate_max = 192000,
.channels_min = 2,
.channels_max = 8,
.buffer_bytes_max = 512 * 1024,
.period_bytes_min = 1 * 1024,
.period_bytes_max = 512 * 1024,
.periods_min = 1,
.periods_max = 128,
};
and the KERNEL variable needs to be set to kernel7l instead of kernel7 in the build_kernel.sh script
ensure that in /boot/config.txt the hdmi audio support is activated with this line
# Enable audio (loads snd_bcm2835)
dtparam=audio=on
and plan for some time. The recompilation of the kernel takes roughly 2h on a PI