Skip to content

Commit d9b571b

Browse files
bardliaokv2019i
authored andcommitted
ASoC: SOF: topology: Get ALH rate amd channels from topology
FW will need these params Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
1 parent 8cee3f8 commit d9b571b

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

include/uapi/sound/sof/tokens.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,8 @@
126126
#define SOF_TKN_MUTE_LED_USE 1300
127127
#define SOF_TKN_MUTE_LED_DIRECTION 1301
128128

129+
/* ALH */
130+
#define SOF_TKN_INTEL_ALH_RATE 1400
131+
#define SOF_TKN_INTEL_ALH_CH 1401
132+
129133
#endif

sound/soc/sof/topology.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,16 @@ static const struct sof_topology_token ssp_tokens[] = {
656656

657657
};
658658

659+
/* ALH */
660+
static const struct sof_topology_token alh_tokens[] = {
661+
{SOF_TKN_INTEL_ALH_RATE,
662+
SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
663+
offsetof(struct sof_ipc_dai_alh_params, rate), 0},
664+
{SOF_TKN_INTEL_ALH_CH,
665+
SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32,
666+
offsetof(struct sof_ipc_dai_alh_params, channels), 0},
667+
};
668+
659669
/* DMIC */
660670
static const struct sof_topology_token dmic_tokens[] = {
661671
{SOF_TKN_INTEL_DMIC_DRIVER_VERSION,
@@ -3095,13 +3105,26 @@ static int sof_link_alh_load(struct snd_soc_component *scomp, int index,
30953105
struct sof_ipc_dai_config *config)
30963106
{
30973107
struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp);
3108+
struct snd_soc_tplg_private *private = &cfg->priv;
30983109
struct sof_ipc_reply reply;
30993110
u32 size = sizeof(*config);
31003111
int ret;
31013112

3113+
ret = sof_parse_tokens(scomp, &config->alh, alh_tokens,
3114+
ARRAY_SIZE(alh_tokens), private->array,
3115+
le32_to_cpu(private->size));
3116+
if (ret != 0) {
3117+
dev_err(scomp->dev, "error: parse alh tokens failed %d\n",
3118+
le32_to_cpu(private->size));
3119+
return ret;
3120+
}
3121+
31023122
/* init IPC */
31033123
config->hdr.size = size;
31043124

3125+
dev_dbg(scomp->dev, "ALH config rate %d channels %d\n",
3126+
config->alh.rate, config->alh.channels);
3127+
31053128
/* send message to DSP */
31063129
ret = sof_ipc_tx_message(sdev->ipc,
31073130
config->hdr.cmd, config, size, &reply,

0 commit comments

Comments
 (0)