Skip to content

Commit be19cd0

Browse files
jsarhaJyri Sarha
authored andcommitted
ASoC: SOF: topology: Add a token for dropping widget name in kcontrol name
Adds SOF_TKN_COMP_NO_WNAME_IN_KCONTROL_NAME token, and copies the token's tuple value to the no_wname_in_kcontrol_name flag in struct snd_soc_dapm_widget. If the tuple value for the token in the topology is true, then the widget name is not added to the mixer name. In practice "gain.2.1 Post Mixer Analog Playback Volume" becomes just "Post Mixer Analog Playback Volume". Signed-off-by: Jyri Sarha <jyri.sarha@intel.com>
1 parent 44de36b commit be19cd0

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

include/uapi/sound/sof/tokens.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,11 @@
9999
#define SOF_TKN_COMP_OUTPUT_PIN_BINDING_WNAME 414
100100
#define SOF_TKN_COMP_NUM_INPUT_AUDIO_FORMATS 415
101101
#define SOF_TKN_COMP_NUM_OUTPUT_AUDIO_FORMATS 416
102-
102+
/*
103+
* The token value is copied to the dapm_widget's
104+
* no_wname_in_kcontrol_name.
105+
*/
106+
#define SOF_TKN_COMP_NO_WNAME_IN_KCONTROL_NAME 417
103107

104108
/* SSP */
105109
#define SOF_TKN_INTEL_SSP_CLKS_CONTROL 500

sound/soc/sof/topology.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,6 +1366,20 @@ static int sof_parse_pin_binding(struct snd_sof_widget *swidget,
13661366
return ret;
13671367
}
13681368

1369+
static int get_w_no_wname_in_long_name(void *elem, void *object, u32 offset)
1370+
{
1371+
struct snd_soc_tplg_vendor_value_elem *velem = elem;
1372+
struct snd_soc_dapm_widget *w = object;
1373+
1374+
w->no_wname_in_kcontrol_name = !!le32_to_cpu(velem->value);
1375+
return 0;
1376+
}
1377+
1378+
static const struct sof_topology_token dapm_widget_tokens[] = {
1379+
{SOF_TKN_COMP_NO_WNAME_IN_KCONTROL_NAME, SND_SOC_TPLG_TUPLE_TYPE_BOOL,
1380+
get_w_no_wname_in_long_name, 0}
1381+
};
1382+
13691383
/* external widget init - used for any driver specific init */
13701384
static int sof_widget_ready(struct snd_soc_component *scomp, int index,
13711385
struct snd_soc_dapm_widget *w,
@@ -1396,6 +1410,14 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index,
13961410
ida_init(&swidget->output_queue_ida);
13971411
ida_init(&swidget->input_queue_ida);
13981412

1413+
ret = sof_parse_tokens(scomp, w, dapm_widget_tokens, ARRAY_SIZE(dapm_widget_tokens),
1414+
priv->array, le32_to_cpu(priv->size));
1415+
if (ret < 0) {
1416+
dev_err(scomp->dev, "failed to parse dapm widget tokens for %s\n",
1417+
w->name);
1418+
goto widget_free;
1419+
}
1420+
13991421
ret = sof_parse_tokens(scomp, swidget, comp_pin_tokens,
14001422
ARRAY_SIZE(comp_pin_tokens), priv->array,
14011423
le32_to_cpu(priv->size));

0 commit comments

Comments
 (0)