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

From: Pierre-Louis Bossart
Date: Wed Aug 26 2020 - 10:40:33 EST



- 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.

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).

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)?