Skip to content

Commit 2469872

Browse files
committed
ASoC: SOF: ipc4-topology: Token for using topology name only in gain
Add SOF_TKN_GAIN_USE_TOPOLOGY_NAME token, sof_topology_token array entry, and the associated code in sof_ipc4_widget_setup_comp_pga() to set kcontrol_name_no_prefix flag in the associated snd_soc_dapm_widget. Signed-off-by: Jyri Sarha <jyri.sarha@intel.com>
1 parent 3fcef55 commit 2469872

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

include/uapi/sound/sof/tokens.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
#define SOF_TKN_GAIN_RAMP_TYPE 260
6464
#define SOF_TKN_GAIN_RAMP_DURATION 261
6565
#define SOF_TKN_GAIN_VAL 262
66+
#define SOF_TKN_GAIN_USE_TOPOLOGY_NAME 263
6667

6768
/* SRC */
6869
#define SOF_TKN_SRC_RATE_IN 300

sound/soc/sof/ipc4-topology.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ static const struct sof_topology_token gain_tokens[] = {
123123
offsetof(struct sof_ipc4_gain_data, curve_duration_l)},
124124
{SOF_TKN_GAIN_VAL, SND_SOC_TPLG_TUPLE_TYPE_WORD,
125125
get_token_u32, offsetof(struct sof_ipc4_gain_data, init_val)},
126+
{SOF_TKN_GAIN_USE_TOPOLOGY_NAME, SND_SOC_TPLG_TUPLE_TYPE_BOOL,
127+
get_token_void, 0},
126128
};
127129

128130
/* SRC */
@@ -699,7 +701,7 @@ static int sof_ipc4_widget_setup_comp_pga(struct snd_sof_widget *swidget)
699701
{
700702
struct snd_soc_component *scomp = swidget->scomp;
701703
struct sof_ipc4_gain *gain;
702-
int ret;
704+
int ret, i;
703705

704706
gain = kzalloc(sizeof(*gain), GFP_KERNEL);
705707
if (!gain)
@@ -732,6 +734,10 @@ static int sof_ipc4_widget_setup_comp_pga(struct snd_sof_widget *swidget)
732734

733735
sof_ipc4_widget_update_kcontrol_module_id(swidget);
734736

737+
for (i = 0; i < swidget->num_tuples; i++ )
738+
if (swidget->tuples[i].token == SOF_TKN_GAIN_USE_TOPOLOGY_NAME)
739+
swidget->widget->kcontrol_name_no_prefix = swidget->tuples[i].value.v;
740+
735741
return 0;
736742
err:
737743
sof_ipc4_free_audio_fmt(&gain->available_fmt);

0 commit comments

Comments
 (0)