alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: rt286: Add API to set supported jack type
@ 2014-08-05  5:52 bardliao
  2014-08-06 20:54 ` Mark Brown
  0 siblings, 1 reply; 8+ messages in thread
From: bardliao @ 2014-08-05  5:52 UTC (permalink / raw)
  To: broonie, lgirdwood; +Cc: oder_chiou, Bard Liao, alsa-devel, lars, flove

From: Bard Liao <bardliao@realtek.com>

RT286 need to configure the jack type (combo or non-combo) according to the
HW design. This function is given a easy way to set the correct jacy type
for those without platform data supported.

Signed-off-by: Bard Liao <bardliao@realtek.com>
---
 sound/soc/codecs/rt286.c | 33 +++++++++++++++++++++++++++++++++
 sound/soc/codecs/rt286.h |  7 +++++++
 2 files changed, 40 insertions(+)

diff --git a/sound/soc/codecs/rt286.c b/sound/soc/codecs/rt286.c
index e4f6102..dd6b454 100644
--- a/sound/soc/codecs/rt286.c
+++ b/sound/soc/codecs/rt286.c
@@ -414,6 +414,39 @@ int rt286_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack)
 }
 EXPORT_SYMBOL_GPL(rt286_mic_detect);
 
+/**
+ * rt286_set_jack_type - Configure the HW supported jack type
+ *
+ * @codec:   RT286 codec
+ * @type:    supported jack type
+ *
+ * RT286 need to configure the jack type (combo or non-combo) according to the
+ * HW design. This function is given a easy way to set the correct jacy type
+ * for those without platform data supported.
+ */
+void rt286_set_jack_type(struct snd_soc_codec *codec,
+				enum rt286_jack_type type)
+{
+	struct rt286_priv *rt286 = snd_soc_codec_get_drvdata(codec);
+
+	if (RT286_TYPE_COMBO == type)
+		rt286->pdata.cbj_en = true;
+	else
+		rt286->pdata.cbj_en = false;
+
+	if (!rt286->pdata.cbj_en) {
+		regmap_write(rt286->regmap, RT286_CBJ_CTRL2, 0x0000);
+		regmap_write(rt286->regmap, RT286_MIC1_DET_CTRL, 0x0816);
+		regmap_write(rt286->regmap, RT286_MISC_CTRL1, 0x0000);
+		regmap_update_bits(rt286->regmap,
+					RT286_CBJ_CTRL1, 0xf000, 0xb000);
+	} else {
+		regmap_update_bits(rt286->regmap,
+					RT286_CBJ_CTRL1, 0xf000, 0x5000);
+	}
+}
+EXPORT_SYMBOL_GPL(rt286_set_jack_type);
+
 static const DECLARE_TLV_DB_SCALE(out_vol_tlv, -6350, 50, 0);
 static const DECLARE_TLV_DB_SCALE(mic_vol_tlv, 0, 1000, 0);
 
diff --git a/sound/soc/codecs/rt286.h b/sound/soc/codecs/rt286.h
index b539b73..2b1cbe6 100644
--- a/sound/soc/codecs/rt286.h
+++ b/sound/soc/codecs/rt286.h
@@ -192,7 +192,14 @@ enum {
 	RT286_AIFS,
 };
 
+enum rt286_jack_type {
+	RT286_TYPE_COMBO,
+	RT286_TYPE_NONCOMBO,
+};
+
 int rt286_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack);
+void rt286_set_jack_type(struct snd_soc_codec *codec,
+				enum rt286_jack_type type);
 
 #endif /* __RT286_H__ */
 
-- 
1.8.1.1.439.g50a6b54

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

end of thread, other threads:[~2014-08-14 19:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-05  5:52 [PATCH] ASoC: rt286: Add API to set supported jack type bardliao
2014-08-06 20:54 ` Mark Brown
2014-08-07  1:43   ` Bard Liao
2014-08-07 17:31     ` Mark Brown
2014-08-11  9:59       ` Liam Girdwood
2014-08-11 12:24         ` Mark Brown
2014-08-14  8:29           ` Liam Girdwood
2014-08-14 19:09             ` [alsa-devel] " 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).