@@ -120,7 +120,7 @@ struct imx_card_data {
120
120
121
121
static struct imx_akcodec_fs_mul ak4458_fs_mul [] = {
122
122
/* Normal, < 32kHz */
123
- { .rmin = 8000 , .rmax = 24000 , .wmin = 1024 , .wmax = 1024 , },
123
+ { .rmin = 8000 , .rmax = 24000 , .wmin = 256 , .wmax = 1024 , },
124
124
/* Normal, 32kHz */
125
125
{ .rmin = 32000 , .rmax = 32000 , .wmin = 256 , .wmax = 1024 , },
126
126
/* Normal */
@@ -151,8 +151,8 @@ static struct imx_akcodec_fs_mul ak4497_fs_mul[] = {
151
151
* Table 7 - mapping multiplier and speed mode
152
152
* Tables 8 & 9 - mapping speed mode and LRCK fs
153
153
*/
154
- { .rmin = 8000 , .rmax = 32000 , .wmin = 1024 , .wmax = 1024 , }, /* Normal, <= 32kHz */
155
- { .rmin = 44100 , .rmax = 48000 , .wmin = 512 , .wmax = 512 , }, /* Normal */
154
+ { .rmin = 8000 , .rmax = 32000 , .wmin = 256 , .wmax = 1024 , }, /* Normal, <= 32kHz */
155
+ { .rmin = 44100 , .rmax = 48000 , .wmin = 256 , .wmax = 512 , }, /* Normal */
156
156
{ .rmin = 88200 , .rmax = 96000 , .wmin = 256 , .wmax = 256 , }, /* Double */
157
157
{ .rmin = 176400 , .rmax = 192000 , .wmin = 128 , .wmax = 128 , }, /* Quad */
158
158
{ .rmin = 352800 , .rmax = 384000 , .wmin = 128 , .wmax = 128 , }, /* Oct */
@@ -164,7 +164,7 @@ static struct imx_akcodec_fs_mul ak4497_fs_mul[] = {
164
164
* (Table 4 from datasheet)
165
165
*/
166
166
static struct imx_akcodec_fs_mul ak5558_fs_mul [] = {
167
- { .rmin = 8000 , .rmax = 32000 , .wmin = 1024 , .wmax = 1024 , },
167
+ { .rmin = 8000 , .rmax = 32000 , .wmin = 512 , .wmax = 1024 , },
168
168
{ .rmin = 44100 , .rmax = 48000 , .wmin = 512 , .wmax = 512 , },
169
169
{ .rmin = 88200 , .rmax = 96000 , .wmin = 256 , .wmax = 256 , },
170
170
{ .rmin = 176400 , .rmax = 192000 , .wmin = 128 , .wmax = 128 , },
@@ -247,13 +247,14 @@ static bool codec_is_akcodec(unsigned int type)
247
247
}
248
248
249
249
static unsigned long akcodec_get_mclk_rate (struct snd_pcm_substream * substream ,
250
- struct snd_pcm_hw_params * params )
250
+ struct snd_pcm_hw_params * params ,
251
+ int slots , int slot_width )
251
252
{
252
253
struct snd_soc_pcm_runtime * rtd = substream -> private_data ;
253
254
struct imx_card_data * data = snd_soc_card_get_drvdata (rtd -> card );
254
255
const struct imx_card_plat_data * plat_data = data -> plat_data ;
255
256
struct dai_link_data * link_data = & data -> link_data [rtd -> num ];
256
- unsigned int width = link_data -> slots * link_data -> slot_width ;
257
+ unsigned int width = slots * slot_width ;
257
258
unsigned int rate = params_rate (params );
258
259
int i ;
259
260
@@ -349,7 +350,7 @@ static int imx_aif_hw_params(struct snd_pcm_substream *substream,
349
350
350
351
/* Set MCLK freq */
351
352
if (codec_is_akcodec (plat_data -> type ))
352
- mclk_freq = akcodec_get_mclk_rate (substream , params );
353
+ mclk_freq = akcodec_get_mclk_rate (substream , params , slots , slot_width );
353
354
else
354
355
mclk_freq = params_rate (params ) * slots * slot_width ;
355
356
/* Use the maximum freq from DSD512 (512*44100 = 22579200) */
@@ -553,8 +554,23 @@ static int imx_card_parse_of(struct imx_card_data *data)
553
554
link_data -> cpu_sysclk_id = FSL_SAI_CLK_MAST1 ;
554
555
555
556
/* sai may support mclk/bclk = 1 */
556
- if (of_find_property (np , "fsl,mclk-equal-bclk" , NULL ))
557
+ if (of_find_property (np , "fsl,mclk-equal-bclk" , NULL )) {
557
558
link_data -> one2one_ratio = true;
559
+ } else {
560
+ int i ;
561
+
562
+ /*
563
+ * i.MX8MQ don't support one2one ratio, then
564
+ * with ak4497 only 16bit case is supported.
565
+ */
566
+ for (i = 0 ; i < ARRAY_SIZE (ak4497_fs_mul ); i ++ ) {
567
+ if (ak4497_fs_mul [i ].rmin == 705600 &&
568
+ ak4497_fs_mul [i ].rmax == 768000 ) {
569
+ ak4497_fs_mul [i ].wmin = 32 ;
570
+ ak4497_fs_mul [i ].wmax = 32 ;
571
+ }
572
+ }
573
+ }
558
574
}
559
575
560
576
link -> cpus -> of_node = args .np ;
0 commit comments