From: <bardliao@realtek.com>
To: broonie@kernel.org, lgirdwood@gmail.com
Cc: oder_chiou@realtek.com, Bard Liao <bardliao@realtek.com>,
alsa-devel@alsa-project.org, lars@metafoo.de, flove@realtek.com
Subject: [PATCH] ASoC: rt286: Add API to set supported jack type
Date: Tue, 5 Aug 2014 13:52:50 +0800 [thread overview]
Message-ID: <1407217970-20126-1-git-send-email-bardliao@realtek.com> (raw)
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
next reply other threads:[~2014-08-05 5:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-05 5:52 bardliao [this message]
2014-08-06 20:54 ` [PATCH] ASoC: rt286: Add API to set supported jack type 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1407217970-20126-1-git-send-email-bardliao@realtek.com \
--to=bardliao@realtek.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=flove@realtek.com \
--cc=lars@metafoo.de \
--cc=lgirdwood@gmail.com \
--cc=oder_chiou@realtek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).