History

ASoC: Intel: Move soc_intel_is_foo() helpers to a generic header

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.

Hans de Goede committed 5 years ago

Commit cd45c9b1 parent fd96e352 files · +68 −48Browse files

Showing the changes to include/linux/platform_data (1 of 2 files). Show all

Unified · Split

include/linux/platform_data/x86/soc.h+65−0
@@ -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) \
17static 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
31SOC_INTEL_IS_CPU(byt, ATOM_SILVERMONT);
32SOC_INTEL_IS_CPU(cht, ATOM_AIRMONT);
33SOC_INTEL_IS_CPU(apl, ATOM_GOLDMONT);
34SOC_INTEL_IS_CPU(glk, ATOM_GOLDMONT_PLUS);
35SOC_INTEL_IS_CPU(cml, KABYLAKE_L);
36
37#else /* IS_ENABLED(CONFIG_X86) */
38
39static inline bool soc_intel_is_byt(void)
40{
41 return false;
42}
43
44static inline bool soc_intel_is_cht(void)
45{
46 return false;
47}
48
49static inline bool soc_intel_is_apl(void)
50{
51 return false;
52}
53
54static inline bool soc_intel_is_glk(void)
55{
56 return false;
57}
58
59static 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 */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t