Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: Mark Brown <broonie@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	dmurphy@ti.com
Cc: alsa-devel@alsa-project.org
Subject: [PATCH v2 12/23] ASoC: tas2552: Correct and clean up data format and BCLK/WCLK direction
Date: Thu, 4 Jun 2015 16:04:24 +0300	[thread overview]
Message-ID: <1433423075-14142-13-git-send-email-peter.ujfalusi@ti.com> (raw)
In-Reply-To: <1433423075-14142-1-git-send-email-peter.ujfalusi@ti.com>

Use names from the datasheet for the definitions.
Correct the data format definitions since they were not correct.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 sound/soc/codecs/tas2552.c | 18 +++++++++---------
 sound/soc/codecs/tas2552.h | 17 ++++++++---------
 2 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/sound/soc/codecs/tas2552.c b/sound/soc/codecs/tas2552.c
index 2f4c2b52a9fa..7615d1bc5f5d 100644
--- a/sound/soc/codecs/tas2552.c
+++ b/sound/soc/codecs/tas2552.c
@@ -188,9 +188,9 @@ static int tas2552_hw_params(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-#define TAS2552_DAI_FMT_MASK	(TAS2552_BIT_CLK_MASK | \
-				 TAS2552_WORD_CLK_MASK | \
-				 TAS2552_DATA_FORMAT_MASK)
+#define TAS2552_DAI_FMT_MASK	(TAS2552_BCLKDIR | \
+				 TAS2552_WCLKDIR | \
+				 TAS2552_DATAFORMAT_MASK)
 static int tas2552_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
 {
 	struct snd_soc_codec *codec = dai->codec;
@@ -202,13 +202,13 @@ static int tas2552_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
 		serial_format = 0x00;
 		break;
 	case SND_SOC_DAIFMT_CBS_CFM:
-		serial_format = TAS2552_WORD_CLK_MASK;
+		serial_format = TAS2552_WCLKDIR;
 		break;
 	case SND_SOC_DAIFMT_CBM_CFS:
-		serial_format = TAS2552_BIT_CLK_MASK;
+		serial_format = TAS2552_BCLKDIR;
 		break;
 	case SND_SOC_DAIFMT_CBM_CFM:
-		serial_format = (TAS2552_BIT_CLK_MASK | TAS2552_WORD_CLK_MASK);
+		serial_format = (TAS2552_BCLKDIR | TAS2552_WCLKDIR);
 		break;
 	default:
 		dev_vdbg(codec->dev, "DAI Format master is not found\n");
@@ -222,13 +222,13 @@ static int tas2552_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
 	case (SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_IB_NF):
 		delay = 1;
 	case (SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_IB_NF):
-		serial_format |= TAS2552_DAIFMT_DSP;
+		serial_format |= TAS2552_DATAFORMAT_DSP;
 		break;
 	case (SND_SOC_DAIFMT_RIGHT_J | SND_SOC_DAIFMT_NB_NF):
-		serial_format |= TAS2552_DAIFMT_RIGHT_J;
+		serial_format |= TAS2552_DATAFORMAT_RIGHT_J;
 		break;
 	case (SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_NB_NF):
-		serial_format |= TAS2552_DAIFMT_LEFT_J;
+		serial_format |= TAS2552_DATAFORMAT_LEFT_J;
 		break;
 	default:
 		dev_vdbg(codec->dev, "DAI Format is not found\n");
diff --git a/sound/soc/codecs/tas2552.h b/sound/soc/codecs/tas2552.h
index 0725befb4c41..0a12b511e951 100644
--- a/sound/soc/codecs/tas2552.h
+++ b/sound/soc/codecs/tas2552.h
@@ -62,15 +62,14 @@
 #define TAS2552_LIM_EN			(1 << 2)
 #define TAS2552_IVSENSE_EN		(1 << 1)
 
-/* CFG3 Register Masks */
-#define TAS2552_WORD_CLK_MASK		(1 << 7)
-#define TAS2552_BIT_CLK_MASK		(1 << 6)
-#define TAS2552_DATA_FORMAT_MASK	(0x11 << 2)
-
-#define TAS2552_DAIFMT_I2S_MASK		0xf3
-#define TAS2552_DAIFMT_DSP			(1 << 3)
-#define TAS2552_DAIFMT_RIGHT_J		(1 << 4)
-#define TAS2552_DAIFMT_LEFT_J		(0x11 << 3)
+/* Serial Interface Control Register Masks */
+#define TAS2552_DATAFORMAT_I2S		(0x0 << 2)
+#define TAS2552_DATAFORMAT_DSP		(0x1 << 2)
+#define TAS2552_DATAFORMAT_RIGHT_J	(0x2 << 2)
+#define TAS2552_DATAFORMAT_LEFT_J	(0x3 << 2)
+#define TAS2552_DATAFORMAT_MASK		TAS2552_DATAFORMAT_LEFT_J
+#define TAS2552_BCLKDIR			(1 << 6)
+#define TAS2552_WCLKDIR			(1 << 7)
 
 #define TAS2552_DIN_SRC_SEL_MUTED	0x00
 #define TAS2552_DIN_SRC_SEL_LEFT	(1 << 4)
-- 
2.4.2

  parent reply	other threads:[~2015-06-04 13:05 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-04 13:04 [PATCH v2 00/23] ASoC: tas2552: Fixes, cleanups and improvements Peter Ujfalusi
2015-06-04 13:04 ` [PATCH v2 01/23] ASoC: tas2552: Make the enable-gpio really optional Peter Ujfalusi
2015-06-04 13:04 ` [PATCH v2 02/23] ASoC: tas2552: Fix kernel crash when the codec is loaded but not part of a card Peter Ujfalusi
2015-06-04 16:25   ` Mark Brown
2015-06-05  6:57     ` Peter Ujfalusi
2015-06-04 16:50   ` Mark Brown
2015-06-04 13:04 ` [PATCH v2 03/23] ASoC: tas2552: Fix kernel crash caused by wrong kcontrol entry Peter Ujfalusi
2015-06-04 13:04 ` [PATCH v2 04/23] ASoC: tas2552: Correct PDM configuration register bit definitions Peter Ujfalusi
2015-06-04 13:04 ` [PATCH v2 05/23] ASoC: tas2552: Correct CFG1 " Peter Ujfalusi
2015-06-04 13:04 ` [PATCH v2 06/23] ASoC: tas2552: Simplify the tas2552_mute function Peter Ujfalusi
2015-06-04 13:04 ` [PATCH v2 07/23] ASoC: tas2552: Simplify and reverse the functionality of tas2552_sw_shutdown Peter Ujfalusi
2015-06-04 13:04 ` [PATCH v2 08/23] ASoC: tas2552: Rename mclk parameter to pll_clkin to match with the datasheet Peter Ujfalusi
2015-06-04 16:51   ` Mark Brown
2015-06-04 13:04 ` [PATCH v2 09/23] DT/sound: bindings header file for tas2552 codec Peter Ujfalusi
2015-06-05 17:54   ` Mark Brown
2015-06-04 13:04 ` [PATCH v2 10/23] ASoC: tas2552: Add support for pll and pdm source clock selection Peter Ujfalusi
2015-06-04 13:04 ` [PATCH v2 11/23] ASoC: tas2552: Correct dai format support Peter Ujfalusi
2015-06-04 13:04 ` Peter Ujfalusi [this message]
2015-06-04 13:04 ` [PATCH v2 13/23] ASoC: tas2552: Add TDM support Peter Ujfalusi
2015-06-04 13:04 ` [PATCH v2 14/23] ASoC: tas2552: Clean up the Digital - Analog DAPM route definition Peter Ujfalusi
2015-06-04 13:04 ` [PATCH v2 15/23] ASoC: tas2552: Correct the Speaker Driver Playback Volume (PGA_GAIN) Peter Ujfalusi
2015-06-04 13:04 ` [PATCH v2 16/23] ASoC: tas2552: Implement startup/stop sequence as per TRM Peter Ujfalusi
2015-06-04 13:04 ` [PATCH v2 17/23] ASoC: tas2552: Add support for word length configuration Peter Ujfalusi
2015-06-04 13:04 ` [PATCH v2 18/23] ASoC: tas2552: Configure the WCLK frequency based on the stream Peter Ujfalusi
2015-06-04 13:04 ` [PATCH v2 19/23] ASoC: tas2552: Correct the PLL configuration Peter Ujfalusi
2015-06-05  6:53   ` Peter Ujfalusi
2015-06-04 13:04 ` [PATCH v2 20/23] ASoC: tas2552: Add control for selecting DIN source Peter Ujfalusi
2015-06-04 13:04 ` [PATCH v2 21/23] ASoC: tas2552: Correct Output Data register usage Peter Ujfalusi
2015-06-04 13:04 ` [PATCH v2 22/23] ASoC: tas2552: Correct Boost Auto-Pass Through Control " Peter Ujfalusi
2015-06-04 13:04 ` [PATCH v2 23/23] ASoC: tas2552: Code, define alignment changes for uniformity Peter Ujfalusi
2015-06-05 17:53 ` [PATCH v2 00/23] ASoC: tas2552: Fixes, cleanups and improvements Mark Brown
2015-06-08  7:52   ` Peter Ujfalusi
2015-06-08  9:24     ` Mark Brown
2015-06-08  9:54       ` Peter Ujfalusi

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=1433423075-14142-13-git-send-email-peter.ujfalusi@ti.com \
    --to=peter.ujfalusi@ti.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=dmurphy@ti.com \
    --cc=lgirdwood@gmail.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