diff options
author | Mark Brown <broonie@kernel.org> | 2014-10-01 12:04:24 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2014-10-01 12:04:24 -0400 |
commit | 1400760c4637e1b3aa4460176d4f81ded58df393 (patch) | |
tree | f80d25835812d07c411d32ec1bdedae1eb701925 | |
parent | f8a770c2c67f28956f8f4601feb99e9bd02a16c8 (diff) | |
parent | cd69dc8868d64cfa2993944607d9e97927d95987 (diff) |
Merge branch 'topic/rt5640' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-intel
-rw-r--r-- | sound/soc/codecs/rt5640.c | 49 | ||||
-rw-r--r-- | sound/soc/codecs/rt5640.h | 3 |
2 files changed, 33 insertions, 19 deletions
diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c index 6bc6efdec550..2fdcbb8e8a2a 100644 --- a/sound/soc/codecs/rt5640.c +++ b/sound/soc/codecs/rt5640.c | |||
@@ -1906,6 +1906,32 @@ static int rt5640_set_bias_level(struct snd_soc_codec *codec, | |||
1906 | return 0; | 1906 | return 0; |
1907 | } | 1907 | } |
1908 | 1908 | ||
1909 | int rt5640_dmic_enable(struct snd_soc_codec *codec, | ||
1910 | bool dmic1_data_pin, bool dmic2_data_pin) | ||
1911 | { | ||
1912 | struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec); | ||
1913 | |||
1914 | regmap_update_bits(rt5640->regmap, RT5640_GPIO_CTRL1, | ||
1915 | RT5640_GP2_PIN_MASK, RT5640_GP2_PIN_DMIC1_SCL); | ||
1916 | |||
1917 | if (dmic1_data_pin) { | ||
1918 | regmap_update_bits(rt5640->regmap, RT5640_DMIC, | ||
1919 | RT5640_DMIC_1_DP_MASK, RT5640_DMIC_1_DP_GPIO3); | ||
1920 | regmap_update_bits(rt5640->regmap, RT5640_GPIO_CTRL1, | ||
1921 | RT5640_GP3_PIN_MASK, RT5640_GP3_PIN_DMIC1_SDA); | ||
1922 | } | ||
1923 | |||
1924 | if (dmic2_data_pin) { | ||
1925 | regmap_update_bits(rt5640->regmap, RT5640_DMIC, | ||
1926 | RT5640_DMIC_2_DP_MASK, RT5640_DMIC_2_DP_GPIO4); | ||
1927 | regmap_update_bits(rt5640->regmap, RT5640_GPIO_CTRL1, | ||
1928 | RT5640_GP4_PIN_MASK, RT5640_GP4_PIN_DMIC2_SDA); | ||
1929 | } | ||
1930 | |||
1931 | return 0; | ||
1932 | } | ||
1933 | EXPORT_SYMBOL_GPL(rt5640_dmic_enable); | ||
1934 | |||
1909 | static int rt5640_probe(struct snd_soc_codec *codec) | 1935 | static int rt5640_probe(struct snd_soc_codec *codec) |
1910 | { | 1936 | { |
1911 | struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec); | 1937 | struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec); |
@@ -1945,6 +1971,10 @@ static int rt5640_probe(struct snd_soc_codec *codec) | |||
1945 | return -ENODEV; | 1971 | return -ENODEV; |
1946 | } | 1972 | } |
1947 | 1973 | ||
1974 | if (rt5640->pdata.dmic_en) | ||
1975 | rt5640_dmic_enable(codec, rt5640->pdata.dmic1_data_pin, | ||
1976 | rt5640->pdata.dmic2_data_pin); | ||
1977 | |||
1948 | return 0; | 1978 | return 0; |
1949 | } | 1979 | } |
1950 | 1980 | ||
@@ -2194,25 +2224,6 @@ static int rt5640_i2c_probe(struct i2c_client *i2c, | |||
2194 | regmap_update_bits(rt5640->regmap, RT5640_IN3_IN4, | 2224 | regmap_update_bits(rt5640->regmap, RT5640_IN3_IN4, |
2195 | RT5640_IN_DF2, RT5640_IN_DF2); | 2225 | RT5640_IN_DF2, RT5640_IN_DF2); |
2196 | 2226 | ||
2197 | if (rt5640->pdata.dmic_en) { | ||
2198 | regmap_update_bits(rt5640->regmap, RT5640_GPIO_CTRL1, | ||
2199 | RT5640_GP2_PIN_MASK, RT5640_GP2_PIN_DMIC1_SCL); | ||
2200 | |||
2201 | if (rt5640->pdata.dmic1_data_pin) { | ||
2202 | regmap_update_bits(rt5640->regmap, RT5640_DMIC, | ||
2203 | RT5640_DMIC_1_DP_MASK, RT5640_DMIC_1_DP_GPIO3); | ||
2204 | regmap_update_bits(rt5640->regmap, RT5640_GPIO_CTRL1, | ||
2205 | RT5640_GP3_PIN_MASK, RT5640_GP3_PIN_DMIC1_SDA); | ||
2206 | } | ||
2207 | |||
2208 | if (rt5640->pdata.dmic2_data_pin) { | ||
2209 | regmap_update_bits(rt5640->regmap, RT5640_DMIC, | ||
2210 | RT5640_DMIC_2_DP_MASK, RT5640_DMIC_2_DP_GPIO4); | ||
2211 | regmap_update_bits(rt5640->regmap, RT5640_GPIO_CTRL1, | ||
2212 | RT5640_GP4_PIN_MASK, RT5640_GP4_PIN_DMIC2_SDA); | ||
2213 | } | ||
2214 | } | ||
2215 | |||
2216 | rt5640->hp_mute = 1; | 2227 | rt5640->hp_mute = 1; |
2217 | 2228 | ||
2218 | return snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5640, | 2229 | return snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5640, |
diff --git a/sound/soc/codecs/rt5640.h b/sound/soc/codecs/rt5640.h index 58ebe96b86da..3deb8babeabb 100644 --- a/sound/soc/codecs/rt5640.h +++ b/sound/soc/codecs/rt5640.h | |||
@@ -2097,4 +2097,7 @@ struct rt5640_priv { | |||
2097 | bool hp_mute; | 2097 | bool hp_mute; |
2098 | }; | 2098 | }; |
2099 | 2099 | ||
2100 | int rt5640_dmic_enable(struct snd_soc_codec *codec, | ||
2101 | bool dmic1_data_pin, bool dmic2_data_pin); | ||
2102 | |||
2100 | #endif | 2103 | #endif |