.. | .. |
---|
60 | 60 | { .rate = 352800, .regvalue = 24 }, |
---|
61 | 61 | }; |
---|
62 | 62 | |
---|
| 63 | +static const unsigned int mt2701_afe_backup_list[] = { |
---|
| 64 | + AUDIO_TOP_CON0, |
---|
| 65 | + AUDIO_TOP_CON4, |
---|
| 66 | + AUDIO_TOP_CON5, |
---|
| 67 | + ASYS_TOP_CON, |
---|
| 68 | + AFE_CONN0, |
---|
| 69 | + AFE_CONN1, |
---|
| 70 | + AFE_CONN2, |
---|
| 71 | + AFE_CONN3, |
---|
| 72 | + AFE_CONN15, |
---|
| 73 | + AFE_CONN16, |
---|
| 74 | + AFE_CONN17, |
---|
| 75 | + AFE_CONN18, |
---|
| 76 | + AFE_CONN19, |
---|
| 77 | + AFE_CONN20, |
---|
| 78 | + AFE_CONN21, |
---|
| 79 | + AFE_CONN22, |
---|
| 80 | + AFE_DAC_CON0, |
---|
| 81 | + AFE_MEMIF_PBUF_SIZE, |
---|
| 82 | +}; |
---|
| 83 | + |
---|
63 | 84 | static int mt2701_dai_num_to_i2s(struct mtk_base_afe *afe, int num) |
---|
64 | 85 | { |
---|
65 | 86 | struct mt2701_afe_private *afe_priv = afe->platform_priv; |
---|
.. | .. |
---|
473 | 494 | static int mt2701_memif_fs(struct snd_pcm_substream *substream, |
---|
474 | 495 | unsigned int rate) |
---|
475 | 496 | { |
---|
476 | | - struct snd_soc_pcm_runtime *rtd = substream->private_data; |
---|
| 497 | + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); |
---|
477 | 498 | int fs; |
---|
478 | 499 | |
---|
479 | | - if (rtd->cpu_dai->id != MT2701_MEMIF_ULBT) |
---|
| 500 | + if (asoc_rtd_to_cpu(rtd, 0)->id != MT2701_MEMIF_ULBT) |
---|
480 | 501 | fs = mt2701_afe_i2s_fs(rate); |
---|
481 | 502 | else |
---|
482 | 503 | fs = (rate == 16000 ? 1 : 0); |
---|
.. | .. |
---|
528 | 549 | { |
---|
529 | 550 | .name = "PCMO0", |
---|
530 | 551 | .id = MT2701_MEMIF_DL1, |
---|
531 | | - .suspend = mtk_afe_dai_suspend, |
---|
532 | | - .resume = mtk_afe_dai_resume, |
---|
533 | 552 | .playback = { |
---|
534 | 553 | .stream_name = "DL1", |
---|
535 | 554 | .channels_min = 1, |
---|
.. | .. |
---|
544 | 563 | { |
---|
545 | 564 | .name = "PCM_multi", |
---|
546 | 565 | .id = MT2701_MEMIF_DLM, |
---|
547 | | - .suspend = mtk_afe_dai_suspend, |
---|
548 | | - .resume = mtk_afe_dai_resume, |
---|
549 | 566 | .playback = { |
---|
550 | 567 | .stream_name = "DLM", |
---|
551 | 568 | .channels_min = 1, |
---|
.. | .. |
---|
561 | 578 | { |
---|
562 | 579 | .name = "PCM0", |
---|
563 | 580 | .id = MT2701_MEMIF_UL1, |
---|
564 | | - .suspend = mtk_afe_dai_suspend, |
---|
565 | | - .resume = mtk_afe_dai_resume, |
---|
566 | 581 | .capture = { |
---|
567 | 582 | .stream_name = "UL1", |
---|
568 | 583 | .channels_min = 1, |
---|
.. | .. |
---|
577 | 592 | { |
---|
578 | 593 | .name = "PCM1", |
---|
579 | 594 | .id = MT2701_MEMIF_UL2, |
---|
580 | | - .suspend = mtk_afe_dai_suspend, |
---|
581 | | - .resume = mtk_afe_dai_resume, |
---|
582 | 595 | .capture = { |
---|
583 | 596 | .stream_name = "UL2", |
---|
584 | 597 | .channels_min = 1, |
---|
.. | .. |
---|
594 | 607 | { |
---|
595 | 608 | .name = "PCM_BT_DL", |
---|
596 | 609 | .id = MT2701_MEMIF_DLBT, |
---|
597 | | - .suspend = mtk_afe_dai_suspend, |
---|
598 | | - .resume = mtk_afe_dai_resume, |
---|
599 | 610 | .playback = { |
---|
600 | 611 | .stream_name = "DLBT", |
---|
601 | 612 | .channels_min = 1, |
---|
.. | .. |
---|
609 | 620 | { |
---|
610 | 621 | .name = "PCM_BT_UL", |
---|
611 | 622 | .id = MT2701_MEMIF_ULBT, |
---|
612 | | - .suspend = mtk_afe_dai_suspend, |
---|
613 | | - .resume = mtk_afe_dai_resume, |
---|
614 | 623 | .capture = { |
---|
615 | 624 | .stream_name = "ULBT", |
---|
616 | 625 | .channels_min = 1, |
---|
.. | .. |
---|
796 | 805 | SOC_DAPM_SINGLE_AUTODISABLE("I19 Switch", AFE_CONN22, 19, 1, 0), |
---|
797 | 806 | }; |
---|
798 | 807 | |
---|
799 | | -static const struct snd_kcontrol_new mt2701_afe_o23_mix[] = { |
---|
800 | | - SOC_DAPM_SINGLE_AUTODISABLE("I20 Switch", AFE_CONN23, 20, 1, 0), |
---|
801 | | -}; |
---|
802 | | - |
---|
803 | | -static const struct snd_kcontrol_new mt2701_afe_o24_mix[] = { |
---|
804 | | - SOC_DAPM_SINGLE_AUTODISABLE("I21 Switch", AFE_CONN24, 21, 1, 0), |
---|
805 | | -}; |
---|
806 | | - |
---|
807 | 808 | static const struct snd_kcontrol_new mt2701_afe_o31_mix[] = { |
---|
808 | 809 | SOC_DAPM_SINGLE_AUTODISABLE("I35 Switch", AFE_CONN41, 9, 1, 0), |
---|
809 | 810 | }; |
---|
.. | .. |
---|
830 | 831 | static const struct snd_kcontrol_new mt2701_afe_multi_ch_out_i2s3[] = { |
---|
831 | 832 | SOC_DAPM_SINGLE_AUTODISABLE("Multich I2S3 Out Switch", |
---|
832 | 833 | PWR2_TOP_CON, 18, 1, 0), |
---|
833 | | -}; |
---|
834 | | - |
---|
835 | | -static const struct snd_kcontrol_new mt2701_afe_multi_ch_out_i2s4[] = { |
---|
836 | | - SOC_DAPM_SINGLE_AUTODISABLE("Multich I2S4 Out Switch", |
---|
837 | | - PWR2_TOP_CON, 19, 1, 0), |
---|
838 | 834 | }; |
---|
839 | 835 | |
---|
840 | 836 | static const struct snd_soc_dapm_widget mt2701_afe_pcm_widgets[] = { |
---|
.. | .. |
---|
974 | 970 | .num_dapm_widgets = ARRAY_SIZE(mt2701_afe_pcm_widgets), |
---|
975 | 971 | .dapm_routes = mt2701_afe_pcm_routes, |
---|
976 | 972 | .num_dapm_routes = ARRAY_SIZE(mt2701_afe_pcm_routes), |
---|
| 973 | + .suspend = mtk_afe_suspend, |
---|
| 974 | + .resume = mtk_afe_resume, |
---|
977 | 975 | }; |
---|
978 | 976 | |
---|
979 | 977 | static const struct mtk_base_memif_data memif_data[MT2701_MEMIF_NUM] = { |
---|
.. | .. |
---|
994 | 992 | .agent_disable_reg = AUDIO_TOP_CON5, |
---|
995 | 993 | .agent_disable_shift = 6, |
---|
996 | 994 | .msb_reg = -1, |
---|
997 | | - .msb_shift = -1, |
---|
998 | 995 | }, |
---|
999 | 996 | { |
---|
1000 | 997 | .name = "DL2", |
---|
.. | .. |
---|
1013 | 1010 | .agent_disable_reg = AUDIO_TOP_CON5, |
---|
1014 | 1011 | .agent_disable_shift = 7, |
---|
1015 | 1012 | .msb_reg = -1, |
---|
1016 | | - .msb_shift = -1, |
---|
1017 | 1013 | }, |
---|
1018 | 1014 | { |
---|
1019 | 1015 | .name = "DL3", |
---|
.. | .. |
---|
1032 | 1028 | .agent_disable_reg = AUDIO_TOP_CON5, |
---|
1033 | 1029 | .agent_disable_shift = 8, |
---|
1034 | 1030 | .msb_reg = -1, |
---|
1035 | | - .msb_shift = -1, |
---|
1036 | 1031 | }, |
---|
1037 | 1032 | { |
---|
1038 | 1033 | .name = "DL4", |
---|
.. | .. |
---|
1051 | 1046 | .agent_disable_reg = AUDIO_TOP_CON5, |
---|
1052 | 1047 | .agent_disable_shift = 9, |
---|
1053 | 1048 | .msb_reg = -1, |
---|
1054 | | - .msb_shift = -1, |
---|
1055 | 1049 | }, |
---|
1056 | 1050 | { |
---|
1057 | 1051 | .name = "DL5", |
---|
.. | .. |
---|
1070 | 1064 | .agent_disable_reg = AUDIO_TOP_CON5, |
---|
1071 | 1065 | .agent_disable_shift = 10, |
---|
1072 | 1066 | .msb_reg = -1, |
---|
1073 | | - .msb_shift = -1, |
---|
1074 | 1067 | }, |
---|
1075 | 1068 | { |
---|
1076 | 1069 | .name = "DLM", |
---|
.. | .. |
---|
1089 | 1082 | .agent_disable_reg = AUDIO_TOP_CON5, |
---|
1090 | 1083 | .agent_disable_shift = 12, |
---|
1091 | 1084 | .msb_reg = -1, |
---|
1092 | | - .msb_shift = -1, |
---|
1093 | 1085 | }, |
---|
1094 | 1086 | { |
---|
1095 | 1087 | .name = "UL1", |
---|
.. | .. |
---|
1108 | 1100 | .agent_disable_reg = AUDIO_TOP_CON5, |
---|
1109 | 1101 | .agent_disable_shift = 0, |
---|
1110 | 1102 | .msb_reg = -1, |
---|
1111 | | - .msb_shift = -1, |
---|
1112 | 1103 | }, |
---|
1113 | 1104 | { |
---|
1114 | 1105 | .name = "UL2", |
---|
.. | .. |
---|
1127 | 1118 | .agent_disable_reg = AUDIO_TOP_CON5, |
---|
1128 | 1119 | .agent_disable_shift = 1, |
---|
1129 | 1120 | .msb_reg = -1, |
---|
1130 | | - .msb_shift = -1, |
---|
1131 | 1121 | }, |
---|
1132 | 1122 | { |
---|
1133 | 1123 | .name = "UL3", |
---|
.. | .. |
---|
1146 | 1136 | .agent_disable_reg = AUDIO_TOP_CON5, |
---|
1147 | 1137 | .agent_disable_shift = 2, |
---|
1148 | 1138 | .msb_reg = -1, |
---|
1149 | | - .msb_shift = -1, |
---|
1150 | 1139 | }, |
---|
1151 | 1140 | { |
---|
1152 | 1141 | .name = "UL4", |
---|
.. | .. |
---|
1165 | 1154 | .agent_disable_reg = AUDIO_TOP_CON5, |
---|
1166 | 1155 | .agent_disable_shift = 3, |
---|
1167 | 1156 | .msb_reg = -1, |
---|
1168 | | - .msb_shift = -1, |
---|
1169 | 1157 | }, |
---|
1170 | 1158 | { |
---|
1171 | 1159 | .name = "UL5", |
---|
.. | .. |
---|
1184 | 1172 | .agent_disable_reg = AUDIO_TOP_CON5, |
---|
1185 | 1173 | .agent_disable_shift = 4, |
---|
1186 | 1174 | .msb_reg = -1, |
---|
1187 | | - .msb_shift = -1, |
---|
1188 | 1175 | }, |
---|
1189 | 1176 | { |
---|
1190 | 1177 | .name = "DLBT", |
---|
.. | .. |
---|
1203 | 1190 | .agent_disable_reg = AUDIO_TOP_CON5, |
---|
1204 | 1191 | .agent_disable_shift = 13, |
---|
1205 | 1192 | .msb_reg = -1, |
---|
1206 | | - .msb_shift = -1, |
---|
1207 | 1193 | }, |
---|
1208 | 1194 | { |
---|
1209 | 1195 | .name = "ULBT", |
---|
.. | .. |
---|
1222 | 1208 | .agent_disable_reg = AUDIO_TOP_CON5, |
---|
1223 | 1209 | .agent_disable_shift = 16, |
---|
1224 | 1210 | .msb_reg = -1, |
---|
1225 | | - .msb_shift = -1, |
---|
1226 | 1211 | }, |
---|
1227 | 1212 | }; |
---|
1228 | 1213 | |
---|
.. | .. |
---|
1355 | 1340 | return -ENOMEM; |
---|
1356 | 1341 | |
---|
1357 | 1342 | irq_id = platform_get_irq_byname(pdev, "asys"); |
---|
1358 | | - if (irq_id < 0) { |
---|
1359 | | - dev_err(dev, "unable to get ASYS IRQ\n"); |
---|
| 1343 | + if (irq_id < 0) |
---|
1360 | 1344 | return irq_id; |
---|
1361 | | - } |
---|
1362 | 1345 | |
---|
1363 | 1346 | ret = devm_request_irq(dev, irq_id, mt2701_asys_isr, |
---|
1364 | 1347 | IRQF_TRIGGER_NONE, "asys-isr", (void *)afe); |
---|