diff mbox series

[alsa-ucm-conf] chtnau8824: Mono speaker fixes

Message ID 20231021143109.52210-1-hdegoede@redhat.com (mailing list archive)
State New, archived
Headers show
Series [alsa-ucm-conf] chtnau8824: Mono speaker fixes | expand

Commit Message

Hans de Goede Oct. 21, 2023, 2:31 p.m. UTC
2 mono speaker setup fixes:

1. Use the kernel's components string to check for a mono-speaker device
when the board has a components string.

2. So far known nau8824 boards with a mono speaker where using the right
speaker channel, which is unusual. Normally mono speaker setups use
only the left speaker channel. The Cyberbook T116 tablet is a nau8824
based model, which indeed uses the left speaker channel for its single
speaker.

Modify ucm2/codecs/nau8824/MonoSpeaker.conf to send a left+right
channel mix to both speaker channels, so that things will work
independent of which speaker channel is used for a mono setup.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 ucm2/Intel/chtnau8824/HiFi.conf      | 15 +++++++++++++++
 ucm2/codecs/nau8824/MonoSpeaker.conf |  7 ++++---
 2 files changed, 19 insertions(+), 3 deletions(-)

Comments

Jaroslav Kysela Oct. 31, 2023, 3:40 p.m. UTC | #1
On 21. 10. 23 16:31, Hans de Goede wrote:
> 2 mono speaker setup fixes:
> 
> 1. Use the kernel's components string to check for a mono-speaker device
> when the board has a components string.
> 
> 2. So far known nau8824 boards with a mono speaker where using the right
> speaker channel, which is unusual. Normally mono speaker setups use
> only the left speaker channel. The Cyberbook T116 tablet is a nau8824
> based model, which indeed uses the left speaker channel for its single
> speaker.
> 
> Modify ucm2/codecs/nau8824/MonoSpeaker.conf to send a left+right
> channel mix to both speaker channels, so that things will work
> independent of which speaker channel is used for a mono setup.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Thanks. Applied.

				Jaroslav
diff mbox series

Patch

diff --git a/ucm2/Intel/chtnau8824/HiFi.conf b/ucm2/Intel/chtnau8824/HiFi.conf
index c3d830d..1a1faf4 100644
--- a/ucm2/Intel/chtnau8824/HiFi.conf
+++ b/ucm2/Intel/chtnau8824/HiFi.conf
@@ -14,6 +14,21 @@  If.Controls {
 	}
 }
 
+# Figure out which components are in use on the device, we check both the
+# components string (present on newer kernels) as well as checking for DMI
+# strings for compatibility with older kernels. Note DMI matches for new
+# models should only be added to the kernel, this UCM profile will then
+# automatically pick up the info from the components string.
+
+If.components-mono-spk {
+	Condition {
+		Type String
+		Haystack "${CardComponents}"
+		Needle "cfg-spk:1"
+	}
+	True.Define.Speaker "MonoSpeaker"
+}
+
 If.cfg-mspk {
 	Condition {
 		Type RegexMatch
diff --git a/ucm2/codecs/nau8824/MonoSpeaker.conf b/ucm2/codecs/nau8824/MonoSpeaker.conf
index 6b4ef8a..5428133 100644
--- a/ucm2/codecs/nau8824/MonoSpeaker.conf
+++ b/ucm2/codecs/nau8824/MonoSpeaker.conf
@@ -11,9 +11,10 @@  SectionDevice."Speaker" {
 	]
 
 	EnableSequence [
-		# nau8824 mono speaker boards have the speaker on the right chan
-		cset "name='Speaker Left DACL Volume' 0"
-		cset "name='Speaker Left DACR Volume' 0"
+		# Some nau8824 mono speaker boards have the speaker on the right chan
+		# others on the left, enable output of both channels on both speakers
+		cset "name='Speaker Left DACL Volume' 1"
+		cset "name='Speaker Left DACR Volume' 1"
 		cset "name='Speaker Right DACL Volume' 1"
 		cset "name='Speaker Right DACR Volume' 1"
 		cset "name='Ext Spk Switch' on"