diff options
Diffstat (limited to 'sound/soc/sh/fsi.c')
-rw-r--r-- | sound/soc/sh/fsi.c | 47 |
1 files changed, 18 insertions, 29 deletions
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c index 58c6bec642de..abc6d8309609 100644 --- a/sound/soc/sh/fsi.c +++ b/sound/soc/sh/fsi.c | |||
@@ -271,16 +271,19 @@ static int fsi_is_port_a(struct fsi_priv *fsi) | |||
271 | static struct snd_soc_dai *fsi_get_dai(struct snd_pcm_substream *substream) | 271 | static struct snd_soc_dai *fsi_get_dai(struct snd_pcm_substream *substream) |
272 | { | 272 | { |
273 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 273 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
274 | struct snd_soc_dai_link *machine = rtd->dai; | ||
275 | 274 | ||
276 | return machine->cpu_dai; | 275 | return rtd->cpu_dai; |
277 | } | 276 | } |
278 | 277 | ||
279 | static struct fsi_priv *fsi_get_priv(struct snd_pcm_substream *substream) | 278 | static struct fsi_priv *fsi_get_priv(struct snd_pcm_substream *substream) |
280 | { | 279 | { |
281 | struct snd_soc_dai *dai = fsi_get_dai(substream); | 280 | struct snd_soc_dai *dai = fsi_get_dai(substream); |
281 | struct fsi_master *master = snd_soc_dai_get_drvdata(dai); | ||
282 | 282 | ||
283 | return dai->private_data; | 283 | if (dai->id == 0) |
284 | return &master->fsia; | ||
285 | else | ||
286 | return &master->fsib; | ||
284 | } | 287 | } |
285 | 288 | ||
286 | static u32 fsi_get_info_flags(struct fsi_priv *fsi) | 289 | static u32 fsi_get_info_flags(struct fsi_priv *fsi) |
@@ -1025,10 +1028,9 @@ static int fsi_pcm_new(struct snd_card *card, | |||
1025 | 1028 | ||
1026 | 1029 | ||
1027 | ************************************************************************/ | 1030 | ************************************************************************/ |
1028 | struct snd_soc_dai fsi_soc_dai[] = { | 1031 | static struct snd_soc_dai_driver fsi_soc_dai[] = { |
1029 | { | 1032 | { |
1030 | .name = "FSIA", | 1033 | .name = "fsia-dai", |
1031 | .id = 0, | ||
1032 | .playback = { | 1034 | .playback = { |
1033 | .rates = FSI_RATES, | 1035 | .rates = FSI_RATES, |
1034 | .formats = FSI_FMTS, | 1036 | .formats = FSI_FMTS, |
@@ -1044,8 +1046,7 @@ struct snd_soc_dai fsi_soc_dai[] = { | |||
1044 | .ops = &fsi_dai_ops, | 1046 | .ops = &fsi_dai_ops, |
1045 | }, | 1047 | }, |
1046 | { | 1048 | { |
1047 | .name = "FSIB", | 1049 | .name = "fsib-dai", |
1048 | .id = 1, | ||
1049 | .playback = { | 1050 | .playback = { |
1050 | .rates = FSI_RATES, | 1051 | .rates = FSI_RATES, |
1051 | .formats = FSI_FMTS, | 1052 | .formats = FSI_FMTS, |
@@ -1061,15 +1062,12 @@ struct snd_soc_dai fsi_soc_dai[] = { | |||
1061 | .ops = &fsi_dai_ops, | 1062 | .ops = &fsi_dai_ops, |
1062 | }, | 1063 | }, |
1063 | }; | 1064 | }; |
1064 | EXPORT_SYMBOL_GPL(fsi_soc_dai); | ||
1065 | 1065 | ||
1066 | struct snd_soc_platform fsi_soc_platform = { | 1066 | static struct snd_soc_platform_driver fsi_soc_platform = { |
1067 | .name = "fsi-pcm", | 1067 | .ops = &fsi_pcm_ops, |
1068 | .pcm_ops = &fsi_pcm_ops, | ||
1069 | .pcm_new = fsi_pcm_new, | 1068 | .pcm_new = fsi_pcm_new, |
1070 | .pcm_free = fsi_pcm_free, | 1069 | .pcm_free = fsi_pcm_free, |
1071 | }; | 1070 | }; |
1072 | EXPORT_SYMBOL_GPL(fsi_soc_platform); | ||
1073 | 1071 | ||
1074 | /************************************************************************ | 1072 | /************************************************************************ |
1075 | 1073 | ||
@@ -1132,11 +1130,7 @@ static int fsi_probe(struct platform_device *pdev) | |||
1132 | 1130 | ||
1133 | pm_runtime_enable(&pdev->dev); | 1131 | pm_runtime_enable(&pdev->dev); |
1134 | pm_runtime_resume(&pdev->dev); | 1132 | pm_runtime_resume(&pdev->dev); |
1135 | 1133 | dev_set_drvdata(&pdev->dev, master); | |
1136 | fsi_soc_dai[0].dev = &pdev->dev; | ||
1137 | fsi_soc_dai[0].private_data = &master->fsia; | ||
1138 | fsi_soc_dai[1].dev = &pdev->dev; | ||
1139 | fsi_soc_dai[1].private_data = &master->fsib; | ||
1140 | 1134 | ||
1141 | fsi_soft_all_reset(master); | 1135 | fsi_soft_all_reset(master); |
1142 | 1136 | ||
@@ -1147,13 +1141,13 @@ static int fsi_probe(struct platform_device *pdev) | |||
1147 | goto exit_iounmap; | 1141 | goto exit_iounmap; |
1148 | } | 1142 | } |
1149 | 1143 | ||
1150 | ret = snd_soc_register_platform(&fsi_soc_platform); | 1144 | ret = snd_soc_register_platform(&pdev->dev, &fsi_soc_platform); |
1151 | if (ret < 0) { | 1145 | if (ret < 0) { |
1152 | dev_err(&pdev->dev, "cannot snd soc register\n"); | 1146 | dev_err(&pdev->dev, "cannot snd soc register\n"); |
1153 | goto exit_free_irq; | 1147 | goto exit_free_irq; |
1154 | } | 1148 | } |
1155 | 1149 | ||
1156 | return snd_soc_register_dais(fsi_soc_dai, ARRAY_SIZE(fsi_soc_dai)); | 1150 | return snd_soc_register_dais(&pdev->dev, fsi_soc_dai, ARRAY_SIZE(fsi_soc_dai)); |
1157 | 1151 | ||
1158 | exit_free_irq: | 1152 | exit_free_irq: |
1159 | free_irq(irq, master); | 1153 | free_irq(irq, master); |
@@ -1171,10 +1165,10 @@ static int fsi_remove(struct platform_device *pdev) | |||
1171 | { | 1165 | { |
1172 | struct fsi_master *master; | 1166 | struct fsi_master *master; |
1173 | 1167 | ||
1174 | master = fsi_get_master(fsi_soc_dai[0].private_data); | 1168 | master = dev_get_drvdata(&pdev->dev); |
1175 | 1169 | ||
1176 | snd_soc_unregister_dais(fsi_soc_dai, ARRAY_SIZE(fsi_soc_dai)); | 1170 | snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(fsi_soc_dai)); |
1177 | snd_soc_unregister_platform(&fsi_soc_platform); | 1171 | snd_soc_unregister_platform(&pdev->dev); |
1178 | 1172 | ||
1179 | pm_runtime_disable(&pdev->dev); | 1173 | pm_runtime_disable(&pdev->dev); |
1180 | 1174 | ||
@@ -1183,11 +1177,6 @@ static int fsi_remove(struct platform_device *pdev) | |||
1183 | iounmap(master->base); | 1177 | iounmap(master->base); |
1184 | kfree(master); | 1178 | kfree(master); |
1185 | 1179 | ||
1186 | fsi_soc_dai[0].dev = NULL; | ||
1187 | fsi_soc_dai[0].private_data = NULL; | ||
1188 | fsi_soc_dai[1].dev = NULL; | ||
1189 | fsi_soc_dai[1].private_data = NULL; | ||
1190 | |||
1191 | return 0; | 1180 | return 0; |
1192 | } | 1181 | } |
1193 | 1182 | ||
@@ -1233,7 +1222,7 @@ static struct platform_device_id fsi_id_table[] = { | |||
1233 | 1222 | ||
1234 | static struct platform_driver fsi_driver = { | 1223 | static struct platform_driver fsi_driver = { |
1235 | .driver = { | 1224 | .driver = { |
1236 | .name = "sh_fsi", | 1225 | .name = "fsi-pcm-audio", |
1237 | .pm = &fsi_pm_ops, | 1226 | .pm = &fsi_pm_ops, |
1238 | }, | 1227 | }, |
1239 | .probe = fsi_probe, | 1228 | .probe = fsi_probe, |