ASoC: davinci-mcasp: Correct TX start sequence

Follow the sequence described in the TRMs when starting TX. This sequence
will make sure that we are not facing with initial channel swap caused by
no data available in McASP for transmit.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Peter Ujfalusi 2014-10-29 13:55:44 +02:00 committed by Mark Brown
parent f114040e3e
commit 36bcecd0a7
2 changed files with 15 additions and 16 deletions

View file

@ -183,31 +183,24 @@ static void mcasp_start_rx(struct davinci_mcasp *mcasp)
static void mcasp_start_tx(struct davinci_mcasp *mcasp) static void mcasp_start_tx(struct davinci_mcasp *mcasp)
{ {
u8 offset = 0, i;
u32 cnt; u32 cnt;
/* Start clocks */
mcasp_set_ctl_reg(mcasp, DAVINCI_MCASP_GBLCTLX_REG, TXHCLKRST); mcasp_set_ctl_reg(mcasp, DAVINCI_MCASP_GBLCTLX_REG, TXHCLKRST);
mcasp_set_ctl_reg(mcasp, DAVINCI_MCASP_GBLCTLX_REG, TXCLKRST); mcasp_set_ctl_reg(mcasp, DAVINCI_MCASP_GBLCTLX_REG, TXCLKRST);
/* Activate serializer(s) */
mcasp_set_ctl_reg(mcasp, DAVINCI_MCASP_GBLCTLX_REG, TXSERCLR); mcasp_set_ctl_reg(mcasp, DAVINCI_MCASP_GBLCTLX_REG, TXSERCLR);
mcasp_set_reg(mcasp, DAVINCI_MCASP_TXBUF_REG, 0);
mcasp_set_ctl_reg(mcasp, DAVINCI_MCASP_GBLCTLX_REG, TXSMRST); /* wait for XDATA to be cleared */
mcasp_set_ctl_reg(mcasp, DAVINCI_MCASP_GBLCTLX_REG, TXFSRST);
mcasp_set_reg(mcasp, DAVINCI_MCASP_TXBUF_REG, 0);
for (i = 0; i < mcasp->num_serializer; i++) {
if (mcasp->serial_dir[i] == TX_MODE) {
offset = i;
break;
}
}
/* wait for TX ready */
cnt = 0; cnt = 0;
while (!(mcasp_get_reg(mcasp, DAVINCI_MCASP_XRSRCTL_REG(offset)) & while (!(mcasp_get_reg(mcasp, DAVINCI_MCASP_TXSTAT_REG) &
TXSTATE) && (cnt < 100000)) ~XRDATA) && (cnt < 100000))
cnt++; cnt++;
mcasp_set_reg(mcasp, DAVINCI_MCASP_TXBUF_REG, 0); /* Release TX state machine */
mcasp_set_ctl_reg(mcasp, DAVINCI_MCASP_GBLCTLX_REG, TXSMRST);
/* Release Frame Sync generator */
mcasp_set_ctl_reg(mcasp, DAVINCI_MCASP_GBLCTLX_REG, TXFSRST);
} }
static void davinci_mcasp_start(struct davinci_mcasp *mcasp, int stream) static void davinci_mcasp_start(struct davinci_mcasp *mcasp, int stream)

View file

@ -252,6 +252,12 @@
#define TXSMRST BIT(11) /* Transmitter State Machine Reset */ #define TXSMRST BIT(11) /* Transmitter State Machine Reset */
#define TXFSRST BIT(12) /* Frame Sync Generator Reset */ #define TXFSRST BIT(12) /* Frame Sync Generator Reset */
/*
* DAVINCI_MCASP_TXSTAT_REG - Transmitter Status Register Bits
* DAVINCI_MCASP_RXSTAT_REG - Receiver Status Register Bits
*/
#define XRDATA BIT(5) /* Transmit/Receive data ready */
/* /*
* DAVINCI_MCASP_AMUTE_REG - Mute Control Register Bits * DAVINCI_MCASP_AMUTE_REG - Mute Control Register Bits
*/ */