aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2013-11-08 05:43:34 -0500
committerMark Brown <broonie@linaro.org>2013-11-08 05:43:34 -0500
commit457eb9016bf00e90cc84513e70d21bcf64742919 (patch)
treefe09af032d3084ea39dfd8dda522e90cdb6a2272 /sound
parent9686e4b2a89375aa72aa9c7a9beea2cd71479941 (diff)
parent5a7615cf1fcaaf1598b5689e54915d88c2344788 (diff)
Merge remote-tracking branch 'asoc/topic/rt5640' into asoc-next
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/rt5640.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c
index c26a8f814b18..a3fb41179636 100644
--- a/sound/soc/codecs/rt5640.c
+++ b/sound/soc/codecs/rt5640.c
@@ -21,6 +21,7 @@
21#include <linux/of_gpio.h> 21#include <linux/of_gpio.h>
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/spi/spi.h> 23#include <linux/spi/spi.h>
24#include <linux/acpi.h>
24#include <sound/core.h> 25#include <sound/core.h>
25#include <sound/pcm.h> 26#include <sound/pcm.h>
26#include <sound/pcm_params.h> 27#include <sound/pcm_params.h>
@@ -926,7 +927,7 @@ static int rt5640_set_dmic2_event(struct snd_soc_dapm_widget *w,
926 return 0; 927 return 0;
927} 928}
928 929
929void hp_amp_power_on(struct snd_soc_codec *codec) 930static void hp_amp_power_on(struct snd_soc_codec *codec)
930{ 931{
931 struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec); 932 struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec);
932 933
@@ -1603,13 +1604,14 @@ static int rt5640_hw_params(struct snd_pcm_substream *substream,
1603 struct snd_soc_pcm_runtime *rtd = substream->private_data; 1604 struct snd_soc_pcm_runtime *rtd = substream->private_data;
1604 struct snd_soc_codec *codec = rtd->codec; 1605 struct snd_soc_codec *codec = rtd->codec;
1605 struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec); 1606 struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec);
1606 unsigned int val_len = 0, val_clk, mask_clk, dai_sel; 1607 unsigned int val_len = 0, val_clk, mask_clk;
1607 int pre_div, bclk_ms, frame_size; 1608 int dai_sel, pre_div, bclk_ms, frame_size;
1608 1609
1609 rt5640->lrck[dai->id] = params_rate(params); 1610 rt5640->lrck[dai->id] = params_rate(params);
1610 pre_div = get_clk_info(rt5640->sysclk, rt5640->lrck[dai->id]); 1611 pre_div = get_clk_info(rt5640->sysclk, rt5640->lrck[dai->id]);
1611 if (pre_div < 0) { 1612 if (pre_div < 0) {
1612 dev_err(codec->dev, "Unsupported clock setting\n"); 1613 dev_err(codec->dev, "Unsupported clock setting %d for DAI %d\n",
1614 rt5640->lrck[dai->id], dai->id);
1613 return -EINVAL; 1615 return -EINVAL;
1614 } 1616 }
1615 frame_size = snd_soc_params_to_frame_size(params); 1617 frame_size = snd_soc_params_to_frame_size(params);
@@ -1673,7 +1675,8 @@ static int rt5640_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
1673{ 1675{
1674 struct snd_soc_codec *codec = dai->codec; 1676 struct snd_soc_codec *codec = dai->codec;
1675 struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec); 1677 struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec);
1676 unsigned int reg_val = 0, dai_sel; 1678 unsigned int reg_val = 0;
1679 int dai_sel;
1677 1680
1678 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { 1681 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
1679 case SND_SOC_DAIFMT_CBM_CFM: 1682 case SND_SOC_DAIFMT_CBM_CFM:
@@ -1977,13 +1980,20 @@ static int rt5640_suspend(struct snd_soc_codec *codec)
1977 rt5640_reset(codec); 1980 rt5640_reset(codec);
1978 regcache_cache_only(rt5640->regmap, true); 1981 regcache_cache_only(rt5640->regmap, true);
1979 regcache_mark_dirty(rt5640->regmap); 1982 regcache_mark_dirty(rt5640->regmap);
1983 if (gpio_is_valid(rt5640->pdata.ldo1_en))
1984 gpio_set_value_cansleep(rt5640->pdata.ldo1_en, 0);
1980 1985
1981 return 0; 1986 return 0;
1982} 1987}
1983 1988
1984static int rt5640_resume(struct snd_soc_codec *codec) 1989static int rt5640_resume(struct snd_soc_codec *codec)
1985{ 1990{
1986 rt5640_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 1991 struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec);
1992
1993 if (gpio_is_valid(rt5640->pdata.ldo1_en)) {
1994 gpio_set_value_cansleep(rt5640->pdata.ldo1_en, 1);
1995 msleep(400);
1996 }
1987 1997
1988 return 0; 1998 return 0;
1989} 1999}
@@ -2080,6 +2090,14 @@ static const struct i2c_device_id rt5640_i2c_id[] = {
2080}; 2090};
2081MODULE_DEVICE_TABLE(i2c, rt5640_i2c_id); 2091MODULE_DEVICE_TABLE(i2c, rt5640_i2c_id);
2082 2092
2093#ifdef CONFIG_ACPI
2094static struct acpi_device_id rt5640_acpi_match[] = {
2095 { "INT33CA", 0 },
2096 { },
2097};
2098MODULE_DEVICE_TABLE(acpi, rt5640_acpi_match);
2099#endif
2100
2083static int rt5640_parse_dt(struct rt5640_priv *rt5640, struct device_node *np) 2101static int rt5640_parse_dt(struct rt5640_priv *rt5640, struct device_node *np)
2084{ 2102{
2085 rt5640->pdata.in1_diff = of_property_read_bool(np, 2103 rt5640->pdata.in1_diff = of_property_read_bool(np,
@@ -2199,6 +2217,7 @@ static struct i2c_driver rt5640_i2c_driver = {
2199 .driver = { 2217 .driver = {
2200 .name = "rt5640", 2218 .name = "rt5640",
2201 .owner = THIS_MODULE, 2219 .owner = THIS_MODULE,
2220 .acpi_match_table = ACPI_PTR(rt5640_acpi_match),
2202 }, 2221 },
2203 .probe = rt5640_i2c_probe, 2222 .probe = rt5640_i2c_probe,
2204 .remove = rt5640_i2c_remove, 2223 .remove = rt5640_i2c_remove,