aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm9713.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-12-25 05:40:25 -0500
committerTakashi Iwai <tiwai@suse.de>2008-12-25 05:40:25 -0500
commit5c8261e44eaebbc91f9fc1bbd3f3167e91a50a57 (patch)
tree6b932687edc73c07e544ccba3f0130fdb257d902 /sound/soc/codecs/wm9713.c
parentfacef8685b3ff95c01c33d9d836401d0dd26211d (diff)
parent472346da9cc4231bec03ff2032e0d5fd4037232c (diff)
Merge branch 'topic/asoc' into to-push
Diffstat (limited to 'sound/soc/codecs/wm9713.c')
-rw-r--r--sound/soc/codecs/wm9713.c46
1 files changed, 20 insertions, 26 deletions
diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c
index 945b32ed9884..f3ca8aaf0139 100644
--- a/sound/soc/codecs/wm9713.c
+++ b/sound/soc/codecs/wm9713.c
@@ -928,11 +928,10 @@ static int wm9713_set_dai_fmt(struct snd_soc_dai *codec_dai,
928} 928}
929 929
930static int wm9713_pcm_hw_params(struct snd_pcm_substream *substream, 930static int wm9713_pcm_hw_params(struct snd_pcm_substream *substream,
931 struct snd_pcm_hw_params *params) 931 struct snd_pcm_hw_params *params,
932 struct snd_soc_dai *dai)
932{ 933{
933 struct snd_soc_pcm_runtime *rtd = substream->private_data; 934 struct snd_soc_codec *codec = dai->codec;
934 struct snd_soc_device *socdev = rtd->socdev;
935 struct snd_soc_codec *codec = socdev->codec;
936 u16 reg = ac97_read(codec, AC97_CENTER_LFE_MASTER) & 0xfff3; 935 u16 reg = ac97_read(codec, AC97_CENTER_LFE_MASTER) & 0xfff3;
937 936
938 switch (params_format(params)) { 937 switch (params_format(params)) {
@@ -954,11 +953,10 @@ static int wm9713_pcm_hw_params(struct snd_pcm_substream *substream,
954 return 0; 953 return 0;
955} 954}
956 955
957static void wm9713_voiceshutdown(struct snd_pcm_substream *substream) 956static void wm9713_voiceshutdown(struct snd_pcm_substream *substream,
957 struct snd_soc_dai *dai)
958{ 958{
959 struct snd_soc_pcm_runtime *rtd = substream->private_data; 959 struct snd_soc_codec *codec = dai->codec;
960 struct snd_soc_device *socdev = rtd->socdev;
961 struct snd_soc_codec *codec = socdev->codec;
962 u16 status; 960 u16 status;
963 961
964 /* Gracefully shut down the voice interface. */ 962 /* Gracefully shut down the voice interface. */
@@ -969,12 +967,11 @@ static void wm9713_voiceshutdown(struct snd_pcm_substream *substream)
969 ac97_write(codec, AC97_EXTENDED_MID, status); 967 ac97_write(codec, AC97_EXTENDED_MID, status);
970} 968}
971 969
972static int ac97_hifi_prepare(struct snd_pcm_substream *substream) 970static int ac97_hifi_prepare(struct snd_pcm_substream *substream,
971 struct snd_soc_dai *dai)
973{ 972{
973 struct snd_soc_codec *codec = dai->codec;
974 struct snd_pcm_runtime *runtime = substream->runtime; 974 struct snd_pcm_runtime *runtime = substream->runtime;
975 struct snd_soc_pcm_runtime *rtd = substream->private_data;
976 struct snd_soc_device *socdev = rtd->socdev;
977 struct snd_soc_codec *codec = socdev->codec;
978 int reg; 975 int reg;
979 u16 vra; 976 u16 vra;
980 977
@@ -989,12 +986,11 @@ static int ac97_hifi_prepare(struct snd_pcm_substream *substream)
989 return ac97_write(codec, reg, runtime->rate); 986 return ac97_write(codec, reg, runtime->rate);
990} 987}
991 988
992static int ac97_aux_prepare(struct snd_pcm_substream *substream) 989static int ac97_aux_prepare(struct snd_pcm_substream *substream,
990 struct snd_soc_dai *dai)
993{ 991{
992 struct snd_soc_codec *codec = dai->codec;
994 struct snd_pcm_runtime *runtime = substream->runtime; 993 struct snd_pcm_runtime *runtime = substream->runtime;
995 struct snd_soc_pcm_runtime *rtd = substream->private_data;
996 struct snd_soc_device *socdev = rtd->socdev;
997 struct snd_soc_codec *codec = socdev->codec;
998 u16 vra, xsle; 994 u16 vra, xsle;
999 995
1000 vra = ac97_read(codec, AC97_EXTENDED_STATUS); 996 vra = ac97_read(codec, AC97_EXTENDED_STATUS);
@@ -1028,7 +1024,7 @@ static int ac97_aux_prepare(struct snd_pcm_substream *substream)
1028struct snd_soc_dai wm9713_dai[] = { 1024struct snd_soc_dai wm9713_dai[] = {
1029{ 1025{
1030 .name = "AC97 HiFi", 1026 .name = "AC97 HiFi",
1031 .type = SND_SOC_DAI_AC97_BUS, 1027 .ac97_control = 1,
1032 .playback = { 1028 .playback = {
1033 .stream_name = "HiFi Playback", 1029 .stream_name = "HiFi Playback",
1034 .channels_min = 1, 1030 .channels_min = 1,
@@ -1042,8 +1038,7 @@ struct snd_soc_dai wm9713_dai[] = {
1042 .rates = WM9713_RATES, 1038 .rates = WM9713_RATES,
1043 .formats = SNDRV_PCM_FMTBIT_S16_LE,}, 1039 .formats = SNDRV_PCM_FMTBIT_S16_LE,},
1044 .ops = { 1040 .ops = {
1045 .prepare = ac97_hifi_prepare,}, 1041 .prepare = ac97_hifi_prepare,
1046 .dai_ops = {
1047 .set_clkdiv = wm9713_set_dai_clkdiv, 1042 .set_clkdiv = wm9713_set_dai_clkdiv,
1048 .set_pll = wm9713_set_dai_pll,}, 1043 .set_pll = wm9713_set_dai_pll,},
1049 }, 1044 },
@@ -1056,8 +1051,7 @@ struct snd_soc_dai wm9713_dai[] = {
1056 .rates = WM9713_RATES, 1051 .rates = WM9713_RATES,
1057 .formats = SNDRV_PCM_FMTBIT_S16_LE,}, 1052 .formats = SNDRV_PCM_FMTBIT_S16_LE,},
1058 .ops = { 1053 .ops = {
1059 .prepare = ac97_aux_prepare,}, 1054 .prepare = ac97_aux_prepare,
1060 .dai_ops = {
1061 .set_clkdiv = wm9713_set_dai_clkdiv, 1055 .set_clkdiv = wm9713_set_dai_clkdiv,
1062 .set_pll = wm9713_set_dai_pll,}, 1056 .set_pll = wm9713_set_dai_pll,},
1063 }, 1057 },
@@ -1077,8 +1071,7 @@ struct snd_soc_dai wm9713_dai[] = {
1077 .formats = WM9713_PCM_FORMATS,}, 1071 .formats = WM9713_PCM_FORMATS,},
1078 .ops = { 1072 .ops = {
1079 .hw_params = wm9713_pcm_hw_params, 1073 .hw_params = wm9713_pcm_hw_params,
1080 .shutdown = wm9713_voiceshutdown,}, 1074 .shutdown = wm9713_voiceshutdown,
1081 .dai_ops = {
1082 .set_clkdiv = wm9713_set_dai_clkdiv, 1075 .set_clkdiv = wm9713_set_dai_clkdiv,
1083 .set_pll = wm9713_set_dai_pll, 1076 .set_pll = wm9713_set_dai_pll,
1084 .set_fmt = wm9713_set_dai_fmt, 1077 .set_fmt = wm9713_set_dai_fmt,
@@ -1097,6 +1090,8 @@ int wm9713_reset(struct snd_soc_codec *codec, int try_warm)
1097 } 1090 }
1098 1091
1099 soc_ac97_ops.reset(codec->ac97); 1092 soc_ac97_ops.reset(codec->ac97);
1093 if (soc_ac97_ops.warm_reset)
1094 soc_ac97_ops.warm_reset(codec->ac97);
1100 if (ac97_read(codec, 0) != wm9713_reg[0]) 1095 if (ac97_read(codec, 0) != wm9713_reg[0])
1101 return -EIO; 1096 return -EIO;
1102 return 0; 1097 return 0;
@@ -1240,7 +1235,7 @@ static int wm9713_soc_probe(struct platform_device *pdev)
1240 wm9713_reset(codec, 0); 1235 wm9713_reset(codec, 0);
1241 ret = wm9713_reset(codec, 1); 1236 ret = wm9713_reset(codec, 1);
1242 if (ret < 0) { 1237 if (ret < 0) {
1243 printk(KERN_ERR "AC97 link error\n"); 1238 printk(KERN_ERR "Failed to reset WM9713: AC97 link error\n");
1244 goto reset_err; 1239 goto reset_err;
1245 } 1240 }
1246 1241
@@ -1252,7 +1247,7 @@ static int wm9713_soc_probe(struct platform_device *pdev)
1252 1247
1253 wm9713_add_controls(codec); 1248 wm9713_add_controls(codec);
1254 wm9713_add_widgets(codec); 1249 wm9713_add_widgets(codec);
1255 ret = snd_soc_register_card(socdev); 1250 ret = snd_soc_init_card(socdev);
1256 if (ret < 0) 1251 if (ret < 0)
1257 goto reset_err; 1252 goto reset_err;
1258 return 0; 1253 return 0;
@@ -1288,7 +1283,6 @@ static int wm9713_soc_remove(struct platform_device *pdev)
1288 snd_soc_free_ac97_codec(codec); 1283 snd_soc_free_ac97_codec(codec);
1289 kfree(codec->private_data); 1284 kfree(codec->private_data);
1290 kfree(codec->reg_cache); 1285 kfree(codec->reg_cache);
1291 kfree(codec->dai);
1292 kfree(codec); 1286 kfree(codec);
1293 return 0; 1287 return 0;
1294} 1288}