author | daisy.skye的博客_CSDN博客-嵌入式,Qt,Linux领域博主 daisy.skye_嵌入式,Linux,Qt-CSDN博客daisy.skye擅长嵌入式,Linux,Qt,等方面的知识https://blog.csdn.net/qq_40715266?type=blog |
默认模式下放音和收音都是关闭状态
130|rk3568_r:/ # tinymix -D 1
Mixer name: 'rockchip,rk809-codec'
Number of controls: 2
ctl type num name value0 ENUM 1 Playback Path OFF
1 ENUM 1 Capture MIC Path MIC OFF
当打开免提录音的时候
Capture MIC Path 由原来的Main OFF切换到Main Mic
rk3568_r:/ # tinymix -D 1
Mixer name: 'rockchip,rk809-codec'
Number of controls: 2
ctl type num name value0 ENUM 1 Playback Path OFF
1 ENUM 1 Capture MIC Path Main Mic
static int rk817_capture_path_put(struct snd_kcontrol *kcontrol,struct snd_ctl_elem_value *ucontrol)
{struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);struct rk817_codec_priv *rk817 = snd_soc_component_get_drvdata(component);long int pre_path;if (rk817->capture_path == ucontrol->value.integer.value[0]) {dev_dbg(component->dev, "%s:capture_path is not changed!\n",__func__);return 0;}
pre_path = rk817->capture_path;
rk817->capture_path = ucontrol->value.integer.value[0];DBG("%s : set capture_path %ld, pre_path %ld\n", __func__,
rk817->capture_path, pre_path);if (rk817->capture_path != MIC_OFF)clk_prepare_enable(rk817->mclk);elseclk_disable_unprepare(rk817->mclk);switch (rk817->capture_path) {case MIC_OFF:if (pre_path != MIC_OFF)rk817_codec_power_down(component, RK817_CODEC_CAPTURE);break;case MAIN_MIC://看这里,代码会执行下面的参数if (pre_path == MIC_OFF)rk817_codec_power_up(component, RK817_CODEC_CAPTURE);if (rk817->adc_for_loopback) {/* don't need to gain when adc use for loopback */snd_soc_component_update_bits(component,
RK817_CODEC_AMIC_CFG0,0xf,0x0);snd_soc_component_write(component,
RK817_CODEC_DMIC_PGA_GAIN,0x66);snd_soc_component_write(component,
RK817_CODEC_DADC_VOLL,0x00);snd_soc_component_write(component,
RK817_CODEC_DADC_VOLR,0x00);break;}
……}
}
当免提喇叭开启时 ,Playback Path会从OFF状态切换到SPK状态,对应的代码位置也会切换到函数 rk817_playback_path_put
rk3568_r:/ # tinymix -D 1
Mixer name: 'rockchip,rk809-codec'
Number of controls: 2
ctl type num name value0 ENUM 1 Playback Path SPK
1 ENUM 1 Capture MIC Path MIC OFF