* [PATCH v4 0/9] x86: Easy way of detecting MS Surface 3
@ 2020-04-15 14:55 Andy Shevchenko
2020-04-15 14:55 ` [PATCH v4 6/9] x86/quirks: Add a DMI quirk for Microsoft " Andy Shevchenko
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Andy Shevchenko @ 2020-04-15 14:55 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, H. Peter Anvin,
x86, Mark Brown, linux-kernel
Cc: Cezary Rojewski, alsa-devel, Jie Yang, Pierre-Louis Bossart,
Liam Girdwood, Andy Shevchenko
While working on RTC regression, I noticed that we are using the same DMI check
over and over in the drivers for MS Surface 3 platform. This series dedicated
for making it easier in the same way how it's done for Apple machines.
Changelog v4:
- rebase on top of v5.7-rc1
Changelog v3:
- fixed typo in patch 5 (Jonathan)
- returned back to if {} else {} condition in ASoC driver (Mark)
- added Mark's Ack tag
Changelog v2:
- removed RTC patches for now (the fix will be independent to this series)
- added couple more clean ups to arch/x86/kernel/quirks.c
- redone DMI quirk to use driver_data instead of callback
- simplified check in soc-acpi-intel-cht-match.c to be oneliner
- added a new patch to cover rt5645 codec driver
Cc: Cezary Rojewski <cezary.rojewski@intel.com>
Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Cc: Jie Yang <yang.jie@linux.intel.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: alsa-devel@alsa-project.org
Andy Shevchenko (9):
x86/platform: Rename x86/apple.h -> x86/machine.h
x86/quirks: Add missed include to satisfy static checker
x86/quirks: Introduce hpet_dev_print_force_hpet_address() helper
x86/quirks: Join string literals back
x86/quirks: Convert DMI matching to use a table
x86/quirks: Add a DMI quirk for Microsoft Surface 3
platform/x86: surface3_wmi: Switch DMI table match to a test of
variable
ASoC: rt5645: Switch DMI table match to a test of variable
ASoC: Intel: Switch DMI table match to a test of variable
arch/x86/kernel/quirks.c | 91 +++++++++++++------
drivers/platform/x86/surface3-wmi.c | 16 +---
include/linux/platform_data/x86/apple.h | 14 +--
include/linux/platform_data/x86/machine.h | 20 ++++
sound/soc/codecs/rt5645.c | 14 ++-
.../intel/common/soc-acpi-intel-cht-match.c | 28 +-----
6 files changed, 93 insertions(+), 90 deletions(-)
create mode 100644 include/linux/platform_data/x86/machine.h
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v4 6/9] x86/quirks: Add a DMI quirk for Microsoft Surface 3
2020-04-15 14:55 [PATCH v4 0/9] x86: Easy way of detecting MS Surface 3 Andy Shevchenko
@ 2020-04-15 14:55 ` Andy Shevchenko
2020-04-15 14:55 ` [PATCH v4 8/9] ASoC: rt5645: Switch DMI table match to a test of variable Andy Shevchenko
2020-04-15 14:55 ` [PATCH v4 9/9] ASoC: Intel: " Andy Shevchenko
2 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2020-04-15 14:55 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, H. Peter Anvin,
x86, Mark Brown, linux-kernel
Cc: Cezary Rojewski, alsa-devel, Jie Yang, Pierre-Louis Bossart,
Liam Girdwood, Andy Shevchenko
Add a DMI quirk for Microsoft Surface 3 which will be utilized by few drivers.
Cc: Cezary Rojewski <cezary.rojewski@intel.com>
Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Cc: Jie Yang <yang.jie@linux.intel.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: alsa-devel@alsa-project.org
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
arch/x86/kernel/quirks.c | 10 ++++++++++
include/linux/platform_data/x86/machine.h | 5 +++++
2 files changed, 15 insertions(+)
diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c
index a97055599bb7..b4a3aa9c3f48 100644
--- a/arch/x86/kernel/quirks.c
+++ b/arch/x86/kernel/quirks.c
@@ -658,6 +658,9 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2083, quirk_intel_purley_xeon_ras
bool x86_apple_machine;
EXPORT_SYMBOL(x86_apple_machine);
+bool x86_microsoft_surface_3_machine;
+EXPORT_SYMBOL(x86_microsoft_surface_3_machine);
+
static const struct dmi_system_id x86_machine_table[] __initconst = {
{
.ident = "x86 Apple Macintosh",
@@ -673,6 +676,13 @@ static const struct dmi_system_id x86_machine_table[] __initconst = {
},
.driver_data = &x86_apple_machine,
},
+ {
+ .ident = "Microsoft Surface 3",
+ .matches = {
+ DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"),
+ },
+ .driver_data = &x86_microsoft_surface_3_machine,
+ },
{}
};
diff --git a/include/linux/platform_data/x86/machine.h b/include/linux/platform_data/x86/machine.h
index b1e7a560a046..9bdf5a06b490 100644
--- a/include/linux/platform_data/x86/machine.h
+++ b/include/linux/platform_data/x86/machine.h
@@ -8,8 +8,13 @@
* x86_apple_machine - whether the machine is an x86 Apple Macintosh
*/
extern bool x86_apple_machine;
+/**
+ * x86_microsoft_surface_3_machine - whether the machine is Microsoft Surface 3
+ */
+extern bool x86_microsoft_surface_3_machine;
#else
#define x86_apple_machine false
+#define x86_microsoft_surface_3_machine false
#endif
#endif /* PLATFORM_DATA_X86_MACHINE_H */
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v4 8/9] ASoC: rt5645: Switch DMI table match to a test of variable
2020-04-15 14:55 [PATCH v4 0/9] x86: Easy way of detecting MS Surface 3 Andy Shevchenko
2020-04-15 14:55 ` [PATCH v4 6/9] x86/quirks: Add a DMI quirk for Microsoft " Andy Shevchenko
@ 2020-04-15 14:55 ` Andy Shevchenko
2020-04-15 16:25 ` Mark Brown
2020-04-15 14:55 ` [PATCH v4 9/9] ASoC: Intel: " Andy Shevchenko
2 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2020-04-15 14:55 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, H. Peter Anvin,
x86, Mark Brown, linux-kernel
Cc: Cezary Rojewski, alsa-devel, Jie Yang, Pierre-Louis Bossart,
Liam Girdwood, Andy Shevchenko
Since we have a common x86 quirk that provides an exported variable,
use it instead of local DMI table match.
Note, arch/x86/kernel/quirks.c::early_platform_detect_quirk() prints
the detected platform.
Cc: Cezary Rojewski <cezary.rojewski@intel.com>
Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Cc: Jie Yang <yang.jie@linux.intel.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: alsa-devel@alsa-project.org
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mark Brown <broonie@kernel.org>
---
sound/soc/codecs/rt5645.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index 6ba1849a77b0..06bd3560b736 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -12,6 +12,7 @@
#include <linux/delay.h>
#include <linux/pm.h>
#include <linux/i2c.h>
+#include <linux/platform_data/x86/machine.h>
#include <linux/platform_device.h>
#include <linux/spi/spi.h>
#include <linux/gpio.h>
@@ -3674,13 +3675,6 @@ static const struct dmi_system_id dmi_platform_data[] = {
},
.driver_data = (void *)&intel_braswell_platform_data,
},
- {
- .ident = "Microsoft Surface 3",
- .matches = {
- DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"),
- },
- .driver_data = (void *)&intel_braswell_platform_data,
- },
{
/*
* Match for the GPDwin which unfortunately uses somewhat
@@ -3797,7 +3791,7 @@ static int rt5645_parse_dt(struct rt5645_priv *rt5645, struct device *dev)
static int rt5645_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
- struct rt5645_platform_data *pdata = dev_get_platdata(&i2c->dev);
+ const struct rt5645_platform_data *pdata = dev_get_platdata(&i2c->dev);
const struct dmi_system_id *dmi_data;
struct rt5645_priv *rt5645;
int ret, i;
@@ -3812,6 +3806,10 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
rt5645->i2c = i2c;
i2c_set_clientdata(i2c, rt5645);
+ /* Put it first to allow DMI to override, if needed */
+ if (x86_microsoft_surface_3_machine)
+ pdata = &intel_braswell_platform_data;
+
dmi_data = dmi_first_match(dmi_platform_data);
if (dmi_data) {
dev_info(&i2c->dev, "Detected %s platform\n", dmi_data->ident);
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v4 9/9] ASoC: Intel: Switch DMI table match to a test of variable
2020-04-15 14:55 [PATCH v4 0/9] x86: Easy way of detecting MS Surface 3 Andy Shevchenko
2020-04-15 14:55 ` [PATCH v4 6/9] x86/quirks: Add a DMI quirk for Microsoft " Andy Shevchenko
2020-04-15 14:55 ` [PATCH v4 8/9] ASoC: rt5645: Switch DMI table match to a test of variable Andy Shevchenko
@ 2020-04-15 14:55 ` Andy Shevchenko
2 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2020-04-15 14:55 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, H. Peter Anvin,
x86, Mark Brown, linux-kernel
Cc: Cezary Rojewski, alsa-devel, Jie Yang, Pierre-Louis Bossart,
Liam Girdwood, Andy Shevchenko
Since we have a common x86 quirk that provides an exported variable,
use it instead of local DMI table match.
Cc: Cezary Rojewski <cezary.rojewski@intel.com>
Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Cc: Jie Yang <yang.jie@linux.intel.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: alsa-devel@alsa-project.org
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mark Brown <broonie@kernel.org>
---
.../intel/common/soc-acpi-intel-cht-match.c | 28 ++-----------------
1 file changed, 3 insertions(+), 25 deletions(-)
diff --git a/sound/soc/intel/common/soc-acpi-intel-cht-match.c b/sound/soc/intel/common/soc-acpi-intel-cht-match.c
index 2752dc955733..1ee93d35a1b8 100644
--- a/sound/soc/intel/common/soc-acpi-intel-cht-match.c
+++ b/sound/soc/intel/common/soc-acpi-intel-cht-match.c
@@ -5,31 +5,11 @@
* Copyright (c) 2017, Intel Corporation.
*/
-#include <linux/dmi.h>
+#include <linux/platform_data/x86/machine.h>
+
#include <sound/soc-acpi.h>
#include <sound/soc-acpi-intel-match.h>
-static unsigned long cht_machine_id;
-
-#define CHT_SURFACE_MACH 1
-
-static int cht_surface_quirk_cb(const struct dmi_system_id *id)
-{
- cht_machine_id = CHT_SURFACE_MACH;
- return 1;
-}
-
-static const struct dmi_system_id cht_table[] = {
- {
- .callback = cht_surface_quirk_cb,
- .matches = {
- DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
- DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"),
- },
- },
- { }
-};
-
static struct snd_soc_acpi_mach cht_surface_mach = {
.id = "10EC5640",
.drv_name = "cht-bsw-rt5645",
@@ -43,9 +23,7 @@ static struct snd_soc_acpi_mach *cht_quirk(void *arg)
{
struct snd_soc_acpi_mach *mach = arg;
- dmi_check_system(cht_table);
-
- if (cht_machine_id == CHT_SURFACE_MACH)
+ if (x86_microsoft_surface_3_machine)
return &cht_surface_mach;
else
return mach;
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v4 8/9] ASoC: rt5645: Switch DMI table match to a test of variable
2020-04-15 14:55 ` [PATCH v4 8/9] ASoC: rt5645: Switch DMI table match to a test of variable Andy Shevchenko
@ 2020-04-15 16:25 ` Mark Brown
2020-04-15 16:43 ` Andy Shevchenko
0 siblings, 1 reply; 6+ messages in thread
From: Mark Brown @ 2020-04-15 16:25 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Cezary Rojewski, alsa-devel, x86, Jie Yang, linux-kernel,
Pierre-Louis Bossart, Liam Girdwood, Ingo Molnar, Borislav Petkov,
H. Peter Anvin, Thomas Gleixner
[-- Attachment #1: Type: text/plain, Size: 720 bytes --]
On Wed, Apr 15, 2020 at 05:55:23PM +0300, Andy Shevchenko wrote:
> Since we have a common x86 quirk that provides an exported variable,
> use it instead of local DMI table match.
>
> Note, arch/x86/kernel/quirks.c::early_platform_detect_quirk() prints
> the detected platform.
> @@ -3674,13 +3675,6 @@ static const struct dmi_system_id dmi_platform_data[] = {
> },
> .driver_data = (void *)&intel_braswell_platform_data,
> },
> - {
> - .ident = "Microsoft Surface 3",
> - .matches = {
> - DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"),
> - },
> - .driver_data = (void *)&intel_braswell_platform_data,
> - },
> {
Are we going to convert all the other platforms to using a variable too?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v4 8/9] ASoC: rt5645: Switch DMI table match to a test of variable
2020-04-15 16:25 ` Mark Brown
@ 2020-04-15 16:43 ` Andy Shevchenko
0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2020-04-15 16:43 UTC (permalink / raw)
To: Mark Brown
Cc: Cezary Rojewski, alsa-devel, x86, Jie Yang, linux-kernel,
Pierre-Louis Bossart, Liam Girdwood, Ingo Molnar, Borislav Petkov,
H. Peter Anvin, Thomas Gleixner
On Wed, Apr 15, 2020 at 05:25:07PM +0100, Mark Brown wrote:
> On Wed, Apr 15, 2020 at 05:55:23PM +0300, Andy Shevchenko wrote:
> > Since we have a common x86 quirk that provides an exported variable,
> > use it instead of local DMI table match.
> >
> > Note, arch/x86/kernel/quirks.c::early_platform_detect_quirk() prints
> > the detected platform.
>
> > @@ -3674,13 +3675,6 @@ static const struct dmi_system_id dmi_platform_data[] = {
> > },
> > .driver_data = (void *)&intel_braswell_platform_data,
> > },
> > - {
> > - .ident = "Microsoft Surface 3",
> > - .matches = {
> > - DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"),
> > - },
> > - .driver_data = (void *)&intel_braswell_platform_data,
> > - },
> > {
>
> Are we going to convert all the other platforms to using a variable too?
It makes sense to ones that have spread quirks over the kernel, like Apple.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-04-15 16:44 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-15 14:55 [PATCH v4 0/9] x86: Easy way of detecting MS Surface 3 Andy Shevchenko
2020-04-15 14:55 ` [PATCH v4 6/9] x86/quirks: Add a DMI quirk for Microsoft " Andy Shevchenko
2020-04-15 14:55 ` [PATCH v4 8/9] ASoC: rt5645: Switch DMI table match to a test of variable Andy Shevchenko
2020-04-15 16:25 ` Mark Brown
2020-04-15 16:43 ` Andy Shevchenko
2020-04-15 14:55 ` [PATCH v4 9/9] ASoC: Intel: " Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox