static snd_pcm_uframes_t sst_byt_pcm_pointer(struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_pcm_runtime *runtime = substream->runtime; struct sst_byt_priv_data *pdata = snd_soc_platform_get_drvdata(rtd->platform); struct sst_byt_pcm_data *pcm_data = snd_soc_pcm_get_drvdata(rtd); struct sst_byt *byt = pdata->byt; snd_pcm_uframes_t offset; int pos; pos = sst_byt_get_dsp_position(byt, pcm_data->stream, snd_pcm_lib_buffer_bytes(substream)); offset = bytes_to_frames(runtime, pos); dev_dbg(rtd->dev, "PCM: DMA pointer %zu bytes\n", frames_to_bytes(runtime, (u32)offset)); return offset; }
static u32 byt_notify_pointer(struct sst_byt_stream *stream, void *data) { struct sst_byt_pcm_data *pcm_data = data; struct snd_pcm_substream *substream = pcm_data->substream; struct snd_pcm_runtime *runtime = substream->runtime; struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); struct sst_byt_priv_data *pdata = snd_soc_component_get_drvdata(component); struct sst_byt *byt = pdata->byt; u32 pos, hw_pos; hw_pos = sst_byt_get_dsp_position(byt, pcm_data->stream, snd_pcm_lib_buffer_bytes(substream)); pcm_data->hw_ptr = hw_pos; pos = frames_to_bytes(runtime, (runtime->control->appl_ptr % runtime->buffer_size)); dev_dbg(rtd->dev, "PCM: App/DMA pointer %u/%u bytes\n", pos, hw_pos); snd_pcm_period_elapsed(substream); return pos; }