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
[SDW UCM2][CML][BUG]Both S/PDIF,S/PDIF 1, S/PDIF 2 values can't be reset after changing default value manually. #2000
CMLApplies to Comet Lake platformPulseAudioPulseAudio restrictionSDWApplies to SoundWire bus for codec connectionUCM2bugSomething isn't workingduplicateThis issue or pull request already existsinitial default mixer valuesSystem lack initial amixer values
To Reproduce
1.Boot up system successfully.
2.Manually change S/PDIF,S/PDIF 1, S/PDIF 2 to unmute in alsamixer.
3.Power cycle system.
4.Check alsamixer
Reproduce rate
5/5
Expected result
S/PDIF,S/PDIF 1, S/PDIF 2 value should can be reset to default value after power cycle system.
Actual result
S/PDIF,S/PDIF 1, S/PDIF 2 can't be reset to default value after power cycle system .
Tried with below scenarios, issue can be triggered.
scenario 1:
Mute S/PDIF,S/PDIF 1, S/PDIF 2 in alsamixer manually then switch output source to speaker in sound setting, it cannot be unmuted in alsamixer.
scenario2:
Mute S/PDIF,S/PDIF 1, S/PDIF 2 in alsamixer manually, then tried to reboot system, checked alsamixer after booting up successfully, they are still muted.
changed the title [-][UCM2][CML][BUG]Both S/PDIF,S/PDIF 1, S/PDIF 2 is muted in default alsamixer when paplay HDMI/DP.[/-][+][SDW UCM2][CML][BUG]Both S/PDIF,S/PDIF 1, S/PDIF 2 is muted in default alsamixer when paplay HDMI/DP.[/+]on Apr 9, 2020
That's an invalid test, sorry. If you use UCM, you should not play with alsamixer and change the values in the background. That will lead to a consistency issue.
changed the title [-][SDW UCM2][CML][BUG]Both S/PDIF,S/PDIF 1, S/PDIF 2 is muted in default alsamixer when paplay HDMI/DP.[/-][+][SDW UCM2][CML][BUG]Both S/PDIF,S/PDIF 1, S/PDIF 2 values can't be reset after changing default value manually.[/+]on Apr 10, 2020
@sinahuang@libinyang I agree with @plbossart , the expected behaviour is not correct. The SPDIF controls for HDMI/DP are unmuted when playback to HDMI/DP monitor is activated via UCM. So unless you connect a monitor and do playback, it is expected for the controls to be muted.
@sinahuang@libinyang I agree with @plbossart , the expected behaviour is not correct. The SPDIF controls for HDMI/DP are unmuted when playback to HDMI/DP monitor is activated via UCM. So unless you connect a monitor and do playback, it is expected for the controls to be muted.
@kv2019i The problem is that SPDIF volume initial state is unknown especially that user may touch this volume. So it is better that we setup the volume to a proper value and mute the S/PDIF to mute. And when HDMI is connected, the S/PDIF is unmuted automatically.
I have submitted a patch for this issue to setup to a proper value: thesofproject/alsa-ucm-conf#35
This is still open whether we should set the volume or not. If we don't want to set the volume, I will close my PR.
@plbossart@kv2019i I'm planned to move cset "name='PGA3.0 3 Master Playback Volume' 50" in RT1308-1.conf into HiFi.conf. As sof-soundwire is a general ucm config, it's hard to say pipeline 3 always belongs RT1308-1. And it will be better to wrapped it into a If statement.
It will be like:
If.pga1
Condition {
Type ControlExists
Control "name='PGA1.0 1 xxx;"
}
True {
EnableSequence [
#setup the volume
]
}
If.pga2
Condition {
Type ControlExists
Control "name='PGA2.0 2 xxx;"
}
True {
EnableSequence [
#setup the volume
]
}
...
What do you think?
BTW: I did some test today and found alsa-lib has some issue to support such usage.
@sinahuang@libinyang I agree with @plbossart , the expected behaviour is not correct. The SPDIF controls for HDMI/DP are unmuted when playback to HDMI/DP monitor is activated via UCM. So unless you connect a monitor and do playback, it is expected for the controls to be muted.
@kv2019i The problem is that SPDIF volume initial state is unknown especially that user may touch this volume. So it is better that we setup the volume to a proper value and mute the S/PDIF to mute. And when HDMI is connected, the S/PDIF is unmuted automatically.
I have submitted a patch for this issue to setup to a proper value: thesofproject/alsa-ucm-conf#35
This is still open whether we should set the volume or not. If we don't want to set the volume, I will close my PR.
We can add a default volume, but it should be 0dB. Not changed in the firmware, let the receiver deal with volume control.
@plbossart@kv2019i I'm planned to move cset "name='PGA3.0 3 Master Playback Volume' 50" in RT1308-1.conf into HiFi.conf. As sof-soundwire is a general ucm config, it's hard to say pipeline 3 always belongs RT1308-1. And it will be better to wrapped it into a If statement.
It will be like:
If.pga1
Condition {
Type ControlExists
Control "name='PGA1.0 1 xxx;"
}
True {
EnableSequence [
#setup the volume
]
}
If.pga2
Condition {
Type ControlExists
Control "name='PGA2.0 2 xxx;"
}
True {
EnableSequence [
#setup the volume
]
}
...
What do you think?
BTW: I did some test today and found alsa-lib has some issue to support such usage.
We can add a default volume, but it should be 0dB. Not changed in the firmware, let the receiver deal with volume control.
@plbossart OK. I will make a final patch for it. The patch should be like: thesofproject/alsa-ucm-conf#36
And only one issue: if we set DMIC to 0db, it seems the volume it too low. Others volume is OK.
@plbossart Yes, the patch you did on Baytrail/Cherrytrail is my destination on SDW with more 'If' statement. Please see thesofproject/alsa-ucm-conf#36. However, currently alsa-lib has an issue to support such usage. alsa-lib will treat all the enablesequence/disablesequence as the same id. So if the first enablesequence is added into ucm config list, the following enablesequece will be seem to exist already. I have some clues how to fix it in alsa-lib. I will submit a patch to alsa-lib these 2 days.
Sorry @libinyang@plbossart a bit late to the discussion. FYI @juimonen and @singalsu with whom we've discussed a similar problem. Basicly there are at least two systems for populating defaults -- alsalib has its own (/usr/share/alsa/init), and when you run pulseaudio for first time, it populates its own database of volume settings.
If we have volume settings in our UCM enable/disable sequences, we are actively working against Pulseaudio and @juimonen has raised concerns this can lead to pulsing (with volume going up/down quickly as we force one gain value in UCM and then pulseaudio immediately reverts it to the saved state).
What is not clear and requires some investigation is how does Pulseaudio take the defaults. UCM spec has "SectionDefaults" and "ValueDefaults" fields, but I don't see any code in Pulseaudio actually querying e.g. volume values directly. So I expect PA to just look the ALSA state when it creates the database initially.
So this could be a feature gap. Ideally vendors should have means to provide meaningful defaults. E.g. @singalsu would like to apply a higher gain to dmic by default. To me, the best way to do is to set this in the Defaults section, and then let Pulseaudio pick up the value when it initially creates the database. But note that the expectation should be that after that initial boot, any volume value in enable/disable UCM sequences (or defaults), should be overridden in normal operation by Pulseaudio, using the setting user has preferred.
Excellent description from @kv2019i and totally agree. Unfortunately I'm also not sure how this works currently in Pulse or does it work etc. I need also to update my info on this "default" setting with empty database...
@kv2019i@juimonen@singalsu Thanks for the update on your investigation. I checked /usr/share/alsa/init and below is my understand on the alsa initialization:
/usr/share/alsa/init setting is general, and it will handle the general kcontrol such as "Master Playback Volume". It won't touch our SOF special PGA setting. And I checked alsactl init (man alsactl_init), my understand is the setting will be applied to the system only when alsactl init is run. So does this mean this depend on the OS whether it will use /usr/share/alsa/init or not?
I'm not very sure but it seems OS will use /var/lib/alsa/asound.state (alsactl default file) to restore the last setting when system boots up. Anyway, based on my test result, if we disable pulseaudio, OS can always recover the last amixer setting when OS boots up.
So if we don't set up the correct amixer setting in pulseaudio, the amixer setting is unpredictable. It may be impacted by the user unconscious amixer setting. For example, a previous user use amixer to set the volume to 0. Another user may not realize this action, and he will find even he reboot his machine, there is always no sound. For the pulse noise you mentioned, I think there is a chance to happen.
For the "SectionDefaults" and "ValueDefaults", I agree with you that PA just look the ALSA state. And yes, putting the kcontrol setting in "SectionDefaults" is a good solution. I'm not sure whether we can use If statement for "SectionDefaults". I will try it tomorrow. (You are suggesting moving the kcontrol into "SectionDefaults", right?) (As SDW UCM is a general ucm config, we can't say PGA always exists. So we should use If in UCM)
But note that the expectation should be that after that initial boot, any volume value in enable/disable UCM sequences (or defaults), should be overridden in normal operation by Pulseaudio, using the setting user has preferred.
Do you mean that we should let user override the enable/disable sequence setting in "sound setting"?
CMLApplies to Comet Lake platformPulseAudioPulseAudio restrictionSDWApplies to SoundWire bus for codec connectionUCM2bugSomething isn't workingduplicateThis issue or pull request already existsinitial default mixer valuesSystem lack initial amixer values
Activity
plbossart commentedon Apr 8, 2020
@sinahuang the SPDIF controls are really the IEC958 ones, which are explicitly used in the UCM file.
https://github.com/thesofproject/alsa-ucm-conf/blob/bd7e4d619d6c721a2cd47f054a107964bdcc94b2/ucm2/sof-soundwire/Hdmi.conf#L13
You will need to provide more details on what you are doing to trigger this error, works fine for me.
sinahuang commentedon Apr 9, 2020
Tried with below scenarios, issue can be triggered.
scenario 1:
Mute S/PDIF,S/PDIF 1, S/PDIF 2 in alsamixer manually then switch output source to speaker in sound setting, it cannot be unmuted in alsamixer.
scenario2:
Mute S/PDIF,S/PDIF 1, S/PDIF 2 in alsamixer manually, then tried to reboot system, checked alsamixer after booting up successfully, they are still muted.
amixer contents.txt
[-][UCM2][CML][BUG]Both S/PDIF,S/PDIF 1, S/PDIF 2 is muted in default alsamixer when paplay HDMI/DP.[/-][+][SDW UCM2][CML][BUG]Both S/PDIF,S/PDIF 1, S/PDIF 2 is muted in default alsamixer when paplay HDMI/DP.[/+]plbossart commentedon Apr 9, 2020
That's an invalid test, sorry. If you use UCM, you should not play with alsamixer and change the values in the background. That will lead to a consistency issue.
[-][SDW UCM2][CML][BUG]Both S/PDIF,S/PDIF 1, S/PDIF 2 is muted in default alsamixer when paplay HDMI/DP.[/-][+][SDW UCM2][CML][BUG]Both S/PDIF,S/PDIF 1, S/PDIF 2 values can't be reset after changing default value manually.[/+]kv2019i commentedon Apr 15, 2020
@sinahuang @libinyang I agree with @plbossart , the expected behaviour is not correct. The SPDIF controls for HDMI/DP are unmuted when playback to HDMI/DP monitor is activated via UCM. So unless you connect a monitor and do playback, it is expected for the controls to be muted.
libinyang commentedon Apr 17, 2020
@kv2019i The problem is that SPDIF volume initial state is unknown especially that user may touch this volume. So it is better that we setup the volume to a proper value and mute the S/PDIF to mute. And when HDMI is connected, the S/PDIF is unmuted automatically.
I have submitted a patch for this issue to setup to a proper value: thesofproject/alsa-ucm-conf#35
This is still open whether we should set the volume or not. If we don't want to set the volume, I will close my PR.
libinyang commentedon Apr 17, 2020
@plbossart @kv2019i I'm planned to move
cset "name='PGA3.0 3 Master Playback Volume' 50"in RT1308-1.conf into HiFi.conf. As sof-soundwire is a general ucm config, it's hard to say pipeline 3 always belongs RT1308-1. And it will be better to wrapped it into aIfstatement.It will be like:
What do you think?
BTW: I did some test today and found alsa-lib has some issue to support such usage.
plbossart commentedon Apr 17, 2020
We can add a default volume, but it should be 0dB. Not changed in the firmware, let the receiver deal with volume control.
plbossart commentedon Apr 17, 2020
Yes, we cannot have conditional parts in the enabling sequence, it's the entire sequence that need to be duplicated/modified for each IF. branch. That's what I did for the Baytrail/Cherrytrail stuf, see alsa-project/alsa-ucm-conf@9880afa#diff-78a6f5bba73d7d01a6b798e4b738bfeaR6
libinyang commentedon Apr 20, 2020
@plbossart OK. I will make a final patch for it. The patch should be like: thesofproject/alsa-ucm-conf#36
And only one issue: if we set DMIC to 0db, it seems the volume it too low. Others volume is OK.
libinyang commentedon Apr 20, 2020
@plbossart Yes, the patch you did on Baytrail/Cherrytrail is my destination on SDW with more 'If' statement. Please see thesofproject/alsa-ucm-conf#36. However, currently alsa-lib has an issue to support such usage. alsa-lib will treat all the enablesequence/disablesequence as the same id. So if the first enablesequence is added into ucm config list, the following enablesequece will be seem to exist already. I have some clues how to fix it in alsa-lib. I will submit a patch to alsa-lib these 2 days.
kv2019i commentedon Apr 20, 2020
Sorry @libinyang @plbossart a bit late to the discussion. FYI @juimonen and @singalsu with whom we've discussed a similar problem. Basicly there are at least two systems for populating defaults -- alsalib has its own (/usr/share/alsa/init), and when you run pulseaudio for first time, it populates its own database of volume settings.
If we have volume settings in our UCM enable/disable sequences, we are actively working against Pulseaudio and @juimonen has raised concerns this can lead to pulsing (with volume going up/down quickly as we force one gain value in UCM and then pulseaudio immediately reverts it to the saved state).
What is not clear and requires some investigation is how does Pulseaudio take the defaults. UCM spec has "SectionDefaults" and "ValueDefaults" fields, but I don't see any code in Pulseaudio actually querying e.g. volume values directly. So I expect PA to just look the ALSA state when it creates the database initially.
So this could be a feature gap. Ideally vendors should have means to provide meaningful defaults. E.g. @singalsu would like to apply a higher gain to dmic by default. To me, the best way to do is to set this in the Defaults section, and then let Pulseaudio pick up the value when it initially creates the database. But note that the expectation should be that after that initial boot, any volume value in enable/disable UCM sequences (or defaults), should be overridden in normal operation by Pulseaudio, using the setting user has preferred.
juimonen commentedon Apr 20, 2020
Excellent description from @kv2019i and totally agree. Unfortunately I'm also not sure how this works currently in Pulse or does it work etc. I need also to update my info on this "default" setting with empty database...
libinyang commentedon Apr 20, 2020
@kv2019i @juimonen @singalsu Thanks for the update on your investigation. I checked /usr/share/alsa/init and below is my understand on the alsa initialization:
/usr/share/alsa/init setting is general, and it will handle the general kcontrol such as "Master Playback Volume". It won't touch our SOF special PGA setting. And I checked
alsactl init(man alsactl_init), my understand is the setting will be applied to the system only whenalsactl initis run. So does this mean this depend on the OS whether it will use /usr/share/alsa/init or not?I'm not very sure but it seems OS will use /var/lib/alsa/asound.state (alsactl default file) to restore the last setting when system boots up. Anyway, based on my test result, if we disable pulseaudio, OS can always recover the last amixer setting when OS boots up.
So if we don't set up the correct amixer setting in pulseaudio, the amixer setting is unpredictable. It may be impacted by the user unconscious amixer setting. For example, a previous user use amixer to set the volume to 0. Another user may not realize this action, and he will find even he reboot his machine, there is always no sound. For the pulse noise you mentioned, I think there is a chance to happen.
For the "SectionDefaults" and "ValueDefaults", I agree with you that PA just look the ALSA state. And yes, putting the kcontrol setting in "SectionDefaults" is a good solution. I'm not sure whether we can use
Ifstatement for "SectionDefaults". I will try it tomorrow. (You are suggesting moving the kcontrol into "SectionDefaults", right?) (As SDW UCM is a general ucm config, we can't say PGA always exists. So we should useIfin UCM)Do you mean that we should let user override the enable/disable sequence setting in "sound setting"?
sinahuang commentedon May 6, 2020
Error can't be seen with UCM2 https://github.com/thesofproject/alsa-ucm-conf/commits/master commit:12743d2 , closed it.