alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] ASoC: ab8500: Downgrade noisy log message
@ 2013-09-20  9:39 Mark Brown
  2013-09-20  9:39 ` [PATCH 2/3] ASoC: ab8500: Use ASoC I/O functions Mark Brown
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Mark Brown @ 2013-09-20  9:39 UTC (permalink / raw)
  To: Lee Jones, Liam Girdwood; +Cc: alsa-devel, linaro-kernel, Mark Brown

From: Mark Brown <broonie@linaro.org>

Signed-off-by: Mark Brown <broonie@linaro.org>
---
 sound/soc/codecs/ab8500-codec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/ab8500-codec.c b/sound/soc/codecs/ab8500-codec.c
index 80555d7..2726e5a 100644
--- a/sound/soc/codecs/ab8500-codec.c
+++ b/sound/soc/codecs/ab8500-codec.c
@@ -2606,7 +2606,7 @@ static int ab8500_codec_driver_probe(struct platform_device *pdev)
 
 static int ab8500_codec_driver_remove(struct platform_device *pdev)
 {
-	dev_info(&pdev->dev, "%s Enter.\n", __func__);
+	dev_dbg(&pdev->dev, "%s Enter.\n", __func__);
 
 	snd_soc_unregister_codec(&pdev->dev);
 
-- 
1.8.4.rc3

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

* [PATCH 2/3] ASoC: ab8500: Use ASoC I/O functions
  2013-09-20  9:39 [PATCH 1/3] ASoC: ab8500: Downgrade noisy log message Mark Brown
@ 2013-09-20  9:39 ` Mark Brown
  2013-09-20  9:39 ` [PATCH 3/3] ASoC: ab8500: Convert register I/O to regmap Mark Brown
  2013-09-20 12:09 ` [PATCH 1/3] ASoC: ab8500: Downgrade noisy log message Lee Jones
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2013-09-20  9:39 UTC (permalink / raw)
  To: Lee Jones, Liam Girdwood; +Cc: alsa-devel, linaro-kernel, Mark Brown

From: Mark Brown <broonie@linaro.org>

In preparation for moving away from implementing the ASoC level register
I/O functionality change direct calls to the ab8500 implementation of that
to use snd_soc_write()

Signed-off-by: Mark Brown <broonie@linaro.org>
---
 sound/soc/codecs/ab8500-codec.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/sound/soc/codecs/ab8500-codec.c b/sound/soc/codecs/ab8500-codec.c
index 2726e5a..7990217 100644
--- a/sound/soc/codecs/ab8500-codec.c
+++ b/sound/soc/codecs/ab8500-codec.c
@@ -2532,12 +2532,10 @@ static int ab8500_codec_probe(struct snd_soc_codec *codec)
 	}
 
 	/* Override HW-defaults */
-	ab8500_codec_write_reg(codec,
-				AB8500_ANACONF5,
-				BIT(AB8500_ANACONF5_HSAUTOEN));
-	ab8500_codec_write_reg(codec,
-				AB8500_SHORTCIRCONF,
-				BIT(AB8500_SHORTCIRCONF_HSZCDDIS));
+	snd_soc_write(codec, AB8500_ANACONF5,
+		      BIT(AB8500_ANACONF5_HSAUTOEN));
+	snd_soc_write(codec, AB8500_SHORTCIRCONF,
+		      BIT(AB8500_SHORTCIRCONF_HSZCDDIS));
 
 	/* Add filter controls */
 	status = snd_soc_add_codec_controls(codec, ab8500_filter_controls,
-- 
1.8.4.rc3

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

* [PATCH 3/3] ASoC: ab8500: Convert register I/O to regmap
  2013-09-20  9:39 [PATCH 1/3] ASoC: ab8500: Downgrade noisy log message Mark Brown
  2013-09-20  9:39 ` [PATCH 2/3] ASoC: ab8500: Use ASoC I/O functions Mark Brown
@ 2013-09-20  9:39 ` Mark Brown
  2013-09-20 12:09 ` [PATCH 1/3] ASoC: ab8500: Downgrade noisy log message Lee Jones
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2013-09-20  9:39 UTC (permalink / raw)
  To: Lee Jones, Liam Girdwood; +Cc: alsa-devel, linaro-kernel, Mark Brown

From: Mark Brown <broonie@linaro.org>

As part of a general push to eliminate the duplicated register I/O support
in ASoC convert ab8500 to use regmap.

Signed-off-by: Mark Brown <broonie@linaro.org>
---
 sound/soc/codecs/ab8500-codec.c | 64 +++++++++++++++++++----------------------
 1 file changed, 30 insertions(+), 34 deletions(-)

diff --git a/sound/soc/codecs/ab8500-codec.c b/sound/soc/codecs/ab8500-codec.c
index 7990217..ca500fd 100644
--- a/sound/soc/codecs/ab8500-codec.c
+++ b/sound/soc/codecs/ab8500-codec.c
@@ -126,6 +126,8 @@ struct ab8500_codec_drvdata_dbg {
 
 /* Private data for AB8500 device-driver */
 struct ab8500_codec_drvdata {
+	struct regmap *regmap;
+
 	/* Sidetone */
 	long *sid_fir_values;
 	enum sid_state sid_status;
@@ -166,49 +168,35 @@ static inline const char *amic_type_str(enum amic_type type)
  */
 
 /* Read a register from the audio-bank of AB8500 */
-static unsigned int ab8500_codec_read_reg(struct snd_soc_codec *codec,
-					unsigned int reg)
+static int ab8500_codec_read_reg(void *context, unsigned int reg,
+				 unsigned int *value)
 {
+	struct device *dev = context;
 	int status;
-	unsigned int value = 0;
 
 	u8 value8;
-	status = abx500_get_register_interruptible(codec->dev, AB8500_AUDIO,
-						reg, &value8);
-	if (status < 0) {
-		dev_err(codec->dev,
-			"%s: ERROR: Register (0x%02x:0x%02x) read failed (%d).\n",
-			__func__, (u8)AB8500_AUDIO, (u8)reg, status);
-	} else {
-		dev_dbg(codec->dev,
-			"%s: Read 0x%02x from register 0x%02x:0x%02x\n",
-			__func__, value8, (u8)AB8500_AUDIO, (u8)reg);
-		value = (unsigned int)value8;
-	}
+	status = abx500_get_register_interruptible(dev, AB8500_AUDIO,
+						   reg, &value8);
+	*value = (unsigned int)value8;
 
-	return value;
+	return status;
 }
 
 /* Write to a register in the audio-bank of AB8500 */
-static int ab8500_codec_write_reg(struct snd_soc_codec *codec,
-				unsigned int reg, unsigned int value)
+static int ab8500_codec_write_reg(void *context, unsigned int reg,
+				  unsigned int value)
 {
-	int status;
+	struct device *dev = context;
 
-	status = abx500_set_register_interruptible(codec->dev, AB8500_AUDIO,
-						reg, value);
-	if (status < 0)
-		dev_err(codec->dev,
-			"%s: ERROR: Register (%02x:%02x) write failed (%d).\n",
-			__func__, (u8)AB8500_AUDIO, (u8)reg, status);
-	else
-		dev_dbg(codec->dev,
-			"%s: Wrote 0x%02x into register %02x:%02x\n",
-			__func__, (u8)value, (u8)AB8500_AUDIO, (u8)reg);
-
-	return status;
+	return abx500_set_register_interruptible(dev, AB8500_AUDIO,
+						 reg, value);
 }
 
+static const struct regmap_config ab8500_codec_regmap = {
+	.reg_read = ab8500_codec_read_reg,
+	.reg_write = ab8500_codec_write_reg,
+};
+
 /*
  * Controls - DAPM
  */
@@ -2488,6 +2476,8 @@ static int ab8500_codec_probe(struct snd_soc_codec *codec)
 	/* Setup AB8500 according to board-settings */
 	pdata = dev_get_platdata(dev->parent);
 
+	codec->control_data = drvdata->regmap;
+
 	if (np) {
 		if (!pdata)
 			pdata = devm_kzalloc(dev,
@@ -2565,9 +2555,6 @@ static int ab8500_codec_probe(struct snd_soc_codec *codec)
 
 static struct snd_soc_codec_driver ab8500_codec_driver = {
 	.probe =		ab8500_codec_probe,
-	.read =			ab8500_codec_read_reg,
-	.write =		ab8500_codec_write_reg,
-	.reg_word_size =	sizeof(u8),
 	.controls =		ab8500_ctrls,
 	.num_controls =		ARRAY_SIZE(ab8500_ctrls),
 	.dapm_widgets =		ab8500_dapm_widgets,
@@ -2590,6 +2577,15 @@ static int ab8500_codec_driver_probe(struct platform_device *pdev)
 	drvdata->anc_status = ANC_UNCONFIGURED;
 	dev_set_drvdata(&pdev->dev, drvdata);
 
+	drvdata->regmap = devm_regmap_init(&pdev->dev, NULL, &pdev->dev,
+					   &ab8500_codec_regmap);
+	if (IS_ERR(drvdata->regmap)) {
+		status = PTR_ERR(drvdata->regmap);
+		dev_err(&pdev->dev, "%s: Failed to allocate regmap: %d\n",
+			__func__, status);
+		return status;
+	}
+
 	dev_dbg(&pdev->dev, "%s: Register codec.\n", __func__);
 	status = snd_soc_register_codec(&pdev->dev, &ab8500_codec_driver,
 				ab8500_codec_dai,
-- 
1.8.4.rc3

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

* Re: [PATCH 1/3] ASoC: ab8500: Downgrade noisy log message
  2013-09-20  9:39 [PATCH 1/3] ASoC: ab8500: Downgrade noisy log message Mark Brown
  2013-09-20  9:39 ` [PATCH 2/3] ASoC: ab8500: Use ASoC I/O functions Mark Brown
  2013-09-20  9:39 ` [PATCH 3/3] ASoC: ab8500: Convert register I/O to regmap Mark Brown
@ 2013-09-20 12:09 ` Lee Jones
  2 siblings, 0 replies; 4+ messages in thread
From: Lee Jones @ 2013-09-20 12:09 UTC (permalink / raw)
  To: Mark Brown; +Cc: linaro-kernel, alsa-devel, Liam Girdwood, Mark Brown

On Fri, 20 Sep 2013, Mark Brown wrote:

> From: Mark Brown <broonie@linaro.org>
> 
> Signed-off-by: Mark Brown <broonie@linaro.org>
> ---
>  sound/soc/codecs/ab8500-codec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

FWIW: All 3 patches look good to me:

Acked-by: Lee Jones <lee.jones@linaro.org>

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

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

end of thread, other threads:[~2013-09-20 12:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-20  9:39 [PATCH 1/3] ASoC: ab8500: Downgrade noisy log message Mark Brown
2013-09-20  9:39 ` [PATCH 2/3] ASoC: ab8500: Use ASoC I/O functions Mark Brown
2013-09-20  9:39 ` [PATCH 3/3] ASoC: ab8500: Convert register I/O to regmap Mark Brown
2013-09-20 12:09 ` [PATCH 1/3] ASoC: ab8500: Downgrade noisy log message Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).