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.
Unified · Split
| @@ -0,0 +1,65 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-only */ | ||
| 2 | /* | ||
| 3 | * Helpers for Intel SoC model detection | ||
| 4 | * | ||
| 5 | * Copyright (c) 2019, Intel Corporation. | ||
| 6 | */ | ||
| 7 | |||
| 8 | #ifndef __PLATFORM_DATA_X86_SOC_H | ||
| 9 | #define __PLATFORM_DATA_X86_SOC_H | ||
| 10 | |||
| 11 | #if IS_ENABLED(CONFIG_X86) | ||
| 12 | |||
| 13 | #include <asm/cpu_device_id.h> | ||
| 14 | #include <asm/intel-family.h> | ||
| 15 | |||
| 16 | #define SOC_INTEL_IS_CPU(soc, type) \ | ||
| 17 | static inline bool soc_intel_is_##soc(void) \ | ||
| 18 | { \ | ||
| 19 | static const struct x86_cpu_id soc##_cpu_ids[] = { \ | ||
| 20 | X86_MATCH_INTEL_FAM6_MODEL(type, NULL), \ | ||
| 21 | {} \ | ||
| 22 | }; \ | ||
| 23 | const struct x86_cpu_id *id; \ | ||
| 24 | \ | ||
| 25 | id = x86_match_cpu(soc##_cpu_ids); \ | ||
| 26 | if (id) \ | ||
| 27 | return true; \ | ||
| 28 | return false; \ | ||
| 29 | } | ||
| 30 | |||
| 31 | SOC_INTEL_IS_CPU(byt, ATOM_SILVERMONT); | ||
| 32 | SOC_INTEL_IS_CPU(cht, ATOM_AIRMONT); | ||
| 33 | SOC_INTEL_IS_CPU(apl, ATOM_GOLDMONT); | ||
| 34 | SOC_INTEL_IS_CPU(glk, ATOM_GOLDMONT_PLUS); | ||
| 35 | SOC_INTEL_IS_CPU(cml, KABYLAKE_L); | ||
| 36 | |||
| 37 | #else /* IS_ENABLED(CONFIG_X86) */ | ||
| 38 | |||
| 39 | static inline bool soc_intel_is_byt(void) | ||
| 40 | { | ||
| 41 | return false; | ||
| 42 | } | ||
| 43 | |||
| 44 | static inline bool soc_intel_is_cht(void) | ||
| 45 | { | ||
| 46 | return false; | ||
| 47 | } | ||
| 48 | |||
| 49 | static inline bool soc_intel_is_apl(void) | ||
| 50 | { | ||
| 51 | return false; | ||
| 52 | } | ||
| 53 | |||
| 54 | static inline bool soc_intel_is_glk(void) | ||
| 55 | { | ||
| 56 | return false; | ||
| 57 | } | ||
| 58 | |||
| 59 | static inline bool soc_intel_is_cml(void) | ||
| 60 | { | ||
| 61 | return false; | ||
| 62 | } | ||
| 63 | #endif /* IS_ENABLED(CONFIG_X86) */ | ||
| 64 | |||
| 65 | #endif /* __PLATFORM_DATA_X86_SOC_H */ | ||
| @@ -9,34 +9,13 @@ · 8 unmodified lines | |||
| 9 | #ifndef _SND_SOC_INTEL_QUIRKS_H | 9 | #ifndef _SND_SOC_INTEL_QUIRKS_H |
| 10 | #define _SND_SOC_INTEL_QUIRKS_H | 10 | #define _SND_SOC_INTEL_QUIRKS_H |
| 11 | 11 | ||
| 12 | #include <linux/platform_data/x86/soc.h> | ||
| 13 | |||
| 12 | #if IS_ENABLED(CONFIG_X86) | 14 | #if IS_ENABLED(CONFIG_X86) |
| 13 | 15 | ||
| 14 | #include <linux/dmi.h> | 16 | #include <linux/dmi.h> |
| 15 | #include <asm/cpu_device_id.h> | ||
| 16 | #include <asm/intel-family.h> | ||
| 17 | #include <asm/iosf_mbi.h> | 17 | #include <asm/iosf_mbi.h> |
| 18 | 18 | ||
| 19 | #define SOC_INTEL_IS_CPU(soc, type) \ | ||
| 20 | static inline bool soc_intel_is_##soc(void) \ | ||
| 21 | { \ | ||
| 22 | static const struct x86_cpu_id soc##_cpu_ids[] = { \ | ||
| 23 | X86_MATCH_INTEL_FAM6_MODEL(type, NULL), \ | ||
| 24 | {} \ | ||
| 25 | }; \ | ||
| 26 | const struct x86_cpu_id *id; \ | ||
| 27 | \ | ||
| 28 | id = x86_match_cpu(soc##_cpu_ids); \ | ||
| 29 | if (id) \ | ||
| 30 | return true; \ | ||
| 31 | return false; \ | ||
| 32 | } | ||
| 33 | |||
| 34 | SOC_INTEL_IS_CPU(byt, ATOM_SILVERMONT); | ||
| 35 | SOC_INTEL_IS_CPU(cht, ATOM_AIRMONT); | ||
| 36 | SOC_INTEL_IS_CPU(apl, ATOM_GOLDMONT); | ||
| 37 | SOC_INTEL_IS_CPU(glk, ATOM_GOLDMONT_PLUS); | ||
| 38 | SOC_INTEL_IS_CPU(cml, KABYLAKE_L); | ||
| 39 | |||
| 40 | static inline bool soc_intel_is_byt_cr(struct platform_device *pdev) | 19 | static inline bool soc_intel_is_byt_cr(struct platform_device *pdev) |
| 41 | { | 20 | { |
| 42 | /* | 21 | /* |
| @@ -114,30 +93,6 @@ static inline bool soc_intel_is_byt_cr(struct platform_device *pdev) · 71 unmodified lines | |||
| 114 | return false; | 93 | return false; |
| 115 | } | 94 | } |
| 116 | 95 | ||
| 117 | static inline bool soc_intel_is_byt(void) | ||
| 118 | { | ||
| 119 | return false; | ||
| 120 | } | ||
| 121 | |||
| 122 | static inline bool soc_intel_is_cht(void) | ||
| 123 | { | ||
| 124 | return false; | ||
| 125 | } | ||
| 126 | |||
| 127 | static inline bool soc_intel_is_apl(void) | ||
| 128 | { | ||
| 129 | return false; | ||
| 130 | } | ||
| 131 | |||
| 132 | static inline bool soc_intel_is_glk(void) | ||
| 133 | { | ||
| 134 | return false; | ||
| 135 | } | ||
| 136 | |||
| 137 | static inline bool soc_intel_is_cml(void) | ||
| 138 | { | ||
| 139 | return false; | ||
| 140 | } | ||
| 141 | #endif | 96 | #endif |
| 142 | 97 | ||
| 143 | #endif /* _SND_SOC_INTEL_QUIRKS_H */ | 98 | #endif /* _SND_SOC_INTEL_QUIRKS_H */ |