aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-11-21 09:07:44 -0500
committerTakashi Iwai <tiwai@suse.de>2013-11-21 09:07:44 -0500
commitee71a70e95e4a01be17cf4dfe0339f9774bb5927 (patch)
treed10ce27c2a3cfee5332a91275f5426640d3bdc4b
parentb8362e70cbbb397db50939bc4c7c78dc3246c3eb (diff)
parent9a5c543dd71952719d40429b6ef252a46c9b2246 (diff)
Merge tag 'asoc-v3.13-5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v3.13 A bunch of device specific fixes, nothing with a general impact here.
-rw-r--r--sound/soc/codecs/ab8500-codec.c66
-rw-r--r--sound/soc/codecs/arizona.c4
-rw-r--r--sound/soc/codecs/wm5110.c43
-rw-r--r--sound/soc/sh/rcar/core.c13
-rw-r--r--sound/soc/sh/rcar/scu.c2
5 files changed, 86 insertions, 42 deletions
diff --git a/sound/soc/codecs/ab8500-codec.c b/sound/soc/codecs/ab8500-codec.c
index 21ae8d4fdbfb..1ad92cbf0b24 100644
--- a/sound/soc/codecs/ab8500-codec.c
+++ b/sound/soc/codecs/ab8500-codec.c
@@ -126,8 +126,6 @@ struct ab8500_codec_drvdata_dbg {
126 126
127/* Private data for AB8500 device-driver */ 127/* Private data for AB8500 device-driver */
128struct ab8500_codec_drvdata { 128struct ab8500_codec_drvdata {
129 struct regmap *regmap;
130
131 /* Sidetone */ 129 /* Sidetone */
132 long *sid_fir_values; 130 long *sid_fir_values;
133 enum sid_state sid_status; 131 enum sid_state sid_status;
@@ -168,34 +166,48 @@ static inline const char *amic_type_str(enum amic_type type)
168 */ 166 */
169 167
170/* Read a register from the audio-bank of AB8500 */ 168/* Read a register from the audio-bank of AB8500 */
171static int ab8500_codec_read_reg(void *context, unsigned int reg, 169static unsigned int ab8500_codec_read_reg(struct snd_soc_codec *codec,
172 unsigned int *value) 170 unsigned int reg)
173{ 171{
174 struct device *dev = context;
175 int status; 172 int status;
173 unsigned int value = 0;
176 174
177 u8 value8; 175 u8 value8;
178 status = abx500_get_register_interruptible(dev, AB8500_AUDIO, 176 status = abx500_get_register_interruptible(codec->dev, AB8500_AUDIO,
179 reg, &value8); 177 reg, &value8);
180 *value = (unsigned int)value8; 178 if (status < 0) {
179 dev_err(codec->dev,
180 "%s: ERROR: Register (0x%02x:0x%02x) read failed (%d).\n",
181 __func__, (u8)AB8500_AUDIO, (u8)reg, status);
182 } else {
183 dev_dbg(codec->dev,
184 "%s: Read 0x%02x from register 0x%02x:0x%02x\n",
185 __func__, value8, (u8)AB8500_AUDIO, (u8)reg);
186 value = (unsigned int)value8;
187 }
181 188
182 return status; 189 return value;
183} 190}
184 191
185/* Write to a register in the audio-bank of AB8500 */ 192/* Write to a register in the audio-bank of AB8500 */
186static int ab8500_codec_write_reg(void *context, unsigned int reg, 193static int ab8500_codec_write_reg(struct snd_soc_codec *codec,
187 unsigned int value) 194 unsigned int reg, unsigned int value)
188{ 195{
189 struct device *dev = context; 196 int status;
190 197
191 return abx500_set_register_interruptible(dev, AB8500_AUDIO, 198 status = abx500_set_register_interruptible(codec->dev, AB8500_AUDIO,
192 reg, value); 199 reg, value);
193} 200 if (status < 0)
201 dev_err(codec->dev,
202 "%s: ERROR: Register (%02x:%02x) write failed (%d).\n",
203 __func__, (u8)AB8500_AUDIO, (u8)reg, status);
204 else
205 dev_dbg(codec->dev,
206 "%s: Wrote 0x%02x into register %02x:%02x\n",
207 __func__, (u8)value, (u8)AB8500_AUDIO, (u8)reg);
194 208
195static const struct regmap_config ab8500_codec_regmap = { 209 return status;
196 .reg_read = ab8500_codec_read_reg, 210}
197 .reg_write = ab8500_codec_write_reg,
198};
199 211
200/* 212/*
201 * Controls - DAPM 213 * Controls - DAPM
@@ -2473,13 +2485,9 @@ static int ab8500_codec_probe(struct snd_soc_codec *codec)
2473 2485
2474 dev_dbg(dev, "%s: Enter.\n", __func__); 2486 dev_dbg(dev, "%s: Enter.\n", __func__);
2475 2487
2476 snd_soc_codec_set_cache_io(codec, 0, 0, SND_SOC_REGMAP);
2477
2478 /* Setup AB8500 according to board-settings */ 2488 /* Setup AB8500 according to board-settings */
2479 pdata = dev_get_platdata(dev->parent); 2489 pdata = dev_get_platdata(dev->parent);
2480 2490
2481 codec->control_data = drvdata->regmap;
2482
2483 if (np) { 2491 if (np) {
2484 if (!pdata) 2492 if (!pdata)
2485 pdata = devm_kzalloc(dev, 2493 pdata = devm_kzalloc(dev,
@@ -2557,6 +2565,9 @@ static int ab8500_codec_probe(struct snd_soc_codec *codec)
2557 2565
2558static struct snd_soc_codec_driver ab8500_codec_driver = { 2566static struct snd_soc_codec_driver ab8500_codec_driver = {
2559 .probe = ab8500_codec_probe, 2567 .probe = ab8500_codec_probe,
2568 .read = ab8500_codec_read_reg,
2569 .write = ab8500_codec_write_reg,
2570 .reg_word_size = sizeof(u8),
2560 .controls = ab8500_ctrls, 2571 .controls = ab8500_ctrls,
2561 .num_controls = ARRAY_SIZE(ab8500_ctrls), 2572 .num_controls = ARRAY_SIZE(ab8500_ctrls),
2562 .dapm_widgets = ab8500_dapm_widgets, 2573 .dapm_widgets = ab8500_dapm_widgets,
@@ -2581,15 +2592,6 @@ static int ab8500_codec_driver_probe(struct platform_device *pdev)
2581 drvdata->anc_status = ANC_UNCONFIGURED; 2592 drvdata->anc_status = ANC_UNCONFIGURED;
2582 dev_set_drvdata(&pdev->dev, drvdata); 2593 dev_set_drvdata(&pdev->dev, drvdata);
2583 2594
2584 drvdata->regmap = devm_regmap_init(&pdev->dev, NULL, &pdev->dev,
2585 &ab8500_codec_regmap);
2586 if (IS_ERR(drvdata->regmap)) {
2587 status = PTR_ERR(drvdata->regmap);
2588 dev_err(&pdev->dev, "%s: Failed to allocate regmap: %d\n",
2589 __func__, status);
2590 return status;
2591 }
2592
2593 dev_dbg(&pdev->dev, "%s: Register codec.\n", __func__); 2595 dev_dbg(&pdev->dev, "%s: Register codec.\n", __func__);
2594 status = snd_soc_register_codec(&pdev->dev, &ab8500_codec_driver, 2596 status = snd_soc_register_codec(&pdev->dev, &ab8500_codec_driver,
2595 ab8500_codec_dai, 2597 ab8500_codec_dai,
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index 6f05b17d1965..fea991031be1 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -1529,6 +1529,8 @@ static void arizona_enable_fll(struct arizona_fll *fll,
1529 try_wait_for_completion(&fll->ok); 1529 try_wait_for_completion(&fll->ok);
1530 1530
1531 regmap_update_bits(arizona->regmap, fll->base + 1, 1531 regmap_update_bits(arizona->regmap, fll->base + 1,
1532 ARIZONA_FLL1_FREERUN, 0);
1533 regmap_update_bits(arizona->regmap, fll->base + 1,
1532 ARIZONA_FLL1_ENA, ARIZONA_FLL1_ENA); 1534 ARIZONA_FLL1_ENA, ARIZONA_FLL1_ENA);
1533 if (use_sync) 1535 if (use_sync)
1534 regmap_update_bits(arizona->regmap, fll->base + 0x11, 1536 regmap_update_bits(arizona->regmap, fll->base + 0x11,
@@ -1546,6 +1548,8 @@ static void arizona_disable_fll(struct arizona_fll *fll)
1546 struct arizona *arizona = fll->arizona; 1548 struct arizona *arizona = fll->arizona;
1547 bool change; 1549 bool change;
1548 1550
1551 regmap_update_bits(arizona->regmap, fll->base + 1,
1552 ARIZONA_FLL1_FREERUN, ARIZONA_FLL1_FREERUN);
1549 regmap_update_bits_check(arizona->regmap, fll->base + 1, 1553 regmap_update_bits_check(arizona->regmap, fll->base + 1,
1550 ARIZONA_FLL1_ENA, 0, &change); 1554 ARIZONA_FLL1_ENA, 0, &change);
1551 regmap_update_bits(arizona->regmap, fll->base + 0x11, 1555 regmap_update_bits(arizona->regmap, fll->base + 0x11,
diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c
index f2d1094424b9..c3c7396a6181 100644
--- a/sound/soc/codecs/wm5110.c
+++ b/sound/soc/codecs/wm5110.c
@@ -37,6 +37,47 @@ struct wm5110_priv {
37 struct arizona_fll fll[2]; 37 struct arizona_fll fll[2];
38}; 38};
39 39
40static const struct reg_default wm5110_sysclk_revd_patch[] = {
41 { 0x3093, 0x1001 },
42 { 0x30E3, 0x1301 },
43 { 0x3133, 0x1201 },
44 { 0x3183, 0x1501 },
45 { 0x31D3, 0x1401 },
46};
47
48static int wm5110_sysclk_ev(struct snd_soc_dapm_widget *w,
49 struct snd_kcontrol *kcontrol, int event)
50{
51 struct snd_soc_codec *codec = w->codec;
52 struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
53 struct regmap *regmap = codec->control_data;
54 const struct reg_default *patch = NULL;
55 int i, patch_size;
56
57 switch (arizona->rev) {
58 case 3:
59 patch = wm5110_sysclk_revd_patch;
60 patch_size = ARRAY_SIZE(wm5110_sysclk_revd_patch);
61 break;
62 default:
63 return 0;
64 }
65
66 switch (event) {
67 case SND_SOC_DAPM_POST_PMU:
68 if (patch)
69 for (i = 0; i < patch_size; i++)
70 regmap_write(regmap, patch[i].reg,
71 patch[i].def);
72 break;
73
74 default:
75 break;
76 }
77
78 return 0;
79}
80
40static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0); 81static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0);
41static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); 82static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
42static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0); 83static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0);
@@ -400,7 +441,7 @@ static const struct snd_kcontrol_new wm5110_aec_loopback_mux =
400 441
401static const struct snd_soc_dapm_widget wm5110_dapm_widgets[] = { 442static const struct snd_soc_dapm_widget wm5110_dapm_widgets[] = {
402SND_SOC_DAPM_SUPPLY("SYSCLK", ARIZONA_SYSTEM_CLOCK_1, ARIZONA_SYSCLK_ENA_SHIFT, 443SND_SOC_DAPM_SUPPLY("SYSCLK", ARIZONA_SYSTEM_CLOCK_1, ARIZONA_SYSCLK_ENA_SHIFT,
403 0, NULL, 0), 444 0, wm5110_sysclk_ev, SND_SOC_DAPM_POST_PMU),
404SND_SOC_DAPM_SUPPLY("ASYNCCLK", ARIZONA_ASYNC_CLOCK_1, 445SND_SOC_DAPM_SUPPLY("ASYNCCLK", ARIZONA_ASYNC_CLOCK_1,
405 ARIZONA_ASYNC_CLK_ENA_SHIFT, 0, NULL, 0), 446 ARIZONA_ASYNC_CLK_ENA_SHIFT, 0, NULL, 0),
406SND_SOC_DAPM_SUPPLY("OPCLK", ARIZONA_OUTPUT_SYSTEM_CLOCK, 447SND_SOC_DAPM_SUPPLY("OPCLK", ARIZONA_OUTPUT_SYSTEM_CLOCK,
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 78c35b44fc04..b3653d37f75f 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -200,9 +200,8 @@ static void rsnd_dma_do_work(struct work_struct *work)
200 return; 200 return;
201 } 201 }
202 202
203 dma_async_issue_pending(dma->chan);
203 } 204 }
204
205 dma_async_issue_pending(dma->chan);
206} 205}
207 206
208int rsnd_dma_available(struct rsnd_dma *dma) 207int rsnd_dma_available(struct rsnd_dma *dma)
@@ -288,15 +287,13 @@ int rsnd_dai_connect(struct rsnd_dai *rdai,
288 struct rsnd_mod *mod, 287 struct rsnd_mod *mod,
289 struct rsnd_dai_stream *io) 288 struct rsnd_dai_stream *io)
290{ 289{
291 struct rsnd_priv *priv = rsnd_mod_to_priv(mod); 290 if (!mod)
292 struct device *dev = rsnd_priv_to_dev(priv);
293
294 if (!mod) {
295 dev_err(dev, "NULL mod\n");
296 return -EIO; 291 return -EIO;
297 }
298 292
299 if (!list_empty(&mod->list)) { 293 if (!list_empty(&mod->list)) {
294 struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
295 struct device *dev = rsnd_priv_to_dev(priv);
296
300 dev_err(dev, "%s%d is not empty\n", 297 dev_err(dev, "%s%d is not empty\n",
301 rsnd_mod_name(mod), 298 rsnd_mod_name(mod),
302 rsnd_mod_id(mod)); 299 rsnd_mod_id(mod));
diff --git a/sound/soc/sh/rcar/scu.c b/sound/soc/sh/rcar/scu.c
index f4453e33a847..fa8fa15860b9 100644
--- a/sound/soc/sh/rcar/scu.c
+++ b/sound/soc/sh/rcar/scu.c
@@ -68,7 +68,7 @@ static int rsnd_scu_set_route(struct rsnd_priv *priv,
68 return 0; 68 return 0;
69 69
70 id = rsnd_mod_id(mod); 70 id = rsnd_mod_id(mod);
71 if (id < 0 || id > ARRAY_SIZE(routes)) 71 if (id < 0 || id >= ARRAY_SIZE(routes))
72 return -EIO; 72 return -EIO;
73 73
74 /* 74 /*