aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorMikko Sarmanne <mikko.sarmanne@symbio.com>2011-01-18 15:23:56 +0200
committerRobert Marklund <robert.marklund@stericsson.com>2011-05-13 10:40:23 +0200
commitdc457f2be3d3769a7f7f955469c6dad89b78ec38 (patch)
tree5614ea955573b452988baba083e75e59d961573d /sound
parente849d5386e9f441ed63e4de12f22dcb91bba50c5 (diff)
Ux500 ASoC: Fix IF delay issue with AV8100
Fixes distortion in the AV8100 playback caused by mismatching IF formats in TDM mode. The fix enables configuration of the IF delay on MSP side. Change-Id: Icf154041fb3032e9f285eb6e7d8fa673e1c7f024 Signed-off-by: Mikko Sarmanne <mikko.sarmanne@symbio.com> Signed-off-by: Ola Lilja <elilola@steludxu2785.(none)> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/13524 Reviewed-by: Ola LILJA2 <ola.o.lilja@stericsson.com> Tested-by: Ola LILJA2 <ola.o.lilja@stericsson.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/ux500/ux500_av8100.c3
-rw-r--r--sound/soc/ux500/ux500_msp_dai.c40
-rw-r--r--sound/soc/ux500/ux500_msp_dai.h4
3 files changed, 42 insertions, 5 deletions
diff --git a/sound/soc/ux500/ux500_av8100.c b/sound/soc/ux500/ux500_av8100.c
index 0a04feca2ef..9497b7b6636 100644
--- a/sound/soc/ux500/ux500_av8100.c
+++ b/sound/soc/ux500/ux500_av8100.c
@@ -14,6 +14,7 @@
#include <sound/soc.h>
#include "../codecs/av8100_audio.h"
#include "ux500_av8100.h"
+#include "ux500_msp_dai.h"
static int ux500_av8100_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
@@ -146,6 +147,8 @@ static int ux500_av8100_hw_params(struct snd_pcm_substream *substream,
return ret;
}
+ ux500_msp_dai_set_data_delay(cpu_dai, MSP_DELAY_1);
+
return ret;
}
diff --git a/sound/soc/ux500/ux500_msp_dai.c b/sound/soc/ux500/ux500_msp_dai.c
index 96d4cf9f6f9..d145c54e654 100644
--- a/sound/soc/ux500/ux500_msp_dai.c
+++ b/sound/soc/ux500/ux500_msp_dai.c
@@ -35,6 +35,7 @@ static struct ux500_platform_drvdata platform_drvdata[UX500_NBR_OF_DAI] = {
.playback_active = false,
.capture_active = false,
.configured = 0,
+ .data_delay = MSP_DELAY_0,
},
{
.i2s = NULL,
@@ -46,6 +47,7 @@ static struct ux500_platform_drvdata platform_drvdata[UX500_NBR_OF_DAI] = {
.playback_active = false,
.capture_active = false,
.configured = 0,
+ .data_delay = MSP_DELAY_0,
},
{
.i2s = NULL,
@@ -57,6 +59,7 @@ static struct ux500_platform_drvdata platform_drvdata[UX500_NBR_OF_DAI] = {
.playback_active = false,
.capture_active = false,
.configured = 0,
+ .data_delay = MSP_DELAY_0,
},
{
.i2s = NULL,
@@ -68,6 +71,7 @@ static struct ux500_platform_drvdata platform_drvdata[UX500_NBR_OF_DAI] = {
.playback_active = false,
.capture_active = false,
.configured = 0,
+ .data_delay = MSP_DELAY_0,
},
};
@@ -383,8 +387,6 @@ static void ux500_msp_dai_compile_prot_desc_pcm(unsigned int fmt,
prot_desc->tx_phase2_start_mode = MSP_PHASE2_START_MODE_IMEDIATE;
prot_desc->rx_bit_transfer_format = MSP_BTF_MS_BIT_FIRST;
prot_desc->tx_bit_transfer_format = MSP_BTF_MS_BIT_FIRST;
- prot_desc->rx_data_delay = MSP_DELAY_0;
- prot_desc->tx_data_delay = MSP_DELAY_0;
if ((fmt & SND_SOC_DAIFMT_FORMAT_MASK) == SND_SOC_DAIFMT_DSP_A) {
pr_debug("%s: DSP_A.\n",
@@ -417,8 +419,6 @@ static void ux500_msp_dai_compile_prot_desc_i2s(struct msp_protocol_desc *prot_d
MSP_PHASE2_START_MODE_FRAME_SYNC;
prot_desc->rx_bit_transfer_format = MSP_BTF_MS_BIT_FIRST;
prot_desc->tx_bit_transfer_format = MSP_BTF_MS_BIT_FIRST;
- prot_desc->rx_data_delay = MSP_DELAY_0;
- prot_desc->tx_data_delay = MSP_DELAY_0;
prot_desc->rx_frame_length_1 = MSP_FRAME_LENGTH_1;
prot_desc->rx_frame_length_2 = MSP_FRAME_LENGTH_1;
@@ -477,6 +477,9 @@ static void ux500_msp_dai_compile_msp_config(struct snd_pcm_substream *substream
/* To avoid division by zero in I2S-driver (i2s_setup) */
prot_desc->total_clocks_for_one_frame = 1;
+ prot_desc->rx_data_delay = private->data_delay;
+ prot_desc->tx_data_delay = private->data_delay;
+
pr_debug("%s: rate: %u channels: %d.\n",
__func__,
rate,
@@ -611,6 +614,33 @@ static int ux500_msp_dai_hw_params(struct snd_pcm_substream *substream,
return 0;
}
+int ux500_msp_dai_set_data_delay(struct snd_soc_dai *dai, int delay)
+{
+ struct ux500_platform_drvdata *drvdata = &platform_drvdata[dai->id];
+
+ pr_debug("%s: MSP %d: Enter.\n", __func__, dai->id);
+
+ switch (delay) {
+ case MSP_DELAY_0:
+ case MSP_DELAY_1:
+ case MSP_DELAY_2:
+ case MSP_DELAY_3:
+ break;
+ default:
+ goto unsupported_delay;
+ }
+
+ drvdata->data_delay = delay;
+ return 0;
+
+unsupported_delay:
+ pr_err("%s: MSP %d: Error: Unsupported DAI delay (%d)!\n",
+ __func__,
+ dai->id,
+ delay);
+ return -EINVAL;
+}
+
static int ux500_msp_dai_set_dai_fmt(struct snd_soc_dai *dai,
unsigned int fmt)
{
@@ -924,7 +954,7 @@ static const struct i2s_device_id dev_id_table_v2[] = {
{ "i2s_device.0", 0, 0 },
{ "i2s_device.1", 1, 0 },
{ "i2s_device.2", 2, 0 },
- { "i2s_device.3", 2, 0 },
+ { "i2s_device.3", 3, 0 },
{ },
};
MODULE_DEVICE_TABLE(i2s, dev_id_table_v2);
diff --git a/sound/soc/ux500/ux500_msp_dai.h b/sound/soc/ux500/ux500_msp_dai.h
index 2b2f3776efc..73be99bb5ab 100644
--- a/sound/soc/ux500/ux500_msp_dai.h
+++ b/sound/soc/ux500/ux500_msp_dai.h
@@ -18,6 +18,7 @@
#include <linux/types.h>
#include <linux/spinlock.h>
#include <linux/i2s/i2s.h>
+#include <mach/msp.h>
#define UX500_NBR_OF_DAI 4
@@ -56,6 +57,7 @@ struct ux500_platform_drvdata {
bool playback_active;
bool capture_active;
u8 configured;
+ int data_delay;
};
extern struct snd_soc_dai ux500_msp_dai[UX500_NBR_OF_DAI];
@@ -70,4 +72,6 @@ int ux500_msp_dai_i2s_configure_sg(dma_addr_t dma_addr,
int ux500_msp_dai_i2s_send_data(void *data, size_t bytes, int dai_idx);
int ux500_msp_dai_i2s_receive_data(void *data, size_t bytes, int dai_idx);
+int ux500_msp_dai_set_data_delay(struct snd_soc_dai *dai, int delay);
+
#endif