alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Chris Morgan <macroalpha82@gmail.com>
To: alsa-devel@alsa-project.org
Cc: Chris Morgan <macromorgan@hotmail.com>
Subject: [PATCH V2] ucm2: Rockchip: rk817: Add ALSA UCM support
Date: Fri, 24 Feb 2023 13:33:20 -0600	[thread overview]
Message-ID: <20230224193320.1503-1-macroalpha82@gmail.com> (raw)

From: Chris Morgan <macromorgan@hotmail.com>

Add ALSA-UCM support for the Rockchip RK817 audio codec. This codec
is typically configured either with an internal or external amplifier
as reflected by the longname. This configuration has been tested on
the Anbernic RG353P (rk817_ext) and the Odroid Go Advance (rk817_int).

Changes from V1:
 - Use a constant to control if the output mux is set to HP or SPK.

Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
---
 ucm2/Rockchip/rk817-sound/HiFi.conf        | 68 ++++++++++++++++++++++
 ucm2/Rockchip/rk817-sound/rk817-sound.conf |  6 ++
 ucm2/conf.d/simple-card/rk817_ext.conf     |  1 +
 ucm2/conf.d/simple-card/rk817_int.conf     |  1 +
 4 files changed, 76 insertions(+)
 create mode 100644 ucm2/Rockchip/rk817-sound/HiFi.conf
 create mode 100644 ucm2/Rockchip/rk817-sound/rk817-sound.conf
 create mode 120000 ucm2/conf.d/simple-card/rk817_ext.conf
 create mode 120000 ucm2/conf.d/simple-card/rk817_int.conf

diff --git a/ucm2/Rockchip/rk817-sound/HiFi.conf b/ucm2/Rockchip/rk817-sound/HiFi.conf
new file mode 100644
index 0000000..8d90567
--- /dev/null
+++ b/ucm2/Rockchip/rk817-sound/HiFi.conf
@@ -0,0 +1,68 @@
+Define.pbk_mux "SPK"
+
+If.1 {
+	Condition {
+		Type ControlExists
+		Control "name='Internal Speakers Switch'"
+	}
+
+	True {
+		Define.pbk_mux "HP"
+		SectionDevice."Speaker".EnableSequence [
+			cset "name='Internal Speakers Switch' on"
+		]
+
+		SectionDevice."Speaker".DisableSequence [
+			cset "name='Internal Speakers Switch' off"
+		]
+	}
+}
+
+SectionDevice."Speaker" {
+	Comment "Internal Speaker"
+
+	EnableSequence [
+		cset "name='Playback Mux' ${var:pbk_mux}"
+	]
+
+	Value {
+		PlaybackMixerElem "Master Playback Volume"
+		PlaybackPriority 100
+		PlaybackPCM "hw:${CardId}"
+	}
+
+	ConflictingDevice [
+		"Headphones"
+	]
+}
+
+SectionDevice."Mic" {
+	Comment "Microphone"
+
+	Value {
+		CapturePriority 100
+		CapturePCM "hw:${CardId}"
+		CaptureMixerElem "Mic Capture Gain"
+		CaptureMasterElem "Master Capture Volume"
+	}
+}
+
+SectionDevice."Headphones" {
+	Comment "Headphones"
+
+	EnableSequence [
+		cset "name='Playback Mux' HP"
+	]
+
+	Value {
+		PlaybackMixerElem "Master Playback Volume"
+		PlaybackPriority 200
+		PlaybackPCM "hw:${CardId}"
+		JackControl "Headphones Jack"
+		JackHWMute "Speaker"
+	}
+
+	ConflictingDevice [
+		"Speaker"
+	]
+}
diff --git a/ucm2/Rockchip/rk817-sound/rk817-sound.conf b/ucm2/Rockchip/rk817-sound/rk817-sound.conf
new file mode 100644
index 0000000..90ec794
--- /dev/null
+++ b/ucm2/Rockchip/rk817-sound/rk817-sound.conf
@@ -0,0 +1,6 @@
+Syntax 4
+
+SectionUseCase."HiFi" {
+	File "/Rockchip/rk817-sound/HiFi.conf"
+	Comment "Play HiFi quality music"
+}
diff --git a/ucm2/conf.d/simple-card/rk817_ext.conf b/ucm2/conf.d/simple-card/rk817_ext.conf
new file mode 120000
index 0000000..6fa8db7
--- /dev/null
+++ b/ucm2/conf.d/simple-card/rk817_ext.conf
@@ -0,0 +1 @@
+../../Rockchip/rk817-sound/rk817-sound.conf
\ No newline at end of file
diff --git a/ucm2/conf.d/simple-card/rk817_int.conf b/ucm2/conf.d/simple-card/rk817_int.conf
new file mode 120000
index 0000000..6fa8db7
--- /dev/null
+++ b/ucm2/conf.d/simple-card/rk817_int.conf
@@ -0,0 +1 @@
+../../Rockchip/rk817-sound/rk817-sound.conf
\ No newline at end of file
-- 
2.34.1


             reply	other threads:[~2023-02-24 19:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-24 19:33 Chris Morgan [this message]
2023-03-02 13:40 ` [PATCH V2] ucm2: Rockchip: rk817: Add ALSA UCM support 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=20230224193320.1503-1-macroalpha82@gmail.com \
    --to=macroalpha82@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=macromorgan@hotmail.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).