ASoC: Intel: Move soc_intel_is_foo() helpers to a generic header
[ Upstream commit cd45c9bf8b43cd387e167cf166ae5c517f56d658 ] The soc_intel_is_foo() helpers from sound/soc/intel/common/soc-intel-quirks.h are useful outside of the sound subsystem too. Move these to include/linux/platform_data/x86/soc.h, so that other code can use them too. Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Acked-by: Mark Brown <broonie@kernel.org> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20211018143324.296961-2-hdegoede@redhat.com Stable-dep-of: 7dd692217b86 ("ASoC: SOF: sof-pci-dev: Fix community key quirk detection") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
8e52b19d92
commit
6368a32d26
65
include/linux/platform_data/x86/soc.h
Normal file
65
include/linux/platform_data/x86/soc.h
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
/*
|
||||||
|
* Helpers for Intel SoC model detection
|
||||||
|
*
|
||||||
|
* Copyright (c) 2019, Intel Corporation.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __PLATFORM_DATA_X86_SOC_H
|
||||||
|
#define __PLATFORM_DATA_X86_SOC_H
|
||||||
|
|
||||||
|
#if IS_ENABLED(CONFIG_X86)
|
||||||
|
|
||||||
|
#include <asm/cpu_device_id.h>
|
||||||
|
#include <asm/intel-family.h>
|
||||||
|
|
||||||
|
#define SOC_INTEL_IS_CPU(soc, type) \
|
||||||
|
static inline bool soc_intel_is_##soc(void) \
|
||||||
|
{ \
|
||||||
|
static const struct x86_cpu_id soc##_cpu_ids[] = { \
|
||||||
|
X86_MATCH_INTEL_FAM6_MODEL(type, NULL), \
|
||||||
|
{} \
|
||||||
|
}; \
|
||||||
|
const struct x86_cpu_id *id; \
|
||||||
|
\
|
||||||
|
id = x86_match_cpu(soc##_cpu_ids); \
|
||||||
|
if (id) \
|
||||||
|
return true; \
|
||||||
|
return false; \
|
||||||
|
}
|
||||||
|
|
||||||
|
SOC_INTEL_IS_CPU(byt, ATOM_SILVERMONT);
|
||||||
|
SOC_INTEL_IS_CPU(cht, ATOM_AIRMONT);
|
||||||
|
SOC_INTEL_IS_CPU(apl, ATOM_GOLDMONT);
|
||||||
|
SOC_INTEL_IS_CPU(glk, ATOM_GOLDMONT_PLUS);
|
||||||
|
SOC_INTEL_IS_CPU(cml, KABYLAKE_L);
|
||||||
|
|
||||||
|
#else /* IS_ENABLED(CONFIG_X86) */
|
||||||
|
|
||||||
|
static inline bool soc_intel_is_byt(void)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool soc_intel_is_cht(void)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool soc_intel_is_apl(void)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool soc_intel_is_glk(void)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool soc_intel_is_cml(void)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif /* IS_ENABLED(CONFIG_X86) */
|
||||||
|
|
||||||
|
#endif /* __PLATFORM_DATA_X86_SOC_H */
|
@@ -9,34 +9,13 @@
|
|||||||
#ifndef _SND_SOC_INTEL_QUIRKS_H
|
#ifndef _SND_SOC_INTEL_QUIRKS_H
|
||||||
#define _SND_SOC_INTEL_QUIRKS_H
|
#define _SND_SOC_INTEL_QUIRKS_H
|
||||||
|
|
||||||
|
#include <linux/platform_data/x86/soc.h>
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_X86)
|
#if IS_ENABLED(CONFIG_X86)
|
||||||
|
|
||||||
#include <linux/dmi.h>
|
#include <linux/dmi.h>
|
||||||
#include <asm/cpu_device_id.h>
|
|
||||||
#include <asm/intel-family.h>
|
|
||||||
#include <asm/iosf_mbi.h>
|
#include <asm/iosf_mbi.h>
|
||||||
|
|
||||||
#define SOC_INTEL_IS_CPU(soc, type) \
|
|
||||||
static inline bool soc_intel_is_##soc(void) \
|
|
||||||
{ \
|
|
||||||
static const struct x86_cpu_id soc##_cpu_ids[] = { \
|
|
||||||
X86_MATCH_INTEL_FAM6_MODEL(type, NULL), \
|
|
||||||
{} \
|
|
||||||
}; \
|
|
||||||
const struct x86_cpu_id *id; \
|
|
||||||
\
|
|
||||||
id = x86_match_cpu(soc##_cpu_ids); \
|
|
||||||
if (id) \
|
|
||||||
return true; \
|
|
||||||
return false; \
|
|
||||||
}
|
|
||||||
|
|
||||||
SOC_INTEL_IS_CPU(byt, ATOM_SILVERMONT);
|
|
||||||
SOC_INTEL_IS_CPU(cht, ATOM_AIRMONT);
|
|
||||||
SOC_INTEL_IS_CPU(apl, ATOM_GOLDMONT);
|
|
||||||
SOC_INTEL_IS_CPU(glk, ATOM_GOLDMONT_PLUS);
|
|
||||||
SOC_INTEL_IS_CPU(cml, KABYLAKE_L);
|
|
||||||
|
|
||||||
static inline bool soc_intel_is_byt_cr(struct platform_device *pdev)
|
static inline bool soc_intel_is_byt_cr(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@@ -114,30 +93,6 @@ static inline bool soc_intel_is_byt_cr(struct platform_device *pdev)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool soc_intel_is_byt(void)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool soc_intel_is_cht(void)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool soc_intel_is_apl(void)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool soc_intel_is_glk(void)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool soc_intel_is_cml(void)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _SND_SOC_INTEL_QUIRKS_H */
|
#endif /* _SND_SOC_INTEL_QUIRKS_H */
|
||||||
|
Reference in New Issue
Block a user