aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBard Liao <bardliao@realtek.com>2014-11-05 02:02:08 -0500
committerMark Brown <broonie@kernel.org>2014-11-06 07:33:49 -0500
commitbb656add19764c7a3cf28b2b330ec0a189fe4f48 (patch)
tree74f8c541138f8c51d9be27a27277b3db76b851dd
parent0b2e4959ceacb26eb586698d9ceecc0a6bd30f72 (diff)
ASoC: rt5645: Add JD function support
rt5645 codec support jack detection function. The patch will set related registers if JD function is used. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--include/sound/rt5645.h3
-rw-r--r--sound/soc/codecs/rt5645.c20
-rw-r--r--sound/soc/codecs/rt5645.h5
3 files changed, 28 insertions, 0 deletions
diff --git a/include/sound/rt5645.h b/include/sound/rt5645.h
index a5352712194b..937f421bc66b 100644
--- a/include/sound/rt5645.h
+++ b/include/sound/rt5645.h
@@ -23,6 +23,9 @@ struct rt5645_platform_data {
23 23
24 unsigned int hp_det_gpio; 24 unsigned int hp_det_gpio;
25 bool gpio_hp_det_active_high; 25 bool gpio_hp_det_active_high;
26
27 /* true if codec's jd function is used */
28 bool en_jd_func;
26}; 29};
27 30
28#endif 31#endif
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index 1423cb283f15..286438d6916b 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -2203,6 +2203,13 @@ static int rt5645_probe(struct snd_soc_codec *codec)
2203 2203
2204 snd_soc_update_bits(codec, RT5645_CHARGE_PUMP, 0x0300, 0x0200); 2204 snd_soc_update_bits(codec, RT5645_CHARGE_PUMP, 0x0300, 0x0200);
2205 2205
2206 /* for JD function */
2207 if (rt5645->pdata.en_jd_func) {
2208 snd_soc_dapm_force_enable_pin(&codec->dapm, "JD Power");
2209 snd_soc_dapm_force_enable_pin(&codec->dapm, "LDO2");
2210 snd_soc_dapm_sync(&codec->dapm);
2211 }
2212
2206 return 0; 2213 return 0;
2207} 2214}
2208 2215
@@ -2436,6 +2443,19 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
2436 2443
2437 } 2444 }
2438 2445
2446 if (rt5645->pdata.en_jd_func) {
2447 regmap_update_bits(rt5645->regmap, RT5645_GEN_CTRL3,
2448 RT5645_IRQ_CLK_GATE_CTRL | RT5645_MICINDET_MANU,
2449 RT5645_IRQ_CLK_GATE_CTRL | RT5645_MICINDET_MANU);
2450 regmap_update_bits(rt5645->regmap, RT5645_IN1_CTRL1,
2451 RT5645_CBJ_BST1_EN, RT5645_CBJ_BST1_EN);
2452 regmap_update_bits(rt5645->regmap, RT5645_JD_CTRL3,
2453 RT5645_JD_CBJ_EN | RT5645_JD_CBJ_POL,
2454 RT5645_JD_CBJ_EN | RT5645_JD_CBJ_POL);
2455 regmap_update_bits(rt5645->regmap, RT5645_MICBIAS,
2456 RT5645_IRQ_CLK_INT, RT5645_IRQ_CLK_INT);
2457 }
2458
2439 if (rt5645->i2c->irq) { 2459 if (rt5645->i2c->irq) {
2440 ret = request_threaded_irq(rt5645->i2c->irq, NULL, rt5645_irq, 2460 ret = request_threaded_irq(rt5645->i2c->irq, NULL, rt5645_irq,
2441 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING 2461 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING
diff --git a/sound/soc/codecs/rt5645.h b/sound/soc/codecs/rt5645.h
index 5ec2520614d2..82f681b02949 100644
--- a/sound/soc/codecs/rt5645.h
+++ b/sound/soc/codecs/rt5645.h
@@ -1348,6 +1348,8 @@
1348#define RT5645_PWR_CLK25M_SFT 4 1348#define RT5645_PWR_CLK25M_SFT 4
1349#define RT5645_PWR_CLK25M_PD (0x0 << 4) 1349#define RT5645_PWR_CLK25M_PD (0x0 << 4)
1350#define RT5645_PWR_CLK25M_PU (0x1 << 4) 1350#define RT5645_PWR_CLK25M_PU (0x1 << 4)
1351#define RT5645_IRQ_CLK_MCLK (0x0 << 3)
1352#define RT5645_IRQ_CLK_INT (0x1 << 3)
1351 1353
1352/* VAD Control 4 (0x9d) */ 1354/* VAD Control 4 (0x9d) */
1353#define RT5645_VAD_SEL_MASK (0x3 << 8) 1355#define RT5645_VAD_SEL_MASK (0x3 << 8)
@@ -2116,6 +2118,9 @@ enum {
2116#define RT5645_RXDP2_SEL_ADC (0x1 << 3) 2118#define RT5645_RXDP2_SEL_ADC (0x1 << 3)
2117#define RT5645_RXDP2_SEL_SFT (3) 2119#define RT5645_RXDP2_SEL_SFT (3)
2118 2120
2121/* General Control3 (0xfc) */
2122#define RT5645_IRQ_CLK_GATE_CTRL (0x1 << 11)
2123#define RT5645_MICINDET_MANU (0x1 << 7)
2119 2124
2120/* Vendor ID (0xfd) */ 2125/* Vendor ID (0xfd) */
2121#define RT5645_VER_C 0x2 2126#define RT5645_VER_C 0x2