Lines Matching full:rtd
331 struct audio_substream_data *rtd, in config_acp_dma() argument
336 acp_pte_config(acp_mmio, rtd->dma_addr, rtd->num_of_pages, in config_acp_dma()
337 rtd->pte_offset); in config_acp_dma()
339 if (rtd->direction == SNDRV_PCM_STREAM_PLAYBACK) { in config_acp_dma()
340 ch_acp_sysmem = rtd->ch1; in config_acp_dma()
341 ch_acp_i2s = rtd->ch2; in config_acp_dma()
343 ch_acp_i2s = rtd->ch1; in config_acp_dma()
344 ch_acp_sysmem = rtd->ch2; in config_acp_dma()
347 set_acp_sysmem_dma_descriptors(acp_mmio, rtd->size, in config_acp_dma()
348 rtd->direction, rtd->pte_offset, in config_acp_dma()
349 ch_acp_sysmem, rtd->sram_bank, in config_acp_dma()
350 rtd->dma_dscr_idx_1, asic_type); in config_acp_dma()
352 set_acp_to_i2s_dma_descriptors(acp_mmio, rtd->size, in config_acp_dma()
353 rtd->direction, rtd->sram_bank, in config_acp_dma()
354 rtd->destination, ch_acp_i2s, in config_acp_dma()
355 rtd->dma_dscr_idx_2, asic_type); in config_acp_dma()
851 struct audio_substream_data *rtd; in acp_dma_hw_params() local
858 rtd = runtime->private_data; in acp_dma_hw_params()
860 if (WARN_ON(!rtd)) in acp_dma_hw_params()
865 rtd->i2s_instance = pinfo->play_i2s_instance; in acp_dma_hw_params()
867 rtd->i2s_instance = pinfo->cap_i2s_instance; in acp_dma_hw_params()
868 rtd->capture_channel = pinfo->capture_channel; in acp_dma_hw_params()
875 switch (rtd->i2s_instance) { in acp_dma_hw_params()
887 switch (rtd->i2s_instance) { in acp_dma_hw_params()
902 switch (rtd->i2s_instance) { in acp_dma_hw_params()
904 rtd->pte_offset = ACP_ST_BT_PLAYBACK_PTE_OFFSET; in acp_dma_hw_params()
905 rtd->ch1 = SYSRAM_TO_ACP_BT_INSTANCE_CH_NUM; in acp_dma_hw_params()
906 rtd->ch2 = ACP_TO_I2S_DMA_BT_INSTANCE_CH_NUM; in acp_dma_hw_params()
907 rtd->sram_bank = ACP_SRAM_BANK_3_ADDRESS; in acp_dma_hw_params()
908 rtd->destination = TO_BLUETOOTH; in acp_dma_hw_params()
909 rtd->dma_dscr_idx_1 = PLAYBACK_START_DMA_DESCR_CH8; in acp_dma_hw_params()
910 rtd->dma_dscr_idx_2 = PLAYBACK_START_DMA_DESCR_CH9; in acp_dma_hw_params()
911 rtd->byte_cnt_high_reg_offset = in acp_dma_hw_params()
913 rtd->byte_cnt_low_reg_offset = in acp_dma_hw_params()
920 rtd->pte_offset = ACP_ST_PLAYBACK_PTE_OFFSET; in acp_dma_hw_params()
923 rtd->pte_offset = ACP_PLAYBACK_PTE_OFFSET; in acp_dma_hw_params()
925 rtd->ch1 = SYSRAM_TO_ACP_MICSP_INSTANCE_CH_NUM; in acp_dma_hw_params()
926 rtd->ch2 = ACP_TO_I2S_DMA_MICSP_INSTANCE_CH_NUM; in acp_dma_hw_params()
927 rtd->sram_bank = ACP_SRAM_BANK_1_ADDRESS; in acp_dma_hw_params()
928 rtd->destination = TO_ACP_I2S_2; in acp_dma_hw_params()
929 rtd->dma_dscr_idx_1 = PLAYBACK_START_DMA_DESCR_CH4; in acp_dma_hw_params()
930 rtd->dma_dscr_idx_2 = PLAYBACK_START_DMA_DESCR_CH5; in acp_dma_hw_params()
931 rtd->byte_cnt_high_reg_offset = in acp_dma_hw_params()
933 rtd->byte_cnt_low_reg_offset = in acp_dma_hw_params()
942 rtd->pte_offset = ACP_ST_PLAYBACK_PTE_OFFSET; in acp_dma_hw_params()
945 rtd->pte_offset = ACP_PLAYBACK_PTE_OFFSET; in acp_dma_hw_params()
947 rtd->ch1 = SYSRAM_TO_ACP_CH_NUM; in acp_dma_hw_params()
948 rtd->ch2 = ACP_TO_I2S_DMA_CH_NUM; in acp_dma_hw_params()
949 rtd->sram_bank = ACP_SRAM_BANK_1_ADDRESS; in acp_dma_hw_params()
950 rtd->destination = TO_ACP_I2S_1; in acp_dma_hw_params()
951 rtd->dma_dscr_idx_1 = PLAYBACK_START_DMA_DESCR_CH12; in acp_dma_hw_params()
952 rtd->dma_dscr_idx_2 = PLAYBACK_START_DMA_DESCR_CH13; in acp_dma_hw_params()
953 rtd->byte_cnt_high_reg_offset = in acp_dma_hw_params()
955 rtd->byte_cnt_low_reg_offset = in acp_dma_hw_params()
960 switch (rtd->i2s_instance) { in acp_dma_hw_params()
962 rtd->pte_offset = ACP_ST_BT_CAPTURE_PTE_OFFSET; in acp_dma_hw_params()
963 rtd->ch1 = I2S_TO_ACP_DMA_BT_INSTANCE_CH_NUM; in acp_dma_hw_params()
964 rtd->ch2 = ACP_TO_SYSRAM_BT_INSTANCE_CH_NUM; in acp_dma_hw_params()
965 rtd->sram_bank = ACP_SRAM_BANK_4_ADDRESS; in acp_dma_hw_params()
966 rtd->destination = FROM_BLUETOOTH; in acp_dma_hw_params()
967 rtd->dma_dscr_idx_1 = CAPTURE_START_DMA_DESCR_CH10; in acp_dma_hw_params()
968 rtd->dma_dscr_idx_2 = CAPTURE_START_DMA_DESCR_CH11; in acp_dma_hw_params()
969 rtd->byte_cnt_high_reg_offset = in acp_dma_hw_params()
971 rtd->byte_cnt_low_reg_offset = in acp_dma_hw_params()
973 rtd->dma_curr_dscr = mmACP_DMA_CUR_DSCR_11; in acp_dma_hw_params()
979 rtd->pte_offset = ACP_CAPTURE_PTE_OFFSET; in acp_dma_hw_params()
980 rtd->ch1 = I2S_TO_ACP_DMA_CH_NUM; in acp_dma_hw_params()
981 rtd->ch2 = ACP_TO_SYSRAM_CH_NUM; in acp_dma_hw_params()
984 rtd->pte_offset = ACP_ST_CAPTURE_PTE_OFFSET; in acp_dma_hw_params()
985 rtd->sram_bank = ACP_SRAM_BANK_2_ADDRESS; in acp_dma_hw_params()
988 rtd->pte_offset = ACP_CAPTURE_PTE_OFFSET; in acp_dma_hw_params()
989 rtd->sram_bank = ACP_SRAM_BANK_5_ADDRESS; in acp_dma_hw_params()
991 rtd->destination = FROM_ACP_I2S_1; in acp_dma_hw_params()
992 rtd->dma_dscr_idx_1 = CAPTURE_START_DMA_DESCR_CH14; in acp_dma_hw_params()
993 rtd->dma_dscr_idx_2 = CAPTURE_START_DMA_DESCR_CH15; in acp_dma_hw_params()
994 rtd->byte_cnt_high_reg_offset = in acp_dma_hw_params()
996 rtd->byte_cnt_low_reg_offset = in acp_dma_hw_params()
998 rtd->dma_curr_dscr = mmACP_DMA_CUR_DSCR_15; in acp_dma_hw_params()
1005 acp_set_sram_bank_state(rtd->acp_mmio, 0, true); in acp_dma_hw_params()
1007 rtd->dma_addr = runtime->dma_addr; in acp_dma_hw_params()
1008 rtd->order = get_order(size); in acp_dma_hw_params()
1011 rtd->size = size; in acp_dma_hw_params()
1012 rtd->num_of_pages = PAGE_ALIGN(size) >> PAGE_SHIFT; in acp_dma_hw_params()
1013 rtd->direction = substream->stream; in acp_dma_hw_params()
1015 config_acp_dma(rtd->acp_mmio, rtd, adata->asic_type); in acp_dma_hw_params()
1019 static u64 acp_get_byte_count(struct audio_substream_data *rtd) in acp_get_byte_count() argument
1023 byte_count.bcount.high = acp_reg_read(rtd->acp_mmio, in acp_get_byte_count()
1024 rtd->byte_cnt_high_reg_offset); in acp_get_byte_count()
1025 byte_count.bcount.low = acp_reg_read(rtd->acp_mmio, in acp_get_byte_count()
1026 rtd->byte_cnt_low_reg_offset); in acp_get_byte_count()
1040 struct audio_substream_data *rtd = runtime->private_data; in acp_dma_pointer() local
1043 if (!rtd) in acp_dma_pointer()
1048 bytescount = acp_get_byte_count(rtd); in acp_dma_pointer()
1049 if (bytescount >= rtd->bytescount) in acp_dma_pointer()
1050 bytescount -= rtd->bytescount; in acp_dma_pointer()
1054 dscr = acp_reg_read(rtd->acp_mmio, rtd->dma_curr_dscr); in acp_dma_pointer()
1055 if (dscr == rtd->dma_dscr_idx_1) in acp_dma_pointer()
1066 bytescount = acp_get_byte_count(rtd); in acp_dma_pointer()
1067 if (bytescount > rtd->bytescount) in acp_dma_pointer()
1068 bytescount -= rtd->bytescount; in acp_dma_pointer()
1089 struct audio_substream_data *rtd = runtime->private_data; in acp_dma_prepare() local
1092 if (!rtd) in acp_dma_prepare()
1095 if (rtd->direction == SNDRV_PCM_STREAM_PLAYBACK) { in acp_dma_prepare()
1096 ch_acp_sysmem = rtd->ch1; in acp_dma_prepare()
1097 ch_acp_i2s = rtd->ch2; in acp_dma_prepare()
1099 ch_acp_i2s = rtd->ch1; in acp_dma_prepare()
1100 ch_acp_sysmem = rtd->ch2; in acp_dma_prepare()
1102 config_acp_dma_channel(rtd->acp_mmio, in acp_dma_prepare()
1104 rtd->dma_dscr_idx_1, in acp_dma_prepare()
1106 config_acp_dma_channel(rtd->acp_mmio, in acp_dma_prepare()
1108 rtd->dma_dscr_idx_2, in acp_dma_prepare()
1119 struct audio_substream_data *rtd = runtime->private_data; in acp_dma_trigger() local
1121 if (!rtd) in acp_dma_trigger()
1127 rtd->bytescount = acp_get_byte_count(rtd); in acp_dma_trigger()
1129 if (rtd->capture_channel == CAP_CHANNEL0) { in acp_dma_trigger()
1130 acp_dma_cap_channel_disable(rtd->acp_mmio, in acp_dma_trigger()
1132 acp_dma_cap_channel_enable(rtd->acp_mmio, in acp_dma_trigger()
1135 if (rtd->capture_channel == CAP_CHANNEL1) { in acp_dma_trigger()
1136 acp_dma_cap_channel_disable(rtd->acp_mmio, in acp_dma_trigger()
1138 acp_dma_cap_channel_enable(rtd->acp_mmio, in acp_dma_trigger()
1141 acp_dma_start(rtd->acp_mmio, rtd->ch1, true); in acp_dma_trigger()
1143 acp_dma_start(rtd->acp_mmio, rtd->ch1, true); in acp_dma_trigger()
1144 acp_dma_start(rtd->acp_mmio, rtd->ch2, true); in acp_dma_trigger()
1151 acp_dma_stop(rtd->acp_mmio, rtd->ch2); in acp_dma_trigger()
1152 ret = acp_dma_stop(rtd->acp_mmio, rtd->ch1); in acp_dma_trigger()
1161 struct snd_soc_pcm_runtime *rtd) in acp_dma_new() argument
1168 snd_pcm_set_managed_buffer_all(rtd->pcm, in acp_dma_new()
1175 snd_pcm_set_managed_buffer_all(rtd->pcm, in acp_dma_new()
1190 struct audio_substream_data *rtd = runtime->private_data; in acp_dma_close() local
1194 switch (rtd->i2s_instance) { in acp_dma_close()
1218 switch (rtd->i2s_instance) { in acp_dma_close()
1242 kfree(rtd); in acp_dma_close()
1341 struct audio_substream_data *rtd; in acp_pcm_resume() local
1361 rtd = adata->play_i2ssp_stream->runtime->private_data; in acp_pcm_resume()
1362 config_acp_dma(adata->acp_mmio, rtd, adata->asic_type); in acp_pcm_resume()
1371 rtd = adata->capture_i2ssp_stream->runtime->private_data; in acp_pcm_resume()
1372 config_acp_dma(adata->acp_mmio, rtd, adata->asic_type); in acp_pcm_resume()
1377 rtd = adata->play_i2s_micsp_stream->runtime->private_data; in acp_pcm_resume()
1378 config_acp_dma(adata->acp_mmio, rtd, adata->asic_type); in acp_pcm_resume()
1382 rtd = adata->play_i2sbt_stream->runtime->private_data; in acp_pcm_resume()
1383 config_acp_dma(adata->acp_mmio, rtd, adata->asic_type); in acp_pcm_resume()
1387 rtd = adata->capture_i2sbt_stream->runtime->private_data; in acp_pcm_resume()
1388 config_acp_dma(adata->acp_mmio, rtd, adata->asic_type); in acp_pcm_resume()