ASoC: SOF: Introduce optional callback to configure stream data offset
Each running audio stream's data have distinct start offset within the stream mailbox area from/to where the host can read/write. Instead of using the struct sof_ipc_pcm_params_reply to configure this offset, add an optional callback which is IPC agnostic. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com> Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/20220310042720.976809-5-ranjani.sridharan@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
d1b1146fc7
commit
757ce8103c
|
@ -476,6 +476,19 @@ snd_sof_ipc_pcm_params(struct snd_sof_dev *sdev,
|
||||||
return sof_ops(sdev)->ipc_pcm_params(sdev, substream, reply);
|
return sof_ops(sdev)->ipc_pcm_params(sdev, substream, reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* host side configuration of the stream's data offset in stream mailbox area */
|
||||||
|
static inline int
|
||||||
|
snd_sof_set_stream_data_offset(struct snd_sof_dev *sdev,
|
||||||
|
struct snd_pcm_substream *substream,
|
||||||
|
size_t posn_offset)
|
||||||
|
{
|
||||||
|
if (sof_ops(sdev) && sof_ops(sdev)->set_stream_data_offset)
|
||||||
|
return sof_ops(sdev)->set_stream_data_offset(sdev, substream,
|
||||||
|
posn_offset);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* host stream pointer */
|
/* host stream pointer */
|
||||||
static inline snd_pcm_uframes_t
|
static inline snd_pcm_uframes_t
|
||||||
snd_sof_pcm_platform_pointer(struct snd_sof_dev *sdev,
|
snd_sof_pcm_platform_pointer(struct snd_sof_dev *sdev,
|
||||||
|
|
|
@ -276,6 +276,14 @@ static int sof_pcm_hw_params(struct snd_soc_component *component,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = snd_sof_set_stream_data_offset(sdev, substream,
|
||||||
|
ipc_params_reply.posn_offset);
|
||||||
|
if (ret < 0) {
|
||||||
|
dev_err(component->dev, "%s: invalid stream data offset for PCM %d\n",
|
||||||
|
__func__, spcm->pcm.pcm_id);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
spcm->prepared[substream->stream] = true;
|
spcm->prepared[substream->stream] = true;
|
||||||
|
|
||||||
/* save pcm hw_params */
|
/* save pcm hw_params */
|
||||||
|
|
|
@ -226,6 +226,11 @@ struct snd_sof_dsp_ops {
|
||||||
struct snd_pcm_substream *substream,
|
struct snd_pcm_substream *substream,
|
||||||
const struct sof_ipc_pcm_params_reply *reply); /* mandatory */
|
const struct sof_ipc_pcm_params_reply *reply); /* mandatory */
|
||||||
|
|
||||||
|
/* host side configuration of the stream's data offset in stream mailbox area */
|
||||||
|
int (*set_stream_data_offset)(struct snd_sof_dev *sdev,
|
||||||
|
struct snd_pcm_substream *substream,
|
||||||
|
size_t posn_offset); /* optional */
|
||||||
|
|
||||||
/* pre/post firmware run */
|
/* pre/post firmware run */
|
||||||
int (*pre_fw_run)(struct snd_sof_dev *sof_dev); /* optional */
|
int (*pre_fw_run)(struct snd_sof_dev *sof_dev); /* optional */
|
||||||
int (*post_fw_run)(struct snd_sof_dev *sof_dev); /* optional */
|
int (*post_fw_run)(struct snd_sof_dev *sof_dev); /* optional */
|
||||||
|
|
Loading…
Reference in New Issue