Re: [PATCH 1/5] ASoC: ti: davinci-mcasp: Fix DIT mode support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 04/07/2021 18:04, Peter Ujfalusi wrote:
> The DIT mode support has not been tested due to lack of platform where it
> can be tested.
> To be able to use the McASP on OMAP4/5 (only supporting DIT mode) we need
> to have DIT mode working in the McASP driver on a know platform.
> After hacking around (on BBW, mcasp1.axr1 can be routed out for this) it
> appeared that DIT mode is broken.
> 
> This patch fixes it up and 16/24 bit audio works along with passthrough,
> but I have only tested with DTS example and test files.
> 
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@xxxxxxxxx>
> ---
>  sound/soc/ti/davinci-mcasp.c | 142 ++++++++++++++++++++++++++++++-----
>  1 file changed, 122 insertions(+), 20 deletions(-)
> 
> diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c
> index 017a5a5e56cd..e56a22c28467 100644
> --- a/sound/soc/ti/davinci-mcasp.c
> +++ b/sound/soc/ti/davinci-mcasp.c
> @@ -83,6 +83,8 @@ struct davinci_mcasp {
>  	struct snd_pcm_substream *substreams[2];
>  	unsigned int dai_fmt;
>  
> +	u32 iec958_status;
> +
>  	/* Audio can not be enabled due to missing parameter(s) */
>  	bool	missing_audio_param;
>  
> @@ -757,6 +759,9 @@ static int davinci_mcasp_set_tdm_slot(struct snd_soc_dai *dai,
>  {
>  	struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(dai);
>  
> +	if (mcasp->op_mode == DAVINCI_MCASP_DIT_MODE)
> +		return 0;
> +
>  	dev_dbg(mcasp->dev,
>  		 "%s() tx_mask 0x%08x rx_mask 0x%08x slots %d width %d\n",
>  		 __func__, tx_mask, rx_mask, slots, slot_width);
> @@ -827,6 +832,20 @@ static int davinci_config_channel_size(struct davinci_mcasp *mcasp,
>  		mcasp_mod_bits(mcasp, DAVINCI_MCASP_RXFMT_REG, RXROT(rx_rotate),
>  			       RXROT(7));
>  		mcasp_set_reg(mcasp, DAVINCI_MCASP_RXMASK_REG, mask);
> +	} else {
> +		/*
> +		 * according to the TRM it should be TXROT=0, this one works:
> +		 * 16 bit to 23-8 (TXROT=6, rotate 24 bits)
> +		 * 24 bit to 23-0 (TXROT=0, rotate 0 bits)
> +		 *
> +		 * TXROT = 0 only works with 24bit samples
> +		 */
> +		tx_rotate = (sample_width / 4 + 2) & 0x7;
> +
> +		mcasp_mod_bits(mcasp, DAVINCI_MCASP_TXFMT_REG, TXROT(tx_rotate),
> +			       TXROT(7));
> +		mcasp_mod_bits(mcasp, DAVINCI_MCASP_TXFMT_REG, TXSSZ(15),
> +			       TXSSZ(0x0F));
>  	}
>  
>  	mcasp_set_reg(mcasp, DAVINCI_MCASP_TXMASK_REG, mask);
> @@ -841,7 +860,7 @@ static int mcasp_common_hw_param(struct davinci_mcasp *mcasp, int stream,
>  	int i;
>  	u8 tx_ser = 0;
>  	u8 rx_ser = 0;
> -	u8 slots = mcasp->tdm_slots;
> +	u8 slots = mcasp->op_mode == DAVINCI_MCASP_DIT_MODE ? 384 : mcasp->tdm_slots;

This is wrong.
384 will not fit to u8...
I wonder why I don't saw this...

-- 
Péter



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux