Re: [PATCH 07/11] soundwire: intel: Only call sdw stream APIs for the first cpu_dai

From: Vinod Koul
Date: Fri Aug 28 2020 - 03:49:27 EST


On 26-08-20, 09:35, Pierre-Louis Bossart wrote:
>
> > > - ret = sdw_prepare_stream(dma->stream);
> > > + /*
> > > + * All cpu dais belong to a stream. To ensure sdw_prepare_stream
> > > + * is called once per stream, we should call it only when
> > > + * dai = first_cpu_dai.
> > > + */
> > > + if (first_cpu_dai == dai)
> > > + ret = sdw_prepare_stream(dma->stream);
> >
> > Hmmm why not use the one place which is unique in the card to call this,
> > hint machine dais are only called once.
>
> we are already calling directly sdw_startup_stream() and
> sdw_shutdown_stream() from the machine driver.
>
> We could call sdw_stream_enable() in the dailink .trigger as well, since it
> only calls the stream API.

Correct :)

> However for both .prepare() and .hw_free() there are a set of dai-level
> configurations using static functions defined only in intel.c, and I don't
> think we can move the code to the machine driver, or split the
> prepare/hw_free in two (dailink and dai operations).

Cant they be exported and continue to call those apis

> I am not against your idea, I am not sure if it can be done.
>
> Would you be ok to merge this as a first step and let us work on an
> optimization later (which would require ASoC/SoundWire synchronization)?

The problem is that we add one flag then another and it does become an
issue eventually, better to do the right thing now than later.

--
~Vinod