alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Jarkko Nikula <jarkko.nikula@bitmer.com>
To: alsa-devel@alsa-project.org
Cc: Kevin Hilman <khilman@ti.com>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Sekhar Nori <nsekhar@ti.com>,
	Vaibhav Bedia <vaibhav.bedia@ti.com>, Liam Girdwood <lrg@ti.com>,
	Jarkko Nikula <jarkko.nikula@bitmer.com>
Subject: [PATCH for-3.2 2/2] ASoC: Davinci: Fix FS polarity for I2S format
Date: Fri, 30 Sep 2011 10:55:33 +0300	[thread overview]
Message-ID: <1317369333-20814-2-git-send-email-jarkko.nikula@bitmer.com> (raw)
In-Reply-To: <1317369333-20814-1-git-send-email-jarkko.nikula@bitmer.com>

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: Vaibhav Bedia <vaibhav.bedia@ti.com>
Cc: Sekhar Nori <nsekhar@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
---
I don't have Davinci so only compile tested.
---
 sound/soc/davinci/davinci-i2s.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c
index d0d60b8..300e121 100644
--- a/sound/soc/davinci/davinci-i2s.c
+++ b/sound/soc/davinci/davinci-i2s.c
@@ -265,6 +265,7 @@ static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai,
 	struct davinci_mcbsp_dev *dev = snd_soc_dai_get_drvdata(cpu_dai);
 	unsigned int pcr;
 	unsigned int srgr;
+	bool inv_fs = false;
 	/* Attention srgr is updated by hw_params! */
 	srgr = DAVINCI_MCBSP_SRGR_FSGM |
 		DAVINCI_MCBSP_SRGR_FPER(DEFAULT_BITPERSAMPLE * 2 - 1) |
@@ -330,7 +331,7 @@ static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai,
 		 * more empty bit clock slots between channels as the sample
 		 * rate is lowered.
 		 */
-		fmt ^= SND_SOC_DAIFMT_NB_IF;
+		inv_fs = true;
 	case SND_SOC_DAIFMT_DSP_A:
 		dev->mode = MOD_DSP_A;
 		break;
@@ -394,6 +395,8 @@ static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai,
 	default:
 		return -EINVAL;
 	}
+	if (inv_fs == true)
+		pcr ^= (DAVINCI_MCBSP_PCR_FSXP | DAVINCI_MCBSP_PCR_FSRP);
 	davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SRGR_REG, srgr);
 	dev->pcr = pcr;
 	davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_PCR_REG, pcr);
-- 
1.7.6.3

  reply	other threads:[~2011-09-30  7:56 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 ` Jarkko Nikula [this message]
2011-09-30 11:49   ` [PATCH for-3.2 2/2] ASoC: Davinci: Fix FS polarity for I2S format Mark Brown
2011-09-30 11:55   ` Mark Brown
2011-09-30 12:14     ` Jarkko Nikula
2011-09-30  8:47 ` [PATCH for-3.2 1/2] ASoC: omap-mcbsp: Fix FS polarity for LEFT_J, DSP_A and DSP_B formats Péter Ujfalusi
2011-09-30 11:51 ` 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=1317369333-20814-2-git-send-email-jarkko.nikula@bitmer.com \
    --to=jarkko.nikula@bitmer.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=khilman@ti.com \
    --cc=lrg@ti.com \
    --cc=nsekhar@ti.com \
    --cc=vaibhav.bedia@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).