alsa-project / alsa-ucm-conf

ALSA Use Case Manager configuration
BSD 3-Clause "New" or "Revised" License
76 stars 219 forks source link

Handling values #442

Open thenameisluk opened 1 month ago

thenameisluk commented 1 month ago

i have similar config to https://github.com/alsa-project/alsa-ucm-conf/blob/master/ucm2/Qualcomm/sc7180/adau7002-max98357a/HiFi.conf for homestar

# Use case configuration for ALC5682+MAX98357A on SC7180

SectionVerb {
    Value {
        TQ "HiFi"
    }
}

SectionDevice."Speaker" {
    Comment "Speaker"

    Value {
        PlaybackChannels 4
        PlaybackPCM "hw:${CardId},1"
        PlaybackPriority 100
        PlaybackMixerElem "Speaker"
        PlaybackVolume "Speaker Playback Volume"
    }
}

SectionDevice."Mic" {
    Comment "Internal Microphone"

    EnableSequence [
        cset "name='IF1 01 ADC Swap Mux' 1"
        cset "name='Stereo1 ADC L2 Mux' 1"
        cset "name='Stereo1 ADC R2 Mux' 1"
        cset "name='Stereo1 ADC MIXL ADC2 Switch' 1"
        cset "name='Stereo1 ADC MIXR ADC2 Switch' 1"
    ]

    DisableSequence [
        cset "name='Stereo1 ADC L2 Mux' 0"
        cset "name='Stereo1 ADC R2 Mux' 0"
        cset "name='Stereo1 ADC MIXL ADC2 Switch' 0"
        cset "name='Stereo1 ADC MIXR ADC2 Switch' 0"
    ]

    Value {
        CapturePCM "hw:${CardId},0"
        CapturePriority 100
        CaptureMixerElem "STO1 ADC"
        CaptureVolume "STO1 ADC Capture Volume"
    }
}

SectionDevice."HDMI" {
    Comment "HDMI Jack"

    ConflictingDevice [
        "Speaker"
    ]

    EnableSequence [
    ]

    DisableSequence [
    ]

    Value {
        PlaybackPriority 200
        PlaybackPCM "hw:${CardId},2"
        JackControl "HDMI Jack"
    }
}

the speaker and mic section is irrelevant here hdmi is causing issues

without

    ConflictingDevice [
        "Speaker"
    ]

pipewire doesn't want to use the ucm at all unless the hdmi is plugged in

with it pipewire will only configure hdmi if hdmi is plugged in (when you restart it or at boot)

it's all on the same card and the interface never goes away, only switches between

# amixer -c 0 contents
numid=9,iface=CARD,name='HDMI Jack'
  ; type=BOOLEAN,access=r-------,values=1
  : values=off
...

without hdmi and

# amixer -c 0 contents
numid=9,iface=CARD,name='HDMI Jack'
  ; type=BOOLEAN,access=r-------,values=1
  : values=on

with hdmi

sudo alsactl monitoralso shows

node hw:0, #9 (0,0,0,HDMI Jack,0) VALUE

when plugging in and unplugging

knowing all this i am unable to figure out how to handle it with ucm2 and would appreciate some help getting it working without that ConflictingDevice

perexg commented 1 month ago

Usually, this problem is caused by the driver. PW tries to enumerate all devices when started, but unfortunately, some drivers are returning errors instead creating a "dummy" output or input when the cable is not connected. You may analyze this issue using spa-acp-tool. Note that PW inherits the code from PA. For this case, the dynamic behavior should be considered instead "static" probe.