From 3c34f1221e8729ced6589c7996de0f015d3fae9b Mon Sep 17 00:00:00 2001 From: Ranjani Sridharan Date: Wed, 20 Jun 2018 15:20:49 -0700 Subject: [PATCH 1/4] ASoC: uapi: sof: rename clk_id to mclk_id to make it explicit and fix the comment Some platforms have more than one MCLK's exposed. So fix the comment and rename the member to mclk_id to make it explicit to be used for passing the corrent mclk id to the firmware. Signed-off-by: Ranjani Sridharan --- include/uapi/sound/sof-ipc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/uapi/sound/sof-ipc.h b/include/uapi/sound/sof-ipc.h index e3c3de0a2d19f0..f78b5cb56508de 100644 --- a/include/uapi/sound/sof-ipc.h +++ b/include/uapi/sound/sof-ipc.h @@ -209,7 +209,7 @@ enum sof_ipc_dai_type { /* SSP Configuration Request - SOF_IPC_DAI_SSP_CONFIG */ struct sof_ipc_dai_ssp_params { uint16_t mode; // FIXME: do we need this? - uint16_t clk_id; // FIXME: do we need this? + uint16_t mclk_id; uint32_t mclk_rate; /* mclk frequency in Hz */ uint32_t fsync_rate; /* fsync frequency in Hz */ From 3b0207cf03161897265c01835e4ad2b81b54a9a3 Mon Sep 17 00:00:00 2001 From: Ranjani Sridharan Date: Wed, 20 Jun 2018 15:22:43 -0700 Subject: [PATCH 2/4] ASoC: uapi: sof: add token for SSP MCLK ID Add a token for SSP_MCLK_ID which will be used to pass the MCLK ID for configuring the SSP. Signed-off-by: Ranjani Sridharan --- include/uapi/sound/sof-topology.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/uapi/sound/sof-topology.h b/include/uapi/sound/sof-topology.h index 1a4957b7fd049d..721a2b52a00b07 100644 --- a/include/uapi/sound/sof-topology.h +++ b/include/uapi/sound/sof-topology.h @@ -68,6 +68,7 @@ #define SOF_TKN_INTEL_SSP_MCLK_KEEP_ACTIVE 500 #define SOF_TKN_INTEL_SSP_BCLK_KEEP_ACTIVE 501 #define SOF_TKN_INTEL_SSP_FS_KEEP_ACTIVE 502 +#define SOF_TKN_INTEL_SSP_MCLK_ID 503 /* DMIC */ #define SOF_TKN_INTEL_DMIC_DRIVER_VERSION 600 From fec21b5024fe460015dc0e4cbd346056b2e2b473 Mon Sep 17 00:00:00 2001 From: Ranjani Sridharan Date: Wed, 20 Jun 2018 15:25:09 -0700 Subject: [PATCH 3/4] ASoC: SOF: topology: add SSP_MCLK_ID to ssp_tokens to enable parsing the mclk id from topology Signed-off-by: Ranjani Sridharan --- sound/soc/sof/topology.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index eb9e16f643b5a5..1d4685c89f932c 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -411,6 +411,9 @@ static const struct sof_topology_token ssp_tokens[] = { {SOF_TKN_INTEL_SSP_FS_KEEP_ACTIVE, SND_SOC_TPLG_TUPLE_TYPE_BOOL, get_token_u32, offsetof(struct sof_ipc_dai_ssp_params, fs_keep_active), 0}, + {SOF_TKN_INTEL_SSP_MCLK_ID, + SND_SOC_TPLG_TUPLE_TYPE_SHORT, get_token_u16, + offsetof(struct sof_ipc_dai_ssp_params, mclk_id), 0}, }; /* DMIC */ @@ -1480,7 +1483,7 @@ static int sof_link_ssp_load(struct snd_soc_component *scomp, int index, return ret; } - ret = sof_parse_tokens(scomp, config, ssp_tokens, + ret = sof_parse_tokens(scomp, &config->ssp, ssp_tokens, ARRAY_SIZE(ssp_tokens), private->array, private->size); if (ret != 0) { @@ -1498,11 +1501,11 @@ static int sof_link_ssp_load(struct snd_soc_component *scomp, int index, config->ssp.rx_slots = hw_config->rx_slots; config->ssp.tx_slots = hw_config->tx_slots; - dev_dbg(sdev->dev, "tplg: config SSP%d fmt 0x%x mclk %d bclk %d fclk %d width (%d)%d slots %d\n", + dev_dbg(sdev->dev, "tplg: config SSP%d fmt 0x%x mclk %d bclk %d fclk %d width (%d)%d slots %d mclk id %d\n", config->id, config->format, config->ssp.mclk_rate, config->ssp.bclk_rate, config->ssp.fsync_rate, config->ssp.sample_valid_bits, - config->ssp.tdm_slot_width, config->ssp.tdm_slots); + config->ssp.tdm_slot_width, config->ssp.tdm_slots, config->ssp.mclk_id); /* send message to DSP */ ret = sof_ipc_tx_message(sdev->ipc, From 8447d1ab1b2c7fc8efcad96abe2330e7b022b2e5 Mon Sep 17 00:00:00 2001 From: Ranjani Sridharan Date: Mon, 25 Jun 2018 00:14:40 -0700 Subject: [PATCH 4/4] ASoC: SOF: merge sample_bits tokens with the rest of the ssp_tokens Sample bits is SSP specific. So move it to be part of SSP tokens. dai_ssp_link_tokens are not need anymore. So remove it and the corresponding call to parse the tokens. Signed-off-by: Ranjani Sridharan --- include/uapi/sound/sof-topology.h | 2 +- sound/soc/sof/topology.c | 18 +++--------------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/include/uapi/sound/sof-topology.h b/include/uapi/sound/sof-topology.h index 721a2b52a00b07..096aaed4333059 100644 --- a/include/uapi/sound/sof-topology.h +++ b/include/uapi/sound/sof-topology.h @@ -37,7 +37,6 @@ #define SOF_TKN_DAI_DMAC_CONFIG 153 #define SOF_TKN_DAI_TYPE 154 #define SOF_TKN_DAI_INDEX 155 -#define SOF_TKN_DAI_SAMPLE_BITS 156 /* scheduling */ #define SOF_TKN_SCHED_DEADLINE 200 @@ -69,6 +68,7 @@ #define SOF_TKN_INTEL_SSP_BCLK_KEEP_ACTIVE 501 #define SOF_TKN_INTEL_SSP_FS_KEEP_ACTIVE 502 #define SOF_TKN_INTEL_SSP_MCLK_ID 503 +#define SOF_TKN_INTEL_SSP_SAMPLE_BITS 504 /* DMIC */ #define SOF_TKN_INTEL_DMIC_DRIVER_VERSION 600 diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index 1d4685c89f932c..f9347384ecf3ad 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -336,11 +336,6 @@ static const struct sof_topology_token dai_link_tokens[] = { offsetof(struct sof_ipc_dai_config, type), 0}, }; -static const struct sof_topology_token dai_ssp_link_tokens[] = { - {SOF_TKN_DAI_SAMPLE_BITS, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, - offsetof(struct sof_ipc_dai_ssp_params, sample_valid_bits), 0}, -}; - /* scheduling */ static const struct sof_topology_token sched_tokens[] = { {SOF_TKN_SCHED_DEADLINE, SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, @@ -414,6 +409,9 @@ static const struct sof_topology_token ssp_tokens[] = { {SOF_TKN_INTEL_SSP_MCLK_ID, SND_SOC_TPLG_TUPLE_TYPE_SHORT, get_token_u16, offsetof(struct sof_ipc_dai_ssp_params, mclk_id), 0}, + {SOF_TKN_INTEL_SSP_SAMPLE_BITS, SND_SOC_TPLG_TUPLE_TYPE_WORD, + get_token_u32, + offsetof(struct sof_ipc_dai_ssp_params, sample_valid_bits), 0}, }; /* DMIC */ @@ -1473,16 +1471,6 @@ static int sof_link_ssp_load(struct snd_soc_component *scomp, int index, memset(&config->ssp, 0, sizeof(struct sof_ipc_dai_ssp_params)); config->hdr.size = size; - /* get any bespoke DAI tokens */ - ret = sof_parse_tokens(scomp, &config->ssp, dai_ssp_link_tokens, - ARRAY_SIZE(dai_ssp_link_tokens), - private->array, private->size); - if (ret != 0) { - dev_err(sdev->dev, "error: parse ssp link tokens failed %d\n", - private->size); - return ret; - } - ret = sof_parse_tokens(scomp, &config->ssp, ssp_tokens, ARRAY_SIZE(ssp_tokens), private->array, private->size);