All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zidan Wang <zidan.wang@freescale.com>
To: <timur@tabi.org>
Cc: <nicoleotsuka@gmail.com>, <Xiubo.Lee@gmail.com>,
	<lgirdwood@gmail.com>, <broonie@kernel.org>, <perex@perex.cz>,
	<tiwai@suse.de>, <alsa-devel@alsa-project.org>,
	<linuxppc-dev@lists.ozlabs.org>, <linux-kernel@vger.kernel.org>,
	Zidan Wang <zidan.wang@freescale.com>
Subject: [alsa-devel][PATCH 3/3] ASoC: fsl_sai: Add support for Right-J mode
Date: Tue, 20 Jan 2015 20:21:20 +0800	[thread overview]
Message-ID: <1421756480-7055-4-git-send-email-zidan.wang@freescale.com> (raw)
In-Reply-To: <1421756480-7055-1-git-send-email-zidan.wang@freescale.com>

Add Right-J mode and set TCR5 FBT bit to let data right justify.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
---
 sound/soc/fsl/fsl_sai.c | 14 +++++++++++---
 sound/soc/fsl/fsl_sai.h |  1 +
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index 4c5040d..19cd6f3 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -228,7 +228,11 @@ static int fsl_sai_set_dai_fmt_tr(struct snd_soc_dai *cpu_dai,
 		sai->is_dsp_mode = true;
 		break;
 	case SND_SOC_DAIFMT_RIGHT_J:
-		/* To be done */
+		/* Frame high, one word length for frame sync */
+		val_cr2 |= FSL_SAI_CR2_BCP;
+		sai->is_right_j_mode = true;
+		break;
+
 	default:
 		return -EINVAL;
 	}
@@ -418,9 +422,13 @@ static int fsl_sai_hw_params(struct snd_pcm_substream *substream,
 	val_cr5 |= FSL_SAI_CR5_WNW(sai->slot_width);
 	val_cr5 |= FSL_SAI_CR5_W0W(sai->slot_width);
 
-	if (sai->is_lsb_first)
+	if (sai->is_lsb_first && sai->is_right_j_mode)
 		val_cr5 |= FSL_SAI_CR5_FBT(0);
-	else
+	else if (sai->is_lsb_first && !sai->is_right_j_mode)
+		val_cr5 |= FSL_SAI_CR5_FBT(sai->slot_width - word_width);
+	else if (!sai->is_lsb_first && sai->is_right_j_mode)
+		val_cr5 |= FSL_SAI_CR5_FBT(sai->slot_width - 1);
+	else if (!sai->is_lsb_first && !sai->is_right_j_mode)
 		val_cr5 |= FSL_SAI_CR5_FBT(word_width - 1);
 
 	val_cr4 |= FSL_SAI_CR4_FRSZ(sai->slots * channels);
diff --git a/sound/soc/fsl/fsl_sai.h b/sound/soc/fsl/fsl_sai.h
index 111dfce..e220940 100644
--- a/sound/soc/fsl/fsl_sai.h
+++ b/sound/soc/fsl/fsl_sai.h
@@ -137,6 +137,7 @@ struct fsl_sai {
 	bool is_lsb_first;
 	bool is_slave_mode;
 	bool is_dsp_mode;
+	bool is_right_j_mode;
 	bool sai_on_imx;
 	bool synchronous[2];
 
-- 
1.9.1


WARNING: multiple messages have this Message-ID (diff)
From: Zidan Wang <zidan.wang@freescale.com>
To: timur@tabi.org
Cc: alsa-devel@alsa-project.org,
	Zidan Wang <zidan.wang@freescale.com>,
	Xiubo.Lee@gmail.com, tiwai@suse.de, linux-kernel@vger.kernel.org,
	lgirdwood@gmail.com, nicoleotsuka@gmail.com, broonie@kernel.org,
	linuxppc-dev@lists.ozlabs.org
Subject: [PATCH 3/3] ASoC: fsl_sai: Add support for Right-J mode
Date: Tue, 20 Jan 2015 20:21:20 +0800	[thread overview]
Message-ID: <1421756480-7055-4-git-send-email-zidan.wang@freescale.com> (raw)
In-Reply-To: <1421756480-7055-1-git-send-email-zidan.wang@freescale.com>

Add Right-J mode and set TCR5 FBT bit to let data right justify.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
---
 sound/soc/fsl/fsl_sai.c | 14 +++++++++++---
 sound/soc/fsl/fsl_sai.h |  1 +
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index 4c5040d..19cd6f3 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -228,7 +228,11 @@ static int fsl_sai_set_dai_fmt_tr(struct snd_soc_dai *cpu_dai,
 		sai->is_dsp_mode = true;
 		break;
 	case SND_SOC_DAIFMT_RIGHT_J:
-		/* To be done */
+		/* Frame high, one word length for frame sync */
+		val_cr2 |= FSL_SAI_CR2_BCP;
+		sai->is_right_j_mode = true;
+		break;
+
 	default:
 		return -EINVAL;
 	}
@@ -418,9 +422,13 @@ static int fsl_sai_hw_params(struct snd_pcm_substream *substream,
 	val_cr5 |= FSL_SAI_CR5_WNW(sai->slot_width);
 	val_cr5 |= FSL_SAI_CR5_W0W(sai->slot_width);
 
-	if (sai->is_lsb_first)
+	if (sai->is_lsb_first && sai->is_right_j_mode)
 		val_cr5 |= FSL_SAI_CR5_FBT(0);
-	else
+	else if (sai->is_lsb_first && !sai->is_right_j_mode)
+		val_cr5 |= FSL_SAI_CR5_FBT(sai->slot_width - word_width);
+	else if (!sai->is_lsb_first && sai->is_right_j_mode)
+		val_cr5 |= FSL_SAI_CR5_FBT(sai->slot_width - 1);
+	else if (!sai->is_lsb_first && !sai->is_right_j_mode)
 		val_cr5 |= FSL_SAI_CR5_FBT(word_width - 1);
 
 	val_cr4 |= FSL_SAI_CR4_FRSZ(sai->slots * channels);
diff --git a/sound/soc/fsl/fsl_sai.h b/sound/soc/fsl/fsl_sai.h
index 111dfce..e220940 100644
--- a/sound/soc/fsl/fsl_sai.h
+++ b/sound/soc/fsl/fsl_sai.h
@@ -137,6 +137,7 @@ struct fsl_sai {
 	bool is_lsb_first;
 	bool is_slave_mode;
 	bool is_dsp_mode;
+	bool is_right_j_mode;
 	bool sai_on_imx;
 	bool synchronous[2];
 
-- 
1.9.1

WARNING: multiple messages have this Message-ID (diff)
From: Zidan Wang <zidan.wang@freescale.com>
To: <timur@tabi.org>
Cc: alsa-devel@alsa-project.org,
	Zidan Wang <zidan.wang@freescale.com>,
	Xiubo.Lee@gmail.com, tiwai@suse.de, linux-kernel@vger.kernel.org,
	lgirdwood@gmail.com, perex@perex.cz, nicoleotsuka@gmail.com,
	broonie@kernel.org, linuxppc-dev@lists.ozlabs.org
Subject: [alsa-devel][PATCH 3/3] ASoC: fsl_sai: Add support for Right-J mode
Date: Tue, 20 Jan 2015 20:21:20 +0800	[thread overview]
Message-ID: <1421756480-7055-4-git-send-email-zidan.wang@freescale.com> (raw)
In-Reply-To: <1421756480-7055-1-git-send-email-zidan.wang@freescale.com>

Add Right-J mode and set TCR5 FBT bit to let data right justify.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
---
 sound/soc/fsl/fsl_sai.c | 14 +++++++++++---
 sound/soc/fsl/fsl_sai.h |  1 +
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index 4c5040d..19cd6f3 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -228,7 +228,11 @@ static int fsl_sai_set_dai_fmt_tr(struct snd_soc_dai *cpu_dai,
 		sai->is_dsp_mode = true;
 		break;
 	case SND_SOC_DAIFMT_RIGHT_J:
-		/* To be done */
+		/* Frame high, one word length for frame sync */
+		val_cr2 |= FSL_SAI_CR2_BCP;
+		sai->is_right_j_mode = true;
+		break;
+
 	default:
 		return -EINVAL;
 	}
@@ -418,9 +422,13 @@ static int fsl_sai_hw_params(struct snd_pcm_substream *substream,
 	val_cr5 |= FSL_SAI_CR5_WNW(sai->slot_width);
 	val_cr5 |= FSL_SAI_CR5_W0W(sai->slot_width);
 
-	if (sai->is_lsb_first)
+	if (sai->is_lsb_first && sai->is_right_j_mode)
 		val_cr5 |= FSL_SAI_CR5_FBT(0);
-	else
+	else if (sai->is_lsb_first && !sai->is_right_j_mode)
+		val_cr5 |= FSL_SAI_CR5_FBT(sai->slot_width - word_width);
+	else if (!sai->is_lsb_first && sai->is_right_j_mode)
+		val_cr5 |= FSL_SAI_CR5_FBT(sai->slot_width - 1);
+	else if (!sai->is_lsb_first && !sai->is_right_j_mode)
 		val_cr5 |= FSL_SAI_CR5_FBT(word_width - 1);
 
 	val_cr4 |= FSL_SAI_CR4_FRSZ(sai->slots * channels);
diff --git a/sound/soc/fsl/fsl_sai.h b/sound/soc/fsl/fsl_sai.h
index 111dfce..e220940 100644
--- a/sound/soc/fsl/fsl_sai.h
+++ b/sound/soc/fsl/fsl_sai.h
@@ -137,6 +137,7 @@ struct fsl_sai {
 	bool is_lsb_first;
 	bool is_slave_mode;
 	bool is_dsp_mode;
+	bool is_right_j_mode;
 	bool sai_on_imx;
 	bool synchronous[2];
 
-- 
1.9.1

  parent reply	other threads:[~2015-01-20 12:36 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-20 12:21 [alsa-devel][PATCH 0/3] Add master mode, tmd and right-j mode support Zidan Wang
2015-01-20 12:21 ` Zidan Wang
2015-01-20 12:21 ` [PATCH " Zidan Wang
2015-01-20 12:21 ` [alsa-devel][PATCH 1/3] SoC: fsl_sai: add sai master " Zidan Wang
2015-01-20 12:21   ` Zidan Wang
2015-01-20 12:21   ` Zidan Wang
2015-01-21  6:07   ` Nicolin Chen
2015-01-21  6:07     ` Nicolin Chen
2015-01-21  9:25     ` Zidan Wang
2015-01-21  9:25       ` Zidan Wang
2015-01-21  9:25       ` [PATCH " Zidan Wang
2015-01-21 17:36       ` [alsa-devel][PATCH " Nicolin Chen
2015-01-21 17:36         ` Nicolin Chen
2015-01-20 12:21 ` [alsa-devel][PATCH 2/3] ASoC: fsl_sai: Add support for tdm slots operation Zidan Wang
2015-01-20 12:21   ` Zidan Wang
2015-01-20 12:21   ` [PATCH " Zidan Wang
2015-01-21 18:08   ` [alsa-devel][PATCH " Nicolin Chen
2015-01-21 18:08     ` Nicolin Chen
2015-01-22  4:55     ` Zidan Wang
2015-01-22  4:55       ` Zidan Wang
2015-01-22  4:55       ` Zidan Wang
2015-01-22  5:44       ` Nicolin Chen
2015-01-22  5:44         ` Nicolin Chen
2015-01-22  6:20         ` Zidan Wang
2015-01-22  6:20           ` Zidan Wang
2015-01-22  6:20           ` Zidan Wang
2015-01-22 23:50           ` Nicolin Chen
2015-01-22 23:50             ` Nicolin Chen
2015-01-23  2:55             ` Zidan Wang
2015-01-23  2:55               ` Zidan Wang
2015-01-23  2:55               ` [PATCH " Zidan Wang
2015-01-23  8:27               ` [alsa-devel][PATCH " Nicolin Chen
2015-01-23  8:27                 ` Nicolin Chen
2015-01-20 12:21 ` Zidan Wang [this message]
2015-01-20 12:21   ` [alsa-devel][PATCH 3/3] ASoC: fsl_sai: Add support for Right-J mode Zidan Wang
2015-01-20 12:21   ` [PATCH " Zidan Wang
2015-01-21 18:53   ` [alsa-devel][PATCH " Nicolin Chen
2015-01-21 18:53     ` Nicolin Chen
2015-01-22  5:13     ` Zidan Wang
2015-01-22  5:13       ` Zidan Wang
2015-01-22  5:13       ` Zidan Wang
2015-01-22  5:46       ` Nicolin Chen
2015-01-22  5:46         ` Nicolin Chen
2015-01-21  1:15 ` [alsa-devel] [PATCH 0/3] Add master mode, tmd and right-j mode support Fabio Estevam
2015-01-21  1:15   ` Fabio Estevam
2015-01-21  6:29   ` Nicolin Chen
2015-01-21  6:29     ` Nicolin Chen

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=1421756480-7055-4-git-send-email-zidan.wang@freescale.com \
    --to=zidan.wang@freescale.com \
    --cc=Xiubo.Lee@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=nicoleotsuka@gmail.com \
    --cc=perex@perex.cz \
    --cc=timur@tabi.org \
    --cc=tiwai@suse.de \
    /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.