qq7643066的个人空间 https://passport2.21ic.com/?1354292 [收藏] [复制] [RSS]

日志

rk3288 rk3399 rk3326 多声卡切换

热度 1已有 871 次阅读2020-2-6 20:06 |系统分类:嵌入式系统

查看当前系统有哪些声卡:



shell@rk3288_box:/ # ll /proc/asound/                                          



lrwxrwxrwx root     root              2013-01-21 10:56 RKRK1000 ->
card0



lrwxrwxrwx root     root              2013-01-21 10:56 RKSPDIFCARD
-> card1



dr-xr-xr-x root     root              2013-01-21 10:56 card0



dr-xr-xr-x root     root              2013-01-21 10:56 card1



-r--r--r-- root     root            0 2013-01-21 10:56 cards



-r--r--r-- root     root            0 2013-01-21 10:56 devices



-r--r--r-- root     root            0 2013-01-21 10:56 hwdep



-r--r--r-- root     root   
        0 2013-01-21 10:56 pcm



-r--r--r-- root     root            0 2013-01-21 10:56 timers



-r--r--r-- root     root            0 2013-01-21 10:56 version



 



看声卡是否正确打开:



播放音乐的情况:



shell@rk322x_box:/ # cat
/proc/asound/card0/pcm0p/sub0/hw_params



closed



录音的情况



shell@rk322x_box:/ # cat
/proc/asound/card0/pcm0c/sub0/hw_params



closed



目前 closed 状态表示此声卡没打开,如果想查看card1,则将上面的card0改为card1即可,即适用于3.10以上的所有内核支持的所有声卡类型。



当播放或录音都差不多:下面例子是播放时的例子:



shell@rk322x_box:/ # cat
/proc/asound/card0/pcm0p/sub0/hw_params



cat /proc/asound/card1/pcm0p/sub0/hw_params



access: RW_INTERLEAVED



format: S16_LE



subformat: STD



channels: 2



rate: 44100 (44100/1)



period_size: 2048



buffer_size: 8192



 



可以看到我们
pcm_open
时的参数。



 



 



系统默认支持 codec 
sound card  card0



Hdmi(spdif)  card
1
插入HDMI 时候系统会自动切换到card1 可以通过route 来确认
route =28



HDMI 不需要 进**切换,



可以更改 framework



diff --git
a/services/java/com/android/server/WiredAccessoryManager.java
b/services/java/com/android/server/WiredAccessoryManager.java



index c8d3510..2fb231e 100644



--- a/services/java/com/android/server/WiredAccessoryManager.java



+++
b/services/java/com/android/server/WiredAccessoryManager.java



@@ -374,7 +374,7 @@ final class
WiredAccessoryManager implements WiredAccessoryCallbacks {



            
//



            
// If the kernel does not have an "hdmi_audio" switch, just
fall back on the older



            
// "hdmi" switch instead.



-           
uei = new UEventInfo(NAME_HDMI_AUDIO, BIT_HDMI_AUDIO, 0);



+/*           
uei = new UEventInfo(NAME_HDMI_AUDIO, BIT_HDMI_AUDIO, 0);



            
if (uei.checkSwitchExists()) {



                
retVal.add(uei);



            
} else {



@@ -385,7 +385,7 @@ final class
WiredAccessoryManager implements WiredAccessoryCallbacks {



                    
Slog.w(TAG, "This kernel does not have HDMI audio support");



                
}



            
}



-



+*/



            
return retVal;



         }



或者 kernel 里面的HDMI 读取到的 state 不进行上报



diff --git
a/drivers/video/rockchip/hdmi/rk_hdmi_task.c
b/drivers/video/rockchip/hdmi/rk_hdmi_task.c



index 6cdb9eb..2ca862f 100755



--- a/drivers/video/rockchip/hdmi/rk_hdmi_task.c



+++ b/drivers/video/rockchip/hdmi/rk_hdmi_task.c



@@ -258,7 +258,7 @@ void hdmi_work(struct
work_struct *work)



                                       
hdmi_dbg(hdmi->dev,"base_audio_support =%d,sink_hdmi =
%d\n",hdmi->edid.base_audio_suppo



                                        #ifdef
CONFIG_SWITCH



                                       
if(hdmi->edid.base_audio_support == 1 &&  hdmi->edid.sink_hdmi == 1)



-                                              
switch_set_state(&(hdmi->switch_hdmi), 1);



+                                              
switch_set_state(&(hdmi->switch_hdmi), 0);



                                        #endif



                                        #ifdef
CONFIG_RK_HDMI_CTL_CODEC



                                        #ifdef CONFIG_MACH_RK_FAC



Usb audio card2  4.4
SDK
默认支持usb audio  route =29 30,
5.1
之后的SDK 
kernel
固定usb audio card3,使用google
原生的 usb audio hal



 



    //usb
audio



   
.usb_normal = {



       
.sound_card = 2,



       
.devices = DEVICES_0,



       
.controls_count = 0,



    },



   
.usb_capture = {



       
.sound_card = 2,



       
.devices = DEVICES_0,



       
.controls_count = 0,



    },


路过

鸡蛋
1

鲜花

握手

雷人

刚表态过的朋友 (1 人)

发表评论 评论 (2 个评论)

回复 幽魂 2020-2-18 19:55
很好 很好
回复 幽魂 2020-2-26 21:03
声卡是和难搞的东西