aboutsummaryrefslogtreecommitdiffstats
path: root/sys/linux
diff options
context:
space:
mode:
authorCheng-Min Chiang <chmnchiang@google.com>2020-07-14 16:43:13 -0700
committerDmitry Vyukov <dvyukov@google.com>2020-07-16 09:11:03 +0200
commita3e915fe9bac96541fed593a05bf5a16f08bf5c7 (patch)
tree8584f954beb84d9e868c4b193984d57f678fba04 /sys/linux
parent561f9a1f6f8652a8fa50569697eacdb0622ae831 (diff)
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.
Diffstat (limited to 'sys/linux')
-rw-r--r--sys/linux/dev_dsp.txt38
-rw-r--r--sys/linux/dev_dsp_386.const2
-rw-r--r--sys/linux/dev_dsp_amd64.const2
-rw-r--r--sys/linux/dev_dsp_arm.const2
-rw-r--r--sys/linux/dev_dsp_arm64.const2
-rw-r--r--sys/linux/dev_dsp_mips64le.const2
-rw-r--r--sys/linux/dev_dsp_ppc64le.const2
-rw-r--r--sys/linux/dev_dsp_riscv64.const2
-rw-r--r--sys/linux/dev_dsp_s390x.const2
9 files changed, 53 insertions, 1 deletions
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:
+# <oss_mixer_name>[ '<alsa_source_names>' <index>]\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