diff options
author | Zhang Peng <peng_zhang_8@nxp.com> | 2020-03-30 16:11:24 +0800 |
---|---|---|
committer | Zhang Peng <peng.zhang_8@nxp.com> | 2020-04-07 12:48:18 +0800 |
commit | 92d77a4619159332f7025dfcfd024cae462a8466 (patch) | |
tree | 8e83845ca97aa568d1bc61bb1f194baf49e0b0a4 | |
parent | d235be4b28d4fa4ff4bd5e3e21d1c692ad800762 (diff) |
MLK-23701-3 ASoc: fsl: Fill pcm_io_frames and sampling_rate
Get samplerate and consumed data from dsp when call
snd_compr_ops.pointer.
Signed-off-by: Zhang Peng <peng_zhang_8@nxp.com>
-rw-r--r-- | sound/soc/fsl/fsl_dsp_platform_compress.c | 17 | ||||
-rw-r--r-- | sound/soc/fsl/fsl_dsp_xaf_api.h | 3 |
2 files changed, 17 insertions, 3 deletions
diff --git a/sound/soc/fsl/fsl_dsp_platform_compress.c b/sound/soc/fsl/fsl_dsp_platform_compress.c index e6f95a065801..e5a4644074d2 100644 --- a/sound/soc/fsl/fsl_dsp_platform_compress.c +++ b/sound/soc/fsl/fsl_dsp_platform_compress.c @@ -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; } diff --git a/sound/soc/fsl/fsl_dsp_xaf_api.h b/sound/soc/fsl/fsl_dsp_xaf_api.h index 2367b6c9c34d..09aa5c043e1f 100644 --- a/sound/soc/fsl/fsl_dsp_xaf_api.h +++ b/sound/soc/fsl/fsl_dsp_xaf_api.h @@ -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 */ |