static snd_pcm_uframes_t wmt_pdm_pcm_pointer(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; struct audio_stream_a *prtd = runtime->private_data; int stream_id = substream->pstr->stream; struct audio_stream_a *s = &prtd[stream_id]; dma_addr_t ptr; snd_pcm_uframes_t offset = 0; //DBG_DETAIL(); ptr = wmt_get_dma_pos(s->dmach); /* if (((runtime->channels == 1) && (runtime->format == SNDRV_PCM_FORMAT_S16_LE)) || ((runtime->channels == 2) && (runtime->format == SNDRV_PCM_FORMAT_U8))) { offset = bytes_to_frames(runtime, (ptr - dump_buf[stream_id].addr) >> 1); } else if ((runtime->channels == 1) && (runtime->format == SNDRV_PCM_FORMAT_U8)) { offset = bytes_to_frames(runtime, (ptr - dump_buf[stream_id].addr) >> 2); } else if ((runtime->channels == 2) && (runtime->format == SNDRV_PCM_FORMAT_FLOAT)) { offset = bytes_to_frames(runtime, (ptr - dump_buf[stream_id].addr) << 1); } else if ((runtime->channels == 1) && (runtime->format == SNDRV_PCM_FORMAT_FLOAT)) { offset = bytes_to_frames(runtime, ptr - dump_buf[stream_id].addr); } else offset = bytes_to_frames(runtime, ptr - runtime->dma_addr); */ if (((runtime->channels == 2) && (runtime->format == SNDRV_PCM_FORMAT_S16_LE)) || ((runtime->channels == 1) && (runtime->format == SNDRV_PCM_FORMAT_S16_LE))) { offset = bytes_to_frames(runtime, ptr - runtime->dma_addr); } if (offset >= runtime->buffer_size) offset = 0; spin_lock(&s->dma_lock); if (s->periods > 0 && s->periods < 2) { if (stream_id == SNDRV_PCM_STREAM_PLAYBACK) { if (snd_pcm_playback_hw_avail(runtime) >= 2 * runtime->period_size) audio_process_dma(s); } else { if (snd_pcm_capture_hw_avail(runtime) >= 2* runtime->period_size) audio_process_dma(s); } } spin_unlock(&s->dma_lock); //DPRINTK("offset = %x", (unsigned int)offset); return offset; }
static snd_pcm_uframes_t wmt_pcm_pointer(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; struct audio_stream_a *prtd = runtime->private_data; int stream_id = substream->pstr->stream; struct audio_stream_a *s = &prtd[stream_id]; dma_addr_t ptr; snd_pcm_uframes_t offset = 0; //DBG_DETAIL(); ptr = wmt_get_dma_pos(s->dmach); #ifdef CONFIG_SND_WMT_SOC_I2S if (!strcmp(wmt_dai_name, "i2s")) { if (((runtime->channels == 1) && (runtime->format == SNDRV_PCM_FORMAT_S16_LE)) || ((runtime->channels == 2) && (runtime->format == SNDRV_PCM_FORMAT_U8))) { offset = bytes_to_frames(runtime, (ptr - dump_buf[stream_id].addr) >> 1); } else if ((runtime->channels == 1) && (runtime->format == SNDRV_PCM_FORMAT_U8)) {