Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ASoC: rt5677: fixed wrong DMIC ref clock
@ 2015-04-28  3:27 Bard Liao
  2015-04-28  3:27 ` [PATCH 2/2] ASoC: rt5677: add i2s asrc clk src selection Bard Liao
  2015-04-29 11:20 ` [PATCH 1/2] ASoC: rt5677: fixed wrong DMIC ref clock Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Bard Liao @ 2015-04-28  3:27 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: oder_chiou, alsa-devel, lars, koro.chen, john.lin, Bard Liao,
	flove

DMIC clock source is not from codec system clock directly. it is
generated from the division of system clock. And it should be 256 *
sample rate of AIF1.

Signed-off-by: Bard Liao <bardliao@realtek.com>
---
 sound/soc/codecs/rt5677.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c
index fbe16ba..dca64ae 100644
--- a/sound/soc/codecs/rt5677.c
+++ b/sound/soc/codecs/rt5677.c
@@ -917,7 +917,7 @@ static int set_dmic_clk(struct snd_soc_dapm_widget *w,
 {
 	struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
 	struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
-	int idx = rl6231_calc_dmic_clk(rt5677->sysclk);
+	int idx = rl6231_calc_dmic_clk(rt5677->lrck[RT5677_AIF1] << 8);
 
 	if (idx < 0)
 		dev_err(codec->dev, "Failed to set DMIC clock\n");
-- 
1.8.1.1.439.g50a6b54

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] ASoC: rt5677: add i2s asrc clk src selection
  2015-04-28  3:27 [PATCH 1/2] ASoC: rt5677: fixed wrong DMIC ref clock Bard Liao
@ 2015-04-28  3:27 ` Bard Liao
  2015-04-29 11:20   ` Mark Brown
  2015-04-29 11:20 ` [PATCH 1/2] ASoC: rt5677: fixed wrong DMIC ref clock Mark Brown
  1 sibling, 1 reply; 4+ messages in thread
From: Bard Liao @ 2015-04-28  3:27 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: oder_chiou, alsa-devel, lars, koro.chen, john.lin, Bard Liao,
	flove

The ASRC source of i2s are also configurable. We add the selection
in the existing rt5677_sel_asrc_clk_src API.

Signed-off-by: Bard Liao <bardliao@realtek.com>
---
 sound/soc/codecs/rt5677.c | 30 ++++++++++++++++++++++++++++++
 sound/soc/codecs/rt5677.h | 14 ++++++++++++++
 2 files changed, 44 insertions(+)

diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c
index dca64ae..685e268 100644
--- a/sound/soc/codecs/rt5677.c
+++ b/sound/soc/codecs/rt5677.c
@@ -1060,6 +1060,7 @@ int rt5677_sel_asrc_clk_src(struct snd_soc_codec *codec,
 	unsigned int asrc5_mask = 0, asrc5_value = 0;
 	unsigned int asrc6_mask = 0, asrc6_value = 0;
 	unsigned int asrc7_mask = 0, asrc7_value = 0;
+	unsigned int asrc8_mask = 0, asrc8_value = 0;
 
 	switch (clk_src) {
 	case RT5677_CLK_SEL_SYS:
@@ -1196,6 +1197,35 @@ int rt5677_sel_asrc_clk_src(struct snd_soc_codec *codec,
 		regmap_update_bits(rt5677->regmap, RT5677_ASRC_7, asrc7_mask,
 			asrc7_value);
 
+	/* ASRC 8 */
+	if (filter_mask & RT5677_I2S1_SOURCE) {
+		asrc8_mask |= RT5677_I2S1_CLK_SEL_MASK;
+		asrc8_value = (asrc8_value & ~RT5677_I2S1_CLK_SEL_MASK)
+			| ((clk_src - 1) << RT5677_I2S1_CLK_SEL_SFT);
+	}
+
+	if (filter_mask & RT5677_I2S2_SOURCE) {
+		asrc8_mask |= RT5677_I2S2_CLK_SEL_MASK;
+		asrc8_value = (asrc8_value & ~RT5677_I2S2_CLK_SEL_MASK)
+			| ((clk_src - 1) << RT5677_I2S2_CLK_SEL_SFT);
+	}
+
+	if (filter_mask & RT5677_I2S3_SOURCE) {
+		asrc8_mask |= RT5677_I2S3_CLK_SEL_MASK;
+		asrc8_value = (asrc8_value & ~RT5677_I2S3_CLK_SEL_MASK)
+			| ((clk_src - 1) << RT5677_I2S3_CLK_SEL_SFT);
+	}
+
+	if (filter_mask & RT5677_I2S4_SOURCE) {
+		asrc8_mask |= RT5677_I2S4_CLK_SEL_MASK;
+		asrc8_value = (asrc8_value & ~RT5677_I2S4_CLK_SEL_MASK)
+			| ((clk_src - 1) << RT5677_I2S4_CLK_SEL_SFT);
+	}
+
+	if (asrc8_mask)
+		regmap_update_bits(rt5677->regmap, RT5677_ASRC_8, asrc8_mask,
+			asrc8_value);
+
 	return 0;
 }
 EXPORT_SYMBOL_GPL(rt5677_sel_asrc_clk_src);
diff --git a/sound/soc/codecs/rt5677.h b/sound/soc/codecs/rt5677.h
index 9dceb41..62571d0 100644
--- a/sound/soc/codecs/rt5677.h
+++ b/sound/soc/codecs/rt5677.h
@@ -1446,6 +1446,16 @@
 #define RT5677_DSP_OB_4_7_CLK_SEL_MASK		(0xf << 8)
 #define RT5677_DSP_OB_4_7_CLK_SEL_SFT		8
 
+/* ASRC Control 8 (0x8a) */
+#define RT5677_I2S1_CLK_SEL_MASK		(0xf << 12)
+#define RT5677_I2S1_CLK_SEL_SFT			12
+#define RT5677_I2S2_CLK_SEL_MASK		(0xf << 8)
+#define RT5677_I2S2_CLK_SEL_SFT			8
+#define RT5677_I2S3_CLK_SEL_MASK		(0xf << 4)
+#define RT5677_I2S3_CLK_SEL_SFT			4
+#define RT5677_I2S4_CLK_SEL_MASK		(0xf)
+#define RT5677_I2S4_CLK_SEL_SFT			0
+
 /* VAD Function Control 4 (0x9f) */
 #define RT5677_VAD_SRC_MASK			(0x7 << 8)
 #define RT5677_VAD_SRC_SFT			8
@@ -1744,6 +1754,10 @@ enum {
 	RT5677_AD_MONO_R_FILTER = (0x1 << 12),
 	RT5677_DSP_OB_0_3_FILTER = (0x1 << 13),
 	RT5677_DSP_OB_4_7_FILTER = (0x1 << 14),
+	RT5677_I2S1_SOURCE = (0x1 << 15),
+	RT5677_I2S2_SOURCE = (0x1 << 16),
+	RT5677_I2S3_SOURCE = (0x1 << 17),
+	RT5677_I2S4_SOURCE = (0x1 << 18),
 };
 
 struct rt5677_priv {
-- 
1.8.1.1.439.g50a6b54

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] ASoC: rt5677: fixed wrong DMIC ref clock
  2015-04-28  3:27 [PATCH 1/2] ASoC: rt5677: fixed wrong DMIC ref clock Bard Liao
  2015-04-28  3:27 ` [PATCH 2/2] ASoC: rt5677: add i2s asrc clk src selection Bard Liao
@ 2015-04-29 11:20 ` Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2015-04-29 11:20 UTC (permalink / raw)
  To: Bard Liao
  Cc: oder_chiou, alsa-devel, lars, lgirdwood, john.lin, koro.chen,
	flove


[-- Attachment #1.1: Type: text/plain, Size: 237 bytes --]

On Tue, Apr 28, 2015 at 11:27:39AM +0800, Bard Liao wrote:
> DMIC clock source is not from codec system clock directly. it is
> generated from the division of system clock. And it should be 256 *
> sample rate of AIF1.

Applied, thanks.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] ASoC: rt5677: add i2s asrc clk src selection
  2015-04-28  3:27 ` [PATCH 2/2] ASoC: rt5677: add i2s asrc clk src selection Bard Liao
@ 2015-04-29 11:20   ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2015-04-29 11:20 UTC (permalink / raw)
  To: Bard Liao
  Cc: oder_chiou, alsa-devel, lars, lgirdwood, john.lin, koro.chen,
	flove


[-- Attachment #1.1: Type: text/plain, Size: 193 bytes --]

On Tue, Apr 28, 2015 at 11:27:40AM +0800, Bard Liao wrote:
> The ASRC source of i2s are also configurable. We add the selection
> in the existing rt5677_sel_asrc_clk_src API.

Applied, thanks.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-04-29 11:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-28  3:27 [PATCH 1/2] ASoC: rt5677: fixed wrong DMIC ref clock Bard Liao
2015-04-28  3:27 ` [PATCH 2/2] ASoC: rt5677: add i2s asrc clk src selection Bard Liao
2015-04-29 11:20   ` Mark Brown
2015-04-29 11:20 ` [PATCH 1/2] ASoC: rt5677: fixed wrong DMIC ref clock Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox