@@ -26,6 +26,7 @@ enum codec_type {
26
26
CODEC_AK4497 ,
27
27
CODEC_AK5552 ,
28
28
CODEC_CS42888 ,
29
+ CODEC_WM8524 ,
29
30
};
30
31
31
32
/*
@@ -196,6 +197,13 @@ static struct imx_akcodec_tdm_fs_mul cs42888_tdm_fs_mul[] = {
196
197
{ .min = 256 , .max = 256 , .mul = 256 },
197
198
};
198
199
200
+ static struct imx_akcodec_fs_mul wm8524_fs_mul [] = {
201
+ { .rmin = 8000 , .rmax = 32000 , .wmin = 256 , .wmax = 1152 , },
202
+ { .rmin = 44100 , .rmax = 48000 , .wmin = 256 , .wmax = 768 , },
203
+ { .rmin = 88200 , .rmax = 96000 , .wmin = 128 , .wmax = 384 , },
204
+ { .rmin = 176400 , .rmax = 192000 , .wmin = 128 , .wmax = 192 , },
205
+ };
206
+
199
207
static const u32 akcodec_rates [] = {
200
208
8000 , 11025 , 16000 , 22050 , 32000 , 44100 , 48000 , 88200 ,
201
209
96000 , 176400 , 192000 , 352800 , 384000 , 705600 , 768000 ,
@@ -229,6 +237,10 @@ static const u32 cs42888_tdm_channels[] = {
229
237
1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ,
230
238
};
231
239
240
+ static const u32 wm8524_channels [] = {
241
+ 2 ,
242
+ };
243
+
232
244
static bool format_is_dsd (struct snd_pcm_hw_params * params )
233
245
{
234
246
snd_pcm_format_t format = params_format (params );
@@ -261,6 +273,7 @@ static bool codec_is_akcodec(unsigned int type)
261
273
case CODEC_AK5558 :
262
274
case CODEC_AK5552 :
263
275
case CODEC_CS42888 :
276
+ case CODEC_WM8524 :
264
277
return true;
265
278
default :
266
279
break ;
@@ -477,9 +490,24 @@ static int imx_aif_startup(struct snd_pcm_substream *substream)
477
490
return ret ;
478
491
}
479
492
493
+ static void imx_aif_shutdown (struct snd_pcm_substream * substream )
494
+ {
495
+ struct snd_soc_pcm_runtime * rtd = snd_soc_substream_to_rtd (substream );
496
+ struct snd_soc_dai * cpu_dai ;
497
+ struct snd_soc_dai * codec_dai ;
498
+ int i ;
499
+
500
+ for_each_rtd_cpu_dais (rtd , i , cpu_dai )
501
+ snd_soc_dai_set_sysclk (cpu_dai , 0 , 0 , SND_SOC_CLOCK_OUT );
502
+
503
+ for_each_rtd_codec_dais (rtd , i , codec_dai )
504
+ snd_soc_dai_set_sysclk (codec_dai , 0 , 0 , SND_SOC_CLOCK_IN );
505
+ }
506
+
480
507
static const struct snd_soc_ops imx_aif_ops = {
481
508
.hw_params = imx_aif_hw_params ,
482
509
.startup = imx_aif_startup ,
510
+ .shutdown = imx_aif_shutdown ,
483
511
};
484
512
485
513
static const struct snd_soc_ops imx_aif_ops_be = {
@@ -632,6 +660,8 @@ static int imx_card_parse_of(struct imx_card_data *data)
632
660
plat_data -> type = CODEC_AK5552 ;
633
661
else if (!strcmp (link -> codecs -> dai_name , "cs42888" ))
634
662
plat_data -> type = CODEC_CS42888 ;
663
+ else if (!strcmp (link -> codecs -> dai_name , "wm8524-hifi" ))
664
+ plat_data -> type = CODEC_WM8524 ;
635
665
636
666
} else {
637
667
link -> codecs = & snd_soc_dummy_dlc ;
@@ -805,6 +835,10 @@ static int imx_card_probe(struct platform_device *pdev)
805
835
data -> dapm_routes [1 ].sink = "CPU-Capture" ;
806
836
data -> dapm_routes [1 ].source = "Capture" ;
807
837
break ;
838
+ case CODEC_WM8524 :
839
+ data -> dapm_routes [0 ].sink = "Playback" ;
840
+ data -> dapm_routes [0 ].source = "CPU-Playback" ;
841
+ break ;
808
842
default :
809
843
break ;
810
844
}
@@ -854,6 +888,12 @@ static int imx_card_probe(struct platform_device *pdev)
854
888
plat_data -> support_tdm_channels = cs42888_tdm_channels ;
855
889
plat_data -> num_tdm_channels = ARRAY_SIZE (cs42888_tdm_channels );
856
890
break ;
891
+ case CODEC_WM8524 :
892
+ plat_data -> fs_mul = wm8524_fs_mul ;
893
+ plat_data -> num_fs_mul = ARRAY_SIZE (wm8524_fs_mul );
894
+ plat_data -> support_channels = wm8524_channels ;
895
+ plat_data -> num_channels = ARRAY_SIZE (wm8524_channels );
896
+ break ;
857
897
default :
858
898
break ;
859
899
}
0 commit comments