Skip to contentSkip to conversation

chtnau8824: Move DAC Channel Source selection to Speaker/Headphones EnableSeq

PATCH Applied Hans de Goede 2 participants 7 messages Dec 16, 2020 – Jan 23, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 chtnau8824: Move DAC Channel Source selection to Speaker/Headphones EnableSeq

Move DAC Channel Source selection to Speaker/Headphones EnableSeq.

The main reason for doing this is to make it easier to allow using variables, as the Speaker/Headphones conf files are evaluated after the main HiFi.conf had a chance to set them.

---
 ucm2/codecs/nau8824/EnableSeq.conf   | 3 ---
 ucm2/codecs/nau8824/HeadPhones.conf  | 2 ++
 ucm2/codecs/nau8824/MonoSpeaker.conf | 2 ++
 ucm2/codecs/nau8824/Speaker.conf     | 2 ++
 4 files changed, 6 insertions(+), 3 deletions(-)
ucm2/codecs/nau8824/EnableSeq.conf +0 -3
index 3650d06..2595e5f 100644
@@ -1,7 +1,4 @@
 EnableSequence [
-	# Playback TDM configuration
-	cset "name='DACL Channel Source' 0"
-	cset "name='DACR Channel Source' 1"
 	# Input Configuration
 	cset "name='DMIC1 Enable Switch' off"
 	cset "name='DMIC2 Enable Switch' off"
ucm2/codecs/nau8824/HeadPhones.conf +2 -0
index a807f84..46ec5d7 100644
@@ -12,6 +12,8 @@ SectionDevice."Headphones" {
 	]
 
 	EnableSequence [
+		cset "name='DACL Channel Source' 0"
+		cset "name='DACR Channel Source' 1"
 		cset "name='Headphone Switch' on"
 	]
 
ucm2/codecs/nau8824/MonoSpeaker.conf +2 -0
index 6b4ef8a..09edea5 100644
@@ -11,6 +11,8 @@ SectionDevice."Speaker" {
 	]
 
 	EnableSequence [
+		cset "name='DACL Channel Source' 0"
+		cset "name='DACR Channel Source' 1"
 		# 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"
ucm2/codecs/nau8824/Speaker.conf +2 -0
index a995873..64d7eee 100644
@@ -11,6 +11,8 @@ SectionDevice."Speaker" {
 	]
 
 	EnableSequence [
+		cset "name='DACL Channel Source' 0"
+		cset "name='DACR Channel Source' 1"
 		cset "name='Speaker Left DACL Volume' 1"
 		cset "name='Speaker Left DACR Volume' 0"
 		cset "name='Speaker Right DACL Volume' 0"
Signature · 1 line
2.28.0
#1 lore raw

PATCH 2/3 chtnau8824: Add a SST define/variable

Add a SST define which gets set to "yes" when using the SST driver and to "" when not using the SST driver;

And decide if platforms/bytcr/PlatformEnableSeq.conf should be included or not based on this.

This is a preparation patch for adding SOF support.

---
 ucm2/chtnau8824/HiFi.conf | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
ucm2/chtnau8824/HiFi.conf +15 -4
index 105f360..b36588f 100644
@@ -1,5 +1,16 @@
 Define.Speaker "Speaker"
 Define.Mic "InternalMic"
+Define.SST "yes"
+
+If.Controls {
+	Condition {
+		Type ControlExists
+		Control "name='media0_in Gain 0 Switch'"
+	}
+	False {
+		Define.SST ""
+	}
+}
 
 If.cfg-mspk {
 	Condition {
@@ -33,12 +44,12 @@ SectionVerb {
 
 	Include.e.File "/codecs/nau8824/EnableSeq.conf"
 
-	If.Controls {
+	If.SST {
 		Condition {
-			Type ControlExists
-			Control "name='media0_in Gain 0 Switch'"
+			Type String
+			Empty "${var:SST}"
 		}
-		True {
+		False {
 			Include.pe {
 				File "/platforms/bytcr/PlatformEnableSeq.conf"
 				Before.EnableSequence "0"
Signature · 1 line
2.28.0
#2 lore raw

PATCH 3/3 chtnau8824: Add support for using the SOF driver

In reply to Hans de Goede

The old (and currently the default) SST driver uses TDM 4 slots 24 bit as wire format to the codec. Where as the new SOF driver uses standard I2S 2 channel 24 bit.

Normally this should not impact the UCM settings, but on the NAU8824 the "DAC Right Channel Source" mixer setting must be set to 1 when using TDM 4 slots and to 0 when using I2S 2 channel mode.

Getting this wrong (in either case) results in the right channel not outputting any sound.

This commit introduces a RightOutputChannel variable which gets set to 0/1 depending on the driver and then uses that for the "DAC Right Channel Source" mixer setting so that we do the right thing depending on the driver.

This has been tested on the following devices:

Medion E2215T:    Stereo speakers, analog mic
Medion E2228T:    Stereo speakers, stereo digital mics
Cube iWork 8 Air: Mono speaker, analog mic
---
 ucm2/chtnau8824/HiFi.conf            | 2 ++
 ucm2/codecs/nau8824/HeadPhones.conf  | 2 +-
 ucm2/codecs/nau8824/MonoSpeaker.conf | 2 +-
 ucm2/codecs/nau8824/Speaker.conf     | 2 +-
 4 files changed, 5 insertions(+), 3 deletions(-)
ucm2/chtnau8824/HiFi.conf +2 -0
index b36588f..7e6669c 100644
@@ -1,6 +1,7 @@
 Define.Speaker "Speaker"
 Define.Mic "InternalMic"
 Define.SST "yes"
+Define.RightOutputChannel "1"
 
 If.Controls {
 	Condition {
@@ -9,6 +10,7 @@ If.Controls {
 	}
 	False {
 		Define.SST ""
+		Define.RightOutputChannel "0"
 	}
 }
 
ucm2/codecs/nau8824/HeadPhones.conf +1 -1
index 46ec5d7..81e6f1e 100644
@@ -13,7 +13,7 @@ SectionDevice."Headphones" {
 
 	EnableSequence [
 		cset "name='DACL Channel Source' 0"
-		cset "name='DACR Channel Source' 1"
+		cset "name='DACR Channel Source' ${var:RightOutputChannel}"
 		cset "name='Headphone Switch' on"
 	]
 
ucm2/codecs/nau8824/MonoSpeaker.conf +1 -1
index 09edea5..098bf03 100644
@@ -12,7 +12,7 @@ SectionDevice."Speaker" {
 
 	EnableSequence [
 		cset "name='DACL Channel Source' 0"
-		cset "name='DACR Channel Source' 1"
+		cset "name='DACR Channel Source' ${var:RightOutputChannel}"
 		# 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"
ucm2/codecs/nau8824/Speaker.conf +1 -1
index 64d7eee..065a577 100644
@@ -12,7 +12,7 @@ SectionDevice."Speaker" {
 
 	EnableSequence [
 		cset "name='DACL Channel Source' 0"
-		cset "name='DACR Channel Source' 1"
+		cset "name='DACR Channel Source' ${var:RightOutputChannel}"
 		cset "name='Speaker Left DACL Volume' 1"
 		cset "name='Speaker Left DACR Volume' 0"
 		cset "name='Speaker Right DACL Volume' 0"
Signature · 1 line
2.28.0
#3 lore raw
In reply to Hans de Goede

Hi,

Quoted 7 lines · Hans de Goede

Move DAC Channel Source selection to Speaker/Headphones EnableSeq.

The main reason for doing this is to make it easier to allow using variables, as the Speaker/Headphones conf files are evaluated after the main HiFi.conf had a chance to set them.

ping? It would be nice to get this series merged for proper SOF support.

Maybe this got confused with my other UCM chtnau8824 series which I send 10 days before this one? That one did get merged, but this is a different series.

Regards,

Hans

Quoted 59 lines
---
 ucm2/codecs/nau8824/EnableSeq.conf   | 3 ---
 ucm2/codecs/nau8824/HeadPhones.conf  | 2 ++
 ucm2/codecs/nau8824/MonoSpeaker.conf | 2 ++
 ucm2/codecs/nau8824/Speaker.conf     | 2 ++
 4 files changed, 6 insertions(+), 3 deletions(-)
ucm2/codecs/nau8824/EnableSeq.conf +0 -3
index 3650d06..2595e5f 100644
@@ -1,7 +1,4 @@
 EnableSequence [
-	# Playback TDM configuration
-	cset "name='DACL Channel Source' 0"
-	cset "name='DACR Channel Source' 1"
 	# Input Configuration
 	cset "name='DMIC1 Enable Switch' off"
 	cset "name='DMIC2 Enable Switch' off"
ucm2/codecs/nau8824/HeadPhones.conf +2 -0
index a807f84..46ec5d7 100644
@@ -12,6 +12,8 @@ SectionDevice."Headphones" {
 	]
 
 	EnableSequence [
+		cset "name='DACL Channel Source' 0"
+		cset "name='DACR Channel Source' 1"
 		cset "name='Headphone Switch' on"
 	]
 
ucm2/codecs/nau8824/MonoSpeaker.conf +2 -0
index 6b4ef8a..09edea5 100644
@@ -11,6 +11,8 @@ SectionDevice."Speaker" {
 	]
 
 	EnableSequence [
+		cset "name='DACL Channel Source' 0"
+		cset "name='DACR Channel Source' 1"
 		# 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"
ucm2/codecs/nau8824/Speaker.conf +2 -0
index a995873..64d7eee 100644
@@ -11,6 +11,8 @@ SectionDevice."Speaker" {
 	]
 
 	EnableSequence [
+		cset "name='DACL Channel Source' 0"
+		cset "name='DACR Channel Source' 1"
 		cset "name='Speaker Left DACL Volume' 1"
 		cset "name='Speaker Left DACR Volume' 0"
 		cset "name='Speaker Right DACL Volume' 0"
#4 lore raw

Dne 17. 01. 21 v 17:09 Hans de Goede napsal(a):

Quoted 9 lines

Hi,

Quoted 6 lines · Hans de Goede

Move DAC Channel Source selection to Speaker/Headphones EnableSeq.

The main reason for doing this is to make it easier to allow using variables, as the Speaker/Headphones conf files are evaluated after the main HiFi.conf had a chance to set them.

Quoted 7 lines
Quoted 1 line

ping? It would be nice to get this series merged for proper SOF support.

Maybe this got confused with my other UCM chtnau8824 series which I send 10 days before t

Hi,

Thanks for the reminder. I though that this one was resolved. I don't think that we need the first change - the evaluation for If and Include sequences is executed before SectionVerb {} parsing. So the If...Define.RightOutputChannel should be valid for SectionVerb...Include...File "/codecs/nau8824/EnableSeq.conf". The 'DACR Channel Source' control seems to require a static settings so keeping it in the verb init sequence has sense.

I applied the second (SST variable) patch for now. It's nice cleanup. Thanks.

Jaroslav

Signature · 2 lines
Jaroslav Kysela <[email protected]>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
#5 lore raw

Dne 17. 01. 21 v 17:52 Jaroslav Kysela napsal(a):

Quoted 20 lines

Dne 17. 01. 21 v 17:09 Hans de Goede napsal(a):

Quoted 9 lines

Hi,

Quoted 6 lines · Hans de Goede

Move DAC Channel Source selection to Speaker/Headphones EnableSeq.

The main reason for doing this is to make it easier to allow using variables, as the Speaker/Headphones conf files are evaluated after the main HiFi.conf had a chance to set them.

Quoted 7 lines
Quoted 1 line

ping? It would be nice to get this series merged for proper SOF support.

Maybe this got confused with my other UCM chtnau8824 series which I send 10 days before t

Hi,

Quoted 8 lines

Thanks for the reminder. I though that this one was resolved. I don't think that we need the first change - the evaluation for If and Include sequences is executed before SectionVerb {} parsing. So the If...Define.RightOutputChannel should be valid for SectionVerb...Include...File "/codecs/nau8824/EnableSeq.conf". The 'DACR Channel Source' control seems to require a static settings so keeping it in the verb init sequence has sense.

I applied the second (SST variable) patch for now. It's nice cleanup. Thanks.

Hans,

could you test https://github.com/alsa-project/alsa-ucm-conf/pull/74 ?

Thank you,
Jaroslav

Signature · 2 lines
Jaroslav Kysela <[email protected]>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
#6 lore raw

Hi,

Quoted 28 lines · Jaroslav Kysela

Dne 17. 01. 21 v 17:52 Jaroslav Kysela napsal(a):

Quoted 27 lines

Dne 17. 01. 21 v 17:09 Hans de Goede napsal(a):

Quoted 9 lines

Hi,

Quoted 6 lines · Hans de Goede

Move DAC Channel Source selection to Speaker/Headphones EnableSeq.

The main reason for doing this is to make it easier to allow using variables, as the Speaker/Headphones conf files are evaluated after the main HiFi.conf had a chance to set them.

Quoted 7 lines
Quoted 1 line

ping? It would be nice to get this series merged for proper SOF support.

Maybe this got confused with my other UCM chtnau8824 series which I send 10 days before t

Hi,

Thanks for the reminder. I though that this one was resolved. I don't think that we need the first change - the evaluation for If and Include sequences is executed before SectionVerb {} parsing. So the If...Define.RightOutputChannel should be valid for SectionVerb...Include...File "/codecs/nau8824/EnableSeq.conf". The 'DACR Channel Source' control seems to require a static settings so keeping it in the verb init sequence has sense.

Quoted 5 lines
Quoted 1 line

I applied the second (SST variable) patch for now. It's nice cleanup. Thanks.

Hans,

could you test https://github.com/alsa-project/alsa-ucm-conf/pull/74 ?

I can confirm that the simplified version from that pull-req works as it should, thanks.

Regards,

Hans