Skip to content

[SDW UCM2][CML][BUG]Both S/PDIF,S/PDIF 1, S/PDIF 2 values can't be reset after changing default value manually. #2000

Closed

Description

@sinahuang

Describe the bug
Both S/PDIF,S/PDIF 1, S/PDIF 2 values can't be reset after changing default value manually.

More info:
Need manually change S/PDIF,S/PDIF 1, S/PDIF 2 to unmute in alsamixer can recover.
UCM2:
https://github.com/thesofproject/alsa-ucm-conf (commit: 4722f5b ) +thesofproject/alsa-ucm-conf#29

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

Screenshot from 2020-04-08 11-28-22

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 .

Test recipe

Kernel:https://github.com/thesofproject/linux/commits/topic/sof-dev commit:052e45d
FW: https://github.com/thesofproject/sof/commits/master commit: b4e8b1e
Tplg: Same with FW branch, sof-cml-rt711-rt1308-rt715.tplg
Platform:CML-H Laptop with codec ALC711, 2 x RT1308, RT715 in SDW mode.

Activity

  1. added
    bug
    CML
    on Apr 8, 2020
  2. plbossart commented on Apr 8, 2020

    @plbossart
    Member

    @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.

  3. sinahuang commented on Apr 9, 2020

    @sinahuang
    Author

    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

  4. 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
  5. added
    SDW
    on Apr 9, 2020
  6. plbossart commented on Apr 9, 2020

    @plbossart
    Member

    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.

  7. 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
  8. added
    duplicate
    on Apr 13, 2020
  9. added
    PulseAudio
    on Apr 15, 2020
  10. kv2019i commented on Apr 15, 2020

    @kv2019i
    Collaborator

    @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.

  11. libinyang commented on Apr 17, 2020

    @libinyang

    @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.

  12. libinyang commented on Apr 17, 2020

    @libinyang

    @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.

  13. plbossart commented on Apr 17, 2020

    @plbossart
    Member

    @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.

  14. plbossart commented on Apr 17, 2020

    @plbossart
    Member

    @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.

    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

  15. libinyang commented on Apr 20, 2020

    @libinyang

    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.

  16. libinyang commented on Apr 20, 2020

    @libinyang

    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

    @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.

  17. kv2019i commented on Apr 20, 2020

    @kv2019i
    Collaborator

    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.

  18. juimonen commented on Apr 20, 2020

    @juimonen

    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...

  19. libinyang commented on Apr 20, 2020

    @libinyang

    @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:

    1. /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?

    2. 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"?

  20. sinahuang commented on May 6, 2020

    @sinahuang
    Author
  21. added
    initial default mixer values
    on May 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

CMLPulseAudioSDWUCM2bugduplicateinitial default mixer values

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions