ucm2: Rockchip: rk817: Add ALSA UCM support
PATCH 1/1 ucm2: Rockchip: rk817: Add ALSA UCM support
From: Chris Morgan <[email protected]>
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).
--- ucm2/Rockchip/rk817-sound/HiFi.conf | 66 ++++++++++++++++++++++ ucm2/Rockchip/rk817-sound/rk817-sound.conf | 7 +++ ucm2/conf.d/simple-card/rk817_ext.conf | 1 + ucm2/conf.d/simple-card/rk817_int.conf | 1 + 4 files changed, 75 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
ucm2/Rockchip/rk817-sound/HiFi.conf new file +66 -0
@@ -0,0 +1,66 @@ +If.1 { + Condition { + Type ControlExists + Control "name='Internal Speakers Switch'" + } + + True { + SectionDevice."Speaker".EnableSequence [ + cset "name='Playback Mux' HP" + 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' SPK" + ] + + Value { + PlaybackMasterElem "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 { + PlaybackMasterElem "Master Playback Volume" + PlaybackPriority 200 + PlaybackPCM "hw:${CardId}" + JackControl "Headphones Jack" + JackHWMute "Speaker" + } + + ConflictingDevice [ + "Speaker" + ] +}
ucm2/Rockchip/rk817-sound/rk817-sound.conf new file +7 -0
@@ -0,0 +1,7 @@ +Syntax 4 + +SectionUseCase."HiFi" { + File "/Rockchip/rk817-sound/HiFi.conf" + Comment "Play HiFi quality music" +} +
ucm2/conf.d/simple-card/rk817_ext.conf new file +1 -0
@@ -0,0 +1 @@ +../../Rockchip/rk817-sound/rk817-sound.conf
ucm2/conf.d/simple-card/rk817_int.conf new file +1 -0
@@ -0,0 +1 @@ +../../Rockchip/rk817-sound/rk817-sound.conf
Signature · 1 line
2.34.1
Quoted 6 lines · Chris Morgan
From: Chris Morgan <[email protected]>
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).
Thank you for your contribution.
Quoted 19 lines
Signed-off-by Chris Morgan <[email protected]>--- ucm2/Rockchip/rk817-sound/HiFi.conf | 66 ++++++++++++++++++++++ ucm2/Rockchip/rk817-sound/rk817-sound.conf | 7 +++ ucm2/conf.d/simple-card/rk817_ext.conf | 1 + ucm2/conf.d/simple-card/rk817_int.conf | 1 + 4 files changed, 75 insertions(+)create mode 100644
ucm2/Rockchip/rk817-sound/HiFi.confcreate mode 100644ucm2/Rockchip/rk817-sound/rk817-sound.confcreate mode 120000ucm2/conf.d/simple-card/rk817_ext.confcreate mode 120000ucm2/conf.d/simple-card/rk817_int.confucm2/Rockchip/rk817-sound/HiFi.conf new file +1
-0@@ -0,0 +1,66 @@ +If.1 {
ucm2/Rockchip/rk817-sound/HiFi.conf line 11
Quoted 10 lines
ucm2/Rockchip/rk817-sound/HiFi.conf new file +10
-0+ Condition { + Type ControlExists + Control "name='Internal Speakers Switch'" + } + + True { + SectionDevice."Speaker".EnableSequence [ + cset "name='Playback Mux' HP" + cset "name='Internal Speakers Switch' on" + ]
It would be better to use variable (Define) to set the "Playback Mux", because the [] arrays are stacked after evaluation in this case like:
SectionDevice."Speaker".EnableSequence [
cset "name='Playback Mux' SPK"
cset "name='Playback Mux' HP"
cset "name='Internal Speakers Switch' on"
]
so
Define.pbk_mux "SPK"
.... If.1.True { Define.pbk_mux "HP" }
.... SectionDevice."Speaker".EnableSequence [
cset "name='Playback Mux' ${var:pbk_mux}"]
Otherwise a nice clean config.
Thanks,
Jaroslav
Signature · 2 lines
Jaroslav Kysela <[email protected]> Linux Sound Maintainer; ALSA Project; Red Hat, Inc.