ASoC: rt5640: enable MCLK detection
authorBard Liao <bardliao@realtek.com>
Mon, 17 Oct 2016 11:14:04 +0000 (19:14 +0800)
committerMark Brown <broonie@kernel.org>
Mon, 24 Oct 2016 17:31:23 +0000 (18:31 +0100)
There is a power saving mechanism in rt5640. It will turn off some
unused power when MCLK is not present. We call that "MCLK detection"
and it should be enabled by default.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/rt5640.c
sound/soc/codecs/rt5640.h

index 3cc1135fc2cd1cba29a5c39b5060b3899abe90df..0a7378f81acb141cba3c1996154200d573bbc674 100644 (file)
@@ -2407,6 +2407,9 @@ static int rt5640_i2c_probe(struct i2c_client *i2c,
        if (ret != 0)
                dev_warn(&i2c->dev, "Failed to apply regmap patch: %d\n", ret);
 
        if (ret != 0)
                dev_warn(&i2c->dev, "Failed to apply regmap patch: %d\n", ret);
 
+       regmap_update_bits(rt5640->regmap, RT5640_DUMMY1,
+                               RT5640_MCLK_DET, RT5640_MCLK_DET);
+
        if (rt5640->pdata.in1_diff)
                regmap_update_bits(rt5640->regmap, RT5640_IN1_IN2,
                                        RT5640_IN_DF1, RT5640_IN_DF1);
        if (rt5640->pdata.in1_diff)
                regmap_update_bits(rt5640->regmap, RT5640_IN1_IN2,
                                        RT5640_IN_DF1, RT5640_IN_DF1);
index 90c88711c72a227a2442d0a93e82782fb3439770..22c017c58d5b3f524c4bca6ae59c01b622027dfb 100644 (file)
 #define RT5640_ZCD_HP_DIS                      (0x0 << 15)
 #define RT5640_ZCD_HP_EN                       (0x1 << 15)
 
 #define RT5640_ZCD_HP_DIS                      (0x0 << 15)
 #define RT5640_ZCD_HP_EN                       (0x1 << 15)
 
+/* General Control 1 (0xfa) */
+#define RT5640_MCLK_DET                                (0x1 << 11)
 
 /* Codec Private Register definition */
 /* 3D Speaker Control (0x63) */
 
 /* Codec Private Register definition */
 /* 3D Speaker Control (0x63) */