static snd_pcm_uframes_t rsnd_pointer(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; struct snd_soc_dai *dai = rsnd_substream_to_dai(substream); struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai); struct rsnd_dai_stream *io = rsnd_rdai_to_io(rdai, substream); return bytes_to_frames(runtime, io->byte_pos); }
static int rsnd_soc_dai_trigger(struct snd_pcm_substream *substream, int cmd, struct snd_soc_dai *dai) { struct rsnd_priv *priv = snd_soc_dai_get_drvdata(dai); struct rsnd_dai *rdai = rsnd_dai_to_rdai(dai); struct rsnd_dai_stream *io = rsnd_rdai_to_io(rdai, substream); int ssi_id = rsnd_mod_id(rsnd_io_to_mod_ssi(io)); int ret; unsigned long flags; rsnd_lock(priv, flags); switch (cmd) { case SNDRV_PCM_TRIGGER_START: ret = rsnd_dai_stream_init(io, substream); if (ret < 0) goto dai_trigger_end; ret = rsnd_platform_call(priv, dai, start, ssi_id); if (ret < 0) goto dai_trigger_end; ret = rsnd_dai_call(init, io, priv); if (ret < 0) goto dai_trigger_end; ret = rsnd_dai_call(start, io, priv); if (ret < 0) goto dai_trigger_end; break; case SNDRV_PCM_TRIGGER_STOP: ret = rsnd_dai_call(stop, io, priv); if (ret < 0) goto dai_trigger_end; ret = rsnd_dai_call(quit, io, priv); if (ret < 0) goto dai_trigger_end; ret = rsnd_platform_call(priv, dai, stop, ssi_id); if (ret < 0) goto dai_trigger_end; break; default: ret = -EINVAL; } dai_trigger_end: rsnd_unlock(priv, flags); return ret; }