aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8900.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/wm8900.c')
-rw-r--r--sound/soc/codecs/wm8900.c51
1 files changed, 19 insertions, 32 deletions
diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c
index 6767de10ded0..46c5ea1ff921 100644
--- a/sound/soc/codecs/wm8900.c
+++ b/sound/soc/codecs/wm8900.c
@@ -517,22 +517,6 @@ SOC_SINGLE("LINEOUT2 LP -12dB", WM8900_REG_LOUTMIXCTL1,
517 517
518}; 518};
519 519
520/* add non dapm controls */
521static int wm8900_add_controls(struct snd_soc_codec *codec)
522{
523 int err, i;
524
525 for (i = 0; i < ARRAY_SIZE(wm8900_snd_controls); i++) {
526 err = snd_ctl_add(codec->card,
527 snd_soc_cnew(&wm8900_snd_controls[i],
528 codec, NULL));
529 if (err < 0)
530 return err;
531 }
532
533 return 0;
534}
535
536static const struct snd_kcontrol_new wm8900_dapm_loutput2_control = 520static const struct snd_kcontrol_new wm8900_dapm_loutput2_control =
537SOC_DAPM_SINGLE("LINEOUT2L Switch", WM8900_REG_POWER3, 6, 1, 0); 521SOC_DAPM_SINGLE("LINEOUT2L Switch", WM8900_REG_POWER3, 6, 1, 0);
538 522
@@ -736,7 +720,7 @@ static int wm8900_hw_params(struct snd_pcm_substream *substream,
736{ 720{
737 struct snd_soc_pcm_runtime *rtd = substream->private_data; 721 struct snd_soc_pcm_runtime *rtd = substream->private_data;
738 struct snd_soc_device *socdev = rtd->socdev; 722 struct snd_soc_device *socdev = rtd->socdev;
739 struct snd_soc_codec *codec = socdev->codec; 723 struct snd_soc_codec *codec = socdev->card->codec;
740 u16 reg; 724 u16 reg;
741 725
742 reg = wm8900_read(codec, WM8900_REG_AUDIO1) & ~0x60; 726 reg = wm8900_read(codec, WM8900_REG_AUDIO1) & ~0x60;
@@ -1104,6 +1088,14 @@ static int wm8900_digital_mute(struct snd_soc_dai *codec_dai, int mute)
1104 (SNDRV_PCM_FORMAT_S16_LE | SNDRV_PCM_FORMAT_S20_3LE | \ 1088 (SNDRV_PCM_FORMAT_S16_LE | SNDRV_PCM_FORMAT_S20_3LE | \
1105 SNDRV_PCM_FORMAT_S24_LE) 1089 SNDRV_PCM_FORMAT_S24_LE)
1106 1090
1091static struct snd_soc_dai_ops wm8900_dai_ops = {
1092 .hw_params = wm8900_hw_params,
1093 .set_clkdiv = wm8900_set_dai_clkdiv,
1094 .set_pll = wm8900_set_dai_pll,
1095 .set_fmt = wm8900_set_dai_fmt,
1096 .digital_mute = wm8900_digital_mute,
1097};
1098
1107struct snd_soc_dai wm8900_dai = { 1099struct snd_soc_dai wm8900_dai = {
1108 .name = "WM8900 HiFi", 1100 .name = "WM8900 HiFi",
1109 .playback = { 1101 .playback = {
@@ -1120,13 +1112,7 @@ struct snd_soc_dai wm8900_dai = {
1120 .rates = WM8900_RATES, 1112 .rates = WM8900_RATES,
1121 .formats = WM8900_PCM_FORMATS, 1113 .formats = WM8900_PCM_FORMATS,
1122 }, 1114 },
1123 .ops = { 1115 .ops = &wm8900_dai_ops,
1124 .hw_params = wm8900_hw_params,
1125 .set_clkdiv = wm8900_set_dai_clkdiv,
1126 .set_pll = wm8900_set_dai_pll,
1127 .set_fmt = wm8900_set_dai_fmt,
1128 .digital_mute = wm8900_digital_mute,
1129 },
1130}; 1116};
1131EXPORT_SYMBOL_GPL(wm8900_dai); 1117EXPORT_SYMBOL_GPL(wm8900_dai);
1132 1118
@@ -1226,7 +1212,7 @@ static int wm8900_set_bias_level(struct snd_soc_codec *codec,
1226static int wm8900_suspend(struct platform_device *pdev, pm_message_t state) 1212static int wm8900_suspend(struct platform_device *pdev, pm_message_t state)
1227{ 1213{
1228 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1214 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1229 struct snd_soc_codec *codec = socdev->codec; 1215 struct snd_soc_codec *codec = socdev->card->codec;
1230 struct wm8900_priv *wm8900 = codec->private_data; 1216 struct wm8900_priv *wm8900 = codec->private_data;
1231 int fll_out = wm8900->fll_out; 1217 int fll_out = wm8900->fll_out;
1232 int fll_in = wm8900->fll_in; 1218 int fll_in = wm8900->fll_in;
@@ -1250,7 +1236,7 @@ static int wm8900_suspend(struct platform_device *pdev, pm_message_t state)
1250static int wm8900_resume(struct platform_device *pdev) 1236static int wm8900_resume(struct platform_device *pdev)
1251{ 1237{
1252 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 1238 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
1253 struct snd_soc_codec *codec = socdev->codec; 1239 struct snd_soc_codec *codec = socdev->card->codec;
1254 struct wm8900_priv *wm8900 = codec->private_data; 1240 struct wm8900_priv *wm8900 = codec->private_data;
1255 u16 *cache; 1241 u16 *cache;
1256 int i, ret; 1242 int i, ret;
@@ -1288,8 +1274,8 @@ static int wm8900_resume(struct platform_device *pdev)
1288 1274
1289static struct snd_soc_codec *wm8900_codec; 1275static struct snd_soc_codec *wm8900_codec;
1290 1276
1291static int wm8900_i2c_probe(struct i2c_client *i2c, 1277static __devinit int wm8900_i2c_probe(struct i2c_client *i2c,
1292 const struct i2c_device_id *id) 1278 const struct i2c_device_id *id)
1293{ 1279{
1294 struct wm8900_priv *wm8900; 1280 struct wm8900_priv *wm8900;
1295 struct snd_soc_codec *codec; 1281 struct snd_soc_codec *codec;
@@ -1388,7 +1374,7 @@ err:
1388 return ret; 1374 return ret;
1389} 1375}
1390 1376
1391static int wm8900_i2c_remove(struct i2c_client *client) 1377static __devexit int wm8900_i2c_remove(struct i2c_client *client)
1392{ 1378{
1393 snd_soc_unregister_dai(&wm8900_dai); 1379 snd_soc_unregister_dai(&wm8900_dai);
1394 snd_soc_unregister_codec(wm8900_codec); 1380 snd_soc_unregister_codec(wm8900_codec);
@@ -1414,7 +1400,7 @@ static struct i2c_driver wm8900_i2c_driver = {
1414 .owner = THIS_MODULE, 1400 .owner = THIS_MODULE,
1415 }, 1401 },
1416 .probe = wm8900_i2c_probe, 1402 .probe = wm8900_i2c_probe,
1417 .remove = wm8900_i2c_remove, 1403 .remove = __devexit_p(wm8900_i2c_remove),
1418 .id_table = wm8900_i2c_id, 1404 .id_table = wm8900_i2c_id,
1419}; 1405};
1420 1406
@@ -1430,7 +1416,7 @@ static int wm8900_probe(struct platform_device *pdev)
1430 } 1416 }
1431 1417
1432 codec = wm8900_codec; 1418 codec = wm8900_codec;
1433 socdev->codec = codec; 1419 socdev->card->codec = codec;
1434 1420
1435 /* Register pcms */ 1421 /* Register pcms */
1436 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1); 1422 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
@@ -1439,7 +1425,8 @@ static int wm8900_probe(struct platform_device *pdev)
1439 goto pcm_err; 1425 goto pcm_err;
1440 } 1426 }
1441 1427
1442 wm8900_add_controls(codec); 1428 snd_soc_add_controls(codec, wm8900_snd_controls,
1429 ARRAY_SIZE(wm8900_snd_controls));
1443 wm8900_add_widgets(codec); 1430 wm8900_add_widgets(codec);
1444 1431
1445 ret = snd_soc_init_card(socdev); 1432 ret = snd_soc_init_card(socdev);