diff options
author | Nicolin Chen <b42378@freescale.com> | 2013-09-25 07:10:58 -0400 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2014-04-16 09:05:43 -0400 |
commit | fa286268797b1ba0fc55248eb7d0034fd2814870 (patch) | |
tree | 55cdacc62d5846d665f8d7b8a35564942a450f9b | |
parent | 5226f166509bffd9277be233f62064b2ced98e98 (diff) |
ENGR00280852-8 mxc: asrc: Add polling mode working without dma for debugging
Add polling mode for data transmitting without dma support for debugging when
sdma may have issue.
Signed-off-by: Nicolin Chen <b42378@freescale.com>
-rw-r--r-- | drivers/mxc/asrc/mxc_asrc.c | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/drivers/mxc/asrc/mxc_asrc.c b/drivers/mxc/asrc/mxc_asrc.c index bb51e97b59af..3809f9c4c413 100644 --- a/drivers/mxc/asrc/mxc_asrc.c +++ b/drivers/mxc/asrc/mxc_asrc.c | |||
@@ -1079,6 +1079,70 @@ int mxc_asrc_process_buffer(struct asrc_pair_params *params, | |||
1079 | return 0; | 1079 | return 0; |
1080 | } | 1080 | } |
1081 | 1081 | ||
1082 | #ifdef ASRC_POLLING_WITHOUT_DMA | ||
1083 | static void asrc_write_one_to_input_FIFO(enum asrc_pair_index index, u32 val) | ||
1084 | { | ||
1085 | regmap_write(asrc->regmap, REG_ASRDI(index), val); | ||
1086 | } | ||
1087 | |||
1088 | /* THIS FUNCTION ONLY EXISTS FOR DEBUGGING AND ONLY SUPPORTS TWO CHANNELS */ | ||
1089 | static void asrc_polling_debug(struct asrc_pair_params *params) | ||
1090 | { | ||
1091 | enum asrc_pair_index index = params->index; | ||
1092 | u32 *in24 = params->input_dma_total.dma_vaddr; | ||
1093 | u32 dma_len = params->input_dma_total.length / (params->channel_nums * 4); | ||
1094 | u32 size, i, j, t_size, reg; | ||
1095 | u32 *reg24 = params->output_dma_total.dma_vaddr; | ||
1096 | |||
1097 | t_size = 0; | ||
1098 | |||
1099 | for (i = 0; i < dma_len; ) { | ||
1100 | for (j = 0; j < 2; j++) { | ||
1101 | asrc_write_one_to_input_FIFO(index, *in24); | ||
1102 | in24++; | ||
1103 | asrc_write_one_to_input_FIFO(index, *in24); | ||
1104 | in24++; | ||
1105 | i++; | ||
1106 | } | ||
1107 | udelay(50); | ||
1108 | udelay(50 * params->output_sample_rate / params->input_sample_rate); | ||
1109 | |||
1110 | size = asrc_get_output_FIFO_size(index); | ||
1111 | for (j = 0; j < size; j++) { | ||
1112 | reg = asrc_read_one_from_output_FIFO(index); | ||
1113 | *(reg24) = reg; | ||
1114 | reg24++; | ||
1115 | reg = asrc_read_one_from_output_FIFO(index); | ||
1116 | *(reg24) = reg; | ||
1117 | reg24++; | ||
1118 | } | ||
1119 | t_size += size; | ||
1120 | } | ||
1121 | |||
1122 | mdelay(1); | ||
1123 | size = asrc_get_output_FIFO_size(index); | ||
1124 | for (j = 0; j < size; j++) { | ||
1125 | reg = asrc_read_one_from_output_FIFO(index); | ||
1126 | *(reg24) = reg; | ||
1127 | reg24++; | ||
1128 | reg = asrc_read_one_from_output_FIFO(index); | ||
1129 | *(reg24) = reg; | ||
1130 | reg24++; | ||
1131 | } | ||
1132 | t_size += size; | ||
1133 | |||
1134 | params->output_dma_total.length = t_size * params->channel_nums * 4; | ||
1135 | params->output_last_period.length = 0; | ||
1136 | |||
1137 | dma_unmap_sg(NULL, params->input_sg, params->input_sg_nodes, | ||
1138 | DMA_MEM_TO_DEV); | ||
1139 | dma_unmap_sg(NULL, params->output_sg, params->output_sg_nodes, | ||
1140 | DMA_MEM_TO_DEV); | ||
1141 | |||
1142 | complete(¶ms->input_complete); | ||
1143 | complete(¶ms->lastperiod_complete); | ||
1144 | } | ||
1145 | #else | ||
1082 | static void mxc_asrc_submit_dma(struct asrc_pair_params *params) | 1146 | static void mxc_asrc_submit_dma(struct asrc_pair_params *params) |
1083 | { | 1147 | { |
1084 | enum asrc_pair_index index = params->index; | 1148 | enum asrc_pair_index index = params->index; |
@@ -1105,6 +1169,7 @@ static void mxc_asrc_submit_dma(struct asrc_pair_params *params) | |||
1105 | 1169 | ||
1106 | sdma_set_event_pending(params->input_dma_channel); | 1170 | sdma_set_event_pending(params->input_dma_channel); |
1107 | } | 1171 | } |
1172 | #endif | ||
1108 | 1173 | ||
1109 | static long asrc_ioctl_req_pair(struct asrc_pair_params *params, | 1174 | static long asrc_ioctl_req_pair(struct asrc_pair_params *params, |
1110 | void __user *user) | 1175 | void __user *user) |
@@ -1271,7 +1336,11 @@ static long asrc_ioctl_convert(struct asrc_pair_params *params, | |||
1271 | return ret; | 1336 | return ret; |
1272 | } | 1337 | } |
1273 | 1338 | ||
1339 | #ifdef ASRC_POLLING_WITHOUT_DMA | ||
1340 | asrc_polling_debug(params); | ||
1341 | #else | ||
1274 | mxc_asrc_submit_dma(params); | 1342 | mxc_asrc_submit_dma(params); |
1343 | #endif | ||
1275 | 1344 | ||
1276 | ret = mxc_asrc_process_buffer(params, &buf); | 1345 | ret = mxc_asrc_process_buffer(params, &buf); |
1277 | if (ret) { | 1346 | if (ret) { |