]> git.alsa-project.org Git - alsa-ucm-conf.git/commitdiff
sof-soundwire: cs42l43: Switch mixer based on output volume
authorMaciej Strozek <mstrozek@opensource.cirrus.com>
Wed, 2 Apr 2025 14:48:35 +0000 (15:48 +0100)
committerJaroslav Kysela <perex@perex.cz>
Fri, 4 Apr 2025 08:19:24 +0000 (10:19 +0200)
Hardware volume control in cs42l43 can go up to +31.5dB which can
cause audio degradation. For best results, limit hardware volume to 0dB.

The application may request >0dB mixer volume controls using
'@OutMix>0dB' variable passed to snd_use_case_mgr_open().

Closes: https://github.com/alsa-project/alsa-ucm-conf/pull/540
Link: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4622
Signed-off-by: Maciej Strozek <mstrozek@opensource.cirrus.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
ucm2/codecs/cs42l43/init.conf
ucm2/sof-soundwire/cs42l43-spk.conf

index c0fa863cff3025ad2899ae98effe5cfe2337ca08..7fa9cf1c28857fcde55a63389dec3a3453d51fdb 100644 (file)
@@ -8,5 +8,19 @@ LibraryConfig.remap.Config {
                "name='cs42l43 Headset Microphone Capture Volume'" {
                        "name='cs42l43 Decimator 1 Volume'".vindex.0 0
                }
+               "name='cs42l43 Speaker Playback Switch'" {
+                       "name='cs42l43 Speaker Digital Switch'".vindex.0 0
+                       "name='cs42l43 Speaker Digital Switch'".vindex.1 1
+               }
+       }
+}
+
+If.0 {
+       Condition {
+               Type String
+               Empty "${var:-@OutMix>0dB}"
        }
+       True.BootSequence [
+               cset "name='cs42l43 Speaker Digital Volume' 128"
+       ]
 }
index 693c450b26e9009117d6633b22abf8db2734181f..48efa510c00160ec74b91aa6db9b0d829946c863 100644 (file)
@@ -17,9 +17,23 @@ SectionDevice."Speaker" {
                cset "name='cs42l43 Speaker R Input 1' 'None'"
        ]
 
+
+       If.0 {
+               Condition {
+                       Type String
+                       Empty "${var:-@OutMix>0dB}"
+               }
+               True.Value {
+                       PlaybackMixer "default:${CardId}"
+                       PlaybackMixerElem "cs42l43 Speaker"
+               }
+               False.Value {
+                       PlaybackMixerElem "cs42l43 Speaker Digital"
+               }
+       }
+
        Value {
                PlaybackPriority 100
                PlaybackPCM "hw:${CardId},2"
-               PlaybackMixerElem "cs42l43 Speaker Digital"
        }
 }