Also, I don't think the /dev/audio/pcm0 device you are talking about is
what you think it is. It is a character driver but not the Class D
lower half. So, yes it can be opened.
/Caveat: It has been ages since I worked with the audio subsystem so I
might be completely wrong./
/dev/audio/pcm0 is the audio subsystem interface device. The "pcm"
indicates that it used the PCM software decoder (that will convert PCM
file data to WAV). It gets set up like:
boards/arm/sama5/sama5d4-ek/src/sam_wm8904.c:
pcm = pcm_decode_initialize(wm8904);
snprintf(devname, 12, "pcm%d", minor);
ret = audio_register(devname, pcm);
And a character driver is registered by the audio subsystem in
audio/audio.c:
int audio_register(FAR const char *name, FAR struct
audio_lowerhalf_s *dev)
{
...
audinfo("Registering %s\n", path);
return register_driver(path, &g_audioops, 0666, upper);
}
Where g_audioops is the character driver operations structure:
static const struct file_operations g_audioops =
{
audio_open, /* open */
audio_close, /* close */
audio_read, /* read */
audio_write, /* write */
NULL, /* seek */
audio_ioctl, /* ioctl */
};
So the registered pcm0 is the standard audio buffer chain configured for
PCM file to WAV conversion and terminating with a wm8904 DAC.
I don't believe that there is any way to get the Class D audio_ops_s as
a driver under /dev. Nothing like that is supported.