aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/codecs/wm2000.c59
-rw-r--r--sound/soc/codecs/wm8904.c26
-rw-r--r--sound/soc/codecs/wm8994.c105
-rw-r--r--sound/soc/codecs/wm8996.c8
-rw-r--r--sound/soc/fsl/imx-audmux.c8
-rw-r--r--sound/soc/fsl/imx-ssi.c6
-rw-r--r--sound/soc/pxa/pxa-ssp.c38
-rw-r--r--sound/soc/sh/fsi.c25
-rw-r--r--sound/soc/soc-dapm.c4
-rw-r--r--sound/soc/soc-pcm.c6
-rw-r--r--sound/soc/tegra/tegra30_ahub.c1
-rw-r--r--sound/soc/tegra/tegra_wm8903.c13
12 files changed, 162 insertions, 137 deletions
diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c
index a75c3766aede..0418fa11e6bd 100644
--- a/sound/soc/codecs/wm2000.c
+++ b/sound/soc/codecs/wm2000.c
@@ -99,8 +99,9 @@ static void wm2000_reset(struct wm2000_priv *wm2000)
99} 99}
100 100
101static int wm2000_poll_bit(struct i2c_client *i2c, 101static int wm2000_poll_bit(struct i2c_client *i2c,
102 unsigned int reg, u8 mask, int timeout) 102 unsigned int reg, u8 mask)
103{ 103{
104 int timeout = 4000;
104 int val; 105 int val;
105 106
106 val = wm2000_read(i2c, reg); 107 val = wm2000_read(i2c, reg);
@@ -119,7 +120,7 @@ static int wm2000_poll_bit(struct i2c_client *i2c,
119static int wm2000_power_up(struct i2c_client *i2c, int analogue) 120static int wm2000_power_up(struct i2c_client *i2c, int analogue)
120{ 121{
121 struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev); 122 struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev);
122 int ret, timeout; 123 int ret;
123 124
124 BUG_ON(wm2000->anc_mode != ANC_OFF); 125 BUG_ON(wm2000->anc_mode != ANC_OFF);
125 126
@@ -140,13 +141,13 @@ static int wm2000_power_up(struct i2c_client *i2c, int analogue)
140 141
141 /* Wait for ANC engine to become ready */ 142 /* Wait for ANC engine to become ready */
142 if (!wm2000_poll_bit(i2c, WM2000_REG_ANC_STAT, 143 if (!wm2000_poll_bit(i2c, WM2000_REG_ANC_STAT,
143 WM2000_ANC_ENG_IDLE, 1)) { 144 WM2000_ANC_ENG_IDLE)) {
144 dev_err(&i2c->dev, "ANC engine failed to reset\n"); 145 dev_err(&i2c->dev, "ANC engine failed to reset\n");
145 return -ETIMEDOUT; 146 return -ETIMEDOUT;
146 } 147 }
147 148
148 if (!wm2000_poll_bit(i2c, WM2000_REG_SYS_STATUS, 149 if (!wm2000_poll_bit(i2c, WM2000_REG_SYS_STATUS,
149 WM2000_STATUS_BOOT_COMPLETE, 1)) { 150 WM2000_STATUS_BOOT_COMPLETE)) {
150 dev_err(&i2c->dev, "ANC engine failed to initialise\n"); 151 dev_err(&i2c->dev, "ANC engine failed to initialise\n");
151 return -ETIMEDOUT; 152 return -ETIMEDOUT;
152 } 153 }
@@ -173,16 +174,13 @@ static int wm2000_power_up(struct i2c_client *i2c, int analogue)
173 dev_dbg(&i2c->dev, "Download complete\n"); 174 dev_dbg(&i2c->dev, "Download complete\n");
174 175
175 if (analogue) { 176 if (analogue) {
176 timeout = 248; 177 wm2000_write(i2c, WM2000_REG_ANA_VMID_PU_TIME, 248 / 4);
177 wm2000_write(i2c, WM2000_REG_ANA_VMID_PU_TIME, timeout / 4);
178 178
179 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL, 179 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL,
180 WM2000_MODE_ANA_SEQ_INCLUDE | 180 WM2000_MODE_ANA_SEQ_INCLUDE |
181 WM2000_MODE_MOUSE_ENABLE | 181 WM2000_MODE_MOUSE_ENABLE |
182 WM2000_MODE_THERMAL_ENABLE); 182 WM2000_MODE_THERMAL_ENABLE);
183 } else { 183 } else {
184 timeout = 10;
185
186 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL, 184 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL,
187 WM2000_MODE_MOUSE_ENABLE | 185 WM2000_MODE_MOUSE_ENABLE |
188 WM2000_MODE_THERMAL_ENABLE); 186 WM2000_MODE_THERMAL_ENABLE);
@@ -201,9 +199,8 @@ static int wm2000_power_up(struct i2c_client *i2c, int analogue)
201 wm2000_write(i2c, WM2000_REG_SYS_CTL2, WM2000_ANC_INT_N_CLR); 199 wm2000_write(i2c, WM2000_REG_SYS_CTL2, WM2000_ANC_INT_N_CLR);
202 200
203 if (!wm2000_poll_bit(i2c, WM2000_REG_SYS_STATUS, 201 if (!wm2000_poll_bit(i2c, WM2000_REG_SYS_STATUS,
204 WM2000_STATUS_MOUSE_ACTIVE, timeout)) { 202 WM2000_STATUS_MOUSE_ACTIVE)) {
205 dev_err(&i2c->dev, "Timed out waiting for device after %dms\n", 203 dev_err(&i2c->dev, "Timed out waiting for device\n");
206 timeout * 10);
207 return -ETIMEDOUT; 204 return -ETIMEDOUT;
208 } 205 }
209 206
@@ -218,28 +215,25 @@ static int wm2000_power_up(struct i2c_client *i2c, int analogue)
218static int wm2000_power_down(struct i2c_client *i2c, int analogue) 215static int wm2000_power_down(struct i2c_client *i2c, int analogue)
219{ 216{
220 struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev); 217 struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev);
221 int timeout;
222 218
223 if (analogue) { 219 if (analogue) {
224 timeout = 248; 220 wm2000_write(i2c, WM2000_REG_ANA_VMID_PD_TIME, 248 / 4);
225 wm2000_write(i2c, WM2000_REG_ANA_VMID_PD_TIME, timeout / 4);
226 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL, 221 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL,
227 WM2000_MODE_ANA_SEQ_INCLUDE | 222 WM2000_MODE_ANA_SEQ_INCLUDE |
228 WM2000_MODE_POWER_DOWN); 223 WM2000_MODE_POWER_DOWN);
229 } else { 224 } else {
230 timeout = 10;
231 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL, 225 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL,
232 WM2000_MODE_POWER_DOWN); 226 WM2000_MODE_POWER_DOWN);
233 } 227 }
234 228
235 if (!wm2000_poll_bit(i2c, WM2000_REG_SYS_STATUS, 229 if (!wm2000_poll_bit(i2c, WM2000_REG_SYS_STATUS,
236 WM2000_STATUS_POWER_DOWN_COMPLETE, timeout)) { 230 WM2000_STATUS_POWER_DOWN_COMPLETE)) {
237 dev_err(&i2c->dev, "Timeout waiting for ANC power down\n"); 231 dev_err(&i2c->dev, "Timeout waiting for ANC power down\n");
238 return -ETIMEDOUT; 232 return -ETIMEDOUT;
239 } 233 }
240 234
241 if (!wm2000_poll_bit(i2c, WM2000_REG_ANC_STAT, 235 if (!wm2000_poll_bit(i2c, WM2000_REG_ANC_STAT,
242 WM2000_ANC_ENG_IDLE, 1)) { 236 WM2000_ANC_ENG_IDLE)) {
243 dev_err(&i2c->dev, "Timeout waiting for ANC engine idle\n"); 237 dev_err(&i2c->dev, "Timeout waiting for ANC engine idle\n");
244 return -ETIMEDOUT; 238 return -ETIMEDOUT;
245 } 239 }
@@ -268,13 +262,13 @@ static int wm2000_enter_bypass(struct i2c_client *i2c, int analogue)
268 } 262 }
269 263
270 if (!wm2000_poll_bit(i2c, WM2000_REG_SYS_STATUS, 264 if (!wm2000_poll_bit(i2c, WM2000_REG_SYS_STATUS,
271 WM2000_STATUS_ANC_DISABLED, 10)) { 265 WM2000_STATUS_ANC_DISABLED)) {
272 dev_err(&i2c->dev, "Timeout waiting for ANC disable\n"); 266 dev_err(&i2c->dev, "Timeout waiting for ANC disable\n");
273 return -ETIMEDOUT; 267 return -ETIMEDOUT;
274 } 268 }
275 269
276 if (!wm2000_poll_bit(i2c, WM2000_REG_ANC_STAT, 270 if (!wm2000_poll_bit(i2c, WM2000_REG_ANC_STAT,
277 WM2000_ANC_ENG_IDLE, 1)) { 271 WM2000_ANC_ENG_IDLE)) {
278 dev_err(&i2c->dev, "Timeout waiting for ANC engine idle\n"); 272 dev_err(&i2c->dev, "Timeout waiting for ANC engine idle\n");
279 return -ETIMEDOUT; 273 return -ETIMEDOUT;
280 } 274 }
@@ -311,7 +305,7 @@ static int wm2000_exit_bypass(struct i2c_client *i2c, int analogue)
311 wm2000_write(i2c, WM2000_REG_SYS_CTL2, WM2000_ANC_INT_N_CLR); 305 wm2000_write(i2c, WM2000_REG_SYS_CTL2, WM2000_ANC_INT_N_CLR);
312 306
313 if (!wm2000_poll_bit(i2c, WM2000_REG_SYS_STATUS, 307 if (!wm2000_poll_bit(i2c, WM2000_REG_SYS_STATUS,
314 WM2000_STATUS_MOUSE_ACTIVE, 10)) { 308 WM2000_STATUS_MOUSE_ACTIVE)) {
315 dev_err(&i2c->dev, "Timed out waiting for MOUSE\n"); 309 dev_err(&i2c->dev, "Timed out waiting for MOUSE\n");
316 return -ETIMEDOUT; 310 return -ETIMEDOUT;
317 } 311 }
@@ -325,38 +319,32 @@ static int wm2000_exit_bypass(struct i2c_client *i2c, int analogue)
325static int wm2000_enter_standby(struct i2c_client *i2c, int analogue) 319static int wm2000_enter_standby(struct i2c_client *i2c, int analogue)
326{ 320{
327 struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev); 321 struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev);
328 int timeout;
329 322
330 BUG_ON(wm2000->anc_mode != ANC_ACTIVE); 323 BUG_ON(wm2000->anc_mode != ANC_ACTIVE);
331 324
332 if (analogue) { 325 if (analogue) {
333 timeout = 248; 326 wm2000_write(i2c, WM2000_REG_ANA_VMID_PD_TIME, 248 / 4);
334 wm2000_write(i2c, WM2000_REG_ANA_VMID_PD_TIME, timeout / 4);
335 327
336 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL, 328 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL,
337 WM2000_MODE_ANA_SEQ_INCLUDE | 329 WM2000_MODE_ANA_SEQ_INCLUDE |
338 WM2000_MODE_THERMAL_ENABLE | 330 WM2000_MODE_THERMAL_ENABLE |
339 WM2000_MODE_STANDBY_ENTRY); 331 WM2000_MODE_STANDBY_ENTRY);
340 } else { 332 } else {
341 timeout = 10;
342
343 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL, 333 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL,
344 WM2000_MODE_THERMAL_ENABLE | 334 WM2000_MODE_THERMAL_ENABLE |
345 WM2000_MODE_STANDBY_ENTRY); 335 WM2000_MODE_STANDBY_ENTRY);
346 } 336 }
347 337
348 if (!wm2000_poll_bit(i2c, WM2000_REG_SYS_STATUS, 338 if (!wm2000_poll_bit(i2c, WM2000_REG_SYS_STATUS,
349 WM2000_STATUS_ANC_DISABLED, timeout)) { 339 WM2000_STATUS_ANC_DISABLED)) {
350 dev_err(&i2c->dev, 340 dev_err(&i2c->dev,
351 "Timed out waiting for ANC disable after 1ms\n"); 341 "Timed out waiting for ANC disable after 1ms\n");
352 return -ETIMEDOUT; 342 return -ETIMEDOUT;
353 } 343 }
354 344
355 if (!wm2000_poll_bit(i2c, WM2000_REG_ANC_STAT, WM2000_ANC_ENG_IDLE, 345 if (!wm2000_poll_bit(i2c, WM2000_REG_ANC_STAT, WM2000_ANC_ENG_IDLE)) {
356 1)) {
357 dev_err(&i2c->dev, 346 dev_err(&i2c->dev,
358 "Timed out waiting for standby after %dms\n", 347 "Timed out waiting for standby\n");
359 timeout * 10);
360 return -ETIMEDOUT; 348 return -ETIMEDOUT;
361 } 349 }
362 350
@@ -374,23 +362,19 @@ static int wm2000_enter_standby(struct i2c_client *i2c, int analogue)
374static int wm2000_exit_standby(struct i2c_client *i2c, int analogue) 362static int wm2000_exit_standby(struct i2c_client *i2c, int analogue)
375{ 363{
376 struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev); 364 struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev);
377 int timeout;
378 365
379 BUG_ON(wm2000->anc_mode != ANC_STANDBY); 366 BUG_ON(wm2000->anc_mode != ANC_STANDBY);
380 367
381 wm2000_write(i2c, WM2000_REG_SYS_CTL1, 0); 368 wm2000_write(i2c, WM2000_REG_SYS_CTL1, 0);
382 369
383 if (analogue) { 370 if (analogue) {
384 timeout = 248; 371 wm2000_write(i2c, WM2000_REG_ANA_VMID_PU_TIME, 248 / 4);
385 wm2000_write(i2c, WM2000_REG_ANA_VMID_PU_TIME, timeout / 4);
386 372
387 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL, 373 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL,
388 WM2000_MODE_ANA_SEQ_INCLUDE | 374 WM2000_MODE_ANA_SEQ_INCLUDE |
389 WM2000_MODE_THERMAL_ENABLE | 375 WM2000_MODE_THERMAL_ENABLE |
390 WM2000_MODE_MOUSE_ENABLE); 376 WM2000_MODE_MOUSE_ENABLE);
391 } else { 377 } else {
392 timeout = 10;
393
394 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL, 378 wm2000_write(i2c, WM2000_REG_SYS_MODE_CNTRL,
395 WM2000_MODE_THERMAL_ENABLE | 379 WM2000_MODE_THERMAL_ENABLE |
396 WM2000_MODE_MOUSE_ENABLE); 380 WM2000_MODE_MOUSE_ENABLE);
@@ -400,9 +384,8 @@ static int wm2000_exit_standby(struct i2c_client *i2c, int analogue)
400 wm2000_write(i2c, WM2000_REG_SYS_CTL2, WM2000_ANC_INT_N_CLR); 384 wm2000_write(i2c, WM2000_REG_SYS_CTL2, WM2000_ANC_INT_N_CLR);
401 385
402 if (!wm2000_poll_bit(i2c, WM2000_REG_SYS_STATUS, 386 if (!wm2000_poll_bit(i2c, WM2000_REG_SYS_STATUS,
403 WM2000_STATUS_MOUSE_ACTIVE, timeout)) { 387 WM2000_STATUS_MOUSE_ACTIVE)) {
404 dev_err(&i2c->dev, "Timed out waiting for MOUSE after %dms\n", 388 dev_err(&i2c->dev, "Timed out waiting for MOUSE\n");
405 timeout * 10);
406 return -ETIMEDOUT; 389 return -ETIMEDOUT;
407 } 390 }
408 391
diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c
index 65d525d74c54..812acd83fb48 100644
--- a/sound/soc/codecs/wm8904.c
+++ b/sound/soc/codecs/wm8904.c
@@ -1863,6 +1863,7 @@ static int wm8904_set_bias_level(struct snd_soc_codec *codec,
1863 return ret; 1863 return ret;
1864 } 1864 }
1865 1865
1866 regcache_cache_only(wm8904->regmap, false);
1866 regcache_sync(wm8904->regmap); 1867 regcache_sync(wm8904->regmap);
1867 1868
1868 /* Enable bias */ 1869 /* Enable bias */
@@ -1899,14 +1900,8 @@ static int wm8904_set_bias_level(struct snd_soc_codec *codec,
1899 snd_soc_update_bits(codec, WM8904_BIAS_CONTROL_0, 1900 snd_soc_update_bits(codec, WM8904_BIAS_CONTROL_0,
1900 WM8904_BIAS_ENA, 0); 1901 WM8904_BIAS_ENA, 0);
1901 1902
1902#ifdef CONFIG_REGULATOR 1903 regcache_cache_only(wm8904->regmap, true);
1903 /* Post 2.6.34 we will be able to get a callback when 1904 regcache_mark_dirty(wm8904->regmap);
1904 * the regulators are disabled which we can use but
1905 * for now just assume that the power will be cut if
1906 * the regulator API is in use.
1907 */
1908 codec->cache_sync = 1;
1909#endif
1910 1905
1911 regulator_bulk_disable(ARRAY_SIZE(wm8904->supplies), 1906 regulator_bulk_disable(ARRAY_SIZE(wm8904->supplies),
1912 wm8904->supplies); 1907 wm8904->supplies);
@@ -2084,10 +2079,8 @@ static int wm8904_probe(struct snd_soc_codec *codec)
2084{ 2079{
2085 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); 2080 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
2086 struct wm8904_pdata *pdata = wm8904->pdata; 2081 struct wm8904_pdata *pdata = wm8904->pdata;
2087 u16 *reg_cache = codec->reg_cache;
2088 int ret, i; 2082 int ret, i;
2089 2083
2090 codec->cache_sync = 1;
2091 codec->control_data = wm8904->regmap; 2084 codec->control_data = wm8904->regmap;
2092 2085
2093 switch (wm8904->devtype) { 2086 switch (wm8904->devtype) {
@@ -2150,6 +2143,7 @@ static int wm8904_probe(struct snd_soc_codec *codec)
2150 goto err_enable; 2143 goto err_enable;
2151 } 2144 }
2152 2145
2146 regcache_cache_only(wm8904->regmap, true);
2153 /* Change some default settings - latch VU and enable ZC */ 2147 /* Change some default settings - latch VU and enable ZC */
2154 snd_soc_update_bits(codec, WM8904_ADC_DIGITAL_VOLUME_LEFT, 2148 snd_soc_update_bits(codec, WM8904_ADC_DIGITAL_VOLUME_LEFT,
2155 WM8904_ADC_VU, WM8904_ADC_VU); 2149 WM8904_ADC_VU, WM8904_ADC_VU);
@@ -2180,14 +2174,18 @@ static int wm8904_probe(struct snd_soc_codec *codec)
2180 if (!pdata->gpio_cfg[i]) 2174 if (!pdata->gpio_cfg[i])
2181 continue; 2175 continue;
2182 2176
2183 reg_cache[WM8904_GPIO_CONTROL_1 + i] 2177 regmap_update_bits(wm8904->regmap,
2184 = pdata->gpio_cfg[i] & 0xffff; 2178 WM8904_GPIO_CONTROL_1 + i,
2179 0xffff,
2180 pdata->gpio_cfg[i]);
2185 } 2181 }
2186 2182
2187 /* Zero is the default value for these anyway */ 2183 /* Zero is the default value for these anyway */
2188 for (i = 0; i < WM8904_MIC_REGS; i++) 2184 for (i = 0; i < WM8904_MIC_REGS; i++)
2189 reg_cache[WM8904_MIC_BIAS_CONTROL_0 + i] 2185 regmap_update_bits(wm8904->regmap,
2190 = pdata->mic_cfg[i]; 2186 WM8904_MIC_BIAS_CONTROL_0 + i,
2187 0xffff,
2188 pdata->mic_cfg[i]);
2191 } 2189 }
2192 2190
2193 /* Set Class W by default - this will be managed by the Class 2191 /* Set Class W by default - this will be managed by the Class
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 993639d694ce..aa8c98b628da 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -46,6 +46,39 @@
46#define WM8994_NUM_DRC 3 46#define WM8994_NUM_DRC 3
47#define WM8994_NUM_EQ 3 47#define WM8994_NUM_EQ 3
48 48
49static struct {
50 unsigned int reg;
51 unsigned int mask;
52} wm8994_vu_bits[] = {
53 { WM8994_LEFT_LINE_INPUT_1_2_VOLUME, WM8994_IN1_VU },
54 { WM8994_RIGHT_LINE_INPUT_1_2_VOLUME, WM8994_IN1_VU },
55 { WM8994_LEFT_LINE_INPUT_3_4_VOLUME, WM8994_IN2_VU },
56 { WM8994_RIGHT_LINE_INPUT_3_4_VOLUME, WM8994_IN2_VU },
57 { WM8994_SPEAKER_VOLUME_LEFT, WM8994_SPKOUT_VU },
58 { WM8994_SPEAKER_VOLUME_RIGHT, WM8994_SPKOUT_VU },
59 { WM8994_LEFT_OUTPUT_VOLUME, WM8994_HPOUT1_VU },
60 { WM8994_RIGHT_OUTPUT_VOLUME, WM8994_HPOUT1_VU },
61 { WM8994_LEFT_OPGA_VOLUME, WM8994_MIXOUT_VU },
62 { WM8994_RIGHT_OPGA_VOLUME, WM8994_MIXOUT_VU },
63
64 { WM8994_AIF1_DAC1_LEFT_VOLUME, WM8994_AIF1DAC1_VU },
65 { WM8994_AIF1_DAC1_RIGHT_VOLUME, WM8994_AIF1DAC1_VU },
66 { WM8994_AIF1_DAC2_LEFT_VOLUME, WM8994_AIF1DAC2_VU },
67 { WM8994_AIF1_DAC2_RIGHT_VOLUME, WM8994_AIF1DAC2_VU },
68 { WM8994_AIF2_DAC_LEFT_VOLUME, WM8994_AIF2DAC_VU },
69 { WM8994_AIF2_DAC_RIGHT_VOLUME, WM8994_AIF2DAC_VU },
70 { WM8994_AIF1_ADC1_LEFT_VOLUME, WM8994_AIF1ADC1_VU },
71 { WM8994_AIF1_ADC1_RIGHT_VOLUME, WM8994_AIF1ADC1_VU },
72 { WM8994_AIF1_ADC2_LEFT_VOLUME, WM8994_AIF1ADC2_VU },
73 { WM8994_AIF1_ADC2_RIGHT_VOLUME, WM8994_AIF1ADC2_VU },
74 { WM8994_AIF2_ADC_LEFT_VOLUME, WM8994_AIF2ADC_VU },
75 { WM8994_AIF2_ADC_RIGHT_VOLUME, WM8994_AIF1ADC2_VU },
76 { WM8994_DAC1_LEFT_VOLUME, WM8994_DAC1_VU },
77 { WM8994_DAC1_RIGHT_VOLUME, WM8994_DAC1_VU },
78 { WM8994_DAC2_LEFT_VOLUME, WM8994_DAC2_VU },
79 { WM8994_DAC2_RIGHT_VOLUME, WM8994_DAC2_VU },
80};
81
49static int wm8994_drc_base[] = { 82static int wm8994_drc_base[] = {
50 WM8994_AIF1_DRC1_1, 83 WM8994_AIF1_DRC1_1,
51 WM8994_AIF1_DRC2_1, 84 WM8994_AIF1_DRC2_1,
@@ -989,6 +1022,7 @@ static int aif1clk_ev(struct snd_soc_dapm_widget *w,
989 struct snd_soc_codec *codec = w->codec; 1022 struct snd_soc_codec *codec = w->codec;
990 struct wm8994 *control = codec->control_data; 1023 struct wm8994 *control = codec->control_data;
991 int mask = WM8994_AIF1DAC1L_ENA | WM8994_AIF1DAC1R_ENA; 1024 int mask = WM8994_AIF1DAC1L_ENA | WM8994_AIF1DAC1R_ENA;
1025 int i;
992 int dac; 1026 int dac;
993 int adc; 1027 int adc;
994 int val; 1028 int val;
@@ -1047,6 +1081,13 @@ static int aif1clk_ev(struct snd_soc_dapm_widget *w,
1047 WM8994_AIF1DAC2L_ENA); 1081 WM8994_AIF1DAC2L_ENA);
1048 break; 1082 break;
1049 1083
1084 case SND_SOC_DAPM_POST_PMU:
1085 for (i = 0; i < ARRAY_SIZE(wm8994_vu_bits); i++)
1086 snd_soc_write(codec, wm8994_vu_bits[i].reg,
1087 snd_soc_read(codec,
1088 wm8994_vu_bits[i].reg));
1089 break;
1090
1050 case SND_SOC_DAPM_PRE_PMD: 1091 case SND_SOC_DAPM_PRE_PMD:
1051 case SND_SOC_DAPM_POST_PMD: 1092 case SND_SOC_DAPM_POST_PMD:
1052 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, 1093 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5,
@@ -1072,6 +1113,7 @@ static int aif2clk_ev(struct snd_soc_dapm_widget *w,
1072 struct snd_kcontrol *kcontrol, int event) 1113 struct snd_kcontrol *kcontrol, int event)
1073{ 1114{
1074 struct snd_soc_codec *codec = w->codec; 1115 struct snd_soc_codec *codec = w->codec;
1116 int i;
1075 int dac; 1117 int dac;
1076 int adc; 1118 int adc;
1077 int val; 1119 int val;
@@ -1122,6 +1164,13 @@ static int aif2clk_ev(struct snd_soc_dapm_widget *w,
1122 WM8994_AIF2DACR_ENA); 1164 WM8994_AIF2DACR_ENA);
1123 break; 1165 break;
1124 1166
1167 case SND_SOC_DAPM_POST_PMU:
1168 for (i = 0; i < ARRAY_SIZE(wm8994_vu_bits); i++)
1169 snd_soc_write(codec, wm8994_vu_bits[i].reg,
1170 snd_soc_read(codec,
1171 wm8994_vu_bits[i].reg));
1172 break;
1173
1125 case SND_SOC_DAPM_PRE_PMD: 1174 case SND_SOC_DAPM_PRE_PMD:
1126 case SND_SOC_DAPM_POST_PMD: 1175 case SND_SOC_DAPM_POST_PMD:
1127 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, 1176 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5,
@@ -1190,17 +1239,19 @@ static int late_enable_ev(struct snd_soc_dapm_widget *w,
1190 switch (event) { 1239 switch (event) {
1191 case SND_SOC_DAPM_PRE_PMU: 1240 case SND_SOC_DAPM_PRE_PMU:
1192 if (wm8994->aif1clk_enable) { 1241 if (wm8994->aif1clk_enable) {
1193 aif1clk_ev(w, kcontrol, event); 1242 aif1clk_ev(w, kcontrol, SND_SOC_DAPM_PRE_PMU);
1194 snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1, 1243 snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1,
1195 WM8994_AIF1CLK_ENA_MASK, 1244 WM8994_AIF1CLK_ENA_MASK,
1196 WM8994_AIF1CLK_ENA); 1245 WM8994_AIF1CLK_ENA);
1246 aif1clk_ev(w, kcontrol, SND_SOC_DAPM_POST_PMU);
1197 wm8994->aif1clk_enable = 0; 1247 wm8994->aif1clk_enable = 0;
1198 } 1248 }
1199 if (wm8994->aif2clk_enable) { 1249 if (wm8994->aif2clk_enable) {
1200 aif2clk_ev(w, kcontrol, event); 1250 aif2clk_ev(w, kcontrol, SND_SOC_DAPM_PRE_PMU);
1201 snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1, 1251 snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1,
1202 WM8994_AIF2CLK_ENA_MASK, 1252 WM8994_AIF2CLK_ENA_MASK,
1203 WM8994_AIF2CLK_ENA); 1253 WM8994_AIF2CLK_ENA);
1254 aif2clk_ev(w, kcontrol, SND_SOC_DAPM_POST_PMU);
1204 wm8994->aif2clk_enable = 0; 1255 wm8994->aif2clk_enable = 0;
1205 } 1256 }
1206 break; 1257 break;
@@ -1221,15 +1272,17 @@ static int late_disable_ev(struct snd_soc_dapm_widget *w,
1221 switch (event) { 1272 switch (event) {
1222 case SND_SOC_DAPM_POST_PMD: 1273 case SND_SOC_DAPM_POST_PMD:
1223 if (wm8994->aif1clk_disable) { 1274 if (wm8994->aif1clk_disable) {
1275 aif1clk_ev(w, kcontrol, SND_SOC_DAPM_PRE_PMD);
1224 snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1, 1276 snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1,
1225 WM8994_AIF1CLK_ENA_MASK, 0); 1277 WM8994_AIF1CLK_ENA_MASK, 0);
1226 aif1clk_ev(w, kcontrol, event); 1278 aif1clk_ev(w, kcontrol, SND_SOC_DAPM_POST_PMD);
1227 wm8994->aif1clk_disable = 0; 1279 wm8994->aif1clk_disable = 0;
1228 } 1280 }
1229 if (wm8994->aif2clk_disable) { 1281 if (wm8994->aif2clk_disable) {
1282 aif2clk_ev(w, kcontrol, SND_SOC_DAPM_PRE_PMD);
1230 snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1, 1283 snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1,
1231 WM8994_AIF2CLK_ENA_MASK, 0); 1284 WM8994_AIF2CLK_ENA_MASK, 0);
1232 aif2clk_ev(w, kcontrol, event); 1285 aif2clk_ev(w, kcontrol, SND_SOC_DAPM_POST_PMD);
1233 wm8994->aif2clk_disable = 0; 1286 wm8994->aif2clk_disable = 0;
1234 } 1287 }
1235 break; 1288 break;
@@ -1527,9 +1580,11 @@ SND_SOC_DAPM_POST("Late Disable PGA", late_disable_ev)
1527 1580
1528static const struct snd_soc_dapm_widget wm8994_lateclk_widgets[] = { 1581static const struct snd_soc_dapm_widget wm8994_lateclk_widgets[] = {
1529SND_SOC_DAPM_SUPPLY("AIF1CLK", WM8994_AIF1_CLOCKING_1, 0, 0, aif1clk_ev, 1582SND_SOC_DAPM_SUPPLY("AIF1CLK", WM8994_AIF1_CLOCKING_1, 0, 0, aif1clk_ev,
1530 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD), 1583 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
1584 SND_SOC_DAPM_PRE_PMD),
1531SND_SOC_DAPM_SUPPLY("AIF2CLK", WM8994_AIF2_CLOCKING_1, 0, 0, aif2clk_ev, 1585SND_SOC_DAPM_SUPPLY("AIF2CLK", WM8994_AIF2_CLOCKING_1, 0, 0, aif2clk_ev,
1532 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD), 1586 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
1587 SND_SOC_DAPM_PRE_PMD),
1533SND_SOC_DAPM_PGA("Direct Voice", SND_SOC_NOPM, 0, 0, NULL, 0), 1588SND_SOC_DAPM_PGA("Direct Voice", SND_SOC_NOPM, 0, 0, NULL, 0),
1534SND_SOC_DAPM_MIXER("SPKL", WM8994_POWER_MANAGEMENT_3, 8, 0, 1589SND_SOC_DAPM_MIXER("SPKL", WM8994_POWER_MANAGEMENT_3, 8, 0,
1535 left_speaker_mixer, ARRAY_SIZE(left_speaker_mixer)), 1590 left_speaker_mixer, ARRAY_SIZE(left_speaker_mixer)),
@@ -3879,39 +3934,11 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
3879 3934
3880 pm_runtime_put(codec->dev); 3935 pm_runtime_put(codec->dev);
3881 3936
3882 /* Latch volume updates (right only; we always do left then right). */ 3937 /* Latch volume update bits */
3883 snd_soc_update_bits(codec, WM8994_AIF1_DAC1_LEFT_VOLUME, 3938 for (i = 0; i < ARRAY_SIZE(wm8994_vu_bits); i++)
3884 WM8994_AIF1DAC1_VU, WM8994_AIF1DAC1_VU); 3939 snd_soc_update_bits(codec, wm8994_vu_bits[i].reg,
3885 snd_soc_update_bits(codec, WM8994_AIF1_DAC1_RIGHT_VOLUME, 3940 wm8994_vu_bits[i].mask,
3886 WM8994_AIF1DAC1_VU, WM8994_AIF1DAC1_VU); 3941 wm8994_vu_bits[i].mask);
3887 snd_soc_update_bits(codec, WM8994_AIF1_DAC2_LEFT_VOLUME,
3888 WM8994_AIF1DAC2_VU, WM8994_AIF1DAC2_VU);
3889 snd_soc_update_bits(codec, WM8994_AIF1_DAC2_RIGHT_VOLUME,
3890 WM8994_AIF1DAC2_VU, WM8994_AIF1DAC2_VU);
3891 snd_soc_update_bits(codec, WM8994_AIF2_DAC_LEFT_VOLUME,
3892 WM8994_AIF2DAC_VU, WM8994_AIF2DAC_VU);
3893 snd_soc_update_bits(codec, WM8994_AIF2_DAC_RIGHT_VOLUME,
3894 WM8994_AIF2DAC_VU, WM8994_AIF2DAC_VU);
3895 snd_soc_update_bits(codec, WM8994_AIF1_ADC1_LEFT_VOLUME,
3896 WM8994_AIF1ADC1_VU, WM8994_AIF1ADC1_VU);
3897 snd_soc_update_bits(codec, WM8994_AIF1_ADC1_RIGHT_VOLUME,
3898 WM8994_AIF1ADC1_VU, WM8994_AIF1ADC1_VU);
3899 snd_soc_update_bits(codec, WM8994_AIF1_ADC2_LEFT_VOLUME,
3900 WM8994_AIF1ADC2_VU, WM8994_AIF1ADC2_VU);
3901 snd_soc_update_bits(codec, WM8994_AIF1_ADC2_RIGHT_VOLUME,
3902 WM8994_AIF1ADC2_VU, WM8994_AIF1ADC2_VU);
3903 snd_soc_update_bits(codec, WM8994_AIF2_ADC_LEFT_VOLUME,
3904 WM8994_AIF2ADC_VU, WM8994_AIF1ADC2_VU);
3905 snd_soc_update_bits(codec, WM8994_AIF2_ADC_RIGHT_VOLUME,
3906 WM8994_AIF2ADC_VU, WM8994_AIF1ADC2_VU);
3907 snd_soc_update_bits(codec, WM8994_DAC1_LEFT_VOLUME,
3908 WM8994_DAC1_VU, WM8994_DAC1_VU);
3909 snd_soc_update_bits(codec, WM8994_DAC1_RIGHT_VOLUME,
3910 WM8994_DAC1_VU, WM8994_DAC1_VU);
3911 snd_soc_update_bits(codec, WM8994_DAC2_LEFT_VOLUME,
3912 WM8994_DAC2_VU, WM8994_DAC2_VU);
3913 snd_soc_update_bits(codec, WM8994_DAC2_RIGHT_VOLUME,
3914 WM8994_DAC2_VU, WM8994_DAC2_VU);
3915 3942
3916 /* Set the low bit of the 3D stereo depth so TLV matches */ 3943 /* Set the low bit of the 3D stereo depth so TLV matches */
3917 snd_soc_update_bits(codec, WM8994_AIF1_DAC1_FILTERS_2, 3944 snd_soc_update_bits(codec, WM8994_AIF1_DAC1_FILTERS_2,
diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c
index 8af422e38fd0..dc9b42b7fc4d 100644
--- a/sound/soc/codecs/wm8996.c
+++ b/sound/soc/codecs/wm8996.c
@@ -2837,8 +2837,6 @@ static int wm8996_probe(struct snd_soc_codec *codec)
2837 } 2837 }
2838 } 2838 }
2839 2839
2840 regcache_cache_only(codec->control_data, true);
2841
2842 /* Apply platform data settings */ 2840 /* Apply platform data settings */
2843 snd_soc_update_bits(codec, WM8996_LINE_INPUT_CONTROL, 2841 snd_soc_update_bits(codec, WM8996_LINE_INPUT_CONTROL,
2844 WM8996_INL_MODE_MASK | WM8996_INR_MODE_MASK, 2842 WM8996_INL_MODE_MASK | WM8996_INR_MODE_MASK,
@@ -3051,7 +3049,6 @@ static int wm8996_remove(struct snd_soc_codec *codec)
3051 for (i = 0; i < ARRAY_SIZE(wm8996->supplies); i++) 3049 for (i = 0; i < ARRAY_SIZE(wm8996->supplies); i++)
3052 regulator_unregister_notifier(wm8996->supplies[i].consumer, 3050 regulator_unregister_notifier(wm8996->supplies[i].consumer,
3053 &wm8996->disable_nb[i]); 3051 &wm8996->disable_nb[i]);
3054 regulator_bulk_free(ARRAY_SIZE(wm8996->supplies), wm8996->supplies);
3055 3052
3056 return 0; 3053 return 0;
3057} 3054}
@@ -3206,14 +3203,15 @@ static __devinit int wm8996_i2c_probe(struct i2c_client *i2c,
3206 dev_info(&i2c->dev, "revision %c\n", 3203 dev_info(&i2c->dev, "revision %c\n",
3207 (reg & WM8996_CHIP_REV_MASK) + 'A'); 3204 (reg & WM8996_CHIP_REV_MASK) + 'A');
3208 3205
3209 regulator_bulk_disable(ARRAY_SIZE(wm8996->supplies), wm8996->supplies);
3210
3211 ret = wm8996_reset(wm8996); 3206 ret = wm8996_reset(wm8996);
3212 if (ret < 0) { 3207 if (ret < 0) {
3213 dev_err(&i2c->dev, "Failed to issue reset\n"); 3208 dev_err(&i2c->dev, "Failed to issue reset\n");
3214 goto err_regmap; 3209 goto err_regmap;
3215 } 3210 }
3216 3211
3212 regcache_cache_only(wm8996->regmap, true);
3213 regulator_bulk_disable(ARRAY_SIZE(wm8996->supplies), wm8996->supplies);
3214
3217 wm8996_init_gpio(wm8996); 3215 wm8996_init_gpio(wm8996);
3218 3216
3219 ret = snd_soc_register_codec(&i2c->dev, 3217 ret = snd_soc_register_codec(&i2c->dev,
diff --git a/sound/soc/fsl/imx-audmux.c b/sound/soc/fsl/imx-audmux.c
index f23700359c67..080327414c6b 100644
--- a/sound/soc/fsl/imx-audmux.c
+++ b/sound/soc/fsl/imx-audmux.c
@@ -26,6 +26,7 @@
26#include <linux/of_device.h> 26#include <linux/of_device.h>
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/pinctrl/consumer.h>
29 30
30#include "imx-audmux.h" 31#include "imx-audmux.h"
31 32
@@ -249,6 +250,7 @@ EXPORT_SYMBOL_GPL(imx_audmux_v2_configure_port);
249static int __devinit imx_audmux_probe(struct platform_device *pdev) 250static int __devinit imx_audmux_probe(struct platform_device *pdev)
250{ 251{
251 struct resource *res; 252 struct resource *res;
253 struct pinctrl *pinctrl;
252 const struct of_device_id *of_id = 254 const struct of_device_id *of_id =
253 of_match_device(imx_audmux_dt_ids, &pdev->dev); 255 of_match_device(imx_audmux_dt_ids, &pdev->dev);
254 256
@@ -257,6 +259,12 @@ static int __devinit imx_audmux_probe(struct platform_device *pdev)
257 if (!audmux_base) 259 if (!audmux_base)
258 return -EADDRNOTAVAIL; 260 return -EADDRNOTAVAIL;
259 261
262 pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
263 if (IS_ERR(pinctrl)) {
264 dev_err(&pdev->dev, "setup pinctrl failed!");
265 return PTR_ERR(pinctrl);
266 }
267
260 audmux_clk = clk_get(&pdev->dev, "audmux"); 268 audmux_clk = clk_get(&pdev->dev, "audmux");
261 if (IS_ERR(audmux_clk)) { 269 if (IS_ERR(audmux_clk)) {
262 dev_dbg(&pdev->dev, "cannot get clock: %ld\n", 270 dev_dbg(&pdev->dev, "cannot get clock: %ld\n",
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
index cf3ed0362c9c..28dd76c7cb1c 100644
--- a/sound/soc/fsl/imx-ssi.c
+++ b/sound/soc/fsl/imx-ssi.c
@@ -543,7 +543,7 @@ static int imx_ssi_probe(struct platform_device *pdev)
543 ret); 543 ret);
544 goto failed_clk; 544 goto failed_clk;
545 } 545 }
546 clk_enable(ssi->clk); 546 clk_prepare_enable(ssi->clk);
547 547
548 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 548 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
549 if (!res) { 549 if (!res) {
@@ -641,7 +641,7 @@ failed_ac97:
641failed_ioremap: 641failed_ioremap:
642 release_mem_region(res->start, resource_size(res)); 642 release_mem_region(res->start, resource_size(res));
643failed_get_resource: 643failed_get_resource:
644 clk_disable(ssi->clk); 644 clk_disable_unprepare(ssi->clk);
645 clk_put(ssi->clk); 645 clk_put(ssi->clk);
646failed_clk: 646failed_clk:
647 kfree(ssi); 647 kfree(ssi);
@@ -664,7 +664,7 @@ static int __devexit imx_ssi_remove(struct platform_device *pdev)
664 664
665 iounmap(ssi->base); 665 iounmap(ssi->base);
666 release_mem_region(res->start, resource_size(res)); 666 release_mem_region(res->start, resource_size(res));
667 clk_disable(ssi->clk); 667 clk_disable_unprepare(ssi->clk);
668 clk_put(ssi->clk); 668 clk_put(ssi->clk);
669 kfree(ssi); 669 kfree(ssi);
670 670
diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c
index 1c2aa7fab3fd..4da5fc55c7ee 100644
--- a/sound/soc/pxa/pxa-ssp.c
+++ b/sound/soc/pxa/pxa-ssp.c
@@ -33,7 +33,6 @@
33 33
34#include <mach/hardware.h> 34#include <mach/hardware.h>
35#include <mach/dma.h> 35#include <mach/dma.h>
36#include <mach/audio.h>
37 36
38#include "../../arm/pxa2xx-pcm.h" 37#include "../../arm/pxa2xx-pcm.h"
39#include "pxa-ssp.h" 38#include "pxa-ssp.h"
@@ -194,7 +193,7 @@ static void pxa_ssp_set_scr(struct ssp_device *ssp, u32 div)
194{ 193{
195 u32 sscr0 = pxa_ssp_read_reg(ssp, SSCR0); 194 u32 sscr0 = pxa_ssp_read_reg(ssp, SSCR0);
196 195
197 if (cpu_is_pxa25x() && ssp->type == PXA25x_SSP) { 196 if (ssp->type == PXA25x_SSP) {
198 sscr0 &= ~0x0000ff00; 197 sscr0 &= ~0x0000ff00;
199 sscr0 |= ((div - 2)/2) << 8; /* 2..512 */ 198 sscr0 |= ((div - 2)/2) << 8; /* 2..512 */
200 } else { 199 } else {
@@ -212,7 +211,7 @@ static u32 pxa_ssp_get_scr(struct ssp_device *ssp)
212 u32 sscr0 = pxa_ssp_read_reg(ssp, SSCR0); 211 u32 sscr0 = pxa_ssp_read_reg(ssp, SSCR0);
213 u32 div; 212 u32 div;
214 213
215 if (cpu_is_pxa25x() && ssp->type == PXA25x_SSP) 214 if (ssp->type == PXA25x_SSP)
216 div = ((sscr0 >> 8) & 0xff) * 2 + 2; 215 div = ((sscr0 >> 8) & 0xff) * 2 + 2;
217 else 216 else
218 div = ((sscr0 >> 8) & 0xfff) + 1; 217 div = ((sscr0 >> 8) & 0xfff) + 1;
@@ -242,7 +241,7 @@ static int pxa_ssp_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
242 break; 241 break;
243 case PXA_SSP_CLK_PLL: 242 case PXA_SSP_CLK_PLL:
244 /* Internal PLL is fixed */ 243 /* Internal PLL is fixed */
245 if (cpu_is_pxa25x()) 244 if (ssp->type == PXA25x_SSP)
246 priv->sysclk = 1843200; 245 priv->sysclk = 1843200;
247 else 246 else
248 priv->sysclk = 13000000; 247 priv->sysclk = 13000000;
@@ -266,11 +265,11 @@ static int pxa_ssp_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
266 265
267 /* The SSP clock must be disabled when changing SSP clock mode 266 /* The SSP clock must be disabled when changing SSP clock mode
268 * on PXA2xx. On PXA3xx it must be enabled when doing so. */ 267 * on PXA2xx. On PXA3xx it must be enabled when doing so. */
269 if (!cpu_is_pxa3xx()) 268 if (ssp->type != PXA3xx_SSP)
270 clk_disable(ssp->clk); 269 clk_disable(ssp->clk);
271 val = pxa_ssp_read_reg(ssp, SSCR0) | sscr0; 270 val = pxa_ssp_read_reg(ssp, SSCR0) | sscr0;
272 pxa_ssp_write_reg(ssp, SSCR0, val); 271 pxa_ssp_write_reg(ssp, SSCR0, val);
273 if (!cpu_is_pxa3xx()) 272 if (ssp->type != PXA3xx_SSP)
274 clk_enable(ssp->clk); 273 clk_enable(ssp->clk);
275 274
276 return 0; 275 return 0;
@@ -294,24 +293,20 @@ static int pxa_ssp_set_dai_clkdiv(struct snd_soc_dai *cpu_dai,
294 case PXA_SSP_AUDIO_DIV_SCDB: 293 case PXA_SSP_AUDIO_DIV_SCDB:
295 val = pxa_ssp_read_reg(ssp, SSACD); 294 val = pxa_ssp_read_reg(ssp, SSACD);
296 val &= ~SSACD_SCDB; 295 val &= ~SSACD_SCDB;
297#if defined(CONFIG_PXA3xx) 296 if (ssp->type == PXA3xx_SSP)
298 if (cpu_is_pxa3xx())
299 val &= ~SSACD_SCDX8; 297 val &= ~SSACD_SCDX8;
300#endif
301 switch (div) { 298 switch (div) {
302 case PXA_SSP_CLK_SCDB_1: 299 case PXA_SSP_CLK_SCDB_1:
303 val |= SSACD_SCDB; 300 val |= SSACD_SCDB;
304 break; 301 break;
305 case PXA_SSP_CLK_SCDB_4: 302 case PXA_SSP_CLK_SCDB_4:
306 break; 303 break;
307#if defined(CONFIG_PXA3xx)
308 case PXA_SSP_CLK_SCDB_8: 304 case PXA_SSP_CLK_SCDB_8:
309 if (cpu_is_pxa3xx()) 305 if (ssp->type == PXA3xx_SSP)
310 val |= SSACD_SCDX8; 306 val |= SSACD_SCDX8;
311 else 307 else
312 return -EINVAL; 308 return -EINVAL;
313 break; 309 break;
314#endif
315 default: 310 default:
316 return -EINVAL; 311 return -EINVAL;
317 } 312 }
@@ -337,10 +332,8 @@ static int pxa_ssp_set_dai_pll(struct snd_soc_dai *cpu_dai, int pll_id,
337 struct ssp_device *ssp = priv->ssp; 332 struct ssp_device *ssp = priv->ssp;
338 u32 ssacd = pxa_ssp_read_reg(ssp, SSACD) & ~0x70; 333 u32 ssacd = pxa_ssp_read_reg(ssp, SSACD) & ~0x70;
339 334
340#if defined(CONFIG_PXA3xx) 335 if (ssp->type == PXA3xx_SSP)
341 if (cpu_is_pxa3xx())
342 pxa_ssp_write_reg(ssp, SSACDD, 0); 336 pxa_ssp_write_reg(ssp, SSACDD, 0);
343#endif
344 337
345 switch (freq_out) { 338 switch (freq_out) {
346 case 5622000: 339 case 5622000:
@@ -365,11 +358,10 @@ static int pxa_ssp_set_dai_pll(struct snd_soc_dai *cpu_dai, int pll_id,
365 break; 358 break;
366 359
367 default: 360 default:
368#ifdef CONFIG_PXA3xx
369 /* PXA3xx has a clock ditherer which can be used to generate 361 /* PXA3xx has a clock ditherer which can be used to generate
370 * a wider range of frequencies - calculate a value for it. 362 * a wider range of frequencies - calculate a value for it.
371 */ 363 */
372 if (cpu_is_pxa3xx()) { 364 if (ssp->type == PXA3xx_SSP) {
373 u32 val; 365 u32 val;
374 u64 tmp = 19968; 366 u64 tmp = 19968;
375 tmp *= 1000000; 367 tmp *= 1000000;
@@ -386,7 +378,6 @@ static int pxa_ssp_set_dai_pll(struct snd_soc_dai *cpu_dai, int pll_id,
386 val, freq_out); 378 val, freq_out);
387 break; 379 break;
388 } 380 }
389#endif
390 381
391 return -EINVAL; 382 return -EINVAL;
392 } 383 }
@@ -590,10 +581,8 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream,
590 /* bit size */ 581 /* bit size */
591 switch (params_format(params)) { 582 switch (params_format(params)) {
592 case SNDRV_PCM_FORMAT_S16_LE: 583 case SNDRV_PCM_FORMAT_S16_LE:
593#ifdef CONFIG_PXA3xx 584 if (ssp->type == PXA3xx_SSP)
594 if (cpu_is_pxa3xx())
595 sscr0 |= SSCR0_FPCKE; 585 sscr0 |= SSCR0_FPCKE;
596#endif
597 sscr0 |= SSCR0_DataSize(16); 586 sscr0 |= SSCR0_DataSize(16);
598 break; 587 break;
599 case SNDRV_PCM_FORMAT_S24_LE: 588 case SNDRV_PCM_FORMAT_S24_LE:
@@ -618,9 +607,7 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream,
618 * trying and failing a lot; some of the registers 607 * trying and failing a lot; some of the registers
619 * needed for that mode are only available on PXA3xx. 608 * needed for that mode are only available on PXA3xx.
620 */ 609 */
621 610 if (ssp->type != PXA3xx_SSP)
622#ifdef CONFIG_PXA3xx
623 if (!cpu_is_pxa3xx())
624 return -EINVAL; 611 return -EINVAL;
625 612
626 sspsp |= SSPSP_SFRMWDTH(width * 2); 613 sspsp |= SSPSP_SFRMWDTH(width * 2);
@@ -628,9 +615,6 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream,
628 sspsp |= SSPSP_EDMYSTOP(3); 615 sspsp |= SSPSP_EDMYSTOP(3);
629 sspsp |= SSPSP_DMYSTOP(3); 616 sspsp |= SSPSP_DMYSTOP(3);
630 sspsp |= SSPSP_DMYSTRT(1); 617 sspsp |= SSPSP_DMYSTRT(1);
631#else
632 return -EINVAL;
633#endif
634 } else { 618 } else {
635 /* The frame width is the width the LRCLK is 619 /* The frame width is the width the LRCLK is
636 * asserted for; the delay is expressed in 620 * asserted for; the delay is expressed in
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 7cee22515d9d..2ef98536f1da 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -1052,6 +1052,13 @@ static int fsi_dma_quit(struct fsi_priv *fsi, struct fsi_stream *io)
1052 return 0; 1052 return 0;
1053} 1053}
1054 1054
1055static dma_addr_t fsi_dma_get_area(struct fsi_stream *io)
1056{
1057 struct snd_pcm_runtime *runtime = io->substream->runtime;
1058
1059 return io->dma + samples_to_bytes(runtime, io->buff_sample_pos);
1060}
1061
1055static void fsi_dma_complete(void *data) 1062static void fsi_dma_complete(void *data)
1056{ 1063{
1057 struct fsi_stream *io = (struct fsi_stream *)data; 1064 struct fsi_stream *io = (struct fsi_stream *)data;
@@ -1061,7 +1068,7 @@ static void fsi_dma_complete(void *data)
1061 enum dma_data_direction dir = fsi_stream_is_play(fsi, io) ? 1068 enum dma_data_direction dir = fsi_stream_is_play(fsi, io) ?
1062 DMA_TO_DEVICE : DMA_FROM_DEVICE; 1069 DMA_TO_DEVICE : DMA_FROM_DEVICE;
1063 1070
1064 dma_sync_single_for_cpu(dai->dev, io->dma, 1071 dma_sync_single_for_cpu(dai->dev, fsi_dma_get_area(io),
1065 samples_to_bytes(runtime, io->period_samples), dir); 1072 samples_to_bytes(runtime, io->period_samples), dir);
1066 1073
1067 io->buff_sample_pos += io->period_samples; 1074 io->buff_sample_pos += io->period_samples;
@@ -1078,13 +1085,6 @@ static void fsi_dma_complete(void *data)
1078 snd_pcm_period_elapsed(io->substream); 1085 snd_pcm_period_elapsed(io->substream);
1079} 1086}
1080 1087
1081static dma_addr_t fsi_dma_get_area(struct fsi_stream *io)
1082{
1083 struct snd_pcm_runtime *runtime = io->substream->runtime;
1084
1085 return io->dma + samples_to_bytes(runtime, io->buff_sample_pos);
1086}
1087
1088static void fsi_dma_do_tasklet(unsigned long data) 1088static void fsi_dma_do_tasklet(unsigned long data)
1089{ 1089{
1090 struct fsi_stream *io = (struct fsi_stream *)data; 1090 struct fsi_stream *io = (struct fsi_stream *)data;
@@ -1110,7 +1110,7 @@ static void fsi_dma_do_tasklet(unsigned long data)
1110 len = samples_to_bytes(runtime, io->period_samples); 1110 len = samples_to_bytes(runtime, io->period_samples);
1111 buf = fsi_dma_get_area(io); 1111 buf = fsi_dma_get_area(io);
1112 1112
1113 dma_sync_single_for_device(dai->dev, io->dma, len, dir); 1113 dma_sync_single_for_device(dai->dev, buf, len, dir);
1114 1114
1115 sg_init_table(&sg, 1); 1115 sg_init_table(&sg, 1);
1116 sg_set_page(&sg, pfn_to_page(PFN_DOWN(buf)), 1116 sg_set_page(&sg, pfn_to_page(PFN_DOWN(buf)),
@@ -1172,9 +1172,16 @@ static int fsi_dma_transfer(struct fsi_priv *fsi, struct fsi_stream *io)
1172static void fsi_dma_push_start_stop(struct fsi_priv *fsi, struct fsi_stream *io, 1172static void fsi_dma_push_start_stop(struct fsi_priv *fsi, struct fsi_stream *io,
1173 int start) 1173 int start)
1174{ 1174{
1175 struct fsi_master *master = fsi_get_master(fsi);
1176 u32 clk = fsi_is_port_a(fsi) ? CRA : CRB;
1175 u32 enable = start ? DMA_ON : 0; 1177 u32 enable = start ? DMA_ON : 0;
1176 1178
1177 fsi_reg_mask_set(fsi, OUT_DMAC, DMA_ON, enable); 1179 fsi_reg_mask_set(fsi, OUT_DMAC, DMA_ON, enable);
1180
1181 dmaengine_terminate_all(io->chan);
1182
1183 if (fsi_is_clk_master(fsi))
1184 fsi_master_mask_set(master, CLK_RST, clk, (enable) ? clk : 0);
1178} 1185}
1179 1186
1180static int fsi_dma_probe(struct fsi_priv *fsi, struct fsi_stream *io) 1187static int fsi_dma_probe(struct fsi_priv *fsi, struct fsi_stream *io)
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 90ee77d2409d..89eae93445cf 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -913,7 +913,7 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget,
913 /* do we need to add this widget to the list ? */ 913 /* do we need to add this widget to the list ? */
914 if (list) { 914 if (list) {
915 int err; 915 int err;
916 err = dapm_list_add_widget(list, path->sink); 916 err = dapm_list_add_widget(list, path->source);
917 if (err < 0) { 917 if (err < 0) {
918 dev_err(widget->dapm->dev, "could not add widget %s\n", 918 dev_err(widget->dapm->dev, "could not add widget %s\n",
919 widget->name); 919 widget->name);
@@ -954,7 +954,7 @@ int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream,
954 if (stream == SNDRV_PCM_STREAM_PLAYBACK) 954 if (stream == SNDRV_PCM_STREAM_PLAYBACK)
955 paths = is_connected_output_ep(dai->playback_widget, list); 955 paths = is_connected_output_ep(dai->playback_widget, list);
956 else 956 else
957 paths = is_connected_input_ep(dai->playback_widget, list); 957 paths = is_connected_input_ep(dai->capture_widget, list);
958 958
959 trace_snd_soc_dapm_connected(paths, stream); 959 trace_snd_soc_dapm_connected(paths, stream);
960 dapm_clear_walk(&card->dapm); 960 dapm_clear_walk(&card->dapm);
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index bedd1717a373..48fd15b312c1 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -794,6 +794,9 @@ static struct snd_soc_pcm_runtime *dpcm_get_be(struct snd_soc_card *card,
794 for (i = 0; i < card->num_links; i++) { 794 for (i = 0; i < card->num_links; i++) {
795 be = &card->rtd[i]; 795 be = &card->rtd[i];
796 796
797 if (!be->dai_link->no_pcm)
798 continue;
799
797 if (be->cpu_dai->playback_widget == widget || 800 if (be->cpu_dai->playback_widget == widget ||
798 be->codec_dai->playback_widget == widget) 801 be->codec_dai->playback_widget == widget)
799 return be; 802 return be;
@@ -803,6 +806,9 @@ static struct snd_soc_pcm_runtime *dpcm_get_be(struct snd_soc_card *card,
803 for (i = 0; i < card->num_links; i++) { 806 for (i = 0; i < card->num_links; i++) {
804 be = &card->rtd[i]; 807 be = &card->rtd[i];
805 808
809 if (!be->dai_link->no_pcm)
810 continue;
811
806 if (be->cpu_dai->capture_widget == widget || 812 if (be->cpu_dai->capture_widget == widget ||
807 be->codec_dai->capture_widget == widget) 813 be->codec_dai->capture_widget == widget)
808 return be; 814 return be;
diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c
index 57cd419f743e..f43edb364a18 100644
--- a/sound/soc/tegra/tegra30_ahub.c
+++ b/sound/soc/tegra/tegra30_ahub.c
@@ -629,3 +629,4 @@ MODULE_AUTHOR("Stephen Warren <swarren@nvidia.com>");
629MODULE_DESCRIPTION("Tegra30 AHUB driver"); 629MODULE_DESCRIPTION("Tegra30 AHUB driver");
630MODULE_LICENSE("GPL v2"); 630MODULE_LICENSE("GPL v2");
631MODULE_ALIAS("platform:" DRV_NAME); 631MODULE_ALIAS("platform:" DRV_NAME);
632MODULE_DEVICE_TABLE(of, tegra30_ahub_of_match);
diff --git a/sound/soc/tegra/tegra_wm8903.c b/sound/soc/tegra/tegra_wm8903.c
index 0b0df49d9d33..3b6da91188a9 100644
--- a/sound/soc/tegra/tegra_wm8903.c
+++ b/sound/soc/tegra/tegra_wm8903.c
@@ -346,6 +346,17 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd)
346 return 0; 346 return 0;
347} 347}
348 348
349static int tegra_wm8903_remove(struct snd_soc_card *card)
350{
351 struct snd_soc_pcm_runtime *rtd = &(card->rtd[0]);
352 struct snd_soc_dai *codec_dai = rtd->codec_dai;
353 struct snd_soc_codec *codec = codec_dai->codec;
354
355 wm8903_mic_detect(codec, NULL, 0, 0);
356
357 return 0;
358}
359
349static struct snd_soc_dai_link tegra_wm8903_dai = { 360static struct snd_soc_dai_link tegra_wm8903_dai = {
350 .name = "WM8903", 361 .name = "WM8903",
351 .stream_name = "WM8903 PCM", 362 .stream_name = "WM8903 PCM",
@@ -363,6 +374,8 @@ static struct snd_soc_card snd_soc_tegra_wm8903 = {
363 .dai_link = &tegra_wm8903_dai, 374 .dai_link = &tegra_wm8903_dai,
364 .num_links = 1, 375 .num_links = 1,
365 376
377 .remove = tegra_wm8903_remove,
378
366 .controls = tegra_wm8903_controls, 379 .controls = tegra_wm8903_controls,
367 .num_controls = ARRAY_SIZE(tegra_wm8903_controls), 380 .num_controls = ARRAY_SIZE(tegra_wm8903_controls),
368 .dapm_widgets = tegra_wm8903_dapm_widgets, 381 .dapm_widgets = tegra_wm8903_dapm_widgets,