Skip to contentSkip to conversation

Changing the order of trigger in soc_pcm_trigger

ASoC Nobin Mathew 2 participants 3 messages Jun 6, 2007

lore
Share & tools
lore
#0 lore raw

Liam,

I have one suggestion.

Can we use this

if (rtd->codec_dai->ops.trigger) {
		ret = rtd->codec_dai->ops.trigger(substream, cmd);
		if (ret < 0)
			return ret;
	}
if (rtd->cpu_dai->ops.trigger) {
	ret = rtd->cpu_dai->ops.trigger(substream, cmd);
	if (ret < 0)
		return ret;
}
if (platform->pcm_ops->trigger) {
	ret = platform->pcm_ops->trigger(substream, cmd);
	if (ret < 0)
		return ret;
}

Instead of

if (rtd->codec_dai->ops.trigger) {
		ret = rtd->codec_dai->ops.trigger(substream, cmd);
		if (ret < 0)
			return ret;
	}
if (platform->pcm_ops->trigger) {
	ret = platform->pcm_ops->trigger(substream, cmd);
	if (ret < 0)
		return ret;
}
if (rtd->cpu_dai->ops.trigger) {
	ret = rtd->cpu_dai->ops.trigger(substream, cmd);
	if (ret < 0)
		return ret;
}

That means trigger the Cpu before pcm. Because most of the controllers needs to be initialized and triggered before external DMA is triggered.

Correct me if i am going wrong.

This was causing so many problems in my hardware.

Nobin Mathew

#1 lore raw
Quoted 44 lines · Nobin Mathew

Liam,

I have one suggestion.

Can we use this

if (rtd->codec_dai->ops.trigger) {
		ret = rtd->codec_dai->ops.trigger(substream, cmd);
		if (ret < 0)
			return ret;
	}
if (rtd->cpu_dai->ops.trigger) {
	ret = rtd->cpu_dai->ops.trigger(substream, cmd);
	if (ret < 0)
		return ret;
}
if (platform->pcm_ops->trigger) {
	ret = platform->pcm_ops->trigger(substream, cmd);
	if (ret < 0)
		return ret;
}

Instead of

if (rtd->codec_dai->ops.trigger) {
		ret = rtd->codec_dai->ops.trigger(substream, cmd);
		if (ret < 0)
			return ret;
	}
if (platform->pcm_ops->trigger) {
	ret = platform->pcm_ops->trigger(substream, cmd);
	if (ret < 0)
		return ret;
}
if (rtd->cpu_dai->ops.trigger) {
	ret = rtd->cpu_dai->ops.trigger(substream, cmd);
	if (ret < 0)
		return ret;
}
Quoted 5 lines

That means trigger the Cpu before pcm. Because most of the controllers needs to be initialized and triggered before external DMA is triggered.

Correct me if i am going wrong.

The current ordering allows the DMA to trigger before the I2S/PCM controller triggers. This means that the DMA should be ready before the controller generates any FIFO DMA interrupt requests. Fwiw, this seems to work well on most machines atm.

Quoted 1 line

This was causing so many problems in my hardware.

What sort of problems. Underruns ? What does your trigger do in each case ?

Is it possible to set some of your controller up in prepare() and then hit it's enable bit in trigger ?

Liam

#2 lore raw
In reply to Nobin Mathew

I feel i am wrong because as soon as controller is triggered it will request for data from DMA.
So this is my controller implementation problem.

Quoted 54 lines · Nobin Mathew

Liam,

I have one suggestion.

Can we use this

if (rtd->codec_dai->ops.trigger) {
                ret = rtd->codec_dai->ops.trigger(substream, cmd);
                if (ret < 0)
                        return ret;
        }
if (rtd->cpu_dai->ops.trigger) {
        ret = rtd->cpu_dai->ops.trigger(substream, cmd);
        if (ret < 0)
                return ret;
}
if (platform->pcm_ops->trigger) {
        ret = platform->pcm_ops->trigger(substream, cmd);
        if (ret < 0)
                return ret;
}

Instead of

if (rtd->codec_dai->ops.trigger) {
                ret = rtd->codec_dai->ops.trigger(substream, cmd);
                if (ret < 0)
                        return ret;
        }
if (platform->pcm_ops->trigger) {
        ret = platform->pcm_ops->trigger(substream, cmd);
        if (ret < 0)
                return ret;
}
if (rtd->cpu_dai->ops.trigger) {
        ret = rtd->cpu_dai->ops.trigger(substream, cmd);
        if (ret < 0)
                return ret;
}

That means trigger the Cpu before pcm. Because most of the controllers needs to be initialized and triggered before external DMA is triggered.

Correct me if i am going wrong.

This was causing so many problems in my hardware.

Nobin Mathew