[alsa-devel] [RFC PATCH] ASoC: Intel: use common helpers to detect CPUs

Amadeusz Sławiński amadeuszx.slawinski at linux.intel.com
Tue Jun 18 13:02:06 CEST 2019


On Mon, 17 Jun 2019 19:18:27 +0300
Andy Shevchenko <andriy.shevchenko at linux.intel.com> wrote:

> On Mon, Jun 17, 2019 at 05:31:53PM +0200, Pierre-Louis Bossart wrote:
> > On 6/17/19 4:47 PM, Mark Brown wrote:  
> > > On Tue, May 28, 2019 at 03:02:55PM -0500, Pierre-Louis Bossart
> > > wrote: 
> > > > 2. is there a better way to do this for all Intel chips or do
> > > > we keep this in sound/? Andy?  
> 
> It's better to discuss with x86 maintainers.
> 
> > > ARM has platform detection stuff in the architecture code,
> > > something similar seems sensible for x86?  
> > 
> > Well yes, we already have x86_match_cpu() but that won't work with
> > COMPILE_TEST (asm/ headers don't exist) and this leads to
> > duplication of code. All we really need here is a yeah/nay answer
> > from a help that hides those details away.  
> 
> I don't see much advantage here. Without specific driver data it will
> be degraded to something like:
> 
> 	if (bootcpu.model == INTEL_CPU_...)
> 		...
> 
> with slight exception to heterogeneous SoCs.
> 
> In order to be compile tested we might introduce a header under
> include/platform_data/x86 with these inliners like:
> 
> static inline bool is_x86_model_XX(void)
> {
> 	return bootcpu.model == XX; // it might be done in more
> generic way? }
> 

You might also want to look at other drivers that do some kind of
platform detection.

There is:
tools/power/x86/turbostat/turbostat.c
which has few is_xxx() functions, and:
drivers/gpu/drm/i915/i915_drv.h
which has quite a lot of IS_XXX macros, although they are used to
detect PCI VGA devices, but maybe some code could be shared, with
separate device specific ids.

Amadeusz


More information about the Alsa-devel mailing list