On Wed, Jun 23, 2021 at 12:23 AM Mark Brown broonie@kernel.org wrote:
On Wed, Jun 23, 2021 at 12:10:53AM +0800, Judy Hsiao wrote:
Thanks for your review comment. This patch is used to support multi-channel where we want one codec to control the only GPIO shared by 4 amps.
So you've got 4 instances of the same CODEC? Then I'd expect to see those all individually represented in DT. Or if there's a single physical CODEC then I'm not sure what the dummies are for?
In snd_soc_runtime_calc_hw(), by creating dummy codecs that share a DAI link with a real codec:
- The min/ max channel of CPU DAI will be directly adopted.
- The formats and sample rates of the DAI link will be determined
by the real codec unless the real codec supports the rate and format that do not intersect with the rate and format of snd-soc-dummy. That is the reason why we don’t specify the format and sample rates of the dummy codec with the real codec determining the properties .
It's not clear to me why you'd not just describe the actual CODECs here rather than using a dummy CODEC, the fact that the dummy CODEC is doing what you want is just an accident of the implementation rather than a description of the hardware.
Thanks for your inputs. Specifying four codes for the multi-channel works fine. We have not thought of specifying four codes before as we want to avoid loading the codec driver multiple times, but actually loading the snd-soc-dummy just has the similar cost. By specifying four codes, the dtsi file describes the real hardware schematic. I will specify four codec in the dtsi file to support the four channel use case and this snd-soc-dummy patch is not needed. Thanks for the discussion!