Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSP related changes #7

Merged
merged 4 commits into from
Jun 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/uapi/sound/sof-ipc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
3 changes: 2 additions & 1 deletion include/uapi/sound/sof-topology.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -68,6 +67,8 @@
#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
#define SOF_TKN_INTEL_SSP_SAMPLE_BITS 504

/* DMIC */
#define SOF_TKN_INTEL_DMIC_DRIVER_VERSION 600
Expand Down
27 changes: 9 additions & 18 deletions sound/soc/sof/topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -411,6 +406,12 @@ 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},
{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 */
Expand Down Expand Up @@ -1470,17 +1471,7 @@ 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_tokens,
ret = sof_parse_tokens(scomp, &config->ssp, ssp_tokens,
ARRAY_SIZE(ssp_tokens), private->array,
private->size);
if (ret != 0) {
Expand All @@ -1498,11 +1489,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,
Expand Down