Zram内存压缩-开机自启动配置

我用的6.8内核 ,Qs315490也试过(内容如下)cht-bsw-rt5659: snd_soc_register_card failed -517惨淡收场 :no_mouth:


[   21.042718] input: PC Speaker as /devices/platform/pcspkr/input/input16
[   21.064516] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[   21.068030] Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[   21.070538] Loaded X.509 cert 'wens: 61c038651aabdcf94bd0ac7ff06c7248db18c600'
[   21.126685] snd_soc_rt5659: loading out-of-tree module taints kernel.
[   21.126705] snd_soc_rt5659: module verification failed: signature and/or required key missing - tainting kernel
[   21.149956] rt5659 i2c-10EC5659:01: rt5659 codec i2c addr is: 1b
[   21.167012] rt5659 i2c-10EC5659:01: Device with ID register ffffffff is not rt5659
[   21.175343] Bluetooth: hci0: BCM: chip id 101
[   21.189877] Bluetooth: hci0: BCM: features 0x2f
[   21.190927] Bluetooth: hci0: BCM4354A2
[   21.190944] Bluetooth: hci0: BCM4356A2 (001.003.015) build 0000
[   21.215452] Bluetooth: hci0: BCM: firmware Patch file not found, tried:
[   21.215467] Bluetooth: hci0: BCM: 'brcm/BCM4356A2.hcd'
[   21.215470] Bluetooth: hci0: BCM: 'brcm/BCM.hcd'
[   21.231802] audit: type=1130 audit(1720215318.298:32): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-tmpfiles-setup comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[   21.290039] audit: type=1334 audit(1720215318.356:33): prog-id=59 op=LOAD
[   21.291237] audit: type=1334 audit(1720215318.357:34): prog-id=60 op=LOAD
[   21.293313] audit: type=1334 audit(1720215318.360:35): prog-id=61 op=LOAD
[   21.318809] usbcore: registered new interface driver brcmfmac
[   21.318953] brcmfmac 0000:01:00.0: enabling device (0000 -> 0002)
[   21.370493] audit: type=1334 audit(1720215318.434:36): prog-id=62 op=LOAD
[   21.468346] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4356-pcie for chip BCM4356/2
[   21.468548] brcmfmac 0000:01:00.0: Direct firmware load for brcm/brcmfmac4356-pcie.Xiaomi Inc-Mipad2.bin failed with error -2
[   21.482489] input: gpio-keys as /devices/platform/ACPI0011:00/gpio-keys.35.auto/input/input17
[   21.497557] RPC: Registered named UNIX socket transport module.
[   21.497568] RPC: Registered udp transport module.
[   21.497571] RPC: Registered tcp transport module.
[   21.497572] RPC: Registered tcp-with-tls transport module.
[   21.497574] RPC: Registered tcp NFSv4.1 backchannel transport module.
[   21.499297] audit: type=1131 audit(1720215318.564:37): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-vconsole-setup comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[   21.499818] input: gpio-keys as /devices/platform/ACPI0011:00/gpio-keys.36.auto/input/input18
[   21.565866] audit: type=1305 audit(1720215318.632:38): auid=4294967295 ses=4294967295 subj=system_u:system_r:unconfined_service_t:s0 op=add_rule key=(null) list=1 res=1
[   21.565895] audit: type=1300 audit(1720215318.632:38): arch=c000003e syscall=44 success=yes exit=1056 a0=3 a1=7ffcb5e5be50 a2=420 a3=0 items=0 ppid=726 pid=749 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="auditctl" exe="/usr/sbin/auditctl" subj=system_u:system_r:unconfined_service_t:s0 key=(null)
[   21.568783] brcmfmac 0000:01:00.0: Direct firmware load for brcm/brcmfmac4356-pcie.txcap_blob failed with error -2
[   21.684732] creating NXP9890 devices
[   21.848238] brcmfmac: brcmf_c_process_txcap_blob: no txcap_blob available (err=-2)
[   21.848962] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4356/2 wl0: Aug 29 2019 02:05:27 version 7.35.180.197 (r722171 CY) FWID 01-4c8512f9
[   22.189224] intel_rapl_common: Found RAPL domain package
[   22.189262] intel_rapl_common: Found RAPL domain core
[   22.209531] rt5659 i2c-10EC5659:01: rt5659 codec i2c addr is: 1b
[   22.434646] tfa989x i2c-NXP9890_00: tfa989x i2c addr is: 37
[   22.434662] tfa989x test 0
[   22.434665] tfa989x check_functionality OK
[   22.439252] my i2c read ret got: 2
[   22.439274] tfa989x i2c-NXP9890_00: tfa989x i2c read got: 80
[   22.439278] tfa989x dev name: i2c-NXP9890_00
[   22.439282] tfa989x test 1
[   22.439293] tfa989x i2c-NXP9890_00: supply vddd not found, using dummy regulator
[   22.439559] tfa989x test 2
[   22.448607] tfa989x test 3
[   22.448619] tfa989x revision number, expected 0x80, got 0x80
[   22.451721] tfa989x test 4
[   22.453135] tfa989x i2c-NXP9890_01: tfa989x i2c addr is: 34
[   22.453146] tfa989x test 0
[   22.453149] tfa989x check_functionality OK
[   22.453345] my i2c read ret got: 2
[   22.453352] tfa989x i2c-NXP9890_01: tfa989x i2c read got: 80
[   22.453356] tfa989x dev name: i2c-NXP9890_01
[   22.453359] tfa989x test 1
[   22.453369] tfa989x i2c-NXP9890_01: supply vddd not found, using dummy regulator
[   22.456478] tfa989x test 2
[   22.459239] tfa989x test 3
[   22.459250] tfa989x revision number, expected 0x80, got 0x80
[   22.464125] tfa989x test 4
[   22.541814] brcmfmac 0000:01:00.0 wlp1s0: renamed from wlan0
[   23.129708] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   23.129723] Bluetooth: BNEP filters: protocol multicast
[   23.129734] Bluetooth: BNEP socket layer initialized
[   23.141756] Bluetooth: MGMT ver 1.22
[   23.525294] rt5659_i2c_probe: dmic1_data_pin = 0, dmic2_data_pin =0
[   23.525499] rt5659 Codec test ok
[   23.538027] intel_sst_acpi 808622A8:00: LPE base: 0x91e00000 size:0x200000
[   23.538044] intel_sst_acpi 808622A8:00: IRAM base: 0x91ec0000
[   23.538097] intel_sst_acpi 808622A8:00: DRAM base: 0x91f00000
[   23.538109] intel_sst_acpi 808622A8:00: SHIM base: 0x91f40000
[   23.538120] intel_sst_acpi 808622A8:00: Mailbox base: 0x91f44000
[   23.538130] intel_sst_acpi 808622A8:00: DDR base: 0x20000000
[   23.544119] intel_sst_acpi 808622A8:00: Got drv data max stream 25
[   24.056691] cht-bsw-rt5659 cht-bsw-rt5659: snd_soc_register_card failed -517
[   24.335072] NET: Registered PF_QIPCRTR protocol family
[   33.413317] usb_otg_vbus: disabling
[   36.445559] rfkill: input handler disabled
[   38.718878] Bluetooth: RFCOMM TTY layer initialized
[   38.718912] Bluetooth: RFCOMM socket layer initialized
[   38.718945] Bluetooth: RFCOMM ver 1.11
[   40.770600] systemd-journald[566]: File /var/log/journal/47cfc0b8d6814473bbe510850cb22ffe/user-1000.journal corrupted or uncleanly shut down, renaming and replacing.
[  106.966853] rt5659 mach pdev name cht-bsw-rt5659
[  106.966870] rt5659 mach id 10EC5659
[  106.966874] rt5659 mach drv_name cht-bsw-rt5659
[  106.966877] rt5659 mach fw_filename intel/fw_sst_22a8.bin
[  106.966881] rt5659 drv codec name i2c-10EC5659:00
[  106.967150] cht-bsw-rt5659 cht-bsw-rt5659: snd_soc_register_card failed -517

[nmsl@10 test]$ cat /proc/asound/cards
 0 [Audio          ]: HdmiLpeAudio - Intel HDMI/DP LPE Audio
                      Intel HDMI/DP LPE Audio

[nmsl@10 test]$ aplay -l
aplay: device_list:279: no soundcards found...

输出rt5659 dai codec name 部分有在吗,我没看到输出更改后的名称,如我上面说的,probe之前芯片没正常工作会导致修复名称错误,看着像这个情况


    pr_info("rt5659 drv codec name %s\n", drv->codec_name);

	/* find index of codec dai */
	for (i = 0; i < ARRAY_SIZE(cht_dailink); i++) {
		if (!strcmp(cht_dailink[i].codecs->name, RT5659_I2C_DEFAULT)) {
			dai_index = i;
			break;
		}
	}
    if(i == ARRAY_SIZE(cht_dailink)){
        pr_info("rt5659 default codec name %s not found\n", drv->codec_name);
    }
    else{
        pr_info("rt5659 index %d dai codec name %s\n", dai_index, cht_dailink[dai_index].codecs->name);

	    /* fixup codec name based on HID */
	    adev = acpi_dev_get_first_match_dev(mach->id, NULL, -1);
	    if (adev) {
		    snprintf(drv->codec_name, sizeof(drv->codec_name),
			     "i2c-%s", acpi_dev_name(adev));
		    cht_dailink[dai_index].codecs->name = drv->codec_name;
	    }
	    acpi_dev_put(adev);

        pr_info("rt5659 acpi_device name %s\n", acpi_dev_name(adev));
        pr_info("rt5659 fixuped index %d dai codec name %s\n", dai_index, cht_dailink[dai_index].codecs->name);

	    /* Use SSP0 on Bay Trail CR devices */
	    if (soc_intel_is_byt() && mach->mach_params.acpi_ipc_irq_index == 0) {
		    cht_dailink[dai_index].cpus->dai_name = "ssp0-port";
		    drv->use_ssp0 = true;
	    }
    }

BUG: kernel NULL pointer dereference, address: 0000000000000000
你这代码改的有问题吧…

补上pr_info语句之后,使用modprobe加载模块。内核日志一句输出都没有

iiowoii3389贴出来的有呀。

使用modprobe加载模块不行的,开机启动时Intel sst 模块运行调用出来才会正常注册,直接modprobe缺少很多信息。

在6.8内核,无论如何最后都会崩溃
dmesg.log (80.9 KB)

我知道问题出在哪里了,你日志里strcmp函数报错

[   24.039030]  ? strcmp+0x10/0x30

我看了一下主线内核的cht_bsw_rt5672.c,它也更新了这个函数的代码。

//6.6内核
	/* find index of codec dai */
	for (i = 0; i < ARRAY_SIZE(cht_dailink); i++) {
		if (!strcmp(cht_dailink[i].codecs->name, RT5672_I2C_DEFAULT)) {
			dai_index = i;
			break;
		}
	}
//6.8内核
	/* find index of codec dai */
	for (i = 0; i < ARRAY_SIZE(cht_dailink); i++) {
		if (cht_dailink[i].codecs->name &&
		    !strcmp(cht_dailink[i].codecs->name, RT5672_I2C_DEFAULT)) {
			dai_index = i;
			break;
		}
	}

应该是cht_dailink[i].codecs->name相关的代码有更新,你试试加上看看重新调试。

[   16.152308] rt5659 i2c-10EC5659:01: rt5659 codec i2c addr is: 1b
[   16.287218] audit: type=1130 audit(1720268104.324:35): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=modprobe@dm_mod comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[   16.287292] audit: type=1131 audit(1720268104.325:36): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=modprobe@dm_mod comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[   16.299375] tfa989x i2c-NXP9890_00: tfa989x i2c addr is: 37
[   16.299390] tfa989x test 0
[   16.299393] tfa989x check_functionality OK
[   16.302405] audit: type=1130 audit(1720268104.340:37): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=modprobe@efi_pstore comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[   16.302429] audit: type=1131 audit(1720268104.340:38): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=modprobe@efi_pstore comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[   16.306848] my i2c read ret got: 2
[   16.306868] tfa989x i2c-NXP9890_00: tfa989x i2c read got: 80
[   16.306873] tfa989x dev name: i2c-NXP9890_00
[   16.306878] tfa989x test 1
[   16.306892] tfa989x i2c-NXP9890_00: supply vddd not found, using dummy regulator
[   16.307174] tfa989x test 2
[   16.310864] tfa989x test 3
[   16.310878] tfa989x revision number, expected 0x80, got 0x80
[   16.317026] tfa989x test 4
[   16.317937] tfa989x i2c-NXP9890_01: tfa989x i2c addr is: 34
[   16.317952] tfa989x test 0
[   16.317955] tfa989x check_functionality OK
[   16.318149] my i2c read ret got: 2
[   16.318159] tfa989x i2c-NXP9890_01: tfa989x i2c read got: 80
[   16.318162] tfa989x dev name: i2c-NXP9890_01
[   16.318166] tfa989x test 1
[   16.318178] tfa989x i2c-NXP9890_01: supply vddd not found, using dummy regulator
[   16.318472] tfa989x test 2
[   16.320117] tfa989x test 3
[   16.320129] tfa989x revision number, expected 0x80, got 0x80
[   16.325684] audit: type=1130 audit(1720268104.363:39): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=modprobe@loop comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[   16.345850] tfa989x test 4
[   16.378592] brcmfmac 0000:01:00.0 wlp1s0: renamed from wlan0
[   16.733012] RPC: Registered named UNIX socket transport module.
[   16.733027] RPC: Registered udp transport module.
[   16.733030] RPC: Registered tcp transport module.
[   16.733031] RPC: Registered tcp-with-tls transport module.
[   16.733033] RPC: Registered tcp NFSv4.1 backchannel transport module.
[   17.477545] rt5659_i2c_probe: dmic1_data_pin = 0, dmic2_data_pin =0
[   17.477737] rt5659 Codec test ok
[   17.500611] intel_sst_acpi 808622A8:00: LPE base: 0x91e00000 size:0x200000
[   17.500642] intel_sst_acpi 808622A8:00: IRAM base: 0x91ec0000
[   17.500713] intel_sst_acpi 808622A8:00: DRAM base: 0x91f00000
[   17.500728] intel_sst_acpi 808622A8:00: SHIM base: 0x91f40000
[   17.500748] intel_sst_acpi 808622A8:00: Mailbox base: 0x91f44000
[   17.500760] intel_sst_acpi 808622A8:00: DDR base: 0x20000000
[   17.502287] intel_sst_acpi 808622A8:00: Got drv data max stream 25
[   17.650553] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   17.650569] Bluetooth: BNEP filters: protocol multicast
[   17.650583] Bluetooth: BNEP socket layer initialized
[   17.674545] Bluetooth: MGMT ver 1.22
[   17.750325] rt5659 mach pdev name cht-bsw-rt5659
[   17.750340] rt5659 mach id 10EC5659
[   17.750343] rt5659 mach drv_name cht-bsw-rt5659
[   17.750345] rt5659 mach fw_filename intel/fw_sst_22a8.bin
[   17.750350] cht-bsw-rt5659 cht-bsw-rt5659: rt5659 mach test 0
[   17.750356] rt5659 drv codec name i2c-10EC5659:00
[   17.750358] rt5659 index 2 dai codec name i2c-10EC5659:00
[   17.750420] rt5659 acpi_device name 10EC5659:01
[   17.750421] rt5659 fixuped index 2 dai codec name i2c-10EC5659:01
[   17.750424] rt5659 mach platform_name sst-mfld-platform
[   17.750426] rt5659 mach test 1
[   17.750590] cht-bsw-rt5659 cht-bsw-rt5659: snd_soc_register_card failed -517
[   18.800322] NET: Registered PF_QIPCRTR protocol family
[   27.822493] rt5659 mach pdev name cht-bsw-rt5659
[   27.822504] rt5659 mach id 10EC5659
[   27.822507] rt5659 mach drv_name cht-bsw-rt5659
[   27.822509] rt5659 mach fw_filename intel/fw_sst_22a8.bin
[   27.822513] cht-bsw-rt5659 cht-bsw-rt5659: rt5659 mach test 0
[   27.822518] rt5659 drv codec name i2c-10EC5659:00
[   27.822522] rt5659 default codec name i2c-10EC5659:00 not found
[   27.822524] rt5659 mach platform_name sst-mfld-platform
[   27.822525] rt5659 mach test 1
[   27.822644] cht-bsw-rt5659 cht-bsw-rt5659: snd_soc_register_card failed -517
[   27.822694] i2c i2c-INT33BE:00: deferred probe pending: (reason unknown)
[   27.822699] platform cht-bsw-rt5659: deferred probe pending: (reason unknown)

从日志看rt5656和tfa9890都已经正常工作了,失败在声卡注册过程。不过你的日志没有debug输出,pr_debug、dev_dbg的输出都没有记录,看不到问题出在哪部分。你看看调一下 loglevel,看到debug输出才好判断。

我知道我哪里出问题了。我的tfa989x设备名称是i2c-tfa9890:00(设备匹配时会自动忽略 : 符号后的内容),与您代码的i2c-NXP9890不同。

[   13.522722] tfa989x test 0 
[   13.522736] tfa989x check_functionality OK 
[   13.527162] tfa989x dev name: i2c-tfa9890:00
[   13.527179] tfa989x i2c-tfa9890:00: unknown device revision
[   13.534919] tfa989x test 0 
[   13.534935] tfa989x check_functionality OK 
[   13.535244] tfa989x dev name: i2c-tfa9890:01
[   13.535258] tfa989x i2c-tfa9890:01: unknown device revision

另外ISP误打误撞被驱动了,不过目前ISP无法开启摄像头供电

atomisp-isp2 0000:00:03.0: alloc_pages_bulk_array() failed
atomisp-isp2 0000:00:03.0: alloc pages err...
atomisp-isp2 0000:00:03.0: hmm_bo_alloc_pages failed.
atomisp-isp2 0000:00:03.0: css init failed --- bad firmware?
atomisp-isp2 0000:00:03.0: Failed to power on device
atomisp-isp2 0000:00:03.0: Failed to power on device

到这一步了,这是什么问题。不过我这边需要开机之后要先卸载cht-bsw-rt5659然后再加载cht-bsw-rt5659才会正常走完代码

[   25.163222] rt5659 mach pdev name cht-bsw-rt5659
[   25.163237] rt5659 mach id 10EC5659
[   25.163239] rt5659 mach drv_name cht-bsw-rt5659
[   25.163242] rt5659 mach fw_filename intel/fw_sst_22a8.bin
[   25.163247] rt5659 default codec name i2c-10EC5659:00 not found
[   25.163249] rt5659 mach platform_name sst-mfld-platform
[   25.163251] rt5659 mach test 1
[   25.163261] rt5659 mach test 2
[   25.163511] cht-bsw-rt5659 cht-bsw-rt5659: snd_soc_register_card failed -517
[   25.163563] platform cht-bsw-rt5659: deferred probe pending: (reason unknown)

[   88.739422] rt5659 mach pdev name cht-bsw-rt5659
[   88.739438] rt5659 mach id 10EC5659
[   88.739442] rt5659 mach drv_name cht-bsw-rt5659
[   88.739446] rt5659 mach fw_filename intel/fw_sst_22a8.bin
[   88.739451] rt5659 index 2 dai codec name i2c-10EC5659:00
[   88.739522] rt5659 acpi_device name 10EC5659:01
[   88.739525] rt5659 fixuped index 2 dai codec name i2c-10EC5659:01
[   88.739530] rt5659 mach platform_name sst-mfld-platform
[   88.739533] rt5659 mach test 1
[   88.739545] rt5659 mach test 2
[   88.759201] tfa989x received fmt: 16385
[   88.773646] rt5659 mach test 3
[   89.062140] intel_sst_acpi 808622A8:00: FW Version 01.0b.02.02
[   89.063342]  Audio Port: ASoC: no backend DAIs enabled for Audio Port, possibly missing ALSA mixer-based routing or UCM profile

需要卸载再启动这个问题应该是我之前说的模块启动顺序的问题。

看日志你已经成功注册声卡了,现在缺配置通路由,需要放ucm的conf文件,但你的alsa版本下放哪个路径日志没有提示。

你试试在内核启动参数调整loglevel=8,可能会有更多有用的 日志输出。

还有一个路子,查找当前系统下的cht-bsw-rt5672.conf,仿照它的路径建立cht-bsw-rt5659.conf。UCM的语法可能有更新,保险起见是在cht-bsw-rt5672.conf基础上替换掉路由route配置的部分。

loglevel=8无其他信息,ucm2/cht-bsw-rt5659和ucm2/intel/cht-bsw-rt5659都试过,都报错找不到文件

抱歉有个地方是为FydeOS改动的忘了删除。FydeOS里主音量调整是匹配widget名Master Playback Volume,所以我把codec_out0 Gain 0手动改成了Master Playback Volume,但是传的那份ucm conf里没改还是用codec_out0 Gain 0,这样路由是不通的。你删除后再试试看。

static void cht_fixup_controls(struct snd_soc_card *cht_card)
{
    struct snd_card *card = cht_card->snd_card;
    struct snd_kcontrol *kctl;
    
    list_for_each_entry(kctl, &card->controls, list)
	{
		if (!strncmp(kctl->id.name, "codec_out0 Gain 0", sizeof(kctl->id.name)))
			snprintf(kctl->id.name, sizeof(kctl->id.name), "Master Playback Volume");
    }
    
    return;
}
/* SoC card */
static struct snd_soc_card snd_soc_card_cht = {
	.owner = THIS_MODULE,
	.dai_link = cht_dailink,
	.num_links = ARRAY_SIZE(cht_dailink),
	.dapm_widgets = cht_dapm_widgets,
	.num_dapm_widgets = ARRAY_SIZE(cht_dapm_widgets),
	.dapm_routes = cht_audio_map,
	.num_dapm_routes = ARRAY_SIZE(cht_audio_map),
	.controls = cht_mc_controls,
	.num_controls = ARRAY_SIZE(cht_mc_controls),
	.fixup_controls = cht_fixup_controls, //删掉这行即可
	.suspend_pre = cht_suspend_pre,
	.resume_post = cht_resume_post,
};

另外我加的有一部分代码是输出当前已连通路由上所有widget名:

static int cht_aif1_startup(struct snd_pcm_substream *substream)
{
    struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
    struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
    struct snd_soc_dapm_widget_list *list_1;
	struct snd_soc_dapm_widget *widget;
	int stream = 0;
	int paths, i;

	pr_debug("%s runtime=%p\n", __func__, substream->runtime);

    paths = snd_soc_dapm_dai_get_connected_widgets(cpu_dai, stream, &list_1, NULL);
    pr_debug("%d paths got\n", paths);

    for_each_dapm_widgets(list_1, i, widget) {
        pr_debug("rt5659 path widget: name=%s, sname=%s\n", widget->name,widget->sname);
    }

	return snd_pcm_hw_constraint_single(substream->runtime,
			SNDRV_PCM_HW_PARAM_RATE, 48000);
}

可以用这个来确认一下音频路由是否连通。调了loglevel也还要在源码文件加 #define DEBUG 才能显示pr_debug的输出。或者改成 pr_info

音量调节相关的数量widget是下面两个,其它widget基本是开关量。

cset "name='codec_out0 Gain 0 Volume' 6"

cset "name='DAC1 Playback Volume' 6"
1 个赞

找到了,是在/usr/share/alsa/ucm2/conf.d/cht-bsw-rt5659/
不过设置里面没有显示声卡,使用aplay命令也无法播放音乐

# aplay -Dhw:0,1 /usr/share/sounds/alsa/Front_Center.wav
Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
aplay: set_params:1358: Channels count non available

alsamixer里面能看到声卡吗?

还有音频路由上widget的输出结果有没有呢,先得确认音频路由是通的,才知道是不是alsa那边的问题。

这个貌似是你播放时没指音频通道数

[   96.057790] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.057811] 0 paths got
[   96.057814] rt5659 path widget: name=media1_in, sname=(null)
[   96.059916] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.059938] 0 paths got
[   96.059941] rt5659 path widget: name=media1_in, sname=(null)
[   96.062888] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.062909] 0 paths got
[   96.062912] rt5659 path widget: name=media1_in, sname=(null)
[   96.066412] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.066434] 0 paths got
[   96.066437] rt5659 path widget: name=media1_in, sname=(null)
[   96.068451] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.068474] 0 paths got
[   96.068477] rt5659 path widget: name=media1_in, sname=(null)
[   96.070442] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.070463] 0 paths got
[   96.070467] rt5659 path widget: name=media1_in, sname=(null)
[   96.073636] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.073658] 0 paths got
[   96.073661] rt5659 path widget: name=media1_in, sname=(null)
[   96.077309] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.077331] 0 paths got
[   96.077334] rt5659 path widget: name=media1_in, sname=(null)
[   96.079190] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.079211] 0 paths got
[   96.079215] rt5659 path widget: name=media1_in, sname=(null)
[   96.081260] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.081281] 0 paths got
[   96.081284] rt5659 path widget: name=media1_in, sname=(null)
[   96.084163] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.084185] 0 paths got
[   96.084188] rt5659 path widget: name=media1_in, sname=(null)
[   96.087453] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.087474] 0 paths got
[   96.087477] rt5659 path widget: name=media1_in, sname=(null)
[   96.089214] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.089235] 0 paths got
[   96.089237] rt5659 path widget: name=media1_in, sname=(null)
[   96.090860] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.090880] 0 paths got
[   96.090882] rt5659 path widget: name=media1_in, sname=(null)
[   96.093389] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.093412] 0 paths got
[   96.093415] rt5659 path widget: name=media1_in, sname=(null)
[   96.096278] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.096298] 0 paths got
[   96.096302] rt5659 path widget: name=media1_in, sname=(null)
[   96.096925] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.096935] 0 paths got
[   96.096938] rt5659 path widget: name=media1_in, sname=(null)
[   96.097417] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.097427] 0 paths got
[   96.097429] rt5659 path widget: name=media1_in, sname=(null)
[   96.097970] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.097981] 0 paths got
[   96.097983] rt5659 path widget: name=media1_in, sname=(null)
[   96.098837] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.098848] 0 paths got
[   96.098850] rt5659 path widget: name=media1_in, sname=(null)
[   96.100463] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.100484] 0 paths got
[   96.100487] rt5659 path widget: name=media1_in, sname=(null)
[   96.102120] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.102140] 0 paths got
[   96.102143] rt5659 path widget: name=media1_in, sname=(null)
[   96.104629] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.104650] 0 paths got
[   96.104652] rt5659 path widget: name=media1_in, sname=(null)
[   96.109311] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.109330] 0 paths got
[   96.109333] rt5659 path widget: name=media1_in, sname=(null)
[   96.111021] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.111040] 0 paths got
[   96.111043] rt5659 path widget: name=media1_in, sname=(null)
[   96.112898] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.112918] 0 paths got
[   96.112922] rt5659 path widget: name=media1_in, sname=(null)
[   96.115287] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.115306] 0 paths got
[   96.115309] rt5659 path widget: name=media1_in, sname=(null)
[   96.119080] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.119103] 0 paths got
[   96.119106] rt5659 path widget: name=media1_in, sname=(null)
[   96.121385] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.121406] 0 paths got
[   96.121409] rt5659 path widget: name=media1_in, sname=(null)
[   96.123317] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.123338] 0 paths got
[   96.123341] rt5659 path widget: name=media1_in, sname=(null)
[   96.126189] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.126210] 0 paths got
[   96.126213] rt5659 path widget: name=media1_in, sname=(null)
[   96.130074] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.130095] 0 paths got
[   96.130098] rt5659 path widget: name=media3_in, sname=(null)
[   96.131880] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.131899] 0 paths got
[   96.131902] rt5659 path widget: name=media3_in, sname=(null)
[   96.133781] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.133800] 0 paths got
[   96.133803] rt5659 path widget: name=media3_in, sname=(null)
[   96.136262] cht_aif1_startup runtime=00000000ebaa2d0e
[   96.136277] 0 paths got
[   96.136280] rt5659 path widget: name=media3_in, sname=(null)
[  456.602496] i915 0000:00:02.0: vgaarb: VGA decodes changed: olddecodes=io+mem,decodes=io+mem:owns=io+mem
[  577.399160] cht_aif1_startup runtime=00000000d96819a4
[  577.399318] 2 paths got
[  577.399322] rt5659 path widget: name=media1_in, sname=(null)
[  577.399325] rt5659 path widget: name=media0_out mix 0, sname=(null)
[  577.399328] rt5659 path widget: name=media0_out, sname=(null)
[  577.399330] rt5659 path widget: name=pcm0_in, sname=(null)
[  577.399333] rt5659 path widget: name=modem_out mix 0, sname=(null)
[  577.399335] rt5659 path widget: name=modem_out, sname=(null)
[  577.399337] rt5659 path widget: name=codec_out0 mix 0, sname=(null)
[  577.399340] rt5659 path widget: name=codec_out0, sname=(null)
[  577.399342] rt5659 path widget: name=ssp2 Tx, sname=ssp2 Tx
[  577.399345] rt5659 path widget: name=AIF1 Playback, sname=AIF1 Playback
[  577.399347] rt5659 path widget: name=AIF1RX, sname=AIF1 Playback
[  577.399349] rt5659 path widget: name=IF1 DAC2, sname=(null)
[  577.399352] rt5659 path widget: name=IF1 DAC2 R, sname=(null)
[  577.399354] rt5659 path widget: name=IF1 DAC2 L, sname=(null)
[  577.399356] rt5659 path widget: name=IF1 DAC1, sname=(null)
[  577.399358] rt5659 path widget: name=SPDIF Mux, sname=(null)
[  577.399361] rt5659 path widget: name=SPDIF, sname=(null)
[  577.399363] rt5659 path widget: name=IF1 DAC1 R, sname=(null)
[  577.399365] rt5659 path widget: name=DAC R1 Mux, sname=(null)
[  577.399367] rt5659 path widget: name=DAC1 MIXR, sname=(null)
[  577.399369] rt5659 path widget: name=DAC_REF, sname=(null)
[  577.399371] rt5659 path widget: name=IF3 ADC Mux, sname=(null)
[  577.399374] rt5659 path widget: name=IF3 ADC, sname=(null)
[  577.399376] rt5659 path widget: name=IF3 ADC Swap Mux, sname=(null)
[  577.399378] rt5659 path widget: name=AIF3TX, sname=AIF3 Capture
[  577.399380] rt5659 path widget: name=AIF3 Capture, sname=AIF3 Capture
[  577.399383] rt5659 path widget: name=TDM AD2:DAC, sname=(null)
[  577.399385] rt5659 path widget: name=TDM AD1:AD2:DAC, sname=(null)
[  577.399387] rt5659 path widget: name=TDM Data Mux, sname=(null)
[  577.399390] rt5659 path widget: name=IF1 67 ADC Swap Mux, sname=(null)
[  577.399392] rt5659 path widget: name=IF1 ADC, sname=(null)
[  577.399394] rt5659 path widget: name=AIF1TX, sname=AIF1 Capture
[  577.399397] rt5659 path widget: name=AIF1 Capture, sname=AIF1 Capture
[  577.399399] rt5659 path widget: name=ssp2 Rx, sname=ssp2 Rx
[  577.399401] rt5659 path widget: name=codec_in1, sname=(null)
[  577.399403] rt5659 path widget: name=codec_in0, sname=(null)
[  577.399406] rt5659 path widget: name=pcm1_out mix 0, sname=(null)
[  577.399408] rt5659 path widget: name=pcm1_out, sname=(null)
[  577.399410] rt5659 path widget: name=Headset Capture, sname=Headset Capture
[  577.399413] rt5659 path widget: name=IF1 45 ADC Swap Mux, sname=(null)
[  577.399415] rt5659 path widget: name=IF1 23 ADC Swap Mux, sname=(null)
[  577.399417] rt5659 path widget: name=IF1 01 ADC Swap Mux, sname=(null)
[  577.399419] rt5659 path widget: name=IF1 DAC1 L, sname=(null)
[  577.399422] rt5659 path widget: name=DAC L1 Mux, sname=(null)
[  577.399424] rt5659 path widget: name=DAC1 MIXL, sname=(null)
[  578.783177] cht_aif1_startup runtime=0000000087037501
[  578.783246] 2 paths got
[  578.783249] rt5659 path widget: name=media1_in, sname=(null)
[  578.783252] rt5659 path widget: name=media0_out mix 0, sname=(null)
[  578.783255] rt5659 path widget: name=media0_out, sname=(null)
[  578.783257] rt5659 path widget: name=pcm0_in, sname=(null)
[  578.783260] rt5659 path widget: name=modem_out mix 0, sname=(null)
[  578.783262] rt5659 path widget: name=modem_out, sname=(null)
[  578.783264] rt5659 path widget: name=codec_out0 mix 0, sname=(null)
[  578.783267] rt5659 path widget: name=codec_out0, sname=(null)
[  578.783269] rt5659 path widget: name=ssp2 Tx, sname=ssp2 Tx
[  578.783272] rt5659 path widget: name=AIF1 Playback, sname=AIF1 Playback
[  578.783274] rt5659 path widget: name=AIF1RX, sname=AIF1 Playback
[  578.783276] rt5659 path widget: name=IF1 DAC2, sname=(null)
[  578.783279] rt5659 path widget: name=IF1 DAC2 R, sname=(null)
[  578.783281] rt5659 path widget: name=IF1 DAC2 L, sname=(null)
[  578.783283] rt5659 path widget: name=IF1 DAC1, sname=(null)
[  578.783285] rt5659 path widget: name=SPDIF Mux, sname=(null)
[  578.783288] rt5659 path widget: name=SPDIF, sname=(null)
[  578.783290] rt5659 path widget: name=IF1 DAC1 R, sname=(null)
[  578.783292] rt5659 path widget: name=DAC R1 Mux, sname=(null)
[  578.783294] rt5659 path widget: name=DAC1 MIXR, sname=(null)
[  578.783296] rt5659 path widget: name=DAC_REF, sname=(null)
[  578.783299] rt5659 path widget: name=IF3 ADC Mux, sname=(null)
[  578.783301] rt5659 path widget: name=IF3 ADC, sname=(null)
[  578.783303] rt5659 path widget: name=IF3 ADC Swap Mux, sname=(null)
[  578.783305] rt5659 path widget: name=AIF3TX, sname=AIF3 Capture
[  578.783307] rt5659 path widget: name=AIF3 Capture, sname=AIF3 Capture
[  578.783310] rt5659 path widget: name=TDM AD2:DAC, sname=(null)
[  578.783312] rt5659 path widget: name=TDM AD1:AD2:DAC, sname=(null)
[  578.783314] rt5659 path widget: name=TDM Data Mux, sname=(null)
[  578.783317] rt5659 path widget: name=IF1 67 ADC Swap Mux, sname=(null)
[  578.783319] rt5659 path widget: name=IF1 ADC, sname=(null)
[  578.783321] rt5659 path widget: name=AIF1TX, sname=AIF1 Capture
[  578.783324] rt5659 path widget: name=AIF1 Capture, sname=AIF1 Capture
[  578.783326] rt5659 path widget: name=ssp2 Rx, sname=ssp2 Rx
[  578.783328] rt5659 path widget: name=codec_in1, sname=(null)
[  578.783331] rt5659 path widget: name=codec_in0, sname=(null)
[  578.783333] rt5659 path widget: name=pcm1_out mix 0, sname=(null)
[  578.783335] rt5659 path widget: name=pcm1_out, sname=(null)
[  578.783337] rt5659 path widget: name=Headset Capture, sname=Headset Capture
[  578.783340] rt5659 path widget: name=IF1 45 ADC Swap Mux, sname=(null)
[  578.783342] rt5659 path widget: name=IF1 23 ADC Swap Mux, sname=(null)
[  578.783344] rt5659 path widget: name=IF1 01 ADC Swap Mux, sname=(null)
[  578.783347] rt5659 path widget: name=IF1 DAC1 L, sname=(null)
[  578.783349] rt5659 path widget: name=DAC L1 Mux, sname=(null)
[  578.783351] rt5659 path widget: name=DAC1 MIXL, sname=(null)
[  584.877506] cht_aif1_startup runtime=0000000025bcc2bd
[  584.877584] 2 paths got
[  584.877587] rt5659 path widget: name=media3_in, sname=(null)
[  584.877590] rt5659 path widget: name=media0_out mix 0, sname=(null)
[  584.877593] rt5659 path widget: name=media0_out, sname=(null)
[  584.877595] rt5659 path widget: name=pcm0_in, sname=(null)
[  584.877598] rt5659 path widget: name=modem_out mix 0, sname=(null)
[  584.877600] rt5659 path widget: name=modem_out, sname=(null)
[  584.877602] rt5659 path widget: name=codec_out0 mix 0, sname=(null)
[  584.877605] rt5659 path widget: name=codec_out0, sname=(null)
[  584.877607] rt5659 path widget: name=ssp2 Tx, sname=ssp2 Tx
[  584.877610] rt5659 path widget: name=AIF1 Playback, sname=AIF1 Playback
[  584.877612] rt5659 path widget: name=AIF1RX, sname=AIF1 Playback
[  584.877614] rt5659 path widget: name=IF1 DAC2, sname=(null)
[  584.877617] rt5659 path widget: name=IF1 DAC2 R, sname=(null)
[  584.877619] rt5659 path widget: name=IF1 DAC2 L, sname=(null)
[  584.877621] rt5659 path widget: name=IF1 DAC1, sname=(null)
[  584.877623] rt5659 path widget: name=SPDIF Mux, sname=(null)
[  584.877626] rt5659 path widget: name=SPDIF, sname=(null)
[  584.877628] rt5659 path widget: name=IF1 DAC1 R, sname=(null)
[  584.877630] rt5659 path widget: name=DAC R1 Mux, sname=(null)
[  584.877632] rt5659 path widget: name=DAC1 MIXR, sname=(null)
[  584.877634] rt5659 path widget: name=DAC_REF, sname=(null)
[  584.877637] rt5659 path widget: name=IF3 ADC Mux, sname=(null)
[  584.877639] rt5659 path widget: name=IF3 ADC, sname=(null)
[  584.877641] rt5659 path widget: name=IF3 ADC Swap Mux, sname=(null)
[  584.877643] rt5659 path widget: name=AIF3TX, sname=AIF3 Capture
[  584.877645] rt5659 path widget: name=AIF3 Capture, sname=AIF3 Capture
[  584.877648] rt5659 path widget: name=TDM AD2:DAC, sname=(null)
[  584.877650] rt5659 path widget: name=TDM AD1:AD2:DAC, sname=(null)
[  584.877652] rt5659 path widget: name=TDM Data Mux, sname=(null)
[  584.877655] rt5659 path widget: name=IF1 67 ADC Swap Mux, sname=(null)
[  584.877657] rt5659 path widget: name=IF1 ADC, sname=(null)
[  584.877659] rt5659 path widget: name=AIF1TX, sname=AIF1 Capture
[  584.877662] rt5659 path widget: name=AIF1 Capture, sname=AIF1 Capture
[  584.877664] rt5659 path widget: name=ssp2 Rx, sname=ssp2 Rx
[  584.877666] rt5659 path widget: name=codec_in1, sname=(null)
[  584.877668] rt5659 path widget: name=codec_in0, sname=(null)
[  584.877670] rt5659 path widget: name=pcm1_out mix 0, sname=(null)
[  584.877673] rt5659 path widget: name=pcm1_out, sname=(null)
[  584.877675] rt5659 path widget: name=Headset Capture, sname=Headset Capture
[  584.877677] rt5659 path widget: name=IF1 45 ADC Swap Mux, sname=(null)
[  584.877680] rt5659 path widget: name=IF1 23 ADC Swap Mux, sname=(null)
[  584.877682] rt5659 path widget: name=IF1 01 ADC Swap Mux, sname=(null)
[  584.877684] rt5659 path widget: name=IF1 DAC1 L, sname=(null)
[  584.877686] rt5659 path widget: name=DAC L1 Mux, sname=(null)
[  584.877689] rt5659 path widget: name=DAC1 MIXL, sname=(null)