Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ASoC: rt5677: Use the regmap functions instead of the snd_soc functions
@ 2015-01-13  3:13 Oder Chiou
  2015-01-13  3:13 ` [PATCH 2/2 v2] ASoC: rt5677: Add the slot_width "25" support in the TDM mode Oder Chiou
  2015-01-14 17:20 ` [PATCH 1/2] ASoC: rt5677: Use the regmap functions instead of the snd_soc functions Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Oder Chiou @ 2015-01-13  3:13 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: Oder Chiou, alsa-devel, yang.a.fang, john.lin, bardliao, flove

The patch uses the regmap functions instead of the snd_soc functions in some
cases.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
---
 sound/soc/codecs/rt5677.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c
index 32c368c..24fc592 100644
--- a/sound/soc/codecs/rt5677.c
+++ b/sound/soc/codecs/rt5677.c
@@ -925,6 +925,8 @@ static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source,
 static int is_using_asrc(struct snd_soc_dapm_widget *source,
 			 struct snd_soc_dapm_widget *sink)
 {
+	struct snd_soc_codec *codec = source->codec;
+	struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
 	unsigned int reg, shift, val;
 
 	if (source->reg == RT5677_ASRC_1) {
@@ -991,7 +993,9 @@ static int is_using_asrc(struct snd_soc_dapm_widget *source,
 		}
 	}
 
-	val = (snd_soc_read(source->codec, reg) >> shift) & 0xf;
+	regmap_read(rt5677->regmap, reg, &val);
+	val = (val >> shift) & 0xf;
+
 	switch (val) {
 	case 1 ... 6:
 		return 1;
@@ -4098,6 +4102,7 @@ static int rt5677_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
 			unsigned int rx_mask, int slots, int slot_width)
 {
 	struct snd_soc_codec *codec = dai->codec;
+	struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
 	unsigned int val = 0;
 
 	if (rx_mask || tx_mask)
@@ -4135,10 +4140,12 @@ static int rt5677_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
 
 	switch (dai->id) {
 	case RT5677_AIF1:
-		snd_soc_update_bits(codec, RT5677_TDM1_CTRL1, 0x1f00, val);
+		regmap_update_bits(rt5677->regmap, RT5677_TDM1_CTRL1, 0x1f00,
+			val);
 		break;
 	case RT5677_AIF2:
-		snd_soc_update_bits(codec, RT5677_TDM2_CTRL1, 0x1f00, val);
+		regmap_update_bits(rt5677->regmap, RT5677_TDM2_CTRL1, 0x1f00,
+			val);
 		break;
 	default:
 		break;
-- 
1.8.1.1.439.g50a6b54

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

* [PATCH 2/2 v2] ASoC: rt5677: Add the slot_width "25" support in the TDM mode
  2015-01-13  3:13 [PATCH 1/2] ASoC: rt5677: Use the regmap functions instead of the snd_soc functions Oder Chiou
@ 2015-01-13  3:13 ` Oder Chiou
  2015-01-14 17:20 ` [PATCH 1/2] ASoC: rt5677: Use the regmap functions instead of the snd_soc functions Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Oder Chiou @ 2015-01-13  3:13 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: Oder Chiou, alsa-devel, yang.a.fang, john.lin, bardliao, flove

Add the slot_width "25" support in the TDM mode for the Intel platform.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
---
 sound/soc/codecs/rt5677.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c
index 24fc592..a683e69 100644
--- a/sound/soc/codecs/rt5677.c
+++ b/sound/soc/codecs/rt5677.c
@@ -4103,7 +4103,7 @@ static int rt5677_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
 {
 	struct snd_soc_codec *codec = dai->codec;
 	struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
-	unsigned int val = 0;
+	unsigned int val = 0, slot_width_25 = 0;
 
 	if (rx_mask || tx_mask)
 		val |= (1 << 12);
@@ -4127,6 +4127,8 @@ static int rt5677_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
 	case 20:
 		val |= (1 << 8);
 		break;
+	case 25:
+		slot_width_25 = 0x8080;
 	case 24:
 		val |= (2 << 8);
 		break;
@@ -4142,10 +4144,14 @@ static int rt5677_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
 	case RT5677_AIF1:
 		regmap_update_bits(rt5677->regmap, RT5677_TDM1_CTRL1, 0x1f00,
 			val);
+		regmap_update_bits(rt5677->regmap, RT5677_DIG_MISC, 0x8000,
+			slot_width_25);
 		break;
 	case RT5677_AIF2:
 		regmap_update_bits(rt5677->regmap, RT5677_TDM2_CTRL1, 0x1f00,
 			val);
+		regmap_update_bits(rt5677->regmap, RT5677_DIG_MISC, 0x80,
+			slot_width_25);
 		break;
 	default:
 		break;
-- 
1.8.1.1.439.g50a6b54

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

* Re: [PATCH 1/2] ASoC: rt5677: Use the regmap functions instead of the snd_soc functions
  2015-01-13  3:13 [PATCH 1/2] ASoC: rt5677: Use the regmap functions instead of the snd_soc functions Oder Chiou
  2015-01-13  3:13 ` [PATCH 2/2 v2] ASoC: rt5677: Add the slot_width "25" support in the TDM mode Oder Chiou
@ 2015-01-14 17:20 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2015-01-14 17:20 UTC (permalink / raw)
  To: Oder Chiou; +Cc: alsa-devel, yang.a.fang, lgirdwood, john.lin, bardliao, flove


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

On Tue, Jan 13, 2015 at 11:13:14AM +0800, Oder Chiou wrote:
> The patch uses the regmap functions instead of the snd_soc functions in some
> cases.

Applied both, 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] 3+ messages in thread

end of thread, other threads:[~2015-01-14 17:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-13  3:13 [PATCH 1/2] ASoC: rt5677: Use the regmap functions instead of the snd_soc functions Oder Chiou
2015-01-13  3:13 ` [PATCH 2/2 v2] ASoC: rt5677: Add the slot_width "25" support in the TDM mode Oder Chiou
2015-01-14 17:20 ` [PATCH 1/2] ASoC: rt5677: Use the regmap functions instead of the snd_soc functions Mark Brown

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