On Thu, Oct 15, 2020 at 03:59:26PM +0800, Cheng-yi Chiang wrote:
On Tue, Oct 13, 2020 at 6:36 PM Srinivas Kandagatla
+properties:
- compatible:
- const: qcom,sc7180-sndcard-rt5682-m98357-1mic
This information can come from the dai link description itself, why should compatible string have this information?
I think dailink description is not enough to specify everything machine driver needs to know. E.g. there is a variation where there are front mic and rear mic. We need to tell the machine driver about it so it can create proper widget, route, and controls.
That sounds like something that could be better described with properties (including for example the existing bindings used for setting up things like analogue outputs and DAPM routes)?
The codec combination also matters. There will be a variation where rt5682 is replaced with adau7002 for dmic. Although machine driver can derive some information by looking at dailink, I think specifying it explicitly in the compatible string is easier to tell what machine driver should do, e.g. setting PLL related to rt5682 or not.
These feel more like things that fit with compatible, though please take a look at Morimoto-san's (CCed) work on generic sound cards for more complex devices:
https://lore.kernel.org/alsa-devel/87imbeybq5.wl-kuninori.morimoto.gx@renesa...
This is not yet implemented but it'd be good to make sure that the Qualcomm systems can be handled too in future.
You can see widget, route, controls are used according to the configuration. The alternative approach is to check whether "dmic-gpio" property exists to decide adding these stuff or not. But it makes the intent less easier to understand.
OTOH if you have lots of compatibles then it can get hard to work out exactly which one corresponds to a given board.