On Mon, Oct 12, 2020 at 02:37:45PM +0100, Mark Brown wrote: > On Fri, Oct 09, 2020 at 01:31:24PM +0300, Andy Shevchenko wrote: > > > What is the best way for individual ASoC drivers to be sure that at load time > > they have or have not DMA resources available? > > > Now, seems the approach is to check dma-names property present and thus, try to > > switch to DMA mode, otherwise PIO. But this seems to me a bit fragile. Why ASoC > > core can't simple recognize DMA resources as optional (for the drivers that > > want to know if they available or not)? > > I'm not sure what you mean by "recognize DMA resources as optional" > here? At present drivers that think something might not have appeared > should go through the resources and check them individually, anything > that hard errored won't be there. For example, when the board supports PIO and DMA mode and during the probe time it wants to check which mode is desired (by means of DT references or alike). Currently those drivers need to do something like: if (of_property_is_present("dma-names")) ret = try DMA mode; else ret = try PIO mode; but this seems to me a bit stricter than needed. What if DMA mode fails, shall we fail the probe of the driver? If ASoC supports optional DMA resources, above can be simplified to something like: ret = try DMA mode; if (ret != DMA mode ok) ret = try PIO mode; which makes OF dependent parts gone along with relying on the properties rather than real resource availability. -- With Best Regards, Andy Shevchenko