From: Hans de Goede <hdegoede@redhat.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Mark Gross <markgross@kernel.org>,
Andy Shevchenko <andy@infradead.org>,
Cezary Rojewski <cezary.rojewski@intel.com>,
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>
Cc: Hans de Goede <hdegoede@redhat.com>,
linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org,
alsa-devel@alsa-project.org,
Andy Shevchenko <andy.shevchenko@gmail.com>
Subject: [PATCH 1/3] ASoC: Intel: Move soc_intel_is_foo() helpers to a generic header
Date: Mon, 18 Oct 2021 16:33:22 +0200 [thread overview]
Message-ID: <20211018143324.296961-2-hdegoede@redhat.com> (raw)
In-Reply-To: <20211018143324.296961-1-hdegoede@redhat.com>
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>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
include/linux/platform_data/x86/soc.h | 65 +++++++++++++++++++++++
sound/soc/intel/common/soc-intel-quirks.h | 51 ++----------------
2 files changed, 68 insertions(+), 48 deletions(-)
create mode 100644 include/linux/platform_data/x86/soc.h
diff --git a/include/linux/platform_data/x86/soc.h b/include/linux/platform_data/x86/soc.h
new file mode 100644
index 000000000000..8d710834e87a
--- /dev/null
+++ b/include/linux/platform_data/x86/soc.h
@@ -0,0 +1,65 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * soc.h - 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 */
diff --git a/sound/soc/intel/common/soc-intel-quirks.h b/sound/soc/intel/common/soc-intel-quirks.h
index a93987ab7f4d..de4e550c5b34 100644
--- a/sound/soc/intel/common/soc-intel-quirks.h
+++ b/sound/soc/intel/common/soc-intel-quirks.h
@@ -9,34 +9,13 @@
#ifndef _SND_SOC_INTEL_QUIRKS_H
#define _SND_SOC_INTEL_QUIRKS_H
+#include <linux/platform_data/x86/soc.h>
+
#if IS_ENABLED(CONFIG_X86)
#include <linux/dmi.h>
-#include <asm/cpu_device_id.h>
-#include <asm/intel-family.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)
{
/*
@@ -114,30 +93,6 @@ static inline bool soc_intel_is_byt_cr(struct platform_device *pdev)
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 /* _SND_SOC_INTEL_QUIRKS_H */
+#endif /* _SND_SOC_INTEL_QUIRKS_H */
--
2.31.1
next prev parent reply other threads:[~2021-10-18 14:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-18 14:33 [PATCH 0/3] ASoC/pdx86/input: Introduce and use soc_intel_is_*() helpers Hans de Goede
2021-10-18 14:33 ` Hans de Goede [this message]
2021-10-18 15:00 ` [PATCH 1/3] ASoC: Intel: Move soc_intel_is_foo() helpers to a generic header Andy Shevchenko
2021-10-18 15:35 ` Mark Brown
2021-10-18 21:13 ` Hans de Goede
2021-10-18 22:23 ` Mark Brown
2021-10-18 14:33 ` [PATCH 2/3] platform/x86: intel_int0002_vgpio: Use the new soc_intel_is_byt/cht helpers Hans de Goede
2021-10-18 15:03 ` Andy Shevchenko
2021-10-18 15:08 ` Andy Shevchenko
2021-10-18 14:33 ` [PATCH 3/3] Input: axp20x-pek - Use new soc_intel_is_cht() helper Hans de Goede
2021-10-19 1:55 ` Dmitry Torokhov
2021-10-18 14:58 ` [PATCH 0/3] ASoC/pdx86/input: Introduce and use soc_intel_is_*() helpers Andy Shevchenko
2021-10-19 15:38 ` Hans de Goede
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211018143324.296961-2-hdegoede@redhat.com \
--to=hdegoede@redhat.com \
--cc=alsa-devel@alsa-project.org \
--cc=andy.shevchenko@gmail.com \
--cc=andy@infradead.org \
--cc=broonie@kernel.org \
--cc=cezary.rojewski@intel.com \
--cc=dmitry.torokhov@gmail.com \
--cc=lgirdwood@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=markgross@kernel.org \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).