phys_addr_t phys;
unsigned int pcm_size;
unsigned int pcm_count;
- unsigned int pcm_irq_pos; /* IRQ position */
unsigned int periods;
uint64_t bytes_sent;
uint64_t bytes_received;
prtd->state = Q6ASM_STREAM_STOPPED;
break;
case ASM_CLIENT_EVENT_DATA_WRITE_DONE: {
- prtd->pcm_irq_pos += prtd->pcm_count;
snd_pcm_period_elapsed(substream);
break;
}
case ASM_CLIENT_EVENT_DATA_READ_DONE:
- prtd->pcm_irq_pos += prtd->pcm_count;
snd_pcm_period_elapsed(substream);
if (prtd->state == Q6ASM_STREAM_RUNNING)
q6asm_read(prtd->audio_client, prtd->stream_id);
}
prtd->pcm_count = snd_pcm_lib_period_bytes(substream);
- prtd->pcm_irq_pos = 0;
/* rate and channels are sent to audio driver */
if (prtd->state == Q6ASM_STREAM_RUNNING) {
/* clear the previous setup if any */
struct snd_pcm_runtime *runtime = substream->runtime;
struct q6asm_dai_rtd *prtd = runtime->private_data;
+ snd_pcm_uframes_t ptr;
- if (prtd->pcm_irq_pos >= prtd->pcm_size)
- prtd->pcm_irq_pos = 0;
+ ptr = q6asm_get_hw_pointer(prtd->audio_client, substream->stream) * runtime->period_size;
+ if (ptr)
+ return ptr - 1;
- return bytes_to_frames(runtime, (prtd->pcm_irq_pos));
+ return 0;
}
static int q6asm_dai_hw_params(struct snd_soc_component *component,