Skip to content

Commit

Permalink
MLK-23701-3 ASoc: fsl: Fill pcm_io_frames and sampling_rate
Browse files Browse the repository at this point in the history
Get samplerate and consumed data from dsp when call
snd_compr_ops.pointer.

Signed-off-by: Zhang Peng <[email protected]>
  • Loading branch information
Zhang Peng authored and Zhang Peng committed Apr 7, 2020
1 parent d235be4 commit 92d77a4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
17 changes: 15 additions & 2 deletions sound/soc/fsl/fsl_dsp_platform_compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,13 +350,26 @@ static int dsp_platform_compr_pointer(struct snd_compr_stream *cstream,
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, FSL_DSP_COMP_NAME);
struct fsl_dsp *dsp_priv = snd_soc_component_get_drvdata(component);
struct dsp_data *drv = &dsp_priv->dsp_data;
struct xf_get_param_msg g_param[2];
int ret;

g_param[0].id = XA_RENDERER_CONFIG_PARAM_SAMPLE_RATE;
g_param[1].id = XA_RENDERER_CONFIG_PARAM_CONSUMED;
ret = xaf_comp_get_config(drv->client, &drv->component[1], 2, &g_param);
if (ret) {
dev_err(component->dev,
"get param[cmd:0x%x|val:0x%x] error, err = %d\n",
g_param[0].id, g_param[0].mixData.value, ret);
goto out;
}

tstamp->copied_total = drv->client->input_bytes;
tstamp->byte_offset = drv->client->input_bytes;
tstamp->pcm_frames = 0x900;
tstamp->pcm_io_frames = 0,
tstamp->sampling_rate = 48000;
tstamp->pcm_io_frames = g_param[0].mixData.value,
tstamp->sampling_rate = g_param[1].mixData.value;

out:
return 0;
}

Expand Down
3 changes: 2 additions & 1 deletion sound/soc/fsl/fsl_dsp_xaf_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ enum xa_config_param_renderer {
XA_RENDERER_CONFIG_PARAM_CHANNELS = 3,
XA_RENDERER_CONFIG_PARAM_SAMPLE_RATE = 4,
XA_RENDERER_CONFIG_PARAM_FRAME_SIZE = 5,
XA_RENDERER_CONFIG_PARAM_NUM = 6,
XA_RENDERER_CONFIG_PARAM_CONSUMED = 6,
XA_RENDERER_CONFIG_PARAM_NUM = 7,
};

#endif /* FSL_DSP_XAF_API_H */

0 comments on commit 92d77a4

Please sign in to comment.