summaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8904.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-08-04 18:28:21 +0200
committerTakashi Iwai <tiwai@suse.de>2014-08-04 18:28:21 +0200
commite9e3bdffe38b256f920eacc455d30deba5e97655 (patch)
treecfa546f6370c117e012c12605da22ce189542127 /sound/soc/codecs/wm8904.c
parentf42bb22243d2ae264d721b055f836059fe35321f (diff)
parentae34a78c430c37c06404f032fb04e51315204281 (diff)
downloadop-kernel-dev-e9e3bdffe38b256f920eacc455d30deba5e97655.zip
op-kernel-dev-e9e3bdffe38b256f920eacc455d30deba5e97655.tar.gz
Merge tag 'asoc-v3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Updates for v3.17 This has been a pretty exciting release in terms of the framework, we've finally got support for multiple CODECs attached to a single DAI link which has been something there's been interest in as long as I've been working on ASoC. A big thanks to Benoit and Misael for their work on this. Otherwise it's been a fairly standard release for development, including more componentisation work from Lars-Peter and a good selection of both CODEC and CPU drivers. - Support for multiple CODECs attached to a single DAI, enabling systems with for example multiple DAC/speaker drivers on a single link, contributed by Benoit Cousson based on work from Misael Lopez Cruz. - Support for byte controls larger than 256 bytes based on the use of TLVs contributed by Omair Mohammed Abdullah. - More componentisation work from Lars-Peter Clausen. - The remainder of the conversions of CODEC drivers to params_width() - Drivers for Cirrus Logic CS4265, Freescale i.MX ASRC blocks, Realtek RT286 and RT5670, Rockchip RK3xxx I2S controllers and Texas Instruments TAS2552. - Lots of updates and fixes, especially to the DaVinci, Intel, Freescale, Realtek, and rcar drivers.
Diffstat (limited to 'sound/soc/codecs/wm8904.c')
-rw-r--r--sound/soc/codecs/wm8904.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c
index f7c5499..4d2d2b1 100644
--- a/sound/soc/codecs/wm8904.c
+++ b/sound/soc/codecs/wm8904.c
@@ -11,6 +11,7 @@
* published by the Free Software Foundation.
*/
+#include <linux/clk.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
@@ -49,6 +50,7 @@ static const char *wm8904_supply_names[WM8904_NUM_SUPPLIES] = {
/* codec private data */
struct wm8904_priv {
struct regmap *regmap;
+ struct clk *mclk;
enum wm8904_type devtype;
@@ -1290,16 +1292,16 @@ static int wm8904_hw_params(struct snd_pcm_substream *substream,
wm8904->bclk = snd_soc_params_to_bclk(params);
}
- switch (params_format(params)) {
- case SNDRV_PCM_FORMAT_S16_LE:
+ switch (params_width(params)) {
+ case 16:
break;
- case SNDRV_PCM_FORMAT_S20_3LE:
+ case 20:
aif1 |= 0x40;
break;
- case SNDRV_PCM_FORMAT_S24_LE:
+ case 24:
aif1 |= 0x80;
break;
- case SNDRV_PCM_FORMAT_S32_LE:
+ case 32:
aif1 |= 0xc0;
break;
default:
@@ -1828,6 +1830,7 @@ static int wm8904_set_bias_level(struct snd_soc_codec *codec,
switch (level) {
case SND_SOC_BIAS_ON:
+ clk_prepare_enable(wm8904->mclk);
break;
case SND_SOC_BIAS_PREPARE:
@@ -1894,6 +1897,7 @@ static int wm8904_set_bias_level(struct snd_soc_codec *codec,
regulator_bulk_disable(ARRAY_SIZE(wm8904->supplies),
wm8904->supplies);
+ clk_disable_unprepare(wm8904->mclk);
break;
}
codec->dapm.bias_level = level;
@@ -2013,12 +2017,8 @@ static void wm8904_handle_pdata(struct snd_soc_codec *codec)
/* We need an array of texts for the enum API */
wm8904->drc_texts = kmalloc(sizeof(char *)
* pdata->num_drc_cfgs, GFP_KERNEL);
- if (!wm8904->drc_texts) {
- dev_err(codec->dev,
- "Failed to allocate %d DRC config texts\n",
- pdata->num_drc_cfgs);
+ if (!wm8904->drc_texts)
return;
- }
for (i = 0; i < pdata->num_drc_cfgs; i++)
wm8904->drc_texts[i] = pdata->drc_cfgs[i].name;
@@ -2110,6 +2110,13 @@ static int wm8904_i2c_probe(struct i2c_client *i2c,
if (wm8904 == NULL)
return -ENOMEM;
+ wm8904->mclk = devm_clk_get(&i2c->dev, "mclk");
+ if (IS_ERR(wm8904->mclk)) {
+ ret = PTR_ERR(wm8904->mclk);
+ dev_err(&i2c->dev, "Failed to get MCLK\n");
+ return ret;
+ }
+
wm8904->regmap = devm_regmap_init_i2c(i2c, &wm8904_regmap);
if (IS_ERR(wm8904->regmap)) {
ret = PTR_ERR(wm8904->regmap);
OpenPOWER on IntegriCloud