Commit 9761c0f6 authored by Bard Liao's avatar Bard Liao Committed by Mark Brown

ASoC: rt5645: merge DMI tables of google projects

There are more and more google projects need to use DMI to get the
platform data configuration. And those projects use the same
configuration. To clean those redundant code, we define a general
DMI for those projects with the same platform data configuration.
Signed-off-by: default avatarOder Chiou <oder_chiou@realtek.com>
Signed-off-by: default avatarBard Liao <bardliao@realtek.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 25e342bc
...@@ -3514,69 +3514,23 @@ static struct acpi_device_id rt5645_acpi_match[] = { ...@@ -3514,69 +3514,23 @@ static struct acpi_device_id rt5645_acpi_match[] = {
MODULE_DEVICE_TABLE(acpi, rt5645_acpi_match); MODULE_DEVICE_TABLE(acpi, rt5645_acpi_match);
#endif #endif
static struct rt5645_platform_data *rt5645_pdata; static struct rt5645_platform_data general_platform_data = {
static struct rt5645_platform_data strago_platform_data = {
.dmic1_data_pin = RT5645_DMIC1_DISABLE, .dmic1_data_pin = RT5645_DMIC1_DISABLE,
.dmic2_data_pin = RT5645_DMIC_DATA_IN2P, .dmic2_data_pin = RT5645_DMIC_DATA_IN2P,
.jd_mode = 3, .jd_mode = 3,
}; };
static int strago_quirk_cb(const struct dmi_system_id *id)
{
rt5645_pdata = &strago_platform_data;
return 1;
}
static const struct dmi_system_id dmi_platform_intel_braswell[] = { static const struct dmi_system_id dmi_platform_intel_braswell[] = {
{ {
.ident = "Intel Strago", .ident = "Intel Strago",
.callback = strago_quirk_cb,
.matches = { .matches = {
DMI_MATCH(DMI_PRODUCT_NAME, "Strago"), DMI_MATCH(DMI_PRODUCT_NAME, "Strago"),
}, },
}, },
{ {
.ident = "Google Celes", .ident = "Google Chrome",
.callback = strago_quirk_cb,
.matches = {
DMI_MATCH(DMI_PRODUCT_NAME, "Celes"),
},
},
{
.ident = "Google Ultima",
.callback = strago_quirk_cb,
.matches = { .matches = {
DMI_MATCH(DMI_PRODUCT_NAME, "Ultima"), DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"),
},
},
{
.ident = "Google Reks",
.callback = strago_quirk_cb,
.matches = {
DMI_MATCH(DMI_PRODUCT_NAME, "Reks"),
},
},
{
.ident = "Google Edgar",
.callback = strago_quirk_cb,
.matches = {
DMI_MATCH(DMI_PRODUCT_NAME, "Edgar"),
},
},
{
.ident = "Google Wizpig",
.callback = strago_quirk_cb,
.matches = {
DMI_MATCH(DMI_PRODUCT_NAME, "Wizpig"),
},
},
{
.ident = "Google Terra",
.callback = strago_quirk_cb,
.matches = {
DMI_MATCH(DMI_PRODUCT_NAME, "Terra"),
}, },
}, },
{ } { }
...@@ -3589,17 +3543,9 @@ static struct rt5645_platform_data buddy_platform_data = { ...@@ -3589,17 +3543,9 @@ static struct rt5645_platform_data buddy_platform_data = {
.jd_invert = true, .jd_invert = true,
}; };
static int buddy_quirk_cb(const struct dmi_system_id *id)
{
rt5645_pdata = &buddy_platform_data;
return 1;
}
static struct dmi_system_id dmi_platform_intel_broadwell[] = { static struct dmi_system_id dmi_platform_intel_broadwell[] = {
{ {
.ident = "Chrome Buddy", .ident = "Chrome Buddy",
.callback = buddy_quirk_cb,
.matches = { .matches = {
DMI_MATCH(DMI_PRODUCT_NAME, "Buddy"), DMI_MATCH(DMI_PRODUCT_NAME, "Buddy"),
}, },
...@@ -3607,6 +3553,16 @@ static struct dmi_system_id dmi_platform_intel_broadwell[] = { ...@@ -3607,6 +3553,16 @@ static struct dmi_system_id dmi_platform_intel_broadwell[] = {
{ } { }
}; };
static bool rt5645_check_dp(struct device *dev)
{
if (device_property_present(dev, "realtek,in2-differential") ||
device_property_present(dev, "realtek,dmic1-data-pin") ||
device_property_present(dev, "realtek,dmic2-data-pin") ||
device_property_present(dev, "realtek,jd-mode"))
return true;
return false;
}
static int rt5645_parse_dt(struct rt5645_priv *rt5645, struct device *dev) static int rt5645_parse_dt(struct rt5645_priv *rt5645, struct device *dev)
{ {
...@@ -3641,11 +3597,12 @@ static int rt5645_i2c_probe(struct i2c_client *i2c, ...@@ -3641,11 +3597,12 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
if (pdata) if (pdata)
rt5645->pdata = *pdata; rt5645->pdata = *pdata;
else if (dmi_check_system(dmi_platform_intel_braswell) || else if (dmi_check_system(dmi_platform_intel_broadwell))
dmi_check_system(dmi_platform_intel_broadwell)) rt5645->pdata = buddy_platform_data;
rt5645->pdata = *rt5645_pdata; else if (rt5645_check_dp(&i2c->dev))
else
rt5645_parse_dt(rt5645, &i2c->dev); rt5645_parse_dt(rt5645, &i2c->dev);
else if (dmi_check_system(dmi_platform_intel_braswell))
rt5645->pdata = general_platform_data;
rt5645->gpiod_hp_det = devm_gpiod_get_optional(&i2c->dev, "hp-detect", rt5645->gpiod_hp_det = devm_gpiod_get_optional(&i2c->dev, "hp-detect",
GPIOD_IN); GPIOD_IN);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment