]> git.alsa-project.org Git - alsa-ucm-conf.git/commitdiff
HDA-Intel: fixes for Headphone+LO variant (Realtek ALC233)
authorJaroslav Kysela <perex@perex.cz>
Thu, 4 Nov 2021 09:40:02 +0000 (10:40 +0100)
committerJaroslav Kysela <perex@perex.cz>
Tue, 16 Nov 2021 17:10:59 +0000 (18:10 +0100)
This commit implements the support for shared Headphone and
Line Out and adds support for the Front Mic.

Controls for Headphone and Lineout:

Simple mixer control 'Headphone',0       # Switch only
Simple mixer control 'Headphone+LO',0    # Volume only
Simple mixer control 'Line Out',0        # Switch only
Jack 'Front Headphone Jack'
Jack 'Line Out Jack'

Control for Mic:

Simple mixer control 'Mic',0
Simple mixer control 'Mic Boost',0
Jack 'Mic Jack'

Control for Front Mic:

Simple mixer control 'Front Mic',0
Simple mixer control 'Front Mic Boost',0
Jack 'Front Mic Jack'

Fixes: https://github.com/alsa-project/alsa-ucm-conf/issues/114
Fixes: https://github.com/alsa-project/alsa-ucm-conf/pull/116
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
ucm2/HDA-Intel/HiFi-analog.conf

index dd0da023a3604edc890ca7d7d4e0ed844585b046..809fcdeb8c8deea104eea554ce001ab1ef7fe012 100644 (file)
@@ -1,5 +1,59 @@
 # Generic HDA devices for analog I/O
 
+Define.DeviceFrontMic ""
+Define.hpvol "Headphone"
+Define.hpjack "Headphone Jack"
+Define.lovol "Line Out"
+
+If.fmic {
+       Condition {
+               Type ControlExists
+               Control "name='Front Mic Playback Switch'"
+       }
+       True {
+               If.mic2 {
+                       Condition {
+                               Type String
+                               String1 "${var:DeviceMic}"
+                               String2 "Mic2"
+                       }
+                       True.Define {
+                               DeviceFrontMic "Mic3"
+                       }
+                       False.Define {
+                               DeviceMic "Mic1"
+                               DeviceFrontMic "Mic2"
+                       }
+               }
+       }
+}
+
+If.hplo {
+       Condition {
+               Type ControlExists
+               Control "name='Headphone+LO Playback Volume'"
+       }
+       True.Define {
+               hpvol "Headphone+LO"
+               lovol "Headphone+LO"
+       }
+}
+
+If.hpjack {
+       Condition {
+               Type ControlExists
+               Control "iface=CARD,name='Headphone Mic Jack'"
+       }
+       True.Define.hpjack "Headphone Mic Jack"
+       False.If.front {
+               Condition {
+                       Type ControlExists
+                       Control "iface=CARD,name='Front Headphone Jack'"
+               }
+               True.Define.hpjack "Front Headphone Jack"
+       }
+}
+
 SectionDevice."Headphones" {
        Comment "Headphones"
 
@@ -21,22 +75,11 @@ SectionDevice."Headphones" {
        Value {
                PlaybackPriority 200
                PlaybackPCM "hw:${CardId}"
-               PlaybackMixerElem "Headphone"
+               PlaybackMixerElem "${var:hpvol}"
                PlaybackMasterElem "Master"
-               PlaybackVolume "Headphone Playback Volume"
+               PlaybackVolume "${var:hpvol} Playback Volume"
                PlaybackSwitch "Headphone Playback Switch"
-               If.jack {
-                       Condition {
-                               Type ControlExists
-                               Control "iface=CARD,name='Headphone Mic Jack'"
-                       }
-                       True {
-                               JackControl "Headphone Mic Jack"
-                       }
-                       False {
-                               JackControl "Headphone Jack"
-                       }
-               }
+               JackControl "${var:hpjack}"
        }
 }
 
@@ -134,3 +177,62 @@ If.monomic {
                }
        }
 }
+
+If.frontmic {
+       Condition {
+               Type String
+               Empty "${var:DeviceFrontMic}"
+       }
+       False.SectionDevice."${var:DeviceFrontMic}" {
+               Comment "Front Stereo Microphone"
+
+               ConflictingDevice [
+                       "${var:DeviceMic}"
+               ]
+
+               Value {
+                       CapturePriority 400
+                       Include.value.File "/HDA-Intel/HDA-Capture-value.conf"
+                       CaptureMasterElem "Front Mic Boost"
+                       JackControl "Front Mic Jack"
+               }
+       }
+}
+
+If.lineout {
+       Condition {
+               Type ControlExists
+               Control "name='Line Out Playback Switch'"
+       }
+       True.SectionDevice."Line" {
+               Comment "Line Output"
+
+               If.conflict {
+                       Condition {
+                               Type String
+                               String1 "${var:lovol}"
+                               String2 "Headphone+LO"
+                       }
+                       True.ConflictingDevice [
+                               "Headphones"
+                       ]
+               }
+
+               EnableSequence [
+                       cset "name='Line Out Playback Switch' on"
+               ]
+               DisableSequence [
+                       cset "name='Line Out Playback Switch' off"
+               ]
+
+               Value {
+                       PlaybackPriority 300
+                       PlaybackPCM "hw:${CardId}"
+                       PlaybackMixerElem "${var:lovol}"
+                       PlaybackMasterElem "Master"
+                       PlaybackVolume "${var:lovol} Playback Volume"
+                       PlaybackSwitch "Line Out Playback Switch"
+                       JackControl "Line Out Jack"
+               }
+       }
+}