[Sound-open-firmware] [PATCH v2] [RFC]SOF: FIX: adjust the SSC3's TFT/RFT field in SSP
Actually I did not have full confidence about this patch. if someone can help do more test, that would be better. before this, do not accept this patch.
Incorrect TFT/RFT will cause DMA IRQ happened too frequently. the interval will be less than 1ms, which will cause XRUN easily.
The old code will has this issue in TDM4-s32le test.
Signed-off-by: Wu Zhigang zhigang.wu@linux.intel.com Acked-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com
--- v2: the sample-width should be taken into account.
--- Test with: APL-GPMRB with TDF8532 codec Linux sof-v4.14: 1d4a25d72d1e87c182f15a68d32c9599b734ea7b SOF master: 7c5dd8cfdf4f8ca1fa5cfdd7352b81cbfc8edb88 Tools master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c
Pass the Sanity test: BYT(Minnowboard Turbo) APL(UP^2) CNL(CNL-RVP) --- src/drivers/apl-ssp.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/src/drivers/apl-ssp.c b/src/drivers/apl-ssp.c index a51f91c..53bb8be 100644 --- a/src/drivers/apl-ssp.c +++ b/src/drivers/apl-ssp.c @@ -36,6 +36,7 @@ #include <sof/ssp.h> #include <sof/alloc.h> #include <sof/interrupt.h> +#include <sof/math/numbers.h> #include <config.h>
/* tracing */ @@ -114,6 +115,7 @@ static inline int ssp_set_config(struct dai *dai, uint32_t rft; uint32_t active_tx_slots = 2; uint32_t active_rx_slots = 2; + uint32_t sample_width = 2;
bool inverted_frame = false; int ret = 0; @@ -499,22 +501,23 @@ static inline int ssp_set_config(struct dai *dai, /* setting TFT and RFT */ switch (config->ssp.sample_valid_bits) { case 16: - /* use 2 bytes for each slot */ - tft = active_tx_slots * 2; - rft = active_rx_slots * 2; - break; + /* use 2 bytes for each slot */ + sample_width = 2; + break; case 24: case 32: - /* use 4 bytes for each slot */ - tft = active_tx_slots * 4; - rft = active_rx_slots * 4; - break; + /* use 4 bytes for each slot */ + sample_width = 4; + break; default: - trace_ssp_error("ecd"); - ret = -EINVAL; - goto out; + trace_ssp_error("ecd"); + ret = -EINVAL; + goto out; }
+ tft = MIN(8, sample_width * active_tx_slots); + rft = MIN(8, sample_width * active_rx_slots); + sscr3 |= SSCR3_TX(tft) | SSCR3_RX(rft);
trace_ssp("coe");
On Fri, 2018-05-18 at 14:37 +0800, Wu Zhigang wrote:
Actually I did not have full confidence about this patch. if someone can help do more test, that would be better. before this, do not accept this patch.
Incorrect TFT/RFT will cause DMA IRQ happened too frequently. the interval will be less than 1ms, which will cause XRUN easily.
The old code will has this issue in TDM4-s32le test.
Signed-off-by: Wu Zhigang zhigang.wu@linux.intel.com Acked-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com
v2: the sample-width should be taken into account.
Applied.
Thanks
Liam
participants (2)
-
Liam Girdwood
-
Wu Zhigang