aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2017-06-28 08:49:39 -0400
committerMark Brown <broonie@kernel.org>2017-06-28 13:33:31 -0400
commitea2b5a6e3a386b89d7f9148ff8be6c78d13542a0 (patch)
treea9968864d11180f7344f139874d5a9bd1ddac30f
parentaea086dda2d5df659a7c5d9efe85721e9442a133 (diff)
ASoC: rt5645: Add jack detection workaround for GPD Win
GPD Win requires jd_mode=3 and the inverted flag for making the jack detection working. Unfortunately, the BIOS doesn't give a nice way to match with DMI strings, and the only working way so far is to match with the board vendor/name/version/date to some known patterns. Hopefully other vendors won't do such a stupid setup, too... Thanks to Hans de Goede for the DMI matching suggestion. Suggested-by: Hans de Goede <hdegoede@redhat.com> Tested-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/codecs/rt5645.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index 162044d82632..308c22f5909a 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -3599,6 +3599,33 @@ static struct dmi_system_id dmi_platform_intel_broadwell[] = {
3599 { } 3599 { }
3600}; 3600};
3601 3601
3602static struct rt5645_platform_data gpd_win_platform_data = {
3603 .jd_mode = 3,
3604 .inv_jd1_1 = true,
3605};
3606
3607static const struct dmi_system_id dmi_platform_gpd_win[] = {
3608 {
3609 /*
3610 * Match for the GPDwin which unfortunately uses somewhat
3611 * generic dmi strings, which is why we test for 4 strings.
3612 * Comparing against 23 other byt/cht boards, board_vendor
3613 * and board_name are unique to the GPDwin, where as only one
3614 * other board has the same board_serial and 3 others have
3615 * the same default product_name. Also the GPDwin is the
3616 * only device to have both board_ and product_name not set.
3617 */
3618 .ident = "GPD Win",
3619 .matches = {
3620 DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
3621 DMI_MATCH(DMI_BOARD_NAME, "Default string"),
3622 DMI_MATCH(DMI_BOARD_SERIAL, "Default string"),
3623 DMI_MATCH(DMI_PRODUCT_NAME, "Default string"),
3624 },
3625 },
3626 {}
3627};
3628
3602static bool rt5645_check_dp(struct device *dev) 3629static bool rt5645_check_dp(struct device *dev)
3603{ 3630{
3604 if (device_property_present(dev, "realtek,in2-differential") || 3631 if (device_property_present(dev, "realtek,in2-differential") ||
@@ -3649,6 +3676,8 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
3649 rt5645_parse_dt(rt5645, &i2c->dev); 3676 rt5645_parse_dt(rt5645, &i2c->dev);
3650 else if (dmi_check_system(dmi_platform_intel_braswell)) 3677 else if (dmi_check_system(dmi_platform_intel_braswell))
3651 rt5645->pdata = general_platform_data; 3678 rt5645->pdata = general_platform_data;
3679 else if (dmi_check_system(dmi_platform_gpd_win))
3680 rt5645->pdata = gpd_win_platform_data;
3652 3681
3653 rt5645->gpiod_hp_det = devm_gpiod_get_optional(&i2c->dev, "hp-detect", 3682 rt5645->gpiod_hp_det = devm_gpiod_get_optional(&i2c->dev, "hp-detect",
3654 GPIOD_IN); 3683 GPIOD_IN);