static snd_pcm_uframes_t bf5xx_pcm_pointer(struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_pcm_runtime *runtime = substream->runtime; struct sport_device *sport = runtime->private_data; unsigned int diff; snd_pcm_uframes_t frames; struct bf5xx_i2s_pcm_data *dma_data; dma_data = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream); pr_debug("%s enter\n", __func__); if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { diff = sport_curr_offset_tx(sport); } else { diff = sport_curr_offset_rx(sport); } /* * TX at least can report one frame beyond the end of the * buffer if we hit the wraparound case - clamp to within the * buffer as the ALSA APIs require. */ if (diff == snd_pcm_lib_buffer_bytes(substream)) diff = 0; frames = bytes_to_frames(substream->runtime, diff); if (dma_data->tdm_mode) frames = frames * runtime->channels / 8; return frames; }
static snd_pcm_uframes_t bf5xx_pcm_pointer(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; struct sport_device *sport = runtime->private_data; unsigned int diff; snd_pcm_uframes_t frames; if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { diff = sport_curr_offset_tx(sport); frames = diff / (8*4); /* 32 bytes per frame */ } else { diff = sport_curr_offset_rx(sport); frames = diff / (8*4); } return frames; }
static snd_pcm_uframes_t bf5xx_pcm_pointer(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; struct sport_device *sport = runtime->private_data; unsigned int diff; snd_pcm_uframes_t frames; pr_debug("%s enter\n", __func__); if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { diff = sport_curr_offset_tx(sport); } else { diff = sport_curr_offset_rx(sport); } if (diff == snd_pcm_lib_buffer_bytes(substream)) diff = 0; frames = bytes_to_frames(substream->runtime, diff); return frames; }
static snd_pcm_uframes_t bf5xx_pcm_pointer(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime = substream->runtime; struct sport_device *sport = runtime->private_data; unsigned int curr; #if defined(CONFIG_SND_BF5XX_MMAP_SUPPORT) if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) curr = sport->tx_delay_pos; else curr = sport->rx_pos; #else if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) curr = sport_curr_offset_tx(sport) / sizeof(struct ac97_frame); else curr = sport_curr_offset_rx(sport) / sizeof(struct ac97_frame); #endif return curr; }
static unsigned int sport_tx_curr_frag(struct sport_device *sport) { return sport->tx_curr_frag = sport_curr_offset_tx(sport) / sport->tx_fragsize; }