Alsa 未启用录制功能

Alsa 未启用录制功能

我们开发了一个基于linux的嵌入式板,并从评估板设计中复制了处理器和音频芯片,当然也使用了alsa。在评估板上,音频播放和录音工作正常。在我们的主板上,只有播放功能有效。 “arecord”正在工作,但实际上没有收到声音。我们没有对驱动程序源代码进行任何修改。设备树的配置与评估板中相同。

我发现音频控制器中所需的启用位均未设置,因此 alsa 在录制时似乎没有配置设备。当我手动设置位时,录音确实可以工作,尽管采样频率错误。

我已经多次检查 alsamixer 设置,所有值似乎都很合理。所以这可能只是其他地方的一个小设置让 alsa 表现出这种行为,我不知道。

在 alsamixer 设置中,我缺少输入静音开关。它在源代码中定义,但没有出现在 alsamixer 中。为了检查混音器中的输入是否静音,我执行了“alsactl store”并查看了生成的文件。它没有静音。

你有什么想法我还可以尝试什么吗?或者源代码中的哪个位置应该启用控制器?

处理器是Atmel SAMA5D4,音频芯片是WM8904。 Linux 版本 5.15.32 音频驱动程序:

声音/soc/atmel/atmel_wm8904.c 声音/soc/codecs/wm8904.c

混合器:

Simple mixer control 'Headphone',0
  Capabilities: volume pswitch
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 63
  Front Left: 45 [71%] [-12.00dB] Playback [on]
  Front Right: 45 [71%] [-12.00dB] Playback [on]
Simple mixer control 'Headphone ZC',0
  Capabilities: pswitch
  Playback channels: Front Left - Front Right
  Mono:
  Front Left: Playback [on]
  Front Right: Playback [on]
Simple mixer control 'Line Output',0
  Capabilities: volume pswitch
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 63
  Front Left: 57 [90%] [0.00dB] Playback [on]
  Front Right: 57 [90%] [0.00dB] Playback [on]
Simple mixer control 'Line Output ZC',0
  Capabilities: pswitch
  Playback channels: Front Left - Front Right
  Mono:
  Front Left: Playback [on]
  Front Right: Playback [on]
Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 31
  Front Left: Capture 5 [16%] [on]
  Front Right: Capture 5 [16%] [on]
Simple mixer control 'ADC 128x OSR',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'AIFOUTL Mux',0
  Capabilities: enum
  Items: 'Left' 'Right'
  Item0: 'Left'
Simple mixer control 'AIFOUTR Mux',0
  Capabilities: enum
  Items: 'Left' 'Right'
  Item0: 'Right'
Simple mixer control 'DAC Deemphasis',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'DAC OSRx2',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'DACL Mux',0
  Capabilities: enum
  Items: 'Left' 'Right'
  Item0: 'Left'
Simple mixer control 'DACR Mux',0
  Capabilities: enum
  Items: 'Left' 'Right'
  Item0: 'Right'
Simple mixer control 'DRC',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'DRC Path',0
  Capabilities: enum
  Items: 'ADC' 'DAC'
  Item0: 'ADC'
Simple mixer control 'Digital',0
  Capabilities: pvolume cvolume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: Playback 0 - 96 Capture 0 - 119
  Front Left: Playback 96 [100%] [0.00dB] Capture 96 [81%] [0.00dB]
  Front Right: Playback 96 [100%] [0.00dB] Capture 96 [81%] [0.00dB]
Simple mixer control 'Digital Playback Boost',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 3
  Mono: 0 [0%] [0.00dB]
Simple mixer control 'Digital Sidetone',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 15
  Front Left: 0 [0%] [-36.00dB]
  Front Right: 0 [0%] [-36.00dB]
Simple mixer control 'EQ',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'EQ1',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 24
  Mono: 12 [50%] [0.00dB]
Simple mixer control 'EQ2',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 24
  Mono: 12 [50%] [0.00dB]
Simple mixer control 'EQ3',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 24
  Mono: 12 [50%] [0.00dB]
Simple mixer control 'EQ4',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 24
  Mono: 12 [50%] [0.00dB]
Simple mixer control 'EQ5',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 24
  Mono: 12 [50%] [0.00dB]
Simple mixer control 'HPL Mux',0
  Capabilities: enum
  Items: 'DAC' 'Bypass'
  Item0: 'DAC'
Simple mixer control 'HPR Mux',0
  Capabilities: enum
  Items: 'DAC' 'Bypass'
  Item0: 'DAC'
Simple mixer control 'High Pass Filter',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'High Pass Filter Mode',0
  Capabilities: enum
  Items: 'Hi-fi' 'Voice 1' 'Voice 2' 'Voice 3'
  Item0: 'Hi-fi'
Simple mixer control 'LINEL Mux',0
  Capabilities: enum
  Items: 'DAC' 'Bypass'
  Item0: 'DAC'
Simple mixer control 'LINER Mux',0
  Capabilities: enum
  Items: 'DAC' 'Bypass'
  Item0: 'DAC'
Simple mixer control 'Left Capture Inverting Mux',0
  Capabilities: enum
  Items: 'IN1L' 'IN2L' 'IN3L'
  Item0: 'IN1L'
Simple mixer control 'Left Capture Mode',0
  Capabilities: enum
  Items: 'Single-Ended' 'Differential Line' 'Differential Mic'
  Item0: 'Single-Ended'
Simple mixer control 'Left Capture Mux',0
  Capabilities: enum
  Items: 'IN1L' 'IN2L' 'IN3L'
  Item0: 'IN2L'
Simple mixer control 'Left Sidetone',0
  Capabilities: enum
  Items: 'None' 'Left' 'Right'
  Item0: 'None'
Simple mixer control 'Right Capture Inverting Mux',0
  Capabilities: enum
  Items: 'IN1R' 'IN2R' 'IN3R'
  Item0: 'IN1R'
Simple mixer control 'Right Capture Mode',0
  Capabilities: enum
  Items: 'Single-Ended' 'Differential Line' 'Differential Mic'
  Item0: 'Single-Ended'
Simple mixer control 'Right Capture Mux',0
  Capabilities: enum
  Items: 'IN1R' 'IN2R' 'IN3R'
  Item0: 'IN2R'
Simple mixer control 'Right Sidetone',0
  Capabilities: enum
  Items: 'None' 'Left' 'Right'
  Item0: 'None'

/var/lib/alsa/asound.state:

state.SAMA5D4GGARD {
        control.1 {
                iface MIXER
                name 'EQ1 Volume'
                value 12
                comment {
                        access 'read write'
                        type INTEGER
                        count 1
                        range '0 - 24'
                        dbmin -1200
                        dbmax 1200
                        dbvalue.0 0
                }
        }
        control.2 {
                iface MIXER
                name 'EQ2 Volume'
                value 12
                comment {
                        access 'read write'
                        type INTEGER
                        count 1
                        range '0 - 24'
                        dbmin -1200
                        dbmax 1200
                        dbvalue.0 0
                }
        }
        control.3 {
                iface MIXER
                name 'EQ3 Volume'
                value 12
                comment {
                        access 'read write'
                        type INTEGER
                        count 1
                        range '0 - 24'
                        dbmin -1200
                        dbmax 1200
                        dbvalue.0 0
                }
        }
        control.4 {
                iface MIXER
                name 'EQ4 Volume'
                value 12
                comment {
                        access 'read write'
                        type INTEGER
                        count 1
                        range '0 - 24'
                        dbmin -1200
                        dbmax 1200
                        dbvalue.0 0
                }
        }
        control.5 {
                iface MIXER
                name 'EQ5 Volume'
                value 12
                comment {
                        access 'read write'
                        type INTEGER
                        count 1
                        range '0 - 24'
                        dbmin -1200
                        dbmax 1200
                        dbvalue.0 0
                }
        }
        control.6 {
                iface MIXER
                name 'Digital Capture Volume'
                value.0 96
                value.1 96
                comment {
                        access 'read write'
                        type INTEGER
                        count 2
                        range '0 - 119'
                        dbmin -9999999
                        dbmax 1725
                        dbvalue.0 0
                        dbvalue.1 0
                }
        }
        control.7 {
                iface MIXER
                name 'Capture Volume'
                value.0 5
                value.1 5
                comment {
                        access 'read write'
                        type INTEGER
                        count 2
                        range '0 - 31'
                }
        }
        control.8 {
                iface MIXER
                name 'Capture Switch'
                value.0 true
                value.1 true
                comment {
                        access 'read write'
                        type BOOLEAN
                        count 2
                }
        }
        control.9 {
                iface MIXER
                name 'High Pass Filter Switch'
                value true
                comment {
                        access 'read write'
                        type BOOLEAN
                        count 1
                }
        }
        control.10 {
                iface MIXER
                name 'High Pass Filter Mode'
                value Hi-fi
                comment {
                        access 'read write'
                        type ENUMERATED
                        count 1
                        item.0 Hi-fi
                        item.1 'Voice 1'
                        item.2 'Voice 2'
                        item.3 'Voice 3'
                }
        }
        control.11 {
                iface MIXER
                name 'ADC 128x OSR Switch'
                value true
                comment {
                        access 'read write'
                        type BOOLEAN
                        count 1
                }
        }
        control.12 {
                iface MIXER
                name 'Digital Playback Boost Volume'
                value 0
                comment {
                        access 'read write'
                        type INTEGER
                        count 1
                        range '0 - 3'
                        dbmin 0
                        dbmax 1800
                        dbvalue.0 0
                }
        }
        control.13 {
                iface MIXER
                name 'Digital Playback Volume'
                value.0 96
                value.1 96
                comment {
                        access 'read write'
                        type INTEGER
                        count 2
                        range '0 - 96'
                        dbmin -9999999
                        dbmax 0
                        dbvalue.0 0
                        dbvalue.1 0
                }
        }
        control.14 {
                iface MIXER
                name 'Headphone Volume'
                value.0 45
                value.1 45
                comment {
                        access 'read write'
                        type INTEGER
                        count 2
                        range '0 - 63'
                        dbmin -5700
                        dbmax 600
                        dbvalue.0 -1200
                        dbvalue.1 -1200
                }
        }
        control.15 {
                iface MIXER
                name 'Headphone Switch'
                value.0 true
                value.1 true
                comment {
                        access 'read write'
                        type BOOLEAN
                        count 2
                }
        }
        control.16 {
                iface MIXER
                name 'Headphone ZC Switch'
                value.0 true
                value.1 true
                comment {
                        access 'read write'
                        type BOOLEAN
                        count 2
                }
        }
        control.17 {
                iface MIXER
                name 'Line Output Volume'
                value.0 57
                value.1 57
                comment {
                        access 'read write'
                        type INTEGER
                        count 2
                        range '0 - 63'
                        dbmin -5700
                        dbmax 600
                        dbvalue.0 0
                        dbvalue.1 0
                }
        }
        control.18 {
                iface MIXER
                name 'Line Output Switch'
                value.0 true
                value.1 true
                comment {
                        access 'read write'
                        type BOOLEAN
                        count 2
                }
        }
        control.19 {
                iface MIXER
                name 'Line Output ZC Switch'
                value.0 true
                value.1 true
                comment {
                        access 'read write'
                        type BOOLEAN
                        count 2
                }
        }
        control.20 {
                iface MIXER
                name 'EQ Switch'
                value false
                comment {
                        access 'read write'
                        type BOOLEAN
                        count 1
                }
        }
        control.21 {
                iface MIXER
                name 'DRC Switch'
                value false
                comment {
                        access 'read write'
                        type BOOLEAN
                        count 1
                }
        }
        control.22 {
                iface MIXER
                name 'DRC Path'
                value ADC
                comment {
                        access 'read write'
                        type ENUMERATED
                        count 1
                        item.0 ADC
                        item.1 DAC
                }
        }
        control.23 {
                iface MIXER
                name 'DAC OSRx2 Switch'
                value false
                comment {
                        access 'read write'
                        type BOOLEAN
                        count 1
                }
        }
        control.24 {
                iface MIXER
                name 'DAC Deemphasis Switch'
                value false
                comment {
                        access 'read write'
                        type BOOLEAN
                        count 1
                }
        }
        control.25 {
                iface MIXER
                name 'Digital Sidetone Volume'
                value.0 0
                value.1 0
                comment {
                        access 'read write'
                        type INTEGER
                        count 2
                        range '0 - 15'
                        dbmin -3600
                        dbmax 900
                        dbvalue.0 -3600
                        dbvalue.1 -3600
                }
        }
        control.26 {
                iface MIXER
                name 'Left Capture Mux'
                value IN2L
                comment {
                        access 'read write'
                        type ENUMERATED
                        count 1
                        item.0 IN1L
                        item.1 IN2L
                        item.2 IN3L
                }
        }
        control.27 {
                iface MIXER
                name 'Left Capture Inverting Mux'
                value IN1L
                comment {
                        access 'read write'
                        type ENUMERATED
                        count 1
                        item.0 IN1L
                        item.1 IN2L
                        item.2 IN3L
                }
        }
        control.28 {
                iface MIXER
                name 'Left Capture Mode'
                value Single-Ended
                comment {
                        access 'read write'
                        type ENUMERATED
                        count 1
                        item.0 Single-Ended
                        item.1 'Differential Line'
                        item.2 'Differential Mic'
                }
        }
        control.29 {
                iface MIXER
                name 'Right Capture Mux'
                value IN2R
                comment {
                        access 'read write'
                        type ENUMERATED
                        count 1
                        item.0 IN1R
                        item.1 IN2R
                        item.2 IN3R
                }
        }
        control.30 {
                iface MIXER
                name 'Right Capture Inverting Mux'
                value IN1R
                comment {
                        access 'read write'
                        type ENUMERATED
                        count 1
                        item.0 IN1R
                        item.1 IN2R
                        item.2 IN3R
                }
        }
        control.31 {
                iface MIXER
                name 'Right Capture Mode'
                value Single-Ended
                comment {
                        access 'read write'
                        type ENUMERATED
                        count 1
                        item.0 Single-Ended
                        item.1 'Differential Line'
                        item.2 'Differential Mic'
                }
        }
        control.32 {
                iface MIXER
                name 'AIFOUTL Mux'
                value Left
                comment {
                        access 'read write'
                        type ENUMERATED
                        count 1
                        item.0 Left
                        item.1 Right
                }
        }
        control.33 {
                iface MIXER
                name 'AIFOUTR Mux'
                value Right
                comment {
                        access 'read write'
                        type ENUMERATED
                        count 1
                        item.0 Left
                        item.1 Right
                }
        }
        control.34 {
                iface MIXER
                name 'DACL Mux'
                value Left
                comment {
                        access 'read write'
                        type ENUMERATED
                        count 1
                        item.0 Left
                        item.1 Right
                }
        }
        control.35 {
                iface MIXER
                name 'DACR Mux'
                value Right
                comment {
                        access 'read write'
                        type ENUMERATED
                        count 1
                        item.0 Left
                        item.1 Right
                }
        }
        control.36 {
                iface MIXER
                name 'Left Sidetone'
                value None
                comment {
                        access 'read write'
                        type ENUMERATED
                        count 1
                        item.0 None
                        item.1 Left
                        item.2 Right
                }
        }
        control.37 {
                iface MIXER
                name 'Right Sidetone'
                value None
                comment {
                        access 'read write'
                        type ENUMERATED
                        count 1
                        item.0 None
                        item.1 Left
                        item.2 Right
                }
        }
        control.38 {
                iface MIXER
                name 'HPL Mux'
                value DAC
                comment {
                        access 'read write'
                        type ENUMERATED
                        count 1
                        item.0 DAC
                        item.1 Bypass
                }
        }
        control.39 {
                iface MIXER
                name 'HPR Mux'
                value DAC
                comment {
                        access 'read write'
                        type ENUMERATED
                        count 1
                        item.0 DAC
                        item.1 Bypass
                }
        }
        control.40 {
                iface MIXER
                name 'LINEL Mux'
                value DAC
                comment {
                        access 'read write'
                        type ENUMERATED
                        count 1
                        item.0 DAC
                        item.1 Bypass
                }
        }
        control.41 {
                iface MIXER
                name 'LINER Mux'
                value DAC
                comment {
                        access 'read write'
                        type ENUMERATED
                        count 1
                        item.0 DAC
                        item.1 Bypass
                }
        }
}

相关内容