alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Jaroslav Kysela <perex@perex.cz>
Cc: Hans de Goede <hdegoede@redhat.com>,
	alsa-devel@alsa-project.org,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Subject: [PATCH alsa-ucm-conf] bytcr-wm5102: Add new UCM profile for BYT boards with a WM5102 codec
Date: Tue,  9 Feb 2021 20:08:59 +0100	[thread overview]
Message-ID: <20210209190859.70997-1-hdegoede@redhat.com> (raw)

Add new UCM profile for BYT boards with a WM5102 codec. This has been
tested with both the SST and the SOF driver on a
Lenovo Yoga Tablet 2 1051L.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 ucm2/SOF/HiFi.conf                      |  9 +++++++++
 ucm2/bytcr-wm5102/HiFi.conf             | 27 +++++++++++++++++++++++++
 ucm2/bytcr-wm5102/bytcr-wm5102.conf     |  6 ++++++
 ucm2/codecs/wm5102/EnableSeq.conf       | 16 +++++++++++++++
 ucm2/codecs/wm5102/HeadPhones.conf      | 23 +++++++++++++++++++++
 ucm2/codecs/wm5102/IN1-HeadsetMic.conf  | 24 ++++++++++++++++++++++
 ucm2/codecs/wm5102/IN3-InternalMic.conf | 23 +++++++++++++++++++++
 ucm2/codecs/wm5102/Speaker.conf         | 22 ++++++++++++++++++++
 8 files changed, 150 insertions(+)
 create mode 100644 ucm2/bytcr-wm5102/HiFi.conf
 create mode 100644 ucm2/bytcr-wm5102/bytcr-wm5102.conf
 create mode 100644 ucm2/codecs/wm5102/EnableSeq.conf
 create mode 100644 ucm2/codecs/wm5102/HeadPhones.conf
 create mode 100644 ucm2/codecs/wm5102/IN1-HeadsetMic.conf
 create mode 100644 ucm2/codecs/wm5102/IN3-InternalMic.conf
 create mode 100644 ucm2/codecs/wm5102/Speaker.conf

diff --git a/ucm2/SOF/HiFi.conf b/ucm2/SOF/HiFi.conf
index af0d8c9..adf8cc5 100644
--- a/ucm2/SOF/HiFi.conf
+++ b/ucm2/SOF/HiFi.conf
@@ -79,6 +79,15 @@ If.bytcht_max98090 {
 	True.Include.main.File "/chtmax98090/HiFi.conf"
 }
 
+If.bytcht_wm5102 {
+	Condition {
+		Type String
+		Haystack "${CardName}"
+		Needle "bytcht wm5102"
+	}
+	True.Include.main.File "/bytcr-wm5102/HiFi.conf"
+}
+
 If.bdw_rt286 {
 	Condition {
 		Type String
diff --git a/ucm2/bytcr-wm5102/HiFi.conf b/ucm2/bytcr-wm5102/HiFi.conf
new file mode 100644
index 0000000..1269868
--- /dev/null
+++ b/ucm2/bytcr-wm5102/HiFi.conf
@@ -0,0 +1,27 @@
+SectionVerb {
+
+	Value {
+		TQ "HiFi"
+	}
+
+	Include.e.File "/codecs/wm5102/EnableSeq.conf"
+
+	If.Controls {
+		Condition {
+			Type ControlExists
+			Control "name='media0_in Gain 0 Switch'"
+		}
+		True {
+			Include.pe {
+				File "/platforms/bytcr/PlatformEnableSeq.conf"
+				Before.EnableSequence "0"
+			}
+			Include.pd.File "/platforms/bytcr/PlatformDisableSeq.conf"
+		}
+	}
+}
+
+Include.spk.File "/codecs/wm5102/Speaker.conf"
+Include.hp.File "/codecs/wm5102/HeadPhones.conf"
+Include.mic.File "/codecs/wm5102/IN3-InternalMic.conf"
+Include.headset.File "/codecs/wm5102/IN1-HeadsetMic.conf"
diff --git a/ucm2/bytcr-wm5102/bytcr-wm5102.conf b/ucm2/bytcr-wm5102/bytcr-wm5102.conf
new file mode 100644
index 0000000..af966ef
--- /dev/null
+++ b/ucm2/bytcr-wm5102/bytcr-wm5102.conf
@@ -0,0 +1,6 @@
+Syntax 3
+
+SectionUseCase."HiFi" {
+	File "HiFi.conf"
+	Comment "Play HiFi quality Music"
+}
diff --git a/ucm2/codecs/wm5102/EnableSeq.conf b/ucm2/codecs/wm5102/EnableSeq.conf
new file mode 100644
index 0000000..6a857a2
--- /dev/null
+++ b/ucm2/codecs/wm5102/EnableSeq.conf
@@ -0,0 +1,16 @@
+EnableSequence [
+	# Route AIF1 to the speakers and headphones
+	cset "name='SPKOUTL Input 1' AIF1RX1"
+	cset "name='SPKOUTR Input 1' AIF1RX2"
+	cset "name='HPOUT1L Input 1' AIF1RX1"
+	cset "name='HPOUT1R Input 1' AIF1RX2"
+
+	# Both mics are quite soft by default, boost then
+	cset "name='IN1L Volume' 28"
+	cset "name='IN3L Volume' 28"
+
+	cset "name='Headphone Switch' off"
+	cset "name='Headset Mic Switch' off"
+	cset "name='Internal Mic Switch' off"
+	cset "name='Speaker Switch' off"
+]
diff --git a/ucm2/codecs/wm5102/HeadPhones.conf b/ucm2/codecs/wm5102/HeadPhones.conf
new file mode 100644
index 0000000..cb29347
--- /dev/null
+++ b/ucm2/codecs/wm5102/HeadPhones.conf
@@ -0,0 +1,23 @@
+SectionDevice."Headphones" {
+	Comment "Headphones"
+
+	Value {
+		PlaybackPriority 200
+		PlaybackPCM "hw:${CardId}"
+		JackControl "Headphone Jack"
+	}
+
+	ConflictingDevice [
+		"Speaker"
+	]
+
+	EnableSequence [
+		cset "name='HPOUT1 Digital Switch' on"
+		cset "name='Headphone Switch' on"
+	]
+
+	DisableSequence [
+		cset "name='HPOUT1 Digital Switch' off"
+		cset "name='Headphone Switch' off"
+	]
+}
diff --git a/ucm2/codecs/wm5102/IN1-HeadsetMic.conf b/ucm2/codecs/wm5102/IN1-HeadsetMic.conf
new file mode 100644
index 0000000..a607487
--- /dev/null
+++ b/ucm2/codecs/wm5102/IN1-HeadsetMic.conf
@@ -0,0 +1,24 @@
+SectionDevice."Headset" {
+	Comment "Headset Microphone"
+
+	ConflictingDevice [
+		"Mic"
+	]
+
+	EnableSequence [
+		cset "name='AIF1TX1 Input 1' IN1L"
+		cset "name='AIF1TX2 Input 1' IN1L"
+
+		cset "name='Headset Mic Switch' on"
+	]
+
+	DisableSequence [
+		cset "name='Headset Mic Switch' off"
+	]
+
+	Value {
+		CapturePriority 200
+		CapturePCM "hw:${CardId}"
+		JackControl "Headset Mic Jack"
+	}
+}
diff --git a/ucm2/codecs/wm5102/IN3-InternalMic.conf b/ucm2/codecs/wm5102/IN3-InternalMic.conf
new file mode 100644
index 0000000..3a03ac3
--- /dev/null
+++ b/ucm2/codecs/wm5102/IN3-InternalMic.conf
@@ -0,0 +1,23 @@
+SectionDevice."Mic" {
+	Comment "Internal Microphone"
+
+	ConflictingDevice [
+		"Headset"
+	]
+
+	EnableSequence [
+		cset "name='AIF1TX1 Input 1' IN3L"
+		cset "name='AIF1TX2 Input 1' IN3L"
+
+		cset "name='Internal Mic Switch' on"
+	]
+
+	DisableSequence [
+		cset "name='Internal Mic Switch' off"
+	]
+
+	Value {
+		CapturePriority 100
+		CapturePCM "hw:${CardId}"
+	}
+}
diff --git a/ucm2/codecs/wm5102/Speaker.conf b/ucm2/codecs/wm5102/Speaker.conf
new file mode 100644
index 0000000..9f631f5
--- /dev/null
+++ b/ucm2/codecs/wm5102/Speaker.conf
@@ -0,0 +1,22 @@
+SectionDevice."Speaker" {
+	Comment "Speakers"
+
+	Value {
+		PlaybackPriority 100
+		PlaybackPCM "hw:${CardId}"
+	}
+
+	ConflictingDevice [
+		"Headphones"
+	]
+
+	EnableSequence [
+		cset "name='Speaker Digital Switch' on"
+		cset "name='Speaker Switch' on"
+	]
+
+	DisableSequence [
+		cset "name='Speaker Digital Switch' off"
+		cset "name='Speaker Switch' off"
+	]
+}
-- 
2.30.0


             reply	other threads:[~2021-02-09 19:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-09 19:08 Hans de Goede [this message]
2021-02-09 19:56 ` [PATCH alsa-ucm-conf] bytcr-wm5102: Add new UCM profile for BYT boards with a WM5102 codec Jaroslav Kysela
2021-02-09 20:47   ` Hans de Goede
2021-02-11 19:16 ` Jaroslav Kysela

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210209190859.70997-1-hdegoede@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=perex@perex.cz \
    --cc=pierre-louis.bossart@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).