Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sof-chtmax98090: initial import #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

plbossart
Copy link
Member

Tested a year ago...

Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com

Tested a year ago...

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
@cujomalainey
Copy link
Member

From the non-sof HiFi, this diff is very different. I don't have time currently to dig into it, right now, I might be able to test something if you want next week.
Note this is targetted at a 3.18 kernel so it may simply be our HiFi is wildly out of date.

diff --git a/HiFi.conf b/SOF-HiFi.conf
index 0d27912..e6b9241 100644
--- a/HiFi.conf
+++ b/SOF-HiFi.conf
@@ -1,33 +1,17 @@
+# command-line sequence to switch playback/capture
+# alsaucm -c sof-chtmax98090 set _verb HiFi set _enadev Headphone
+# alsaucm -c sof-chtmax98090 set _verb HiFi set _enadev Speakers
+# alsaucm -c sof-chtmax98090 set _verb HiFi set _enadev HeadsetMic
+# alsaucm -c sof-chtmax98090 set _verb HiFi set _enadev InternalMic
+
+
 SectionVerb {
-	Value {
-		FullySpecifiedUCM "1"
-	}
 
 	EnableSequence [
-		cdev "hw:chtmax98090"
-
-		cset "name='codec_out0 mix 0 pcm0_in Switch' on"
-		cset "name='media0_out mix 0 media1_in Switch' on"
-		cset "name='media1_in Gain 0 Ramp Delay' 50"
-		cset "name='media1_in Gain 0 Switch' on"
-		cset "name='media1_in Gain 0 Volume' 80% 80%"
-		cset "name='pcm0_in Gain 0 Ramp Delay' 50"
-		cset "name='pcm0_in Gain 0 Switch' on"
-		cset "name='pcm0_in Gain 0 Volume' 80% 80%"
-		cset "name='codec_out0 Gain 0 Ramp Delay' 50"
-		cset "name='codec_out0 Gain 0 Switch' on"
-		cset "name='codec_out0 Gain 0 Volume' 80% 80%"
-		cset "name='pcm1_out mix 0 media_loop2_in Switch' 1"
-		cset "name='media_loop2_out mix 0 codec_in0 Switch' 1"
-		cset "name='codec_in0 Gain 0 Ramp Delay' 50"
-		cset "name='codec_in0 Gain 0 Switch' on"
-		cset "name='codec_in0 Gain 0 Volume' 80% 80%"
-		cset "name='media_loop2_out Gain 0 Ramp Delay' 50"
-		cset "name='media_loop2_out Gain 0 Switch' on"
-		cset "name='media_loop2_out Gain 0 Volume' 80% 80%"
-		cset "name='pcm1_out Gain 0 Ramp Delay' 50"
-		cset "name='pcm1_out Gain 0 Switch' on"
-		cset "name='pcm1_out Gain 0 Volume' 80% 80%"
+		cdev "hw:sofchtmax98090"
+
+		cset "name='Left Speaker Mixer Left DAC Switch' on"
+		cset "name='Right Speaker Mixer Right DAC Switch' on"
 		cset "name='Digital EQ 3 Band Switch' off"
 		cset "name='Digital EQ 5 Band Switch' off"
 		cset "name='Digital EQ 7 Band Switch' off"
@@ -37,136 +21,168 @@ SectionVerb {
 
 		cset "name='DMIC Mux' DMIC"
 		cset "name='MIC2 Mux' IN34"
-		cset "name='Right ADC Mixer MIC2 Switch' on"
-		cset "name='Left ADC Mixer MIC2 Switch' on"
-		cset "name='MIC2 Volume' 20"
-		cset "name='Int Mic Switch' on"
+		cset "name='MIC2 Volume' 10"
+		cset "name='MIC2 Boost Volume' 0"
 
 		cset "name='ADCR Boost Volume' 4"
 		cset "name='ADCL Boost Volume' 4"
 		cset "name='ADCR Volume' 11"
 		cset "name='ADCL Volume' 11"
 
-		cset "name='Left Speaker Mixer Left DAC Switch' on"
-		cset "name='Right Speaker Mixer Right DAC Switch' on"
-		cset "name='Speaker Left Mixer Volume' 2"
-		cset "name='Speaker Right Mixer Volume' 2"
+		cset "name='Headphone Volume' 10"
+		cset "name='Speaker Volume' 10"
+
+		cset "name='Speaker Left Mixer Volume' 3"
+		cset "name='Speaker Right Mixer Volume' 3"
 		cset "name='Record Path DC Blocking' on"
 		cset "name='Playback Path DC Blocking' on"
 
-		cset "name='Headphone Left Switch' on"
-		cset "name='Headphone Right Switch' on"
+		cset "name='Headphone Left Switch' off"
+		cset "name='Headphone Right Switch' off"
 		cset "name='Headphone Switch' off"
 
-		cset "name='Ext Spk Switch' off"
 		cset "name='Speaker Left Switch' off"
 		cset "name='Speaker Right Switch' off"
+		cset "name='Ext Spk Switch' off"
+
+		cset "name='Headset Mic Switch' off"
+		cset "name='Int Mic Switch' off"
 	]
 
 	DisableSequence [
 	]
-}
 
-SectionDevice."Speaker".0 {
+	# ALSA PCM
 	Value {
-		PlaybackPCM "hw:chtmax98090,0"
-		MixerName "Speaker"
-		DspName "speaker_eq"
+		# ALSA PCM device for HiFi
+		PlaybackPCM "hw:sofchtmax98090"
+		CapturePCM  "hw:sofchtmax98090"
 	}
-	EnableSequence [
-		cdev "hw:chtmax98090"
+}
 
-		cset "name='Speaker Left Switch' on"
-		cset "name='Speaker Right Switch' on"
-		cset "name='Ext Spk Switch' on"
-	]
-	DisableSequence [
-		cdev "hw:chtmax98090"
+SectionDevice."Headphone" {
+	Comment "Headphone"
 
-		cset "name='Ext Spk Switch' off"
-		cset "name='Speaker Left Switch' off"
-		cset "name='Speaker Right Switch' off"
+	ConflictingDevice [
+		"Speakers"
 	]
-}
 
-SectionDevice."Internal Mic".0 {
 	Value {
-		CapturePCM "hw:chtmax98090,0"
-		MixerName "Int Mic"
+		JackControl "Headphone Jack"
+		JackHWMute "Speakers"
 	}
+
 	EnableSequence [
-		cdev "hw:chtmax98090"
+		cdev "hw:sofchtmax98090"
+
+		cset "name='Headphone Left Switch' on"
+		cset "name='Headphone Right Switch' on"
+		cset "name='Headphone Switch' on"
 
-		cset "name='Int Mic Switch' on"
-		cset "name='DMIC Mux' DMIC"
 	]
 	DisableSequence [
-		cdev "hw:chtmax98090"
+		cdev "hw:sofchtmax98090"
+
+		cset "name='Headphone Left Switch' off"
+		cset "name='Headphone Right Switch' off"
+		cset "name='Headphone Switch' off"
 
-		cset "name='Int Mic Switch' off"
 	]
-}
 
-SectionDevice."Headphone".0 {
 	Value {
-		PlaybackPCM "hw:chtmax98090,0"
-		JackName "chtmax98090 Headset Jack"
-		JackType "gpio"
+		PlaybackChannels 2
 	}
+}
+
+SectionDevice."Speakers" {
+        Comment "Speakers"
+
+	ConflictingDevice [
+		"Headphone"
+	]
 
 	EnableSequence [
-		cdev "hw:chtmax98090"
-		cset "name='HP Left Out Switch' on"
-		cset "name='HP Right Out Switch' on"
-		cset "name='Headphone Switch' on"
+		cdev "hw:sofchtmax98090"
+
+		cset "name='Speaker Left Switch' on"
+		cset "name='Speaker Right Switch' on"
+		cset "name='Ext Spk Switch' on"
 	]
 	DisableSequence [
-		cdev "hw:chtmax98090"
-		cset "name='Headphone Switch' off"
-		cset "name='HP Left Out Switch' off"
-		cset "name='HP Right Out Switch' off"
+		cdev "hw:sofchtmax98090"
+
+		cset "name='Speaker Left Switch' off"
+		cset "name='Speaker Right Switch' off"
+		cset "name='Ext Spk Switch' off"
 	]
-}
 
-SectionDevice."Mic".0 {
 	Value {
-		CapturePCM "hw:chtmax98090,0"
-		JackName "chtmax98090 Headset Jack"
-		JackType "gpio"
+		PlaybackChannels 2
+	}
+}
+
+SectionDevice."HeadsetMic" {
+         Comment "Headset Mic"
+
+	 Value {
+		JackControl "Headset Mic Jack"
+		#FIXME CaptureControl "MIC2"
 	}
 
+	ConflictingDevice [
+		"InternalMic"
+	]
+
 	EnableSequence [
-		cdev "hw:chtmax98090"
+		cdev "hw:sofchtmax98090"
+
 		cset "name='Headset Mic Switch' on"
 		cset "name='DMIC Mux' ADC"
 		cset "name='Record Path DC Blocking' on"
+
 	]
 
 	DisableSequence [
-		cdev "hw:chtmax98090"
+		cdev "hw:sofchtmax98090"
+
 		cset "name='Headset Mic Switch' off"
+		cset "name='DMIC Mux' DMIC"
 		cset "name='Record Path DC Blocking' off"
 	]
+
+	Value {
+		CaptureChannels 2
+	}
 }
 
-SectionModifier."Speaker Swap Mode".0 {
-	Comment "Swap the left and right channels of speaker."
+SectionDevice."InternalMic" {
+         Comment "Internal Mic"
+
+	 Value {
+		#FIXME CaptureControl "MIC2"
+	}
+
+	ConflictingDevice [
+		"HeadsetMic"
+	]
 
 	EnableSequence [
-		cdev "hw:chtmax98090"
+		cdev "hw:sofchtmax98090"
 
-		cset "name='Left Speaker Mixer Left DAC Switch' off"
-		cset "name='Right Speaker Mixer Right DAC Switch' off"
-		cset "name='Left Speaker Mixer Right DAC Switch' on"
-		cset "name='Right Speaker Mixer Left DAC Switch' on"
+		cset "name='Int Mic Switch' on"
+		cset "name='DMIC Mux' DMIC"
+		cset "name='Record Path DC Blocking' off"
 	]
 
 	DisableSequence [
-		cdev "hw:chtmax98090"
+		cdev "hw:sofchtmax98090"
 
-		cset "name='Left Speaker Mixer Right DAC Switch' off"
-		cset "name='Right Speaker Mixer Left DAC Switch' off"
-		cset "name='Left Speaker Mixer Left DAC Switch' on"
-		cset "name='Right Speaker Mixer Right DAC Switch' on"
+		cset "name='Int Mic Switch' off"
+		cset "name='DMIC Mux' ADC"
+		cset "name='Record Path DC Blocking' on"
 	]
+
+	Value {
+		CaptureChannels 2
+	}
 }

@plbossart
Copy link
Member Author

From the non-sof HiFi, this diff is very different. I don't have time currently to dig into it, right now, I might be able to test something if you want next week.

there's a known issue with this driver, there was an inversion between Switch and Mute that was corrected maybe in 2016 when I revisited all this. There were also changes in control names for the codec.

plbossart pushed a commit to plbossart/alsa-ucm-conf that referenced this pull request Jun 27, 2022
…one (thesofproject#1)

Fixes ASUS ROG Maximus XIII support.
C/Sub port is not tested.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants