From a3e915fe9bac96541fed593a05bf5a16f08bf5c7 Mon Sep 17 00:00:00 2001 From: Cheng-Min Chiang Date: Tue, 14 Jul 2020 16:43:13 -0700 Subject: sys/linux: add descriptions for mixer devices Add descriptions for OSS mixer devices, which includes `/dev/mixer` and its proc file `/proc/asound/card*/oss_mixer`. These descriptions should improve the coverage of `sound/core/oss/mixer_oss.c`. Update #533. --- sys/linux/dev_dsp.txt | 38 +++++++++++++++++++++++++++++++++++++- sys/linux/dev_dsp_386.const | 2 ++ sys/linux/dev_dsp_amd64.const | 2 ++ sys/linux/dev_dsp_arm.const | 2 ++ sys/linux/dev_dsp_arm64.const | 2 ++ sys/linux/dev_dsp_mips64le.const | 2 ++ sys/linux/dev_dsp_ppc64le.const | 2 ++ sys/linux/dev_dsp_riscv64.const | 2 ++ sys/linux/dev_dsp_s390x.const | 2 ++ 9 files changed, 53 insertions(+), 1 deletion(-) (limited to 'sys/linux') diff --git a/sys/linux/dev_dsp.txt b/sys/linux/dev_dsp.txt index d2f610615..18b014c24 100644 --- a/sys/linux/dev_dsp.txt +++ b/sys/linux/dev_dsp.txt @@ -43,9 +43,13 @@ ioctl$SNDCTL_DSP_GETODELAY(fd fd_dsp, cmd const[SNDCTL_DSP_GETODELAY], arg ptr[o ioctl$SOUND_PCM_READ_RATE(fd fd_dsp, cmd const[SOUND_PCM_READ_RATE], arg ptr[out, int32]) ioctl$SOUND_PCM_READ_CHANNELS(fd fd_dsp, cmd const[SOUND_PCM_READ_CHANNELS], arg ptr[out, int32]) ioctl$SOUND_PCM_READ_BITS(fd fd_dsp, cmd const[SOUND_PCM_READ_BITS], arg ptr[out, int32]) + +# /dev/mixer ioctl$SOUND_OLD_MIXER_INFO(fd fd_mixer, cmd const[SOUND_OLD_MIXER_INFO], arg ptr[out, array[int8, OLD_MIXED_INFO_SIZE]]) ioctl$SOUND_MIXER_INFO(fd fd_mixer, cmd const[SOUND_MIXER_INFO], arg ptr[out, array[int8, MIXER_INFO_SIZE]]) -ioctl$SOUND_MIXER_WRITE_RECSRC(fd fd_mixer, cmd const[SOUND_MIXER_WRITE_RECSRC], arg ptr[in, int32]) +ioctl$SOUND_MIXER_WRITE_RECSRC(fd fd_mixer, cmd const[SOUND_MIXER_WRITE_RECSRC], arg ptr[inout, int32]) +ioctl$mixer_OSS_GETVERSION(fd fd_mixer, cmd const[OSS_GETVERSION], arg ptr[out, int32]) +ioctl$mixer_OSS_ALSAEMULVER(fd fd_mixer, cmd const[OSS_ALSAEMULVER], arg ptr[out, int32]) ioctl$SOUND_MIXER_READ_DEVMASK(fd fd_mixer, cmd const[SOUND_MIXER_READ_DEVMASK], arg ptr[out, int32]) ioctl$SOUND_MIXER_READ_STEREODEVS(fd fd_mixer, cmd const[SOUND_MIXER_READ_STEREODEVS], arg ptr[out, int32]) ioctl$SOUND_MIXER_READ_RECMASK(fd fd_mixer, cmd const[SOUND_MIXER_READ_RECMASK], arg ptr[out, int32]) @@ -54,6 +58,37 @@ ioctl$SOUND_MIXER_READ_RECSRC(fd fd_mixer, cmd const[SOUND_MIXER_READ_RECSRC], a ioctl$SOUND_MIXER_WRITE_VOLUME(fd fd_mixer, cmd int32[SOUND_MIXER_WRITE_VOLUME:SOUND_MIXER_WRITE_ONOFF_MAX], arg ptr[in, int32[0:100]]) ioctl$SOUND_MIXER_READ_VOLUME(fd fd_mixer, cmd int32[SOUND_MIXER_READ_VOLUME:SOUND_MIXER_READ_ONOFF_MAX], arg ptr[out, int32]) +# /proc/asound/card*/oss_mixer +resource fd_proc_mixer[fd] +oss_mixer_proc_files = "/proc/asound/card0/oss_mixer", "/proc/asound/card1/oss_mixer", "/proc/asound/card2/oss_mixer", "/proc/asound/card3/oss_mixer" + +openat$proc_mixer(fd const[AT_FDCWD], file ptr[in, string[oss_mixer_proc_files]], flags flags[open_flags], mode const[0]) fd_proc_mixer +read$proc_mixer(fd fd_proc_mixer, data ptr[out, array[int8]], len bytesize[data]) +write$proc_mixer(fd fd_proc_mixer, data ptr[in, array[oss_mixer_input_line]], len bytesize[data]) + +# The input to write$proc_mixer can consist of several lines. +# The format of each line should be: +# [ '' ]\n +# e.g. "VOLUME\nBASS 'Line Capture Switch' 123\n" + +# 10 = '\n' +oss_mixer_input_line { + name stringnoz[oss_mixer_names] + body optional[oss_mixer_input_body] + newline const[10, int8] +} [packed] + +# index should be intptr[0:0x4000], but only 0 works on qemu currently. +oss_mixer_input_body { + sep1 stringnoz[" '"] + alsa_source stringnoz[alsa_source_names] + sep2 stringnoz["' "] + index fmt[dec, intptr[0:0]] +} [packed] + +oss_mixer_names = "VOLUME", "BASS", "TREBLE", "SYNTH", "PCM", "SPEAKER", "LINE", "MIC", "CD", "IMIX", "ALTPCM", "RECLEV", "IGAIN", "OGAIN", "LINE1", "LINE2", "LINE3", "DIGITAL1", "DIGITAL2", "DIGITAL3", "PHONEIN", "PHONEOUT", "VIDEO", "RADIO", "MONITOR" +alsa_source_names = "Master", "Master Capture", "Master Capture Switch", "Master Playback", "Master Playback Volume", "Master Playback Switch", "Synth", "Synth Capture", "Synth Capture Switch", "Line", "Line Capture", "Line Capture Switch", "Mic", "Mic Capture", "Mic Capture Switch", "CD", "CD Capture", "CD Capture Switch", "Capture", "Capture Volume", "Capture Switch" + # NEED: we could provide a special support for this to save typing and duplication here. # It could be eigher: # csizeof[struct audio_buf_info] @@ -69,4 +104,5 @@ define MIXER_INFO_SIZE sizeof(struct mixer_info) define OLD_MIXED_INFO_SIZE sizeof(struct _old_mixer_info) define SOUND_MIXER_WRITE_ONOFF_MAX MIXER_WRITE(SOUND_ONOFF_MAX) define SOUND_MIXER_READ_ONOFF_MAX MIXER_READ(SOUND_ONOFF_MAX) +define OSS_ALSAEMULVER _SIOR ('M', 249, int) _ = __NR_mmap2 diff --git a/sys/linux/dev_dsp_386.const b/sys/linux/dev_dsp_386.const index eae982f99..4d5c28e75 100644 --- a/sys/linux/dev_dsp_386.const +++ b/sys/linux/dev_dsp_386.const @@ -4,6 +4,8 @@ AUFIO_BUF_INFO_SIZE = 16 COUNT_INFO_SIZE = 12 MIXER_INFO_SIZE = 92 OLD_MIXED_INFO_SIZE = 48 +OSS_ALSAEMULVER = 2147765753 +OSS_GETVERSION = 2147765622 SNDCTL_DSP_CHANNELS = 3221508102 SNDCTL_DSP_GETBLKSIZE = 3221508100 SNDCTL_DSP_GETCAPS = 2147766287 diff --git a/sys/linux/dev_dsp_amd64.const b/sys/linux/dev_dsp_amd64.const index 9ada6c9ca..cc09b8064 100644 --- a/sys/linux/dev_dsp_amd64.const +++ b/sys/linux/dev_dsp_amd64.const @@ -4,6 +4,8 @@ AUFIO_BUF_INFO_SIZE = 16 COUNT_INFO_SIZE = 12 MIXER_INFO_SIZE = 92 OLD_MIXED_INFO_SIZE = 48 +OSS_ALSAEMULVER = 2147765753 +OSS_GETVERSION = 2147765622 SNDCTL_DSP_CHANNELS = 3221508102 SNDCTL_DSP_GETBLKSIZE = 3221508100 SNDCTL_DSP_GETCAPS = 2147766287 diff --git a/sys/linux/dev_dsp_arm.const b/sys/linux/dev_dsp_arm.const index f8c8994bf..d95cdece3 100644 --- a/sys/linux/dev_dsp_arm.const +++ b/sys/linux/dev_dsp_arm.const @@ -4,6 +4,8 @@ AUFIO_BUF_INFO_SIZE = 16 COUNT_INFO_SIZE = 12 MIXER_INFO_SIZE = 92 OLD_MIXED_INFO_SIZE = 48 +OSS_ALSAEMULVER = 2147765753 +OSS_GETVERSION = 2147765622 SNDCTL_DSP_CHANNELS = 3221508102 SNDCTL_DSP_GETBLKSIZE = 3221508100 SNDCTL_DSP_GETCAPS = 2147766287 diff --git a/sys/linux/dev_dsp_arm64.const b/sys/linux/dev_dsp_arm64.const index 0fcf67bd9..ed8af580e 100644 --- a/sys/linux/dev_dsp_arm64.const +++ b/sys/linux/dev_dsp_arm64.const @@ -4,6 +4,8 @@ AUFIO_BUF_INFO_SIZE = 16 COUNT_INFO_SIZE = 12 MIXER_INFO_SIZE = 92 OLD_MIXED_INFO_SIZE = 48 +OSS_ALSAEMULVER = 2147765753 +OSS_GETVERSION = 2147765622 SNDCTL_DSP_CHANNELS = 3221508102 SNDCTL_DSP_GETBLKSIZE = 3221508100 SNDCTL_DSP_GETCAPS = 2147766287 diff --git a/sys/linux/dev_dsp_mips64le.const b/sys/linux/dev_dsp_mips64le.const index 3349cde61..3a4f3e542 100644 --- a/sys/linux/dev_dsp_mips64le.const +++ b/sys/linux/dev_dsp_mips64le.const @@ -4,6 +4,8 @@ AUFIO_BUF_INFO_SIZE = 16 COUNT_INFO_SIZE = 12 MIXER_INFO_SIZE = 92 OLD_MIXED_INFO_SIZE = 48 +OSS_ALSAEMULVER = 1074023929 +OSS_GETVERSION = 1074023798 SNDCTL_DSP_CHANNELS = 3221508102 SNDCTL_DSP_GETBLKSIZE = 3221508100 SNDCTL_DSP_GETCAPS = 1074024463 diff --git a/sys/linux/dev_dsp_ppc64le.const b/sys/linux/dev_dsp_ppc64le.const index 5ae1c2756..149d3afa5 100644 --- a/sys/linux/dev_dsp_ppc64le.const +++ b/sys/linux/dev_dsp_ppc64le.const @@ -4,6 +4,8 @@ AUFIO_BUF_INFO_SIZE = 16 COUNT_INFO_SIZE = 12 MIXER_INFO_SIZE = 92 OLD_MIXED_INFO_SIZE = 48 +OSS_ALSAEMULVER = 1074023929 +OSS_GETVERSION = 1074023798 SNDCTL_DSP_CHANNELS = 3221508102 SNDCTL_DSP_GETBLKSIZE = 3221508100 SNDCTL_DSP_GETCAPS = 1074024463 diff --git a/sys/linux/dev_dsp_riscv64.const b/sys/linux/dev_dsp_riscv64.const index 0fcf67bd9..ed8af580e 100644 --- a/sys/linux/dev_dsp_riscv64.const +++ b/sys/linux/dev_dsp_riscv64.const @@ -4,6 +4,8 @@ AUFIO_BUF_INFO_SIZE = 16 COUNT_INFO_SIZE = 12 MIXER_INFO_SIZE = 92 OLD_MIXED_INFO_SIZE = 48 +OSS_ALSAEMULVER = 2147765753 +OSS_GETVERSION = 2147765622 SNDCTL_DSP_CHANNELS = 3221508102 SNDCTL_DSP_GETBLKSIZE = 3221508100 SNDCTL_DSP_GETCAPS = 2147766287 diff --git a/sys/linux/dev_dsp_s390x.const b/sys/linux/dev_dsp_s390x.const index 2b7dc56fc..ba0635fa2 100644 --- a/sys/linux/dev_dsp_s390x.const +++ b/sys/linux/dev_dsp_s390x.const @@ -4,6 +4,8 @@ AUFIO_BUF_INFO_SIZE = 16 COUNT_INFO_SIZE = 12 MIXER_INFO_SIZE = 92 OLD_MIXED_INFO_SIZE = 48 +OSS_ALSAEMULVER = 2147765753 +OSS_GETVERSION = 2147765622 SNDCTL_DSP_CHANNELS = 3221508102 SNDCTL_DSP_GETBLKSIZE = 3221508100 SNDCTL_DSP_GETCAPS = 2147766287 -- cgit mrf-deployment