summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShengjiu Wang <shengjiu.wang@freescale.com>2014-12-02 18:41:36 +0800
committerShengjiu Wang <shengjiu.wang@freescale.com>2014-12-12 18:20:22 +0800
commit49108fcf7b79ed77d34be33b53a3964b2ac27204 (patch)
tree797a0fbd7441463d3971c33db08c9432db997c3c
parent644e274a982a7559b8df4bbd4dde80268166cfd2 (diff)
MLK-9881: mxc: asrc: fix dma task timeout issue when use 3 instance.
1. Watermark level in sdma use byte as its unit. but asrc driver use word, there is mismatch between them. Here fix this issue and sdma can work more efficiency. 2. Enlarge the larst_period_size, when use small size, for some case, the dma task will timeout, because sdma has no much data for output. Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
-rw-r--r--drivers/mxc/asrc/mxc_asrc.c10
-rw-r--r--include/linux/mxc_asrc.h3
2 files changed, 9 insertions, 4 deletions
diff --git a/drivers/mxc/asrc/mxc_asrc.c b/drivers/mxc/asrc/mxc_asrc.c
index d9a0ff128984..b7e5a51f411f 100644
--- a/drivers/mxc/asrc/mxc_asrc.c
+++ b/drivers/mxc/asrc/mxc_asrc.c
@@ -837,13 +837,13 @@ static int imx_asrc_dma_config(struct asrc_pair_params *params,
slave_config.dst_addr = dma_addr;
slave_config.dst_addr_width = buswidth;
slave_config.dst_maxburst =
- params->input_wm * params->channel_nums / buswidth;
+ params->input_wm * params->channel_nums;
} else {
slave_config.direction = DMA_DEV_TO_MEM;
slave_config.src_addr = dma_addr;
slave_config.src_addr_width = buswidth;
slave_config.src_maxburst =
- params->output_wm * params->channel_nums / buswidth;
+ params->output_wm * params->channel_nums;
}
ret = dmaengine_slave_config(chan, &slave_config);
if (ret) {
@@ -1236,7 +1236,11 @@ static long asrc_ioctl_config_pair(struct asrc_pair_params *params,
params->input_sample_rate = config.input_sample_rate;
params->output_sample_rate = config.output_sample_rate;
- params->last_period_sample = ASRC_OUTPUT_LAST_SAMPLE_DEFAULT;
+ if (params->output_sample_rate > params->input_sample_rate)
+ params->last_period_sample = ASRC_OUTPUT_LAST_SAMPLE_DEFAULT_MAX;
+ else
+ params->last_period_sample = ASRC_OUTPUT_LAST_SAMPLE_DEFAULT;
+
ret = mxc_allocate_dma_buf(params);
if (ret) {
diff --git a/include/linux/mxc_asrc.h b/include/linux/mxc_asrc.h
index bdb04f17c8e1..aee5ae36430c 100644
--- a/include/linux/mxc_asrc.h
+++ b/include/linux/mxc_asrc.h
@@ -28,7 +28,8 @@
#define ASRC_FIFO_THRESHOLD_MAX 63
#define ASRC_DMA_BUFFER_SIZE (1024 * 48 * 4)
#define ASRC_MAX_BUFFER_SIZE (1024 * 48)
-#define ASRC_OUTPUT_LAST_SAMPLE_DEFAULT 8
+#define ASRC_OUTPUT_LAST_SAMPLE_DEFAULT_MAX 32
+#define ASRC_OUTPUT_LAST_SAMPLE_DEFAULT 16
/* Ideal Ratio mode doesn't care the outclk frequency, so be fixed */