Commit 1b68c7dc authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Mark Brown

ASoC: tas2552: Correct and clean up data format and BCLK/WCLK direction

Use names from the datasheet for the definitions.
Correct the data format definitions since they were not correct.
Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 4c331373
...@@ -188,9 +188,9 @@ static int tas2552_hw_params(struct snd_pcm_substream *substream, ...@@ -188,9 +188,9 @@ static int tas2552_hw_params(struct snd_pcm_substream *substream,
return 0; return 0;
} }
#define TAS2552_DAI_FMT_MASK (TAS2552_BIT_CLK_MASK | \ #define TAS2552_DAI_FMT_MASK (TAS2552_BCLKDIR | \
TAS2552_WORD_CLK_MASK | \ TAS2552_WCLKDIR | \
TAS2552_DATA_FORMAT_MASK) TAS2552_DATAFORMAT_MASK)
static int tas2552_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) static int tas2552_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
{ {
struct snd_soc_codec *codec = dai->codec; 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) ...@@ -202,13 +202,13 @@ static int tas2552_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
serial_format = 0x00; serial_format = 0x00;
break; break;
case SND_SOC_DAIFMT_CBS_CFM: case SND_SOC_DAIFMT_CBS_CFM:
serial_format = TAS2552_WORD_CLK_MASK; serial_format = TAS2552_WCLKDIR;
break; break;
case SND_SOC_DAIFMT_CBM_CFS: case SND_SOC_DAIFMT_CBM_CFS:
serial_format = TAS2552_BIT_CLK_MASK; serial_format = TAS2552_BCLKDIR;
break; break;
case SND_SOC_DAIFMT_CBM_CFM: case SND_SOC_DAIFMT_CBM_CFM:
serial_format = (TAS2552_BIT_CLK_MASK | TAS2552_WORD_CLK_MASK); serial_format = (TAS2552_BCLKDIR | TAS2552_WCLKDIR);
break; break;
default: default:
dev_vdbg(codec->dev, "DAI Format master is not found\n"); 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) ...@@ -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): case (SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_IB_NF):
delay = 1; delay = 1;
case (SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_IB_NF): case (SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_IB_NF):
serial_format |= TAS2552_DAIFMT_DSP; serial_format |= TAS2552_DATAFORMAT_DSP;
break; break;
case (SND_SOC_DAIFMT_RIGHT_J | SND_SOC_DAIFMT_NB_NF): case (SND_SOC_DAIFMT_RIGHT_J | SND_SOC_DAIFMT_NB_NF):
serial_format |= TAS2552_DAIFMT_RIGHT_J; serial_format |= TAS2552_DATAFORMAT_RIGHT_J;
break; break;
case (SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_NB_NF): case (SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_NB_NF):
serial_format |= TAS2552_DAIFMT_LEFT_J; serial_format |= TAS2552_DATAFORMAT_LEFT_J;
break; break;
default: default:
dev_vdbg(codec->dev, "DAI Format is not found\n"); dev_vdbg(codec->dev, "DAI Format is not found\n");
......
...@@ -62,15 +62,14 @@ ...@@ -62,15 +62,14 @@
#define TAS2552_LIM_EN (1 << 2) #define TAS2552_LIM_EN (1 << 2)
#define TAS2552_IVSENSE_EN (1 << 1) #define TAS2552_IVSENSE_EN (1 << 1)
/* CFG3 Register Masks */ /* Serial Interface Control Register Masks */
#define TAS2552_WORD_CLK_MASK (1 << 7) #define TAS2552_DATAFORMAT_I2S (0x0 << 2)
#define TAS2552_BIT_CLK_MASK (1 << 6) #define TAS2552_DATAFORMAT_DSP (0x1 << 2)
#define TAS2552_DATA_FORMAT_MASK (0x11 << 2) #define TAS2552_DATAFORMAT_RIGHT_J (0x2 << 2)
#define TAS2552_DATAFORMAT_LEFT_J (0x3 << 2)
#define TAS2552_DAIFMT_I2S_MASK 0xf3 #define TAS2552_DATAFORMAT_MASK TAS2552_DATAFORMAT_LEFT_J
#define TAS2552_DAIFMT_DSP (1 << 3) #define TAS2552_BCLKDIR (1 << 6)
#define TAS2552_DAIFMT_RIGHT_J (1 << 4) #define TAS2552_WCLKDIR (1 << 7)
#define TAS2552_DAIFMT_LEFT_J (0x11 << 3)
#define TAS2552_DIN_SRC_SEL_MUTED 0x00 #define TAS2552_DIN_SRC_SEL_MUTED 0x00
#define TAS2552_DIN_SRC_SEL_LEFT (1 << 4) #define TAS2552_DIN_SRC_SEL_LEFT (1 << 4)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment