aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2013-11-15 05:20:08 -0500
committerMark Brown <broonie@linaro.org>2013-11-15 05:20:08 -0500
commit514918f0d1c3e7cf78fe2acbe80f7b616065e210 (patch)
treef6a918d115acf0347ee69b2b90aada657a68ef96 /sound
parent9450d92c8c647752586eeeb7927da8a50a691c96 (diff)
parentfc7dc61d9a87011aaf8a6eb3144ebf9552adf5d2 (diff)
Merge remote-tracking branch 'asoc/fix/fsl' into asoc-linus
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/ab8500-codec.c14
-rw-r--r--sound/soc/codecs/ak4642.c2
-rw-r--r--sound/soc/codecs/cs42l52.c93
-rw-r--r--sound/soc/codecs/cs42l52.h2
-rw-r--r--sound/soc/codecs/ml26124.c2
-rw-r--r--sound/soc/codecs/rt5640.c7
-rw-r--r--sound/soc/codecs/wm0010.c8
-rw-r--r--sound/soc/codecs/wm5110.c12
-rw-r--r--sound/soc/codecs/wm8962.c22
-rw-r--r--sound/soc/codecs/wm8996.c2
-rw-r--r--sound/soc/codecs/wm_adsp.c27
-rw-r--r--sound/soc/fsl/eukrea-tlv320.c15
-rw-r--r--sound/soc/fsl/fsl_spdif.c4
-rw-r--r--sound/soc/fsl/imx-pcm-fiq.c29
-rw-r--r--sound/soc/kirkwood/kirkwood-i2s.c2
-rw-r--r--sound/soc/samsung/i2s.c2
-rw-r--r--sound/soc/sh/rcar/core.c31
-rw-r--r--sound/soc/soc-core.c5
-rw-r--r--sound/soc/soc-pcm.c52
19 files changed, 207 insertions, 124 deletions
diff --git a/sound/soc/codecs/ab8500-codec.c b/sound/soc/codecs/ab8500-codec.c
index a0394a8f2257..21ae8d4fdbfb 100644
--- a/sound/soc/codecs/ab8500-codec.c
+++ b/sound/soc/codecs/ab8500-codec.c
@@ -2300,17 +2300,17 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai,
2300 case 0: 2300 case 0:
2301 break; 2301 break;
2302 case 1: 2302 case 1:
2303 slot = find_first_bit((unsigned long *)&tx_mask, 32); 2303 slot = ffs(tx_mask);
2304 snd_soc_update_bits(codec, AB8500_DASLOTCONF1, mask, slot); 2304 snd_soc_update_bits(codec, AB8500_DASLOTCONF1, mask, slot);
2305 snd_soc_update_bits(codec, AB8500_DASLOTCONF3, mask, slot); 2305 snd_soc_update_bits(codec, AB8500_DASLOTCONF3, mask, slot);
2306 snd_soc_update_bits(codec, AB8500_DASLOTCONF2, mask, slot); 2306 snd_soc_update_bits(codec, AB8500_DASLOTCONF2, mask, slot);
2307 snd_soc_update_bits(codec, AB8500_DASLOTCONF4, mask, slot); 2307 snd_soc_update_bits(codec, AB8500_DASLOTCONF4, mask, slot);
2308 break; 2308 break;
2309 case 2: 2309 case 2:
2310 slot = find_first_bit((unsigned long *)&tx_mask, 32); 2310 slot = ffs(tx_mask);
2311 snd_soc_update_bits(codec, AB8500_DASLOTCONF1, mask, slot); 2311 snd_soc_update_bits(codec, AB8500_DASLOTCONF1, mask, slot);
2312 snd_soc_update_bits(codec, AB8500_DASLOTCONF3, mask, slot); 2312 snd_soc_update_bits(codec, AB8500_DASLOTCONF3, mask, slot);
2313 slot = find_next_bit((unsigned long *)&tx_mask, 32, slot + 1); 2313 slot = fls(tx_mask);
2314 snd_soc_update_bits(codec, AB8500_DASLOTCONF2, mask, slot); 2314 snd_soc_update_bits(codec, AB8500_DASLOTCONF2, mask, slot);
2315 snd_soc_update_bits(codec, AB8500_DASLOTCONF4, mask, slot); 2315 snd_soc_update_bits(codec, AB8500_DASLOTCONF4, mask, slot);
2316 break; 2316 break;
@@ -2341,18 +2341,18 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai,
2341 case 0: 2341 case 0:
2342 break; 2342 break;
2343 case 1: 2343 case 1:
2344 slot = find_first_bit((unsigned long *)&rx_mask, 32); 2344 slot = ffs(rx_mask);
2345 snd_soc_update_bits(codec, AB8500_ADSLOTSEL(slot), 2345 snd_soc_update_bits(codec, AB8500_ADSLOTSEL(slot),
2346 AB8500_MASK_SLOT(slot), 2346 AB8500_MASK_SLOT(slot),
2347 AB8500_ADSLOTSELX_AD_OUT_TO_SLOT(AB8500_AD_OUT3, slot)); 2347 AB8500_ADSLOTSELX_AD_OUT_TO_SLOT(AB8500_AD_OUT3, slot));
2348 break; 2348 break;
2349 case 2: 2349 case 2:
2350 slot = find_first_bit((unsigned long *)&rx_mask, 32); 2350 slot = ffs(rx_mask);
2351 snd_soc_update_bits(codec, 2351 snd_soc_update_bits(codec,
2352 AB8500_ADSLOTSEL(slot), 2352 AB8500_ADSLOTSEL(slot),
2353 AB8500_MASK_SLOT(slot), 2353 AB8500_MASK_SLOT(slot),
2354 AB8500_ADSLOTSELX_AD_OUT_TO_SLOT(AB8500_AD_OUT3, slot)); 2354 AB8500_ADSLOTSELX_AD_OUT_TO_SLOT(AB8500_AD_OUT3, slot));
2355 slot = find_next_bit((unsigned long *)&rx_mask, 32, slot + 1); 2355 slot = fls(rx_mask);
2356 snd_soc_update_bits(codec, 2356 snd_soc_update_bits(codec,
2357 AB8500_ADSLOTSEL(slot), 2357 AB8500_ADSLOTSEL(slot),
2358 AB8500_MASK_SLOT(slot), 2358 AB8500_MASK_SLOT(slot),
@@ -2575,6 +2575,8 @@ static int ab8500_codec_driver_probe(struct platform_device *pdev)
2575 /* Create driver private-data struct */ 2575 /* Create driver private-data struct */
2576 drvdata = devm_kzalloc(&pdev->dev, sizeof(struct ab8500_codec_drvdata), 2576 drvdata = devm_kzalloc(&pdev->dev, sizeof(struct ab8500_codec_drvdata),
2577 GFP_KERNEL); 2577 GFP_KERNEL);
2578 if (!drvdata)
2579 return -ENOMEM;
2578 drvdata->sid_status = SID_UNCONFIGURED; 2580 drvdata->sid_status = SID_UNCONFIGURED;
2579 drvdata->anc_status = ANC_UNCONFIGURED; 2581 drvdata->anc_status = ANC_UNCONFIGURED;
2580 dev_set_drvdata(&pdev->dev, drvdata); 2582 dev_set_drvdata(&pdev->dev, drvdata);
diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c
index 21c35ed778cc..090d499bb7eb 100644
--- a/sound/soc/codecs/ak4642.c
+++ b/sound/soc/codecs/ak4642.c
@@ -257,7 +257,7 @@ static int ak4642_dai_startup(struct snd_pcm_substream *substream,
257 * This operation came from example code of 257 * This operation came from example code of
258 * "ASAHI KASEI AK4642" (japanese) manual p94. 258 * "ASAHI KASEI AK4642" (japanese) manual p94.
259 */ 259 */
260 snd_soc_write(codec, SG_SL1, PMMP | MGAIN0); 260 snd_soc_update_bits(codec, SG_SL1, PMMP | MGAIN0, PMMP | MGAIN0);
261 snd_soc_write(codec, TIMER, ZTM(0x3) | WTM(0x3)); 261 snd_soc_write(codec, TIMER, ZTM(0x3) | WTM(0x3));
262 snd_soc_write(codec, ALC_CTL1, ALC | LMTH0); 262 snd_soc_write(codec, ALC_CTL1, ALC | LMTH0);
263 snd_soc_update_bits(codec, PW_MGMT1, PMADL, PMADL); 263 snd_soc_update_bits(codec, PW_MGMT1, PMADL, PMADL);
diff --git a/sound/soc/codecs/cs42l52.c b/sound/soc/codecs/cs42l52.c
index be2ba1b6fe4a..8b427c977083 100644
--- a/sound/soc/codecs/cs42l52.c
+++ b/sound/soc/codecs/cs42l52.c
@@ -17,6 +17,7 @@
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/gpio.h>
20#include <linux/pm.h> 21#include <linux/pm.h>
21#include <linux/i2c.h> 22#include <linux/i2c.h>
22#include <linux/input.h> 23#include <linux/input.h>
@@ -1116,40 +1117,6 @@ static int cs42l52_probe(struct snd_soc_codec *codec)
1116 cs42l52->sysclk = CS42L52_DEFAULT_CLK; 1117 cs42l52->sysclk = CS42L52_DEFAULT_CLK;
1117 cs42l52->config.format = CS42L52_DEFAULT_FORMAT; 1118 cs42l52->config.format = CS42L52_DEFAULT_FORMAT;
1118 1119
1119 /* Set Platform MICx CFG */
1120 snd_soc_update_bits(codec, CS42L52_MICA_CTL,
1121 CS42L52_MIC_CTL_TYPE_MASK,
1122 cs42l52->pdata.mica_cfg <<
1123 CS42L52_MIC_CTL_TYPE_SHIFT);
1124
1125 snd_soc_update_bits(codec, CS42L52_MICB_CTL,
1126 CS42L52_MIC_CTL_TYPE_MASK,
1127 cs42l52->pdata.micb_cfg <<
1128 CS42L52_MIC_CTL_TYPE_SHIFT);
1129
1130 /* if Single Ended, Get Mic_Select */
1131 if (cs42l52->pdata.mica_cfg)
1132 snd_soc_update_bits(codec, CS42L52_MICA_CTL,
1133 CS42L52_MIC_CTL_MIC_SEL_MASK,
1134 cs42l52->pdata.mica_sel <<
1135 CS42L52_MIC_CTL_MIC_SEL_SHIFT);
1136 if (cs42l52->pdata.micb_cfg)
1137 snd_soc_update_bits(codec, CS42L52_MICB_CTL,
1138 CS42L52_MIC_CTL_MIC_SEL_MASK,
1139 cs42l52->pdata.micb_sel <<
1140 CS42L52_MIC_CTL_MIC_SEL_SHIFT);
1141
1142 /* Set Platform Charge Pump Freq */
1143 snd_soc_update_bits(codec, CS42L52_CHARGE_PUMP,
1144 CS42L52_CHARGE_PUMP_MASK,
1145 cs42l52->pdata.chgfreq <<
1146 CS42L52_CHARGE_PUMP_SHIFT);
1147
1148 /* Set Platform Bias Level */
1149 snd_soc_update_bits(codec, CS42L52_IFACE_CTL2,
1150 CS42L52_IFACE_CTL2_BIAS_LVL,
1151 cs42l52->pdata.micbias_lvl);
1152
1153 return ret; 1120 return ret;
1154} 1121}
1155 1122
@@ -1205,6 +1172,7 @@ static int cs42l52_i2c_probe(struct i2c_client *i2c_client,
1205 const struct i2c_device_id *id) 1172 const struct i2c_device_id *id)
1206{ 1173{
1207 struct cs42l52_private *cs42l52; 1174 struct cs42l52_private *cs42l52;
1175 struct cs42l52_platform_data *pdata = dev_get_platdata(&i2c_client->dev);
1208 int ret; 1176 int ret;
1209 unsigned int devid = 0; 1177 unsigned int devid = 0;
1210 unsigned int reg; 1178 unsigned int reg;
@@ -1222,11 +1190,22 @@ static int cs42l52_i2c_probe(struct i2c_client *i2c_client,
1222 return ret; 1190 return ret;
1223 } 1191 }
1224 1192
1225 i2c_set_clientdata(i2c_client, cs42l52); 1193 if (pdata)
1194 cs42l52->pdata = *pdata;
1195
1196 if (cs42l52->pdata.reset_gpio) {
1197 ret = gpio_request_one(cs42l52->pdata.reset_gpio,
1198 GPIOF_OUT_INIT_HIGH, "CS42L52 /RST");
1199 if (ret < 0) {
1200 dev_err(&i2c_client->dev, "Failed to request /RST %d: %d\n",
1201 cs42l52->pdata.reset_gpio, ret);
1202 return ret;
1203 }
1204 gpio_set_value_cansleep(cs42l52->pdata.reset_gpio, 0);
1205 gpio_set_value_cansleep(cs42l52->pdata.reset_gpio, 1);
1206 }
1226 1207
1227 if (dev_get_platdata(&i2c_client->dev)) 1208 i2c_set_clientdata(i2c_client, cs42l52);
1228 memcpy(&cs42l52->pdata, dev_get_platdata(&i2c_client->dev),
1229 sizeof(cs42l52->pdata));
1230 1209
1231 ret = regmap_register_patch(cs42l52->regmap, cs42l52_threshold_patch, 1210 ret = regmap_register_patch(cs42l52->regmap, cs42l52_threshold_patch,
1232 ARRAY_SIZE(cs42l52_threshold_patch)); 1211 ARRAY_SIZE(cs42l52_threshold_patch));
@@ -1244,7 +1223,43 @@ static int cs42l52_i2c_probe(struct i2c_client *i2c_client,
1244 return ret; 1223 return ret;
1245 } 1224 }
1246 1225
1247 regcache_cache_only(cs42l52->regmap, true); 1226 dev_info(&i2c_client->dev, "Cirrus Logic CS42L52, Revision: %02X\n",
1227 reg & 0xFF);
1228
1229 /* Set Platform Data */
1230 if (cs42l52->pdata.mica_cfg)
1231 regmap_update_bits(cs42l52->regmap, CS42L52_MICA_CTL,
1232 CS42L52_MIC_CTL_TYPE_MASK,
1233 cs42l52->pdata.mica_cfg <<
1234 CS42L52_MIC_CTL_TYPE_SHIFT);
1235
1236 if (cs42l52->pdata.micb_cfg)
1237 regmap_update_bits(cs42l52->regmap, CS42L52_MICB_CTL,
1238 CS42L52_MIC_CTL_TYPE_MASK,
1239 cs42l52->pdata.micb_cfg <<
1240 CS42L52_MIC_CTL_TYPE_SHIFT);
1241
1242 if (cs42l52->pdata.mica_sel)
1243 regmap_update_bits(cs42l52->regmap, CS42L52_MICA_CTL,
1244 CS42L52_MIC_CTL_MIC_SEL_MASK,
1245 cs42l52->pdata.mica_sel <<
1246 CS42L52_MIC_CTL_MIC_SEL_SHIFT);
1247 if (cs42l52->pdata.micb_sel)
1248 regmap_update_bits(cs42l52->regmap, CS42L52_MICB_CTL,
1249 CS42L52_MIC_CTL_MIC_SEL_MASK,
1250 cs42l52->pdata.micb_sel <<
1251 CS42L52_MIC_CTL_MIC_SEL_SHIFT);
1252
1253 if (cs42l52->pdata.chgfreq)
1254 regmap_update_bits(cs42l52->regmap, CS42L52_CHARGE_PUMP,
1255 CS42L52_CHARGE_PUMP_MASK,
1256 cs42l52->pdata.chgfreq <<
1257 CS42L52_CHARGE_PUMP_SHIFT);
1258
1259 if (cs42l52->pdata.micbias_lvl)
1260 regmap_update_bits(cs42l52->regmap, CS42L52_IFACE_CTL2,
1261 CS42L52_IFACE_CTL2_BIAS_LVL,
1262 cs42l52->pdata.micbias_lvl);
1248 1263
1249 ret = snd_soc_register_codec(&i2c_client->dev, 1264 ret = snd_soc_register_codec(&i2c_client->dev,
1250 &soc_codec_dev_cs42l52, &cs42l52_dai, 1); 1265 &soc_codec_dev_cs42l52, &cs42l52_dai, 1);
diff --git a/sound/soc/codecs/cs42l52.h b/sound/soc/codecs/cs42l52.h
index a935d7381af6..6fb8f00f4191 100644
--- a/sound/soc/codecs/cs42l52.h
+++ b/sound/soc/codecs/cs42l52.h
@@ -269,6 +269,6 @@
269#define CS42L52_FIX_BITS1 0x3E 269#define CS42L52_FIX_BITS1 0x3E
270#define CS42L52_FIX_BITS2 0x47 270#define CS42L52_FIX_BITS2 0x47
271 271
272#define CS42L52_MAX_REGISTER 0x34 272#define CS42L52_MAX_REGISTER 0x47
273 273
274#endif 274#endif
diff --git a/sound/soc/codecs/ml26124.c b/sound/soc/codecs/ml26124.c
index 26118828782b..185fa3bc3052 100644
--- a/sound/soc/codecs/ml26124.c
+++ b/sound/soc/codecs/ml26124.c
@@ -342,6 +342,8 @@ static int ml26124_hw_params(struct snd_pcm_substream *substream,
342 struct ml26124_priv *priv = snd_soc_codec_get_drvdata(codec); 342 struct ml26124_priv *priv = snd_soc_codec_get_drvdata(codec);
343 int i = get_coeff(priv->mclk, params_rate(hw_params)); 343 int i = get_coeff(priv->mclk, params_rate(hw_params));
344 344
345 if (i < 0)
346 return i;
345 priv->substream = substream; 347 priv->substream = substream;
346 priv->rate = params_rate(hw_params); 348 priv->rate = params_rate(hw_params);
347 349
diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c
index 4d041d376f31..a3fb41179636 100644
--- a/sound/soc/codecs/rt5640.c
+++ b/sound/soc/codecs/rt5640.c
@@ -1604,8 +1604,8 @@ static int rt5640_hw_params(struct snd_pcm_substream *substream,
1604 struct snd_soc_pcm_runtime *rtd = substream->private_data; 1604 struct snd_soc_pcm_runtime *rtd = substream->private_data;
1605 struct snd_soc_codec *codec = rtd->codec; 1605 struct snd_soc_codec *codec = rtd->codec;
1606 struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec); 1606 struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec);
1607 unsigned int val_len = 0, val_clk, mask_clk, dai_sel; 1607 unsigned int val_len = 0, val_clk, mask_clk;
1608 int pre_div, bclk_ms, frame_size; 1608 int dai_sel, pre_div, bclk_ms, frame_size;
1609 1609
1610 rt5640->lrck[dai->id] = params_rate(params); 1610 rt5640->lrck[dai->id] = params_rate(params);
1611 pre_div = get_clk_info(rt5640->sysclk, rt5640->lrck[dai->id]); 1611 pre_div = get_clk_info(rt5640->sysclk, rt5640->lrck[dai->id]);
@@ -1675,7 +1675,8 @@ static int rt5640_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
1675{ 1675{
1676 struct snd_soc_codec *codec = dai->codec; 1676 struct snd_soc_codec *codec = dai->codec;
1677 struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec); 1677 struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec);
1678 unsigned int reg_val = 0, dai_sel; 1678 unsigned int reg_val = 0;
1679 int dai_sel;
1679 1680
1680 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { 1681 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
1681 case SND_SOC_DAIFMT_CBM_CFM: 1682 case SND_SOC_DAIFMT_CBM_CFM:
diff --git a/sound/soc/codecs/wm0010.c b/sound/soc/codecs/wm0010.c
index d5ebcb00019b..bf7804a12863 100644
--- a/sound/soc/codecs/wm0010.c
+++ b/sound/soc/codecs/wm0010.c
@@ -793,11 +793,11 @@ static int wm0010_set_sysclk(struct snd_soc_codec *codec, int source,
793 wm0010->max_spi_freq = 0; 793 wm0010->max_spi_freq = 0;
794 } else { 794 } else {
795 for (i = 0; i < ARRAY_SIZE(pll_clock_map); i++) 795 for (i = 0; i < ARRAY_SIZE(pll_clock_map); i++)
796 if (freq >= pll_clock_map[i].max_sysclk) 796 if (freq >= pll_clock_map[i].max_sysclk) {
797 wm0010->max_spi_freq = pll_clock_map[i].max_pll_spi_speed;
798 wm0010->pll_clkctrl1 = pll_clock_map[i].pll_clkctrl1;
797 break; 799 break;
798 800 }
799 wm0010->max_spi_freq = pll_clock_map[i].max_pll_spi_speed;
800 wm0010->pll_clkctrl1 = pll_clock_map[i].pll_clkctrl1;
801 } 801 }
802 802
803 return 0; 803 return 0;
diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c
index b67ba33546d6..f2d1094424b9 100644
--- a/sound/soc/codecs/wm5110.c
+++ b/sound/soc/codecs/wm5110.c
@@ -983,24 +983,36 @@ static const struct snd_soc_dapm_route wm5110_dapm_routes[] = {
983 ARIZONA_MUX_ROUTES("ASRC2L", "ASRC2L"), 983 ARIZONA_MUX_ROUTES("ASRC2L", "ASRC2L"),
984 ARIZONA_MUX_ROUTES("ASRC2R", "ASRC2R"), 984 ARIZONA_MUX_ROUTES("ASRC2R", "ASRC2R"),
985 985
986 { "AEC Loopback", "HPOUT1L", "OUT1L" },
987 { "AEC Loopback", "HPOUT1R", "OUT1R" },
986 { "HPOUT1L", NULL, "OUT1L" }, 988 { "HPOUT1L", NULL, "OUT1L" },
987 { "HPOUT1R", NULL, "OUT1R" }, 989 { "HPOUT1R", NULL, "OUT1R" },
988 990
991 { "AEC Loopback", "HPOUT2L", "OUT2L" },
992 { "AEC Loopback", "HPOUT2R", "OUT2R" },
989 { "HPOUT2L", NULL, "OUT2L" }, 993 { "HPOUT2L", NULL, "OUT2L" },
990 { "HPOUT2R", NULL, "OUT2R" }, 994 { "HPOUT2R", NULL, "OUT2R" },
991 995
996 { "AEC Loopback", "HPOUT3L", "OUT3L" },
997 { "AEC Loopback", "HPOUT3R", "OUT3R" },
992 { "HPOUT3L", NULL, "OUT3L" }, 998 { "HPOUT3L", NULL, "OUT3L" },
993 { "HPOUT3R", NULL, "OUT3L" }, 999 { "HPOUT3R", NULL, "OUT3L" },
994 1000
1001 { "AEC Loopback", "SPKOUTL", "OUT4L" },
995 { "SPKOUTLN", NULL, "OUT4L" }, 1002 { "SPKOUTLN", NULL, "OUT4L" },
996 { "SPKOUTLP", NULL, "OUT4L" }, 1003 { "SPKOUTLP", NULL, "OUT4L" },
997 1004
1005 { "AEC Loopback", "SPKOUTR", "OUT4R" },
998 { "SPKOUTRN", NULL, "OUT4R" }, 1006 { "SPKOUTRN", NULL, "OUT4R" },
999 { "SPKOUTRP", NULL, "OUT4R" }, 1007 { "SPKOUTRP", NULL, "OUT4R" },
1000 1008
1009 { "AEC Loopback", "SPKDAT1L", "OUT5L" },
1010 { "AEC Loopback", "SPKDAT1R", "OUT5R" },
1001 { "SPKDAT1L", NULL, "OUT5L" }, 1011 { "SPKDAT1L", NULL, "OUT5L" },
1002 { "SPKDAT1R", NULL, "OUT5R" }, 1012 { "SPKDAT1R", NULL, "OUT5R" },
1003 1013
1014 { "AEC Loopback", "SPKDAT2L", "OUT6L" },
1015 { "AEC Loopback", "SPKDAT2R", "OUT6R" },
1004 { "SPKDAT2L", NULL, "OUT6L" }, 1016 { "SPKDAT2L", NULL, "OUT6L" },
1005 { "SPKDAT2R", NULL, "OUT6R" }, 1017 { "SPKDAT2R", NULL, "OUT6R" },
1006 1018
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index 2bf9ee7c5407..3a2f96c5442c 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -1758,6 +1758,9 @@ SOC_DOUBLE_R_TLV("EQ4 Volume", WM8962_EQ3, WM8962_EQ23,
1758 WM8962_EQL_B4_GAIN_SHIFT, 31, 0, eq_tlv), 1758 WM8962_EQL_B4_GAIN_SHIFT, 31, 0, eq_tlv),
1759SOC_DOUBLE_R_TLV("EQ5 Volume", WM8962_EQ3, WM8962_EQ23, 1759SOC_DOUBLE_R_TLV("EQ5 Volume", WM8962_EQ3, WM8962_EQ23,
1760 WM8962_EQL_B5_GAIN_SHIFT, 31, 0, eq_tlv), 1760 WM8962_EQL_B5_GAIN_SHIFT, 31, 0, eq_tlv),
1761SND_SOC_BYTES("EQL Coefficients", WM8962_EQ4, 18),
1762SND_SOC_BYTES("EQR Coefficients", WM8962_EQ24, 18),
1763
1761 1764
1762SOC_SINGLE("3D Switch", WM8962_THREED1, 0, 1, 0), 1765SOC_SINGLE("3D Switch", WM8962_THREED1, 0, 1, 0),
1763SND_SOC_BYTES_MASK("3D Coefficients", WM8962_THREED1, 4, WM8962_THREED_ENA), 1766SND_SOC_BYTES_MASK("3D Coefficients", WM8962_THREED1, 4, WM8962_THREED_ENA),
@@ -1775,6 +1778,11 @@ WM8962_DSP2_ENABLE("HPF2 Switch", WM8962_HPF2_ENA_SHIFT),
1775SND_SOC_BYTES("HPF Coefficients", WM8962_LHPF2, 1), 1778SND_SOC_BYTES("HPF Coefficients", WM8962_LHPF2, 1),
1776WM8962_DSP2_ENABLE("HD Bass Switch", WM8962_HDBASS_ENA_SHIFT), 1779WM8962_DSP2_ENABLE("HD Bass Switch", WM8962_HDBASS_ENA_SHIFT),
1777SND_SOC_BYTES("HD Bass Coefficients", WM8962_HDBASS_AI_1, 30), 1780SND_SOC_BYTES("HD Bass Coefficients", WM8962_HDBASS_AI_1, 30),
1781
1782SOC_DOUBLE("ALC Switch", WM8962_ALC1, WM8962_ALCL_ENA_SHIFT,
1783 WM8962_ALCR_ENA_SHIFT, 1, 0),
1784SND_SOC_BYTES_MASK("ALC Coefficients", WM8962_ALC1, 4,
1785 WM8962_ALCL_ENA_MASK | WM8962_ALCR_ENA_MASK),
1778}; 1786};
1779 1787
1780static const struct snd_kcontrol_new wm8962_spk_mono_controls[] = { 1788static const struct snd_kcontrol_new wm8962_spk_mono_controls[] = {
@@ -3616,28 +3624,28 @@ static int wm8962_i2c_probe(struct i2c_client *i2c,
3616 0); 3624 0);
3617 3625
3618 /* Apply static configuration for GPIOs */ 3626 /* Apply static configuration for GPIOs */
3619 for (i = 0; i < ARRAY_SIZE(pdata->gpio_init); i++) 3627 for (i = 0; i < ARRAY_SIZE(wm8962->pdata.gpio_init); i++)
3620 if (pdata->gpio_init[i]) { 3628 if (wm8962->pdata.gpio_init[i]) {
3621 wm8962_set_gpio_mode(wm8962, i + 1); 3629 wm8962_set_gpio_mode(wm8962, i + 1);
3622 regmap_write(wm8962->regmap, 0x200 + i, 3630 regmap_write(wm8962->regmap, 0x200 + i,
3623 pdata->gpio_init[i] & 0xffff); 3631 wm8962->pdata.gpio_init[i] & 0xffff);
3624 } 3632 }
3625 3633
3626 3634
3627 /* Put the speakers into mono mode? */ 3635 /* Put the speakers into mono mode? */
3628 if (pdata->spk_mono) 3636 if (wm8962->pdata.spk_mono)
3629 regmap_update_bits(wm8962->regmap, WM8962_CLASS_D_CONTROL_2, 3637 regmap_update_bits(wm8962->regmap, WM8962_CLASS_D_CONTROL_2,
3630 WM8962_SPK_MONO_MASK, WM8962_SPK_MONO); 3638 WM8962_SPK_MONO_MASK, WM8962_SPK_MONO);
3631 3639
3632 /* Micbias setup, detection enable and detection 3640 /* Micbias setup, detection enable and detection
3633 * threasholds. */ 3641 * threasholds. */
3634 if (pdata->mic_cfg) 3642 if (wm8962->pdata.mic_cfg)
3635 regmap_update_bits(wm8962->regmap, WM8962_ADDITIONAL_CONTROL_4, 3643 regmap_update_bits(wm8962->regmap, WM8962_ADDITIONAL_CONTROL_4,
3636 WM8962_MICDET_ENA | 3644 WM8962_MICDET_ENA |
3637 WM8962_MICDET_THR_MASK | 3645 WM8962_MICDET_THR_MASK |
3638 WM8962_MICSHORT_THR_MASK | 3646 WM8962_MICSHORT_THR_MASK |
3639 WM8962_MICBIAS_LVL, 3647 WM8962_MICBIAS_LVL,
3640 pdata->mic_cfg); 3648 wm8962->pdata.mic_cfg);
3641 3649
3642 /* Latch volume update bits */ 3650 /* Latch volume update bits */
3643 regmap_update_bits(wm8962->regmap, WM8962_LEFT_INPUT_VOLUME, 3651 regmap_update_bits(wm8962->regmap, WM8962_LEFT_INPUT_VOLUME,
@@ -3682,7 +3690,7 @@ static int wm8962_i2c_probe(struct i2c_client *i2c,
3682 } 3690 }
3683 3691
3684 if (wm8962->irq) { 3692 if (wm8962->irq) {
3685 if (pdata->irq_active_low) { 3693 if (wm8962->pdata.irq_active_low) {
3686 trigger = IRQF_TRIGGER_LOW; 3694 trigger = IRQF_TRIGGER_LOW;
3687 irq_pol = WM8962_IRQ_POL; 3695 irq_pol = WM8962_IRQ_POL;
3688 } else { 3696 } else {
diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c
index 46fe83d2b224..b70379ebd142 100644
--- a/sound/soc/codecs/wm8996.c
+++ b/sound/soc/codecs/wm8996.c
@@ -438,6 +438,8 @@ static int wm8996_get_retune_mobile_enum(struct snd_kcontrol *kcontrol,
438 struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); 438 struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec);
439 int block = wm8996_get_retune_mobile_block(kcontrol->id.name); 439 int block = wm8996_get_retune_mobile_block(kcontrol->id.name);
440 440
441 if (block < 0)
442 return block;
441 ucontrol->value.enumerated.item[0] = wm8996->retune_mobile_cfg[block]; 443 ucontrol->value.enumerated.item[0] = wm8996->retune_mobile_cfg[block];
442 444
443 return 0; 445 return 0;
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index b38f3506418f..53b6033658a6 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -396,11 +396,12 @@ static int wm_coeff_write_control(struct snd_kcontrol *kcontrol,
396 ret = regmap_raw_write(adsp->regmap, reg, scratch, 396 ret = regmap_raw_write(adsp->regmap, reg, scratch,
397 ctl->len); 397 ctl->len);
398 if (ret) { 398 if (ret) {
399 adsp_err(adsp, "Failed to write %zu bytes to %x\n", 399 adsp_err(adsp, "Failed to write %zu bytes to %x: %d\n",
400 ctl->len, reg); 400 ctl->len, reg, ret);
401 kfree(scratch); 401 kfree(scratch);
402 return ret; 402 return ret;
403 } 403 }
404 adsp_dbg(adsp, "Wrote %zu bytes to %x\n", ctl->len, reg);
404 405
405 kfree(scratch); 406 kfree(scratch);
406 407
@@ -450,11 +451,12 @@ static int wm_coeff_read_control(struct snd_kcontrol *kcontrol,
450 451
451 ret = regmap_raw_read(adsp->regmap, reg, scratch, ctl->len); 452 ret = regmap_raw_read(adsp->regmap, reg, scratch, ctl->len);
452 if (ret) { 453 if (ret) {
453 adsp_err(adsp, "Failed to read %zu bytes from %x\n", 454 adsp_err(adsp, "Failed to read %zu bytes from %x: %d\n",
454 ctl->len, reg); 455 ctl->len, reg, ret);
455 kfree(scratch); 456 kfree(scratch);
456 return ret; 457 return ret;
457 } 458 }
459 adsp_dbg(adsp, "Read %zu bytes from %x\n", ctl->len, reg);
458 460
459 memcpy(buf, scratch, ctl->len); 461 memcpy(buf, scratch, ctl->len);
460 kfree(scratch); 462 kfree(scratch);
@@ -568,6 +570,7 @@ static int wm_adsp_load(struct wm_adsp *dsp)
568 file, header->ver); 570 file, header->ver);
569 goto out_fw; 571 goto out_fw;
570 } 572 }
573 adsp_info(dsp, "Firmware version: %d\n", header->ver);
571 574
572 if (header->core != dsp->type) { 575 if (header->core != dsp->type) {
573 adsp_err(dsp, "%s: invalid core %d != %d\n", 576 adsp_err(dsp, "%s: invalid core %d != %d\n",
@@ -689,7 +692,8 @@ static int wm_adsp_load(struct wm_adsp *dsp)
689 &buf_list); 692 &buf_list);
690 if (!buf) { 693 if (!buf) {
691 adsp_err(dsp, "Out of memory\n"); 694 adsp_err(dsp, "Out of memory\n");
692 return -ENOMEM; 695 ret = -ENOMEM;
696 goto out_fw;
693 } 697 }
694 698
695 ret = regmap_raw_write_async(regmap, reg, buf->buf, 699 ret = regmap_raw_write_async(regmap, reg, buf->buf,
@@ -1313,8 +1317,8 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp)
1313 le32_to_cpu(blk->len)); 1317 le32_to_cpu(blk->len));
1314 if (ret != 0) { 1318 if (ret != 0) {
1315 adsp_err(dsp, 1319 adsp_err(dsp,
1316 "%s.%d: Failed to write to %x in %s\n", 1320 "%s.%d: Failed to write to %x in %s: %d\n",
1317 file, blocks, reg, region_name); 1321 file, blocks, reg, region_name, ret);
1318 } 1322 }
1319 } 1323 }
1320 1324
@@ -1358,6 +1362,7 @@ int wm_adsp1_event(struct snd_soc_dapm_widget *w,
1358 struct snd_soc_codec *codec = w->codec; 1362 struct snd_soc_codec *codec = w->codec;
1359 struct wm_adsp *dsps = snd_soc_codec_get_drvdata(codec); 1363 struct wm_adsp *dsps = snd_soc_codec_get_drvdata(codec);
1360 struct wm_adsp *dsp = &dsps[w->shift]; 1364 struct wm_adsp *dsp = &dsps[w->shift];
1365 struct wm_adsp_alg_region *alg_region;
1361 struct wm_coeff_ctl *ctl; 1366 struct wm_coeff_ctl *ctl;
1362 int ret; 1367 int ret;
1363 int val; 1368 int val;
@@ -1435,6 +1440,14 @@ int wm_adsp1_event(struct snd_soc_dapm_widget *w,
1435 1440
1436 list_for_each_entry(ctl, &dsp->ctl_list, list) 1441 list_for_each_entry(ctl, &dsp->ctl_list, list)
1437 ctl->enabled = 0; 1442 ctl->enabled = 0;
1443
1444 while (!list_empty(&dsp->alg_regions)) {
1445 alg_region = list_first_entry(&dsp->alg_regions,
1446 struct wm_adsp_alg_region,
1447 list);
1448 list_del(&alg_region->list);
1449 kfree(alg_region);
1450 }
1438 break; 1451 break;
1439 1452
1440 default: 1453 default:
diff --git a/sound/soc/fsl/eukrea-tlv320.c b/sound/soc/fsl/eukrea-tlv320.c
index 9a4a0ca2c1de..5983740be123 100644
--- a/sound/soc/fsl/eukrea-tlv320.c
+++ b/sound/soc/fsl/eukrea-tlv320.c
@@ -42,7 +42,8 @@ static int eukrea_tlv320_hw_params(struct snd_pcm_substream *substream,
42 SND_SOC_DAIFMT_NB_NF | 42 SND_SOC_DAIFMT_NB_NF |
43 SND_SOC_DAIFMT_CBM_CFM); 43 SND_SOC_DAIFMT_CBM_CFM);
44 if (ret) { 44 if (ret) {
45 pr_err("%s: failed set cpu dai format\n", __func__); 45 dev_err(cpu_dai->dev,
46 "Failed to set the cpu dai format.\n");
46 return ret; 47 return ret;
47 } 48 }
48 49
@@ -50,14 +51,16 @@ static int eukrea_tlv320_hw_params(struct snd_pcm_substream *substream,
50 SND_SOC_DAIFMT_NB_NF | 51 SND_SOC_DAIFMT_NB_NF |
51 SND_SOC_DAIFMT_CBM_CFM); 52 SND_SOC_DAIFMT_CBM_CFM);
52 if (ret) { 53 if (ret) {
53 pr_err("%s: failed set codec dai format\n", __func__); 54 dev_err(cpu_dai->dev,
55 "Failed to set the codec format.\n");
54 return ret; 56 return ret;
55 } 57 }
56 58
57 ret = snd_soc_dai_set_sysclk(codec_dai, 0, 59 ret = snd_soc_dai_set_sysclk(codec_dai, 0,
58 CODEC_CLOCK, SND_SOC_CLOCK_OUT); 60 CODEC_CLOCK, SND_SOC_CLOCK_OUT);
59 if (ret) { 61 if (ret) {
60 pr_err("%s: failed setting codec sysclk\n", __func__); 62 dev_err(cpu_dai->dev,
63 "Failed to set the codec sysclk.\n");
61 return ret; 64 return ret;
62 } 65 }
63 snd_soc_dai_set_tdm_slot(cpu_dai, 0xffffffc, 0xffffffc, 2, 0); 66 snd_soc_dai_set_tdm_slot(cpu_dai, 0xffffffc, 0xffffffc, 2, 0);
@@ -65,7 +68,8 @@ static int eukrea_tlv320_hw_params(struct snd_pcm_substream *substream,
65 ret = snd_soc_dai_set_sysclk(cpu_dai, IMX_SSP_SYS_CLK, 0, 68 ret = snd_soc_dai_set_sysclk(cpu_dai, IMX_SSP_SYS_CLK, 0,
66 SND_SOC_CLOCK_IN); 69 SND_SOC_CLOCK_IN);
67 if (ret) { 70 if (ret) {
68 pr_err("can't set CPU system clock IMX_SSP_SYS_CLK\n"); 71 dev_err(cpu_dai->dev,
72 "Can't set the IMX_SSP_SYS_CLK CPU system clock.\n");
69 return ret; 73 return ret;
70 } 74 }
71 75
@@ -155,7 +159,8 @@ static struct platform_driver eukrea_tlv320_driver = {
155 .owner = THIS_MODULE, 159 .owner = THIS_MODULE,
156 }, 160 },
157 .probe = eukrea_tlv320_probe, 161 .probe = eukrea_tlv320_probe,
158 .remove = eukrea_tlv320_remove,}; 162 .remove = eukrea_tlv320_remove,
163};
159 164
160module_platform_driver(eukrea_tlv320_driver); 165module_platform_driver(eukrea_tlv320_driver);
161 166
diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c
index ff1f34766ee3..76c742a09ef9 100644
--- a/sound/soc/fsl/fsl_spdif.c
+++ b/sound/soc/fsl/fsl_spdif.c
@@ -1107,9 +1107,9 @@ static int fsl_spdif_probe(struct platform_device *pdev)
1107 1107
1108 /* Get the addresses and IRQ */ 1108 /* Get the addresses and IRQ */
1109 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1109 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1110 if (IS_ERR(res)) { 1110 if (!res) {
1111 dev_err(&pdev->dev, "could not determine device resources\n"); 1111 dev_err(&pdev->dev, "could not determine device resources\n");
1112 return PTR_ERR(res); 1112 return -ENXIO;
1113 } 1113 }
1114 1114
1115 regs = devm_ioremap_resource(&pdev->dev, res); 1115 regs = devm_ioremap_resource(&pdev->dev, res);
diff --git a/sound/soc/fsl/imx-pcm-fiq.c b/sound/soc/fsl/imx-pcm-fiq.c
index 34043c55f2a6..2fc872b2deff 100644
--- a/sound/soc/fsl/imx-pcm-fiq.c
+++ b/sound/soc/fsl/imx-pcm-fiq.c
@@ -44,7 +44,8 @@ struct imx_pcm_runtime_data {
44 struct hrtimer hrt; 44 struct hrtimer hrt;
45 int poll_time_ns; 45 int poll_time_ns;
46 struct snd_pcm_substream *substream; 46 struct snd_pcm_substream *substream;
47 atomic_t running; 47 atomic_t playing;
48 atomic_t capturing;
48}; 49};
49 50
50static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt) 51static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt)
@@ -56,7 +57,7 @@ static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt)
56 struct pt_regs regs; 57 struct pt_regs regs;
57 unsigned long delta; 58 unsigned long delta;
58 59
59 if (!atomic_read(&iprtd->running)) 60 if (!atomic_read(&iprtd->playing) && !atomic_read(&iprtd->capturing))
60 return HRTIMER_NORESTART; 61 return HRTIMER_NORESTART;
61 62
62 get_fiq_regs(&regs); 63 get_fiq_regs(&regs);
@@ -124,7 +125,6 @@ static int snd_imx_pcm_prepare(struct snd_pcm_substream *substream)
124 return 0; 125 return 0;
125} 126}
126 127
127static int fiq_enable;
128static int imx_pcm_fiq; 128static int imx_pcm_fiq;
129 129
130static int snd_imx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) 130static int snd_imx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
@@ -136,23 +136,27 @@ static int snd_imx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
136 case SNDRV_PCM_TRIGGER_START: 136 case SNDRV_PCM_TRIGGER_START:
137 case SNDRV_PCM_TRIGGER_RESUME: 137 case SNDRV_PCM_TRIGGER_RESUME:
138 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 138 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
139 atomic_set(&iprtd->running, 1); 139 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
140 atomic_set(&iprtd->playing, 1);
141 else
142 atomic_set(&iprtd->capturing, 1);
140 hrtimer_start(&iprtd->hrt, ns_to_ktime(iprtd->poll_time_ns), 143 hrtimer_start(&iprtd->hrt, ns_to_ktime(iprtd->poll_time_ns),
141 HRTIMER_MODE_REL); 144 HRTIMER_MODE_REL);
142 if (++fiq_enable == 1) 145 enable_fiq(imx_pcm_fiq);
143 enable_fiq(imx_pcm_fiq);
144
145 break; 146 break;
146 147
147 case SNDRV_PCM_TRIGGER_STOP: 148 case SNDRV_PCM_TRIGGER_STOP:
148 case SNDRV_PCM_TRIGGER_SUSPEND: 149 case SNDRV_PCM_TRIGGER_SUSPEND:
149 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 150 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
150 atomic_set(&iprtd->running, 0); 151 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
151 152 atomic_set(&iprtd->playing, 0);
152 if (--fiq_enable == 0) 153 else
154 atomic_set(&iprtd->capturing, 0);
155 if (!atomic_read(&iprtd->playing) &&
156 !atomic_read(&iprtd->capturing))
153 disable_fiq(imx_pcm_fiq); 157 disable_fiq(imx_pcm_fiq);
154
155 break; 158 break;
159
156 default: 160 default:
157 return -EINVAL; 161 return -EINVAL;
158 } 162 }
@@ -200,7 +204,8 @@ static int snd_imx_open(struct snd_pcm_substream *substream)
200 204
201 iprtd->substream = substream; 205 iprtd->substream = substream;
202 206
203 atomic_set(&iprtd->running, 0); 207 atomic_set(&iprtd->playing, 0);
208 atomic_set(&iprtd->capturing, 0);
204 hrtimer_init(&iprtd->hrt, CLOCK_MONOTONIC, HRTIMER_MODE_REL); 209 hrtimer_init(&iprtd->hrt, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
205 iprtd->hrt.function = snd_hrtimer_callback; 210 iprtd->hrt.function = snd_hrtimer_callback;
206 211
diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c
index 9ec38d15df9e..d34d91743e3f 100644
--- a/sound/soc/kirkwood/kirkwood-i2s.c
+++ b/sound/soc/kirkwood/kirkwood-i2s.c
@@ -568,7 +568,7 @@ static int kirkwood_i2s_dev_probe(struct platform_device *pdev)
568 } else { 568 } else {
569 dev_info(&pdev->dev, "found external clock\n"); 569 dev_info(&pdev->dev, "found external clock\n");
570 clk_prepare_enable(priv->extclk); 570 clk_prepare_enable(priv->extclk);
571 soc_dai = &kirkwood_i2s_dai_extclk; 571 soc_dai = kirkwood_i2s_dai_extclk;
572 } 572 }
573 } 573 }
574 574
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index 2c4d2505a19e..a5cbdb4f1655 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -1068,7 +1068,7 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec)
1068 dev_set_drvdata(&i2s->pdev->dev, i2s); 1068 dev_set_drvdata(&i2s->pdev->dev, i2s);
1069 } else { /* Create a new platform_device for Secondary */ 1069 } else { /* Create a new platform_device for Secondary */
1070 i2s->pdev = platform_device_alloc("samsung-i2s-sec", -1); 1070 i2s->pdev = platform_device_alloc("samsung-i2s-sec", -1);
1071 if (IS_ERR(i2s->pdev)) 1071 if (!i2s->pdev)
1072 return NULL; 1072 return NULL;
1073 1073
1074 i2s->pdev->dev.parent = &pdev->dev; 1074 i2s->pdev->dev.parent = &pdev->dev;
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index b234ed663073..78c35b44fc04 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -94,6 +94,7 @@
94 * 94 *
95 */ 95 */
96#include <linux/pm_runtime.h> 96#include <linux/pm_runtime.h>
97#include <linux/shdma-base.h>
97#include "rsnd.h" 98#include "rsnd.h"
98 99
99#define RSND_RATES SNDRV_PCM_RATE_8000_96000 100#define RSND_RATES SNDRV_PCM_RATE_8000_96000
@@ -209,13 +210,6 @@ int rsnd_dma_available(struct rsnd_dma *dma)
209 return !!dma->chan; 210 return !!dma->chan;
210} 211}
211 212
212static bool rsnd_dma_filter(struct dma_chan *chan, void *param)
213{
214 chan->private = param;
215
216 return true;
217}
218
219int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma, 213int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
220 int is_play, int id, 214 int is_play, int id,
221 int (*inquiry)(struct rsnd_dma *dma, 215 int (*inquiry)(struct rsnd_dma *dma,
@@ -223,7 +217,9 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
223 int (*complete)(struct rsnd_dma *dma)) 217 int (*complete)(struct rsnd_dma *dma))
224{ 218{
225 struct device *dev = rsnd_priv_to_dev(priv); 219 struct device *dev = rsnd_priv_to_dev(priv);
220 struct dma_slave_config cfg;
226 dma_cap_mask_t mask; 221 dma_cap_mask_t mask;
222 int ret;
227 223
228 if (dma->chan) { 224 if (dma->chan) {
229 dev_err(dev, "it already has dma channel\n"); 225 dev_err(dev, "it already has dma channel\n");
@@ -233,15 +229,23 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
233 dma_cap_zero(mask); 229 dma_cap_zero(mask);
234 dma_cap_set(DMA_SLAVE, mask); 230 dma_cap_set(DMA_SLAVE, mask);
235 231
236 dma->slave.shdma_slave.slave_id = id; 232 dma->chan = dma_request_slave_channel_compat(mask, shdma_chan_filter,
237 233 (void *)id, dev,
238 dma->chan = dma_request_channel(mask, rsnd_dma_filter, 234 is_play ? "tx" : "rx");
239 &dma->slave.shdma_slave);
240 if (!dma->chan) { 235 if (!dma->chan) {
241 dev_err(dev, "can't get dma channel\n"); 236 dev_err(dev, "can't get dma channel\n");
242 return -EIO; 237 return -EIO;
243 } 238 }
244 239
240 cfg.slave_id = id;
241 cfg.dst_addr = 0; /* use default addr when playback */
242 cfg.src_addr = 0; /* use default addr when capture */
243 cfg.direction = is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
244
245 ret = dmaengine_slave_config(dma->chan, &cfg);
246 if (ret < 0)
247 goto rsnd_dma_init_err;
248
245 dma->dir = is_play ? DMA_TO_DEVICE : DMA_FROM_DEVICE; 249 dma->dir = is_play ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
246 dma->priv = priv; 250 dma->priv = priv;
247 dma->inquiry = inquiry; 251 dma->inquiry = inquiry;
@@ -249,6 +253,11 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
249 INIT_WORK(&dma->work, rsnd_dma_do_work); 253 INIT_WORK(&dma->work, rsnd_dma_do_work);
250 254
251 return 0; 255 return 0;
256
257rsnd_dma_init_err:
258 rsnd_dma_quit(priv, dma);
259
260 return ret;
252} 261}
253 262
254void rsnd_dma_quit(struct rsnd_priv *priv, 263void rsnd_dma_quit(struct rsnd_priv *priv,
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index afc3fa8b7470..bdc1d74eb7b0 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2551,8 +2551,9 @@ int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol,
2551 2551
2552 if (uinfo->value.enumerated.item > e->max - 1) 2552 if (uinfo->value.enumerated.item > e->max - 1)
2553 uinfo->value.enumerated.item = e->max - 1; 2553 uinfo->value.enumerated.item = e->max - 1;
2554 strcpy(uinfo->value.enumerated.name, 2554 strlcpy(uinfo->value.enumerated.name,
2555 e->texts[uinfo->value.enumerated.item]); 2555 e->texts[uinfo->value.enumerated.item],
2556 sizeof(uinfo->value.enumerated.name));
2556 return 0; 2557 return 0;
2557} 2558}
2558EXPORT_SYMBOL_GPL(snd_soc_info_enum_double); 2559EXPORT_SYMBOL_GPL(snd_soc_info_enum_double);
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index d4498723b375..591f0f3074c5 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -190,7 +190,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
190 mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass); 190 mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass);
191 191
192 /* startup the audio subsystem */ 192 /* startup the audio subsystem */
193 if (cpu_dai->driver->ops->startup) { 193 if (cpu_dai->driver->ops && cpu_dai->driver->ops->startup) {
194 ret = cpu_dai->driver->ops->startup(substream, cpu_dai); 194 ret = cpu_dai->driver->ops->startup(substream, cpu_dai);
195 if (ret < 0) { 195 if (ret < 0) {
196 dev_err(cpu_dai->dev, "ASoC: can't open interface" 196 dev_err(cpu_dai->dev, "ASoC: can't open interface"
@@ -208,7 +208,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
208 } 208 }
209 } 209 }
210 210
211 if (codec_dai->driver->ops->startup) { 211 if (codec_dai->driver->ops && codec_dai->driver->ops->startup) {
212 ret = codec_dai->driver->ops->startup(substream, codec_dai); 212 ret = codec_dai->driver->ops->startup(substream, codec_dai);
213 if (ret < 0) { 213 if (ret < 0) {
214 dev_err(codec_dai->dev, "ASoC: can't open codec" 214 dev_err(codec_dai->dev, "ASoC: can't open codec"
@@ -463,7 +463,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
463 } 463 }
464 } 464 }
465 465
466 if (codec_dai->driver->ops->prepare) { 466 if (codec_dai->driver->ops && codec_dai->driver->ops->prepare) {
467 ret = codec_dai->driver->ops->prepare(substream, codec_dai); 467 ret = codec_dai->driver->ops->prepare(substream, codec_dai);
468 if (ret < 0) { 468 if (ret < 0) {
469 dev_err(codec_dai->dev, "ASoC: DAI prepare error: %d\n", 469 dev_err(codec_dai->dev, "ASoC: DAI prepare error: %d\n",
@@ -472,7 +472,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
472 } 472 }
473 } 473 }
474 474
475 if (cpu_dai->driver->ops->prepare) { 475 if (cpu_dai->driver->ops && cpu_dai->driver->ops->prepare) {
476 ret = cpu_dai->driver->ops->prepare(substream, cpu_dai); 476 ret = cpu_dai->driver->ops->prepare(substream, cpu_dai);
477 if (ret < 0) { 477 if (ret < 0) {
478 dev_err(cpu_dai->dev, "ASoC: DAI prepare error: %d\n", 478 dev_err(cpu_dai->dev, "ASoC: DAI prepare error: %d\n",
@@ -523,7 +523,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
523 } 523 }
524 } 524 }
525 525
526 if (codec_dai->driver->ops->hw_params) { 526 if (codec_dai->driver->ops && codec_dai->driver->ops->hw_params) {
527 ret = codec_dai->driver->ops->hw_params(substream, params, codec_dai); 527 ret = codec_dai->driver->ops->hw_params(substream, params, codec_dai);
528 if (ret < 0) { 528 if (ret < 0) {
529 dev_err(codec_dai->dev, "ASoC: can't set %s hw params:" 529 dev_err(codec_dai->dev, "ASoC: can't set %s hw params:"
@@ -532,7 +532,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
532 } 532 }
533 } 533 }
534 534
535 if (cpu_dai->driver->ops->hw_params) { 535 if (cpu_dai->driver->ops && cpu_dai->driver->ops->hw_params) {
536 ret = cpu_dai->driver->ops->hw_params(substream, params, cpu_dai); 536 ret = cpu_dai->driver->ops->hw_params(substream, params, cpu_dai);
537 if (ret < 0) { 537 if (ret < 0) {
538 dev_err(cpu_dai->dev, "ASoC: %s hw params failed: %d\n", 538 dev_err(cpu_dai->dev, "ASoC: %s hw params failed: %d\n",
@@ -559,11 +559,11 @@ out:
559 return ret; 559 return ret;
560 560
561platform_err: 561platform_err:
562 if (cpu_dai->driver->ops->hw_free) 562 if (cpu_dai->driver->ops && cpu_dai->driver->ops->hw_free)
563 cpu_dai->driver->ops->hw_free(substream, cpu_dai); 563 cpu_dai->driver->ops->hw_free(substream, cpu_dai);
564 564
565interface_err: 565interface_err:
566 if (codec_dai->driver->ops->hw_free) 566 if (codec_dai->driver->ops && codec_dai->driver->ops->hw_free)
567 codec_dai->driver->ops->hw_free(substream, codec_dai); 567 codec_dai->driver->ops->hw_free(substream, codec_dai);
568 568
569codec_err: 569codec_err:
@@ -600,10 +600,10 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream)
600 platform->driver->ops->hw_free(substream); 600 platform->driver->ops->hw_free(substream);
601 601
602 /* now free hw params for the DAIs */ 602 /* now free hw params for the DAIs */
603 if (codec_dai->driver->ops->hw_free) 603 if (codec_dai->driver->ops && codec_dai->driver->ops->hw_free)
604 codec_dai->driver->ops->hw_free(substream, codec_dai); 604 codec_dai->driver->ops->hw_free(substream, codec_dai);
605 605
606 if (cpu_dai->driver->ops->hw_free) 606 if (cpu_dai->driver->ops && cpu_dai->driver->ops->hw_free)
607 cpu_dai->driver->ops->hw_free(substream, cpu_dai); 607 cpu_dai->driver->ops->hw_free(substream, cpu_dai);
608 608
609 mutex_unlock(&rtd->pcm_mutex); 609 mutex_unlock(&rtd->pcm_mutex);
@@ -618,7 +618,7 @@ static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
618 struct snd_soc_dai *codec_dai = rtd->codec_dai; 618 struct snd_soc_dai *codec_dai = rtd->codec_dai;
619 int ret; 619 int ret;
620 620
621 if (codec_dai->driver->ops->trigger) { 621 if (codec_dai->driver->ops && codec_dai->driver->ops->trigger) {
622 ret = codec_dai->driver->ops->trigger(substream, cmd, codec_dai); 622 ret = codec_dai->driver->ops->trigger(substream, cmd, codec_dai);
623 if (ret < 0) 623 if (ret < 0)
624 return ret; 624 return ret;
@@ -630,7 +630,7 @@ static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
630 return ret; 630 return ret;
631 } 631 }
632 632
633 if (cpu_dai->driver->ops->trigger) { 633 if (cpu_dai->driver->ops && cpu_dai->driver->ops->trigger) {
634 ret = cpu_dai->driver->ops->trigger(substream, cmd, cpu_dai); 634 ret = cpu_dai->driver->ops->trigger(substream, cmd, cpu_dai);
635 if (ret < 0) 635 if (ret < 0)
636 return ret; 636 return ret;
@@ -647,19 +647,20 @@ static int soc_pcm_bespoke_trigger(struct snd_pcm_substream *substream,
647 struct snd_soc_dai *codec_dai = rtd->codec_dai; 647 struct snd_soc_dai *codec_dai = rtd->codec_dai;
648 int ret; 648 int ret;
649 649
650 if (codec_dai->driver->ops->bespoke_trigger) { 650 if (codec_dai->driver->ops &&
651 codec_dai->driver->ops->bespoke_trigger) {
651 ret = codec_dai->driver->ops->bespoke_trigger(substream, cmd, codec_dai); 652 ret = codec_dai->driver->ops->bespoke_trigger(substream, cmd, codec_dai);
652 if (ret < 0) 653 if (ret < 0)
653 return ret; 654 return ret;
654 } 655 }
655 656
656 if (platform->driver->bespoke_trigger) { 657 if (platform->driver->ops && platform->driver->bespoke_trigger) {
657 ret = platform->driver->bespoke_trigger(substream, cmd); 658 ret = platform->driver->bespoke_trigger(substream, cmd);
658 if (ret < 0) 659 if (ret < 0)
659 return ret; 660 return ret;
660 } 661 }
661 662
662 if (cpu_dai->driver->ops->bespoke_trigger) { 663 if (cpu_dai->driver->ops && cpu_dai->driver->ops->bespoke_trigger) {
663 ret = cpu_dai->driver->ops->bespoke_trigger(substream, cmd, cpu_dai); 664 ret = cpu_dai->driver->ops->bespoke_trigger(substream, cmd, cpu_dai);
664 if (ret < 0) 665 if (ret < 0)
665 return ret; 666 return ret;
@@ -684,10 +685,10 @@ static snd_pcm_uframes_t soc_pcm_pointer(struct snd_pcm_substream *substream)
684 if (platform->driver->ops && platform->driver->ops->pointer) 685 if (platform->driver->ops && platform->driver->ops->pointer)
685 offset = platform->driver->ops->pointer(substream); 686 offset = platform->driver->ops->pointer(substream);
686 687
687 if (cpu_dai->driver->ops->delay) 688 if (cpu_dai->driver->ops && cpu_dai->driver->ops->delay)
688 delay += cpu_dai->driver->ops->delay(substream, cpu_dai); 689 delay += cpu_dai->driver->ops->delay(substream, cpu_dai);
689 690
690 if (codec_dai->driver->ops->delay) 691 if (codec_dai->driver->ops && codec_dai->driver->ops->delay)
691 delay += codec_dai->driver->ops->delay(substream, codec_dai); 692 delay += codec_dai->driver->ops->delay(substream, codec_dai);
692 693
693 if (platform->driver->delay) 694 if (platform->driver->delay)
@@ -1037,6 +1038,12 @@ static int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream)
1037 struct snd_pcm_substream *be_substream = 1038 struct snd_pcm_substream *be_substream =
1038 snd_soc_dpcm_get_substream(be, stream); 1039 snd_soc_dpcm_get_substream(be, stream);
1039 1040
1041 if (!be_substream) {
1042 dev_err(be->dev, "ASoC: no backend %s stream\n",
1043 stream ? "capture" : "playback");
1044 continue;
1045 }
1046
1040 /* is this op for this BE ? */ 1047 /* is this op for this BE ? */
1041 if (!snd_soc_dpcm_be_can_update(fe, be, stream)) 1048 if (!snd_soc_dpcm_be_can_update(fe, be, stream))
1042 continue; 1049 continue;
@@ -1054,7 +1061,8 @@ static int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream)
1054 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_CLOSE)) 1061 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_CLOSE))
1055 continue; 1062 continue;
1056 1063
1057 dev_dbg(be->dev, "ASoC: open BE %s\n", be->dai_link->name); 1064 dev_dbg(be->dev, "ASoC: open %s BE %s\n",
1065 stream ? "capture" : "playback", be->dai_link->name);
1058 1066
1059 be_substream->runtime = be->dpcm[stream].runtime; 1067 be_substream->runtime = be->dpcm[stream].runtime;
1060 err = soc_pcm_open(be_substream); 1068 err = soc_pcm_open(be_substream);
@@ -1673,7 +1681,7 @@ static int soc_pcm_ioctl(struct snd_pcm_substream *substream,
1673 struct snd_soc_pcm_runtime *rtd = substream->private_data; 1681 struct snd_soc_pcm_runtime *rtd = substream->private_data;
1674 struct snd_soc_platform *platform = rtd->platform; 1682 struct snd_soc_platform *platform = rtd->platform;
1675 1683
1676 if (platform->driver->ops->ioctl) 1684 if (platform->driver->ops && platform->driver->ops->ioctl)
1677 return platform->driver->ops->ioctl(substream, cmd, arg); 1685 return platform->driver->ops->ioctl(substream, cmd, arg);
1678 return snd_pcm_lib_ioctl(substream, cmd, arg); 1686 return snd_pcm_lib_ioctl(substream, cmd, arg);
1679} 1687}
@@ -1934,8 +1942,8 @@ int soc_dpcm_be_digital_mute(struct snd_soc_pcm_runtime *fe, int mute)
1934 1942
1935 dev_dbg(be->dev, "ASoC: BE digital mute %s\n", be->dai_link->name); 1943 dev_dbg(be->dev, "ASoC: BE digital mute %s\n", be->dai_link->name);
1936 1944
1937 if (drv->ops->digital_mute && dai->playback_active) 1945 if (drv->ops && drv->ops->digital_mute && dai->playback_active)
1938 drv->ops->digital_mute(dai, mute); 1946 drv->ops->digital_mute(dai, mute);
1939 } 1947 }
1940 1948
1941 return 0; 1949 return 0;
@@ -2224,7 +2232,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dpcm_can_be_params);
2224int snd_soc_platform_trigger(struct snd_pcm_substream *substream, 2232int snd_soc_platform_trigger(struct snd_pcm_substream *substream,
2225 int cmd, struct snd_soc_platform *platform) 2233 int cmd, struct snd_soc_platform *platform)
2226{ 2234{
2227 if (platform->driver->ops->trigger) 2235 if (platform->driver->ops && platform->driver->ops->trigger)
2228 return platform->driver->ops->trigger(substream, cmd); 2236 return platform->driver->ops->trigger(substream, cmd);
2229 return 0; 2237 return 0;
2230} 2238}