All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Péter Ujfalusi" <peter.ujfalusi@ti.com>
To: Jarkko Nikula <jarkko.nikula@bitmer.com>
Cc: alsa-devel@alsa-project.org,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Liam Girdwood <lrg@ti.com>
Subject: Re: [PATCH for-3.2 1/2] ASoC: omap-mcbsp: Fix FS polarity for LEFT_J, DSP_A and DSP_B formats
Date: Fri, 30 Sep 2011 11:47:33 +0300	[thread overview]
Message-ID: <4047208.99FlxY0R56@barack> (raw)
In-Reply-To: <1317369333-20814-1-git-send-email-jarkko.nikula@bitmer.com>

On Friday 30 September 2011 10:55:32 Jarkko Nikula wrote:
> Commit 75d9ac4 ("ASoC: Allow DAI formats to be specified in the dai_link")
> changed DAI format flag values and we cannot simply invert anymore e.g.
> frame-sync with ^= SND_SOC_DAIFMT_NB_IF (which was anyway misuse) as there
> is no anymore fixed bit position for bit-clock or frame-sync inversion.
> 
> Fix this by relying only on DAI format flag values passed to us and by not
> making any assumption on individual bit positions.
> 
> Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
> Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>

I have missed the 75d9ac4 ;)
As a note: omap-mcbsp still needs the runtime configuration of dai format...

Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

> ---
>  sound/soc/omap/omap-mcbsp.c |   12 +++++++-----
>  1 files changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
> index 1391ea0..894f2f3 100644
> --- a/sound/soc/omap/omap-mcbsp.c
> +++ b/sound/soc/omap/omap-mcbsp.c
> @@ -398,7 +398,7 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai
> *cpu_dai, {
>  	struct omap_mcbsp_data *mcbsp_data = snd_soc_dai_get_drvdata(cpu_dai);
>  	struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs;
> -	unsigned int temp_fmt = fmt;
> +	bool inv_fs = false;
> 
>  	if (mcbsp_data->configured)
>  		return 0;
> @@ -430,21 +430,21 @@ static int omap_mcbsp_dai_set_dai_fmt(struct
> snd_soc_dai *cpu_dai, regs->xcr2	|= XDATDLY(0);
>  		regs->spcr1	|= RJUST(2);
>  		/* Invert FS polarity configuration */
> -		temp_fmt ^= SND_SOC_DAIFMT_NB_IF;
> +		inv_fs = true;
>  		break;
>  	case SND_SOC_DAIFMT_DSP_A:
>  		/* 1-bit data delay */
>  		regs->rcr2      |= RDATDLY(1);
>  		regs->xcr2      |= XDATDLY(1);
>  		/* Invert FS polarity configuration */
> -		temp_fmt ^= SND_SOC_DAIFMT_NB_IF;
> +		inv_fs = true;
>  		break;
>  	case SND_SOC_DAIFMT_DSP_B:
>  		/* 0-bit data delay */
>  		regs->rcr2      |= RDATDLY(0);
>  		regs->xcr2      |= XDATDLY(0);
>  		/* Invert FS polarity configuration */
> -		temp_fmt ^= SND_SOC_DAIFMT_NB_IF;
> +		inv_fs = true;
>  		break;
>  	default:
>  		/* Unsupported data format */
> @@ -468,7 +468,7 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai
> *cpu_dai, }
> 
>  	/* Set bit clock (CLKX/CLKR) and FS polarities */
> -	switch (temp_fmt & SND_SOC_DAIFMT_INV_MASK) {
> +	switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
>  	case SND_SOC_DAIFMT_NB_NF:
>  		/*
>  		 * Normal BCLK + FS.
> @@ -489,6 +489,8 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai
> *cpu_dai, default:
>  		return -EINVAL;
>  	}
> +	if (inv_fs == true)
> +		regs->pcr0 ^= FSXP | FSRP;
> 
>  	return 0;
>  }

--
Péter

  parent reply	other threads:[~2011-09-30  8:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-30  7:55 [PATCH for-3.2 1/2] ASoC: omap-mcbsp: Fix FS polarity for LEFT_J, DSP_A and DSP_B formats Jarkko Nikula
2011-09-30  7:55 ` [PATCH for-3.2 2/2] ASoC: Davinci: Fix FS polarity for I2S format Jarkko Nikula
2011-09-30 11:49   ` Mark Brown
2011-09-30 11:55   ` Mark Brown
2011-09-30 12:14     ` Jarkko Nikula
2011-09-30  8:47 ` Péter Ujfalusi [this message]
2011-09-30 11:51 ` [PATCH for-3.2 1/2] ASoC: omap-mcbsp: Fix FS polarity for LEFT_J, DSP_A and DSP_B formats Mark Brown

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=4047208.99FlxY0R56@barack \
    --to=peter.ujfalusi@ti.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=jarkko.nikula@bitmer.com \
    --cc=lrg@ti.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.