alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] ASoC: rt5645: Add dmi for Broadwell
@ 2015-09-18  2:55 Bard Liao
  2015-09-18  2:55 ` [PATCH v2 2/2] ASoC: rt5645: Add jd_invert " Bard Liao
  2015-09-20 14:37 ` [PATCH v2 1/2] ASoC: rt5645: Add dmi " Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Bard Liao @ 2015-09-18  2:55 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: oder_chiou, alsa-devel, lars, john.lin, benzh, Bard Liao, flove

Add DMI data for Buddy project.

Signed-off-by: Bard Liao <bardliao@realtek.com>
---
 sound/soc/codecs/rt5645.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index 66e9ce6..2fc437f 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -3210,6 +3210,31 @@ static const struct dmi_system_id dmi_platform_intel_braswell[] = {
 	{ }
 };
 
+static struct rt5645_platform_data buddy_platform_data = {
+	.dmic1_data_pin = RT5645_DMIC_DATA_GPIO5,
+	.dmic2_data_pin = RT5645_DMIC_DATA_IN2P,
+	.jd_mode = 3,
+};
+
+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[] __initdata = {
+	{
+		.ident = "Chrome Buddy",
+		.callback = buddy_quirk_cb,
+		.matches = {
+			DMI_MATCH(DMI_PRODUCT_NAME, "Buddy"),
+		},
+	},
+	{ }
+};
+
+
 static int rt5645_parse_dt(struct rt5645_priv *rt5645, struct device *dev)
 {
 	rt5645->pdata.in2_diff = device_property_read_bool(dev,
@@ -3242,7 +3267,8 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
 
 	if (pdata)
 		rt5645->pdata = *pdata;
-	else if (dmi_check_system(dmi_platform_intel_braswell))
+	else if (dmi_check_system(dmi_platform_intel_braswell) ||
+			dmi_check_system(dmi_platform_intel_broadwel)
 		rt5645->pdata = *rt5645_pdata;
 	else
 		rt5645_parse_dt(rt5645, &i2c->dev);
-- 
1.8.1.1.439.g50a6b54

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v2 2/2] ASoC: rt5645: Add jd_invert for Broadwell
  2015-09-18  2:55 [PATCH v2 1/2] ASoC: rt5645: Add dmi for Broadwell Bard Liao
@ 2015-09-18  2:55 ` Bard Liao
  2015-09-20 14:37 ` [PATCH v2 1/2] ASoC: rt5645: Add dmi " Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Bard Liao @ 2015-09-18  2:55 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: oder_chiou, alsa-devel, lars, john.lin, benzh, Bard Liao, flove

Broadwell can not triger the IRQ falling and rising simultaneously,
so it can not detect jack-in and jack-out simultaneously.
We add a flag "jd_invert" to platform data. If this flag is set,
codec IRQ will be set to invert that forces IRQ as pulse when jack-in
and jack-out.

Signed-off-by: John Lin <john.lin@realtek.com>
Signed-off-by: Bard Liao <bardliao@realtek.com>
---
Resend with correct Signed-off-by line
---
 include/sound/rt5645.h    | 2 ++
 sound/soc/codecs/rt5645.c | 7 +++++++
 sound/soc/codecs/rt5645.h | 4 ++++
 3 files changed, 13 insertions(+)

diff --git a/include/sound/rt5645.h b/include/sound/rt5645.h
index 22734bc..a5cf615 100644
--- a/include/sound/rt5645.h
+++ b/include/sound/rt5645.h
@@ -21,6 +21,8 @@ struct rt5645_platform_data {
 	/* 0 = IN2P; 1 = GPIO6; 2 = GPIO10; 3 = GPIO12 */
 
 	unsigned int jd_mode;
+	/* Invert JD when jack insert */
+	bool jd_invert;
 };
 
 #endif
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index 2fc437f..021215c 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -2830,6 +2830,9 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert)
 			snd_soc_dapm_sync(dapm);
 			rt5645->jack_type = SND_JACK_HEADPHONE;
 		}
+		if (rt5645->pdata.jd_invert)
+			regmap_update_bits(rt5645->regmap, RT5645_IRQ_CTRL2,
+				RT5645_JD_1_1_MASK, RT5645_JD_1_1_INV);
 	} else { /* jack out */
 		rt5645->jack_type = 0;
 
@@ -2845,6 +2848,9 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert)
 			snd_soc_dapm_disable_pin(dapm, "LDO2");
 		snd_soc_dapm_disable_pin(dapm, "Mic Det Power");
 		snd_soc_dapm_sync(dapm);
+		if (rt5645->pdata.jd_invert)
+			regmap_update_bits(rt5645->regmap, RT5645_IRQ_CTRL2,
+				RT5645_JD_1_1_MASK, RT5645_JD_1_1_NOR);
 	}
 
 	return rt5645->jack_type;
@@ -3214,6 +3220,7 @@ static struct rt5645_platform_data buddy_platform_data = {
 	.dmic1_data_pin = RT5645_DMIC_DATA_GPIO5,
 	.dmic2_data_pin = RT5645_DMIC_DATA_IN2P,
 	.jd_mode = 3,
+	.jd_invert = true,
 };
 
 static int buddy_quirk_cb(const struct dmi_system_id *id)
diff --git a/sound/soc/codecs/rt5645.h b/sound/soc/codecs/rt5645.h
index 0e4cfc6..90325d9 100644
--- a/sound/soc/codecs/rt5645.h
+++ b/sound/soc/codecs/rt5645.h
@@ -1626,6 +1626,10 @@
 #define RT5645_OT_P_NOR				(0x0 << 10)
 #define RT5645_OT_P_INV				(0x1 << 10)
 #define RT5645_IRQ_JD_1_1_EN			(0x1 << 9)
+#define RT5645_JD_1_1_MASK			(0x1 << 7)
+#define RT5645_JD_1_1_SFT			7
+#define RT5645_JD_1_1_NOR			(0x0 << 7)
+#define RT5645_JD_1_1_INV			(0x1 << 7)
 
 /* IRQ Control 2 (0xbe) */
 #define RT5645_IRQ_MB1_OC_MASK			(0x1 << 15)
-- 
1.8.1.1.439.g50a6b54

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 1/2] ASoC: rt5645: Add dmi for Broadwell
  2015-09-18  2:55 [PATCH v2 1/2] ASoC: rt5645: Add dmi for Broadwell Bard Liao
  2015-09-18  2:55 ` [PATCH v2 2/2] ASoC: rt5645: Add jd_invert " Bard Liao
@ 2015-09-20 14:37 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2015-09-20 14:37 UTC (permalink / raw)
  To: Bard Liao; +Cc: oder_chiou, alsa-devel, lars, lgirdwood, john.lin, benzh, flove


[-- Attachment #1.1: Type: text/plain, Size: 155 bytes --]

On Fri, Sep 18, 2015 at 10:55:58AM +0800, Bard Liao wrote:
> Add DMI data for Buddy project.

Both patches reverted because this doesn't even compile.  :(

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-09-20 14:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-18  2:55 [PATCH v2 1/2] ASoC: rt5645: Add dmi for Broadwell Bard Liao
2015-09-18  2:55 ` [PATCH v2 2/2] ASoC: rt5645: Add jd_invert " Bard Liao
2015-09-20 14:37 ` [PATCH v2 1/2] ASoC: rt5645: Add dmi " Mark Brown

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).