You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MTL:Soundwire: Playback via Max98363 soundwire speaker is silent soon after reboot #4461
On the Soundwire Max98363 codec, soon after reboot with aplay or Youtube, the speaker playback is silent (4/10)
Tried #4345 and the repro rate got reduced to 1/10. Could see the SCP and DP registers 00 when the issue happens.
Setting the SCP and DP reg values to the working values fixes the issue.
The subusequent playbacks without any reboot doesn't have any issue.
The issue is not observed with the CS42L42 headset codec.
@jairaj-arava@plbossart With limited information, I guess the issue might be that aplay started before the codec is attached. In this corner case, codec driver should do cache_sync after attached. However, max98363_resume() will return 0 directly if max98363->first_hw_init is false and max98363_io_init set max98363->first_hw_init = true after calling pm_runtime_get_noresume().
Please see if #4462 makes sense, thanks.
Thanks @bardliao this goes back to my earlier question, what exactly was the solution described in "Setting the SCP and DP reg values to the working values fixes the issue."
SCP and DP values are related to transport, but usually the problem is with regmap caches. That's two very different root causes.
also what do you mean by "Setting the SCP and DP reg values to the working values fixes the issue."
These values are not visible through regmap, how did you set those values?
Hi @plbossart
Earlier, Maxim codec team provided a work around patch for another debug to access these SCP/DP registers. Hence, it allowed me to set these registers via commandline. Below are the expected values but the same were 0's when the issue hits.
0103: 0f
0120: 01
0122: c7
0124: 01
0126: 33
0132: c7
0134: 01
0136: 33
As discussed with @bardliao , I will provide the full dmesg log when the issue happens.
Well, yes. If those registers are not setup, then the codec will not use the data at all. It's different to being 'silent', it never processed the samples.
Well, yes. If those registers are not setup, then the codec will not use the data at all. It's different to being 'silent', it never processed the samples.
@jairaj-arava@plbossart With limited information, I guess the issue might be that aplay started before the codec is attached. In this corner case, codec driver should do cache_sync after attached. However, max98363_resume() will return 0 directly if max98363->first_hw_init is false and max98363_io_init set max98363->first_hw_init = true after calling pm_runtime_get_noresume(). Please see if #4462 makes sense, thanks.
Hi @bardliao,
Yes, as you suspected, I see in the logs during the non-working case with fix #4345 (started immediately as soon as system boots) or without the fix , after PCM triggert start, the slave is attached as shown below.
Also, another finding is, when I repro the issue with the fix #4345 (very rare happens) and also without the fix, in both scenarios the issue happens when the DSP is not in D3 and soundwire links are not powered down. I don't see the issue if DSP wents to D3 and soundwire links are powered down in all my trials.
@plbossart Do you have any idea why the codec re-attached after pcm started?
No, it's a hardware issue we can't control. This should not happen, ever. The SoundWire design assumed that the link was reliable and we don't have any support for devices that come and go.
It should be the same issue as 98373 bring up. @bardliao will test it and port it to 363.
No, @RanderWang the DSP is always active issue is not due to any dapm widget is active. That is a different issue from 98373. I can see 98363 is active, but I have no idea why yet.
Scenario 1: After reboot, once DSP enters into D3, the playback always works and later DSP is always remains active.
I don't understand the comment @jairaj-aravav. What do you mean the DSP is always active? As measured by what? can you try to show the refcount if this is pm_runtime active?
Scenario 2: After reboot, if we make a playback before DSP enters into D3 sporadically playback is not working and we see these unattached prints. As discussed, I see DSP is always active in both scenarios after the playback.
It's likely that you have a race condition and start playback 'too early'. Please disable pm_runtime and report the results.
Scenario 1: After reboot, once DSP enters into D3, the playback always works and later DSP is always remains active.
I don't understand the comment @jairaj-aravav. What do you mean the DSP is always active? As measured by what? can you try to show the refcount if this is pm_runtime active?
@plbossart He meant "cat /sys/bus/pci/devices/0000:00:1f.3/power/runtime_status" is active
Scenario 1: After reboot, once DSP enters into D3, the playback always works and later DSP is always remains active.
I don't understand the comment @jairaj-aravav. What do you mean the DSP is always active? As measured by what? can you try to show the refcount if this is pm_runtime active?
@plbossart He meant "cat /sys/bus/pci/devices/0000:00:1f.3/power/runtime_status" is active
And while 0000:00:1f.3 is active, cat sdw-master-1/sdw\:2\:019f\:8363\:00\:0/power/runtime_status will be active
Not following sorry, do you mean to say the runtime_status remains 'active' even after playback stops? I think we're really confusing things, the first order of business is to clarify why the amp loses sync and what happens without pm_runtime.
Not following sorry, do you mean to say the runtime_status remains 'active' even after playback stops? I think we're really confusing things, the first order of business is to clarify why the amp loses sync and what happens without pm_runtime.
Yes, they are 2 different issues. Let's disable runtime PM and focus on the amp silence issue.
Not following sorry, do you mean to say the runtime_status remains 'active' even after playback stops? I think we're really confusing things, the first order of business is to clarify why the amp loses sync and what happens without pm_runtime.
Hi @plbossart ,
Yes, there are two different issues that came up during debug.
Issue#1. Speaker amp silence issue
Issue#2. DSP active always after the spk amp playback.
Not following sorry, do you mean to say the runtime_status remains 'active' even after playback stops? I think we're really confusing things, the first order of business is to clarify why the amp loses sync and what happens without pm_runtime.
Yes, they are 2 different issues. Let's disable runtime PM and focus on the amp silence issue.
@bardliao
After disabling the pm_runtime using:
#disable PCI pm_runtime
options snd_sof_pci sof_pci_debug=0x1
#disable SDW runtime PM
options soundwire_intel sdw_md_flags=0x01010101
After reboot the speaker amp is still silent for the first playback and the same slave unattached prints are seen in the log.
As said this is a sporadic issue, out of the observance from the logs during working and non-working scenario, it is clear that:
Working scenario: During the playback, the SCP/DP registers are updated correctly and there are no unusual (unattached and re-attached) prints from the codec driver. Attached the log with comments. Working_after_reboot.txt
Non-working scenario: During the playback, the SCP/DP registers are updated correctly, however later as the codec is unattached and re-attached, the SCP/DP registers are made 0’s. Once the playback is stopped, the SCP/DP registers are resumed to the working configuration. Attached the log with comments NOT_working_after_reboot.txt
@jairaj-arava can you make sure you have all the drivers/soundwire/ upstream patches in your kernel. There was a patch from Cirrus Logic maybe last year to deal with invalid unattached status with there are 2 devices on the same link.
@jairaj-arava can you make sure you have all the drivers/soundwire/ upstream patches in your kernel. There was a patch from Cirrus Logic maybe last year to deal with invalid unattached status with there are 2 devices on the same link.
Hi @plbossart,
Sure, will check on the Cirrus Logic patch. Here the issue was seen with Maxim speaker amp and if we found Cirrus logic patch for the same issue, will check if we can adopt those for the Maxim too and give a try.
@jairaj-arava can you make sure you have all the drivers/soundwire/ upstream patches in your kernel. There was a patch from Cirrus Logic maybe last year to deal with invalid unattached status with there are 2 devices on the same link.
soundwire: bus: Don't exit early if no device IDs were programmed
soundwire: cadence: Fix lost ATTACHED interrupts when enumerating
soundwire: bus: Don't re-enumerate before status is UNATTACHED
soundwire: bus: Don't lose unattach notifications
soundwire: cadence: fix updating slave status when a bus has multiple peripherals
Activity
jairaj-arava commentedon Jul 5, 2023
@bardliao @ranj063 @RanderWang @plbossart @yongzhi1 @udaymb @RDharageswari
plbossart commentedon Jul 6, 2023
#4345 fixes pm_runtime, that shouldn't have any impacts on sound after boot.
Please disable pm_runtime first to see if this changes anything.
plbossart commentedon Jul 6, 2023
also what do you mean by "Setting the SCP and DP reg values to the working values fixes the issue."
These values are not visible through regmap, how did you set those values?
bardliao commentedon Jul 6, 2023
@jairaj-arava @plbossart With limited information, I guess the issue might be that aplay started before the codec is attached. In this corner case, codec driver should do cache_sync after attached. However, max98363_resume() will return 0 directly if max98363->first_hw_init is false and max98363_io_init set max98363->first_hw_init = true after calling pm_runtime_get_noresume().
Please see if #4462 makes sense, thanks.
plbossart commentedon Jul 6, 2023
Thanks @bardliao this goes back to my earlier question, what exactly was the solution described in "Setting the SCP and DP reg values to the working values fixes the issue."
SCP and DP values are related to transport, but usually the problem is with regmap caches. That's two very different root causes.
jairaj-arava commentedon Jul 6, 2023
Hi @plbossart
Earlier, Maxim codec team provided a work around patch for another debug to access these SCP/DP registers. Hence, it allowed me to set these registers via commandline. Below are the expected values but the same were 0's when the issue hits.
0103: 0f
0120: 01
0122: c7
0124: 01
0126: 33
0132: c7
0134: 01
0136: 33
As discussed with @bardliao , I will provide the full dmesg log when the issue happens.
plbossart commentedon Jul 6, 2023
This has really nothing to do with the regmap cache. My guess is that the port setup isn't done right.
jairaj-arava commentedon Jul 6, 2023
so @plbossart , these SCP/DP registers are mandatory for the port setup before the data is fed to the codec?
plbossart commentedon Jul 6, 2023
Well, yes. If those registers are not setup, then the codec will not use the data at all. It's different to being 'silent', it never processed the samples.
plbossart commentedon Jul 6, 2023
Well, yes. If those registers are not setup, then the codec will not use the data at all. It's different to being 'silent', it never processed the samples.
jairaj-arava commentedon Jul 6, 2023
Hi @bardliao,
Yes, as you suspected, I see in the logs during the non-working case with fix #4345 (started immediately as soon as system boots) or without the fix , after PCM triggert start, the slave is attached as shown below.
[ 20.530374] sof-audio-pci-intel-mtl 0000:00:1f.3: pcm: trigger stream 2 dir 0 cmd 1
[ 20.530389] sof-audio-pci-intel-mtl 0000:00:1f.3: trigger cmd: 1 state: 4
[ 20.530398] sof-audio-pci-intel-mtl 0000:00:1f.3: ipc tx : 0x13000003|0x1 [data size: 12]
[ 20.530743] sof-audio-pci-intel-mtl 0000:00:1f.3: ipc tx reply: 0x33000000|0x1
[ 20.530765] sof-audio-pci-intel-mtl 0000:00:1f.3: ipc tx done : 0x13000003|0x1 [data size: 12]
[ 20.530771] sof-audio-pci-intel-mtl 0000:00:1f.3: ipc tx : 0x13000004|0x1 [data size: 12]
[ 20.531372] soundwire_intel soundwire_intel.link.2: Slave status change: 0x1100000
[ 20.531401] max98363 sdw:2:019f:8363:00:1: Slave 5 state check1: UNATTACHED, status was 1
[ 20.540625] sof-audio-pci-intel-mtl 0000:00:1f.3: ipc tx reply: 0x33000000|0x1
[ 20.540652] max98363 sdw:2:019f:8363:00:1: initializing enumeration and init completion for Slave 5
[ 20.540654] sof-audio-pci-intel-mtl 0000:00:1f.3: ipc tx done : 0x13000004|0x1 [data size: 12]
[ [ 20.530374] sof-audio-pci-intel-mtl 0000:00:1f.3: pcm: trigger stream 2 dir 0 cmd 1
[ 20.530389] sof-audio-pci-intel-mtl 0000:00:1f.3: trigger cmd: 1 state: 4
...........
[ 20.531372] soundwire_intel soundwire_intel.link.2: Slave status change: 0x1100000
[ 20.531401] max98363 sdw:2:019f:8363:00:1: Slave 5 state check1: UNATTACHED, status was 1
[ 20.540625] sof-audio-pci-intel-mtl 0000:00:1f.3: ipc tx reply: 0x33000000|0x1
[ 20.540652] max98363 sdw:2:019f:8363:00:1: initializing enumeration and init completion for Slave 5
[ 20.540654] sof-audio-pci-intel-mtl 0000:00:1f.3: ipc tx done : 0x13000004|0x1 [data size: 12]
[ 20.540660] max98363 sdw:2:019f:8363:00:0: Slave 6 state check1: UNATTACHED, status was 1
[ 20.540665] max98363 sdw:2:019f:8363:00:0: initializing enumeration and init completion for Slave 6
[ 20.540679] soundwire_intel soundwire_intel.link.2: Device0 detected after clearing status, iteration 1
[ 20.549871] sof-audio-pci-intel-mtl 0000:00:1f.3: FW Poll Status: reg[0x1c0]=0x2014001e successful
[ 20.549876] soundwire sdw-master-1: Slave attached, programming device number
[ 20.550058] soundwire sdw-master-1: SDW Slave Addr: 31019f836300
[ 20.550064] soundwire sdw-master-1: SDW Slave class_id 0x00, mfg_id 0x019f, part_id 0x8363, unique_id 0x1, version 0x3
[ 20.550072] soundwire sdw-master-1: Slave already registered, reusing dev_num:5
Attached the full logs.
NOT_WORKING_WITH_4345fix.txt
dmesg_NOTWORKING_without_4345fix.txt
working_withFix4345.txt
Also, another finding is, when I repro the issue with the fix #4345 (very rare happens) and also without the fix, in both scenarios the issue happens when the DSP is not in D3 and soundwire links are not powered down. I don't see the issue if DSP wents to D3 and soundwire links are powered down in all my trials.
bardliao commentedon Jul 7, 2023
@jairaj-arava
sdw_enable_stream(sdw_stream);is called in sof_sdw.c's .trigger ops which will program the SCP/DP registers.However, from the log:
Slave re-attached after trigger. I think that is the problem.
@plbossart Do you have any idea why the codec re-attached after pcm started?
plbossart commentedon Jul 7, 2023
No, it's a hardware issue we can't control. This should not happen, ever. The SoundWire design assumed that the link was reliable and we don't have any support for devices that come and go.
1 remaining item
RanderWang commentedon Jul 11, 2023
It should be the same issue as 98373 bring up. @bardliao will test it and port it to 363.
bardliao commentedon Jul 11, 2023
No, @RanderWang the DSP is always active issue is not due to any dapm widget is active. That is a different issue from 98373. I can see 98363 is active, but I have no idea why yet.
plbossart commentedon Jul 11, 2023
I don't understand the comment @jairaj-aravav. What do you mean the DSP is always active? As measured by what? can you try to show the refcount if this is pm_runtime active?
It's likely that you have a race condition and start playback 'too early'. Please disable pm_runtime and report the results.
bardliao commentedon Jul 11, 2023
@plbossart He meant "cat /sys/bus/pci/devices/0000:00:1f.3/power/runtime_status" is
activebardliao commentedon Jul 11, 2023
And while
0000:00:1f.3is active,cat sdw-master-1/sdw\:2\:019f\:8363\:00\:0/power/runtime_statuswill be activeplbossart commentedon Jul 11, 2023
Not following sorry, do you mean to say the runtime_status remains 'active' even after playback stops? I think we're really confusing things, the first order of business is to clarify why the amp loses sync and what happens without pm_runtime.
bardliao commentedon Jul 11, 2023
Yes, they are 2 different issues. Let's disable runtime PM and focus on the amp silence issue.
jairaj-arava commentedon Jul 11, 2023
Hi @plbossart ,
Yes, there are two different issues that came up during debug.
Issue#1. Speaker amp silence issue
Issue#2. DSP active always after the spk amp playback.
@bardliao
After disabling the pm_runtime using:
#disable PCI pm_runtime
options snd_sof_pci sof_pci_debug=0x1
#disable SDW runtime PM
options soundwire_intel sdw_md_flags=0x01010101
After reboot the speaker amp is still silent for the first playback and the same slave unattached prints are seen in the log.
jairaj-arava commentedon Jul 13, 2023
As said this is a sporadic issue, out of the observance from the logs during working and non-working scenario, it is clear that:
Working scenario: During the playback, the SCP/DP registers are updated correctly and there are no unusual (unattached and re-attached) prints from the codec driver. Attached the log with comments.
Working_after_reboot.txt
Non-working scenario: During the playback, the SCP/DP registers are updated correctly, however later as the codec is unattached and re-attached, the SCP/DP registers are made 0’s. Once the playback is stopped, the SCP/DP registers are resumed to the working configuration. Attached the log with comments
NOT_working_after_reboot.txt
plbossart commentedon Jul 26, 2023
@jairaj-arava can you make sure you have all the drivers/soundwire/ upstream patches in your kernel. There was a patch from Cirrus Logic maybe last year to deal with invalid unattached status with there are 2 devices on the same link.
jairaj-arava commentedon Jul 26, 2023
Hi @plbossart,
Sure, will check on the Cirrus Logic patch. Here the issue was seen with Maxim speaker amp and if we found Cirrus logic patch for the same issue, will check if we can adopt those for the Maxim too and give a try.
jairaj-arava commentedon Jul 27, 2023
Hi @pi
Hi @plbossart,
I found the series you are mentioning about https://lore.kernel.org/all/20220914160248.1047627-1-rf@opensource.cirrus.com/.
All the 5 patches are already part of the chrome kernel:
soundwire: bus: Don't exit early if no device IDs were programmed
soundwire: cadence: Fix lost ATTACHED interrupts when enumerating
soundwire: bus: Don't re-enumerate before status is UNATTACHED
soundwire: bus: Don't lose unattach notifications
soundwire: cadence: fix updating slave status when a bus has multiple peripherals
I see you dropped the series from Intel https://github.com/thesofproject/linux/pull/3836/commits as Richard patches were already in upstream by that time.
jairaj-arava commentedon Aug 3, 2023
Hi,
With the fix #4503, couldn't see both the spk amp silent and the DSP active always issues. Hence, closing this. Thanks.