Linux on ARM based TI OMAP SoCs
 help / color / mirror / Atom feed
From: "Péter Ujfalusi" <peter.ujfalusi@gmail.com>
To: broonie@kernel.org, tony@atomide.com
Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com,
	linux-omap@vger.kernel.org, hns@goldelico.com
Subject: Re: [PATCH 1/5] ASoC: ti: davinci-mcasp: Fix DIT mode support
Date: Mon, 5 Jul 2021 17:58:04 +0300	[thread overview]
Message-ID: <4b530480-bcd6-08cc-b8d6-7e57d0a823ce@gmail.com> (raw)
In-Reply-To: <20210704150450.20106-2-peter.ujfalusi@gmail.com>

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@gmail.com>
> ---
>  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

  reply	other threads:[~2021-07-05 14:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-04 15:04 [PATCH 0/5] ASoC: ti: davinci-mcasp: Fix the DIT mode and OMAP4 support Peter Ujfalusi
2021-07-04 15:04 ` [PATCH 1/5] ASoC: ti: davinci-mcasp: Fix DIT mode support Peter Ujfalusi
2021-07-05 14:58   ` Péter Ujfalusi [this message]
2021-07-05 15:50     ` Mark Brown
2021-07-04 15:04 ` [PATCH 2/5] ASoC: dt-bindings: davinci-mcasp: Add compatible string for OMAP4 Peter Ujfalusi
2021-07-04 15:04 ` [PATCH 3/5] ASoC: ti: davinci-mcasp: Add support for the OMAP4 version of McASP Peter Ujfalusi
2021-07-04 15:04 ` [PATCH 4/5] ARM: dts: omap4-l4-abe: Correct sidle modes for McASP Peter Ujfalusi
2021-07-04 15:04 ` [PATCH 5/5] ARM: dts: omap4-l4-abe: Add McASP configuration Peter Ujfalusi
2021-07-05 13:32 ` [PATCH 0/5] ASoC: ti: davinci-mcasp: Fix the DIT mode and OMAP4 support H. Nikolaus Schaller
2021-07-05 14:10   ` Péter Ujfalusi
2021-07-05 15:33     ` H. Nikolaus Schaller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4b530480-bcd6-08cc-b8d6-7e57d0a823ce@gmail.com \
    --to=peter.ujfalusi@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=hns@goldelico.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox