aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2014-11-23 07:37:18 -0500
committerMark Brown <broonie@kernel.org>2014-11-24 13:17:33 -0500
commit098f6f17c3f1beeccdce78f9722ccaa7925b8041 (patch)
tree5df9d17cfba888acc254eae7c72c18cef300fc21
parentf114040e3ea6e07372334ade75d1ee0775c355e1 (diff)
ASoC: wm8400: Cleanup manual bias level transitions
Set the CODEC driver's suspend_bias_off flag rather than manually going to SND_SOC_BIAS_OFF in suspend and SND_SOC_BIAS_STANDBY in resume. This makes the code a bit shorter and cleaner. Since the ASoC core now takes care of setting the bias level to SND_SOC_BIAS_OFF when removing the CODEC there is no need to do it manually anymore either. The manual asynchronous transition to SND_SOC_BIAS_STANDBY at the end of CODEC probe() can also be removed as the core will automatically do this after the CODEC has been probed. Also running this asynchronously has the problem of potential race conditions with the core. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/codecs/wm8400.c34
1 files changed, 1 insertions, 33 deletions
diff --git a/sound/soc/codecs/wm8400.c b/sound/soc/codecs/wm8400.c
index 72471bef2e9a..385894f6e264 100644
--- a/sound/soc/codecs/wm8400.c
+++ b/sound/soc/codecs/wm8400.c
@@ -58,12 +58,10 @@ static struct regulator_bulk_data power[] = {
58 58
59/* codec private data */ 59/* codec private data */
60struct wm8400_priv { 60struct wm8400_priv {
61 struct snd_soc_codec *codec;
62 struct wm8400 *wm8400; 61 struct wm8400 *wm8400;
63 u16 fake_register; 62 u16 fake_register;
64 unsigned int sysclk; 63 unsigned int sysclk;
65 unsigned int pcmclk; 64 unsigned int pcmclk;
66 struct work_struct work;
67 int fll_in, fll_out; 65 int fll_in, fll_out;
68}; 66};
69 67
@@ -1278,30 +1276,6 @@ static struct snd_soc_dai_driver wm8400_dai = {
1278 .ops = &wm8400_dai_ops, 1276 .ops = &wm8400_dai_ops,
1279}; 1277};
1280 1278
1281static int wm8400_suspend(struct snd_soc_codec *codec)
1282{
1283 wm8400_set_bias_level(codec, SND_SOC_BIAS_OFF);
1284
1285 return 0;
1286}
1287
1288static int wm8400_resume(struct snd_soc_codec *codec)
1289{
1290 wm8400_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
1291
1292 return 0;
1293}
1294
1295static void wm8400_probe_deferred(struct work_struct *work)
1296{
1297 struct wm8400_priv *priv = container_of(work, struct wm8400_priv,
1298 work);
1299 struct snd_soc_codec *codec = priv->codec;
1300
1301 /* charge output caps */
1302 wm8400_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
1303}
1304
1305static int wm8400_codec_probe(struct snd_soc_codec *codec) 1279static int wm8400_codec_probe(struct snd_soc_codec *codec)
1306{ 1280{
1307 struct wm8400 *wm8400 = dev_get_platdata(codec->dev); 1281 struct wm8400 *wm8400 = dev_get_platdata(codec->dev);
@@ -1316,7 +1290,6 @@ static int wm8400_codec_probe(struct snd_soc_codec *codec)
1316 1290
1317 snd_soc_codec_set_drvdata(codec, priv); 1291 snd_soc_codec_set_drvdata(codec, priv);
1318 priv->wm8400 = wm8400; 1292 priv->wm8400 = wm8400;
1319 priv->codec = codec;
1320 1293
1321 ret = devm_regulator_bulk_get(wm8400->dev, 1294 ret = devm_regulator_bulk_get(wm8400->dev,
1322 ARRAY_SIZE(power), &power[0]); 1295 ARRAY_SIZE(power), &power[0]);
@@ -1325,8 +1298,6 @@ static int wm8400_codec_probe(struct snd_soc_codec *codec)
1325 return ret; 1298 return ret;
1326 } 1299 }
1327 1300
1328 INIT_WORK(&priv->work, wm8400_probe_deferred);
1329
1330 wm8400_codec_reset(codec); 1301 wm8400_codec_reset(codec);
1331 1302
1332 reg = snd_soc_read(codec, WM8400_POWER_MANAGEMENT_1); 1303 reg = snd_soc_read(codec, WM8400_POWER_MANAGEMENT_1);
@@ -1343,8 +1314,6 @@ static int wm8400_codec_probe(struct snd_soc_codec *codec)
1343 snd_soc_write(codec, WM8400_LEFT_OUTPUT_VOLUME, 0x50 | (1<<8)); 1314 snd_soc_write(codec, WM8400_LEFT_OUTPUT_VOLUME, 0x50 | (1<<8));
1344 snd_soc_write(codec, WM8400_RIGHT_OUTPUT_VOLUME, 0x50 | (1<<8)); 1315 snd_soc_write(codec, WM8400_RIGHT_OUTPUT_VOLUME, 0x50 | (1<<8));
1345 1316
1346 if (!schedule_work(&priv->work))
1347 return -EINVAL;
1348 return 0; 1317 return 0;
1349} 1318}
1350 1319
@@ -1369,10 +1338,9 @@ static struct regmap *wm8400_get_regmap(struct device *dev)
1369static struct snd_soc_codec_driver soc_codec_dev_wm8400 = { 1338static struct snd_soc_codec_driver soc_codec_dev_wm8400 = {
1370 .probe = wm8400_codec_probe, 1339 .probe = wm8400_codec_probe,
1371 .remove = wm8400_codec_remove, 1340 .remove = wm8400_codec_remove,
1372 .suspend = wm8400_suspend,
1373 .resume = wm8400_resume,
1374 .get_regmap = wm8400_get_regmap, 1341 .get_regmap = wm8400_get_regmap,
1375 .set_bias_level = wm8400_set_bias_level, 1342 .set_bias_level = wm8400_set_bias_level,
1343 .suspend_bias_off = true,
1376 1344
1377 .controls = wm8400_snd_controls, 1345 .controls = wm8400_snd_controls,
1378 .num_controls = ARRAY_SIZE(wm8400_snd_controls), 1346 .num_controls = ARRAY_SIZE(wm8400_snd_controls),