2020-04-16 00:14:18

by Andy Shevchenko

[permalink] [raw]
Subject: [PATCH v4 8/9] ASoC: rt5645: Switch DMI table match to a test of variable

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 <[email protected]>
Cc: Pierre-Louis Bossart <[email protected]>
Cc: Liam Girdwood <[email protected]>
Cc: Jie Yang <[email protected]>
Cc: Mark Brown <[email protected]>
Cc: [email protected]
Signed-off-by: Andy Shevchenko <[email protected]>
Acked-by: Mark Brown <[email protected]>
---
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


2020-04-16 00:22:39

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH v4 8/9] ASoC: rt5645: Switch DMI table match to a test of variable

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?


Attachments:
(No filename) (720.00 B)
signature.asc (499.00 B)
Download all attachments

2020-04-16 01:49:34

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v4 8/9] ASoC: rt5645: Switch DMI table match to a test of variable

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