Skip to content

Commit

Permalink
ucm2: sof-soundwire: Use one file for speaker codec initialization
Browse files Browse the repository at this point in the history
Use macros to minimize configuration blocks.

Signed-off-by: Jaroslav Kysela <[email protected]>
  • Loading branch information
perexg committed Dec 6, 2023
1 parent 23adf5a commit 59fee7f
Show file tree
Hide file tree
Showing 10 changed files with 150 additions and 189 deletions.
2 changes: 1 addition & 1 deletion ucm2/sof-soundwire/HiFi.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ If.spkdev {
Type String
Empty "${var:SpeakerCodec1}"
}
False.Include.spkdev.File "/sof-soundwire/${var:SpeakerCodec1}-${var:SpeakerAmps1}.conf"
False.Include.spkdev.File "/sof-soundwire/${var:SpeakerCodec1}.conf"
}

If.micdev {
Expand Down
22 changes: 0 additions & 22 deletions ucm2/sof-soundwire/rt1308-1.conf

This file was deleted.

29 changes: 0 additions & 29 deletions ucm2/sof-soundwire/rt1308-2.conf

This file was deleted.

44 changes: 44 additions & 0 deletions ucm2/sof-soundwire/rt1308.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Use case Configuration for sof-soundwire card

#
# Arguments:
# Codec - codec number (1,2 etc.)
# Channel - channel selection (LR, LL, RL, RR)
#
DefineMacro.rt1308spk {
EnableSequence [
cset cset "name='rt1308-${var:__Codec} RX Channel Select' ${var:__Channel}"
cset "name='rt1308-${var:__Codec} DAC L Switch' 1"
cset "name='rt1308-${var:__Codec} DAC R Switch' 1"
]
DisableSequence [
cset "name='rt1308-${var:__Codec} DAC L Switch' 0"
cset "name='rt1308-${var:__Codec} DAC R Switch' 0"
]
}

SectionDevice."Speaker" {
Comment "Speaker"

Macro.num1.rt1308spk { Codec 1 Channel LL }

Condition {
Type String
Haystack "${var:SpeakerAmps1}"
Needle "2"
}
True.Macro.num2.rt1308spk { Codec 2 Channel RR }

EnableSequence [
cset "name='Speaker Switch' on"
]

DisableSequence [
cset "name='Speaker Switch' off"
]

Value {
PlaybackPriority 100
PlaybackPCM "hw:${CardId},2"
}
}
41 changes: 0 additions & 41 deletions ucm2/sof-soundwire/rt1316-1.conf

This file was deleted.

51 changes: 0 additions & 51 deletions ucm2/sof-soundwire/rt1316-2.conf

This file was deleted.

63 changes: 63 additions & 0 deletions ucm2/sof-soundwire/rt1316.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Use case Configuration for sof-soundwire card

#
# Arguments:
# Codec - codec number (1,2 etc.)
# Channel - channel selection (L,R;L,L;L,R;L,L+R;R,L;R,R;R,L+R;L+R,L;L+R,R;L+R,L+R)
)
#
DefineMacro.rt1316spk {
EnableSequence [
cset cset "name='rt1316-${var:__Codec} RX Channel Select' ${var:__Channel}"
]
If.lrswitch {
Condition {
Type ControlExists
Control "name='rt1316-${var:__Codec} DAC L Switch'"
}
True {
EnableSequence [
cset "name='rt1316-${var:__Codec} DAC L Switch' 1"
cset "name='rt1316-${var:__Codec} DAC R Switch' 1"
]
DisableSequence [
cset "name='rt1316-${var:__Codec} DAC L Switch' 0"
cset "name='rt1316-${var:__Codec} DAC R Switch' 0"
]
}
False {
EnableSequence [
cset "name='rt1316-1 DAC Switch' 1"
]

DisableSequence [
cset "name='rt1316-1 DAC Switch' 0"
]
}
}
}

SectionDevice."Speaker" {
Comment "Speaker"

Macro.num1.rt1316spk { Codec 1 Channel "L,L" }
Condition {
Type String
Haystack "${var:SpeakerAmps1}"
Needle "2"
}
True.Macro.num2.rt1316spk { Codec 2 Channel "R,R" }

EnableSequence [
cset "name='Speaker Switch' on"
]

DisableSequence [
cset "name='Speaker Switch' off"
]

Value {
PlaybackPriority 100
PlaybackPCM "hw:${CardId},2"
}
}
20 changes: 0 additions & 20 deletions ucm2/sof-soundwire/rt1318-1.conf

This file was deleted.

25 changes: 0 additions & 25 deletions ucm2/sof-soundwire/rt1318-2.conf

This file was deleted.

42 changes: 42 additions & 0 deletions ucm2/sof-soundwire/rt1318.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Use case Configuration for sof-soundwire card

#
# Arguments:
# Codec - codec number (1,2 etc.)
# Channel - channel selection (L,R;L,L;L,R;L,L+R;R,L;R,R;R,L+R;L+R,L;L+R,R;L+R,L+R)
#
DefineMacro.rt1318spk {
EnableSequence [
cset cset "name='rt1308-${var:__Codec} RX Channel Select' ${var:__Channel}"
cset "name='rt1308-${var:__Codec} DAC Switch' 1"
]
DisableSequence [
cset "name='rt1308-${var:__Codec} DAC Switch' 0"
]
}

SectionDevice."Speaker" {
Comment "Speaker"

Macro.num1.rt1318spk { Codec 1 Channel "L,L" }

Condition {
Type String
Haystack "${var:SpeakerAmps1}"
Needle "2"
}
True.Macro.num2.rt1318spk { Codec 2 Channel "R,R" }

EnableSequence [
cset "name='Speaker Switch' on"
]

DisableSequence [
cset "name='Speaker Switch' off"
]

Value {
PlaybackPriority 100
PlaybackPCM "hw:${CardId},2"
}
}

0 comments on commit 59fee7f

Please sign in to comment.