* [alsa-devel] [PATCH v3 0/9] x86: Easy way of detecting MS Surface 3
@ 2020-01-22 11:22 Andy Shevchenko
2020-01-22 11:23 ` [alsa-devel] [PATCH v3 6/9] x86/quirks: Add a DMI quirk for Microsoft " Andy Shevchenko
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Andy Shevchenko @ 2020-01-22 11:22 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 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.24.1
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* [alsa-devel] [PATCH v3 6/9] x86/quirks: Add a DMI quirk for Microsoft Surface 3
2020-01-22 11:22 [alsa-devel] [PATCH v3 0/9] x86: Easy way of detecting MS Surface 3 Andy Shevchenko
@ 2020-01-22 11:23 ` Andy Shevchenko
2020-01-22 11:23 ` [alsa-devel] [PATCH v3 8/9] ASoC: rt5645: Switch DMI table match to a test of variable Andy Shevchenko
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2020-01-22 11:23 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 3867f81baae7..88675844b1ab 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.24.1
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [alsa-devel] [PATCH v3 8/9] ASoC: rt5645: Switch DMI table match to a test of variable
2020-01-22 11:22 [alsa-devel] [PATCH v3 0/9] x86: Easy way of detecting MS Surface 3 Andy Shevchenko
2020-01-22 11:23 ` [alsa-devel] [PATCH v3 6/9] x86/quirks: Add a DMI quirk for Microsoft " Andy Shevchenko
@ 2020-01-22 11:23 ` Andy Shevchenko
2020-01-22 11:23 ` [alsa-devel] [PATCH v3 9/9] ASoC: Intel: " Andy Shevchenko
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2020-01-22 11:23 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 92d67010aeed..3ccecb81bc37 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
@@ -3789,7 +3783,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;
@@ -3804,6 +3798,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.24.1
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [alsa-devel] [PATCH v3 9/9] ASoC: Intel: Switch DMI table match to a test of variable
2020-01-22 11:22 [alsa-devel] [PATCH v3 0/9] x86: Easy way of detecting MS Surface 3 Andy Shevchenko
2020-01-22 11:23 ` [alsa-devel] [PATCH v3 6/9] x86/quirks: Add a DMI quirk for Microsoft " Andy Shevchenko
2020-01-22 11:23 ` [alsa-devel] [PATCH v3 8/9] ASoC: rt5645: Switch DMI table match to a test of variable Andy Shevchenko
@ 2020-01-22 11:23 ` Andy Shevchenko
2020-02-14 14:24 ` [alsa-devel] [PATCH v3 0/9] x86: Easy way of detecting MS Surface 3 Andy Shevchenko
2020-03-16 15:33 ` Alexander Shishkin
4 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2020-01-22 11:23 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 d0fb43c2b9f6..833d2e130e6e 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.24.1
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [alsa-devel] [PATCH v3 0/9] x86: Easy way of detecting MS Surface 3
2020-01-22 11:22 [alsa-devel] [PATCH v3 0/9] x86: Easy way of detecting MS Surface 3 Andy Shevchenko
` (2 preceding siblings ...)
2020-01-22 11:23 ` [alsa-devel] [PATCH v3 9/9] ASoC: Intel: " Andy Shevchenko
@ 2020-02-14 14:24 ` Andy Shevchenko
2020-03-16 15:33 ` Alexander Shishkin
4 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2020-02-14 14:24 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, H. Peter Anvin,
x86, Mark Brown, linux-kernel
Cc: Liam Girdwood, Cezary Rojewski, Jie Yang, Pierre-Louis Bossart,
alsa-devel
On Wed, Jan 22, 2020 at 01:22:57PM +0200, Andy Shevchenko wrote:
> 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.
Any comments on this?
> 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.24.1
>
--
With Best Regards,
Andy Shevchenko
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 0/9] x86: Easy way of detecting MS Surface 3
2020-01-22 11:22 [alsa-devel] [PATCH v3 0/9] x86: Easy way of detecting MS Surface 3 Andy Shevchenko
` (3 preceding siblings ...)
2020-02-14 14:24 ` [alsa-devel] [PATCH v3 0/9] x86: Easy way of detecting MS Surface 3 Andy Shevchenko
@ 2020-03-16 15:33 ` Alexander Shishkin
2020-03-16 15:52 ` Andy Shevchenko
4 siblings, 1 reply; 7+ messages in thread
From: Alexander Shishkin @ 2020-03-16 15:33 UTC (permalink / raw)
To: Andy Shevchenko, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
H. Peter Anvin, x86, Mark Brown, linux-kernel
Cc: Cezary Rojewski, alsa-devel, alexander.shishkin, Jie Yang,
Pierre-Louis Bossart, Liam Girdwood, Andy Shevchenko
Andy Shevchenko <andriy.shevchenko@linux.intel.com> writes:
> 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.
[...]
> x86/quirks: Introduce hpet_dev_print_force_hpet_address() helper
> x86/quirks: Join string literals back
These two don't seem to be related to the Surface 3 cause of the rest of
the patchset, or am I missing something?
Regards,
--
Alex
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 0/9] x86: Easy way of detecting MS Surface 3
2020-03-16 15:33 ` Alexander Shishkin
@ 2020-03-16 15:52 ` Andy Shevchenko
0 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2020-03-16 15:52 UTC (permalink / raw)
To: Alexander Shishkin
Cc: Cezary Rojewski, alsa-devel, x86, Jie Yang, linux-kernel,
Pierre-Louis Bossart, Liam Girdwood, Mark Brown, Borislav Petkov,
H. Peter Anvin, Thomas Gleixner, Ingo Molnar
On Mon, Mar 16, 2020 at 05:33:02PM +0200, Alexander Shishkin wrote:
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> writes:
>
> > 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.
>
> [...]
>
> > x86/quirks: Introduce hpet_dev_print_force_hpet_address() helper
> > x86/quirks: Join string literals back
>
> These two don't seem to be related to the Surface 3 cause of the rest of
> the patchset, or am I missing something?
No, they are not. I think it's suitable to have them in the bunch nevertheless.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-03-19 15:44 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-22 11:22 [alsa-devel] [PATCH v3 0/9] x86: Easy way of detecting MS Surface 3 Andy Shevchenko
2020-01-22 11:23 ` [alsa-devel] [PATCH v3 6/9] x86/quirks: Add a DMI quirk for Microsoft " Andy Shevchenko
2020-01-22 11:23 ` [alsa-devel] [PATCH v3 8/9] ASoC: rt5645: Switch DMI table match to a test of variable Andy Shevchenko
2020-01-22 11:23 ` [alsa-devel] [PATCH v3 9/9] ASoC: Intel: " Andy Shevchenko
2020-02-14 14:24 ` [alsa-devel] [PATCH v3 0/9] x86: Easy way of detecting MS Surface 3 Andy Shevchenko
2020-03-16 15:33 ` Alexander Shishkin
2020-03-16 15:52 ` Andy Shevchenko
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).