alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2 00/11] Remove set_cache_io entirely from ASoC probe
@ 2014-03-26  5:40 Xiubo Li
  2014-03-26  5:40 ` [PATCHv2 01/11] ASoC: core: Move the default regmap I/O setting to snd_soc_register_codec() Xiubo Li
                   ` (12 more replies)
  0 siblings, 13 replies; 15+ messages in thread
From: Xiubo Li @ 2014-03-26  5:40 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: alsa-devel, lars, shc_work, tiwai, viresh.kumar, patches,
	andrew.smirnov, Xiubo Li, akpm, s.trumtrar, rf, ckeepax,
	vinod.koul

Change in v2:
- Add .get_regmap() support for struct snd_soc_codec_driver.


Xiubo Li (11):
  ASoC: core: Move the default regmap I/O setting to
    snd_soc_register_codec()
  ASoc: 88pm860x: Remove the set_cache_io() entirely from ASoC probe.
  ASoc: cq93vc: Remove the set_cache_io() entirely from ASoC probe.
  ASoc: mc13783: Remove the set_cache_io() entirely from ASoC probe.
  ASoc: si476x: Remove the set_cache_io() entirely from ASoC probe.
  ASoc: wm5102: Remove the set_cache_io() entirely from ASoC probe.
  ASoc: wm5110: Remove the set_cache_io() entirely from ASoC probe.
  ASoc: wm8350: Remove the set_cache_io() entirely from ASoC probe.
  ASoc: wm8400: Remove the set_cache_io() entirely from ASoC probe.
  ASoc: wm8994: Remove the set_cache_io() entirely from ASoC probe.
  ASoc: wm8997: Remove the set_cache_io() entirely from ASoC probe.

 include/sound/soc.h               |  1 +
 sound/soc/codecs/88pm860x-codec.c | 12 ++++++++----
 sound/soc/codecs/cq93vc.c         | 10 ++++++++--
 sound/soc/codecs/mc13783.c        | 14 ++++++--------
 sound/soc/codecs/si476x.c         | 14 ++++++--------
 sound/soc/codecs/wm5102.c         | 12 ++++++++----
 sound/soc/codecs/wm5110.c         | 12 ++++++++----
 sound/soc/codecs/wm8350.c         | 10 ++++++++--
 sound/soc/codecs/wm8400.c         | 10 ++++++++--
 sound/soc/codecs/wm8994.c         | 10 ++++++++--
 sound/soc/codecs/wm8997.c         | 13 ++++++++-----
 sound/soc/soc-core.c              | 28 ++++++++++++++++++----------
 sound/soc/soc-io.c                |  9 +++------
 13 files changed, 98 insertions(+), 57 deletions(-)

-- 
1.8.4

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

* [PATCHv2 01/11] ASoC: core: Move the default regmap I/O setting to snd_soc_register_codec()
  2014-03-26  5:40 [PATCHv2 00/11] Remove set_cache_io entirely from ASoC probe Xiubo Li
@ 2014-03-26  5:40 ` Xiubo Li
  2014-03-26  5:40 ` [PATCHv2 02/11] ASoc: 88pm860x: Remove the set_cache_io() entirely from ASoC probe Xiubo Li
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Xiubo Li @ 2014-03-26  5:40 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: alsa-devel, lars, shc_work, tiwai, viresh.kumar, patches,
	andrew.smirnov, Xiubo Li, akpm, s.trumtrar, rf, ckeepax,
	vinod.koul

Add the default regmap I/O setting to snd_soc_register_codec() while
the CODEC is initialising, which will be called by CODEC driver device
probe(), and then we can make XXX_set_cache_io() go away entirely from each
CODEC ASoC probe.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 include/sound/soc.h  |  1 +
 sound/soc/soc-core.c | 28 ++++++++++++++++++----------
 sound/soc/soc-io.c   |  9 +++------
 3 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 0b83168..2f62436 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -754,6 +754,7 @@ struct snd_soc_codec_driver {
 		unsigned int freq_in, unsigned int freq_out);
 
 	/* codec IO */
+	struct regmap *(*get_regmap)(struct device *);
 	unsigned int (*read)(struct snd_soc_codec *, unsigned int);
 	int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
 	int (*display_register)(struct snd_soc_codec *, char *,
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index b322cf2..465a367 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1137,16 +1137,6 @@ static int soc_probe_codec(struct snd_soc_card *card,
 
 	codec->dapm.idle_bias_off = driver->idle_bias_off;
 
-	if (!codec->write && dev_get_regmap(codec->dev, NULL)) {
-		/* Set the default I/O up try regmap */
-		ret = snd_soc_codec_set_cache_io(codec, NULL);
-		if (ret < 0) {
-			dev_err(codec->dev,
-				"Failed to set cache I/O: %d\n", ret);
-			goto err_probe;
-		}
-	}
-
 	if (driver->probe) {
 		ret = driver->probe(codec);
 		if (ret < 0) {
@@ -4269,6 +4259,7 @@ int snd_soc_register_codec(struct device *dev,
 			   int num_dai)
 {
 	struct snd_soc_codec *codec;
+	struct regmap *regmap;
 	int ret, i;
 
 	dev_dbg(dev, "codec register %s\n", dev_name(dev));
@@ -4300,6 +4291,23 @@ int snd_soc_register_codec(struct device *dev,
 	codec->num_dai = num_dai;
 	mutex_init(&codec->mutex);
 
+	if (!codec->write) {
+		if (codec_drv->get_regmap)
+			regmap = codec_drv->get_regmap(dev);
+		else
+			regmap = dev_get_regmap(dev, NULL);
+
+		if (regmap) {
+			ret = snd_soc_codec_set_cache_io(codec, regmap);
+			if (ret && ret != -ENOTSUPP) {
+				dev_err(codec->dev,
+						"Failed to set cache I/O:%d\n",
+						ret);
+				return ret;
+			}
+		}
+	}
+
 	for (i = 0; i < num_dai; i++) {
 		fixup_codec_formats(&dai_drv[i].playback);
 		fixup_codec_formats(&dai_drv[i].capture);
diff --git a/sound/soc/soc-io.c b/sound/soc/soc-io.c
index 260efc8..6480e8f 100644
--- a/sound/soc/soc-io.c
+++ b/sound/soc/soc-io.c
@@ -60,14 +60,11 @@ int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
 {
 	int ret;
 
-	/* Device has made its own regmap arrangements */
 	if (!regmap)
-		codec->control_data = dev_get_regmap(codec->dev, NULL);
-	else
-		codec->control_data = regmap;
+		return -EINVAL;
 
-	if (IS_ERR(codec->control_data))
-		return PTR_ERR(codec->control_data);
+	/* Device has made its own regmap arrangements */
+	codec->control_data = regmap;
 
 	codec->write = hw_write;
 	codec->read = hw_read;
-- 
1.8.4

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

* [PATCHv2 02/11] ASoc: 88pm860x: Remove the set_cache_io() entirely from ASoC probe.
  2014-03-26  5:40 [PATCHv2 00/11] Remove set_cache_io entirely from ASoC probe Xiubo Li
  2014-03-26  5:40 ` [PATCHv2 01/11] ASoC: core: Move the default regmap I/O setting to snd_soc_register_codec() Xiubo Li
@ 2014-03-26  5:40 ` Xiubo Li
  2014-03-26  5:40 ` [PATCHv2 03/11] ASoc: cq93vc: " Xiubo Li
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Xiubo Li @ 2014-03-26  5:40 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: alsa-devel, lars, shc_work, tiwai, viresh.kumar, patches,
	andrew.smirnov, Xiubo Li, akpm, s.trumtrar, rf, ckeepax,
	vinod.koul

As we can set the CODEC I/O while snd_soc_register_codec(), so the
calling of set_cache_io() from CODEC ASoC probe could be removed
entirely.

And then we can set the CODEC I/O in the device probe instead of
CODEC ASoC probe as earily as possible.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 sound/soc/codecs/88pm860x-codec.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/88pm860x-codec.c b/sound/soc/codecs/88pm860x-codec.c
index b07e171..dc9e6b9 100644
--- a/sound/soc/codecs/88pm860x-codec.c
+++ b/sound/soc/codecs/88pm860x-codec.c
@@ -1327,10 +1327,6 @@ static int pm860x_probe(struct snd_soc_codec *codec)
 
 	pm860x->codec = codec;
 
-	ret = snd_soc_codec_set_cache_io(codec, pm860x->regmap);
-	if (ret)
-		return ret;
-
 	for (i = 0; i < 4; i++) {
 		ret = request_threaded_irq(pm860x->irq[i], NULL,
 					   pm860x_codec_handler, IRQF_ONESHOT,
@@ -1362,10 +1358,18 @@ static int pm860x_remove(struct snd_soc_codec *codec)
 	return 0;
 }
 
+struct regmap *pm860x_get_regmap(struct device *dev)
+{
+	struct pm860x_priv *pm860x = dev_get_drvdata(dev);
+
+	return pm860x->regmap;
+}
+
 static struct snd_soc_codec_driver soc_codec_dev_pm860x = {
 	.probe		= pm860x_probe,
 	.remove		= pm860x_remove,
 	.set_bias_level	= pm860x_set_bias_level,
+	.get_regmap	= pm860x_get_regmap,
 
 	.controls = pm860x_snd_controls,
 	.num_controls = ARRAY_SIZE(pm860x_snd_controls),
-- 
1.8.4

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

* [PATCHv2 03/11] ASoc: cq93vc: Remove the set_cache_io() entirely from ASoC probe.
  2014-03-26  5:40 [PATCHv2 00/11] Remove set_cache_io entirely from ASoC probe Xiubo Li
  2014-03-26  5:40 ` [PATCHv2 01/11] ASoC: core: Move the default regmap I/O setting to snd_soc_register_codec() Xiubo Li
  2014-03-26  5:40 ` [PATCHv2 02/11] ASoc: 88pm860x: Remove the set_cache_io() entirely from ASoC probe Xiubo Li
@ 2014-03-26  5:40 ` Xiubo Li
  2014-03-26  5:40 ` [PATCHv2 04/11] ASoc: mc13783: " Xiubo Li
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Xiubo Li @ 2014-03-26  5:40 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: alsa-devel, lars, shc_work, tiwai, viresh.kumar, patches,
	andrew.smirnov, Xiubo Li, akpm, s.trumtrar, rf, ckeepax,
	vinod.koul

As we can set the CODEC I/O while snd_soc_register_codec(), so the
calling of set_cache_io() from CODEC ASoC probe could be removed
entirely.

And then we can set the CODEC I/O in the device probe instead of
CODEC ASoC probe as earily as possible.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 sound/soc/codecs/cq93vc.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/cq93vc.c b/sound/soc/codecs/cq93vc.c
index 1e25c7a..5e5518d 100644
--- a/sound/soc/codecs/cq93vc.c
+++ b/sound/soc/codecs/cq93vc.c
@@ -139,8 +139,6 @@ static int cq93vc_probe(struct snd_soc_codec *codec)
 
 	davinci_vc->cq93vc.codec = codec;
 
-	snd_soc_codec_set_cache_io(codec, davinci_vc->regmap);
-
 	/* Off, with power on */
 	cq93vc_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
 
@@ -154,11 +152,19 @@ static int cq93vc_remove(struct snd_soc_codec *codec)
 	return 0;
 }
 
+struct regmap *cq93vc_get_regmap(struct device *dev)
+{
+	struct davinci_vc *davinci_vc = codec->dev->platform_data;
+
+	return davinci_vc->regmap;
+}
+
 static struct snd_soc_codec_driver soc_codec_dev_cq93vc = {
 	.set_bias_level = cq93vc_set_bias_level,
 	.probe = cq93vc_probe,
 	.remove = cq93vc_remove,
 	.resume = cq93vc_resume,
+	.get_regmap = cq93vc_get_regmap,
 	.controls = cq93vc_snd_controls,
 	.num_controls = ARRAY_SIZE(cq93vc_snd_controls),
 };
-- 
1.8.4

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

* [PATCHv2 04/11] ASoc: mc13783: Remove the set_cache_io() entirely from ASoC probe.
  2014-03-26  5:40 [PATCHv2 00/11] Remove set_cache_io entirely from ASoC probe Xiubo Li
                   ` (2 preceding siblings ...)
  2014-03-26  5:40 ` [PATCHv2 03/11] ASoc: cq93vc: " Xiubo Li
@ 2014-03-26  5:40 ` Xiubo Li
  2014-03-26  5:40 ` [PATCHv2 05/11] ASoc: si476x: " Xiubo Li
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Xiubo Li @ 2014-03-26  5:40 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: alsa-devel, lars, shc_work, tiwai, viresh.kumar, patches,
	andrew.smirnov, Xiubo Li, akpm, s.trumtrar, rf, ckeepax,
	vinod.koul

As we can set the CODEC I/O while snd_soc_register_codec(), so the
calling of set_cache_io() from CODEC ASoC probe could be removed
entirely.

And then we can set the CODEC I/O in the device probe instead of
CODEC ASoC probe as earily as possible.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 sound/soc/codecs/mc13783.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/sound/soc/codecs/mc13783.c b/sound/soc/codecs/mc13783.c
index 2c59b1f..8c0cec3 100644
--- a/sound/soc/codecs/mc13783.c
+++ b/sound/soc/codecs/mc13783.c
@@ -608,14 +608,6 @@ static struct snd_kcontrol_new mc13783_control_list[] = {
 static int mc13783_probe(struct snd_soc_codec *codec)
 {
 	struct mc13783_priv *priv = snd_soc_codec_get_drvdata(codec);
-	int ret;
-
-	ret = snd_soc_codec_set_cache_io(codec,
-			dev_get_regmap(codec->dev->parent, NULL));
-	if (ret != 0) {
-		dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
-		return ret;
-	}
 
 	/* these are the reset values */
 	mc13xxx_reg_write(priv->mc13xxx, MC13783_AUDIO_RX0, 0x25893);
@@ -735,9 +727,15 @@ static struct snd_soc_dai_driver mc13783_dai_sync[] = {
 	}
 };
 
+struct regmap *mc13783_get_regmap(struct device *dev)
+{
+	return dev_get_regmap(dev->parent, NULL);
+}
+
 static struct snd_soc_codec_driver soc_codec_dev_mc13783 = {
 	.probe		= mc13783_probe,
 	.remove		= mc13783_remove,
+	.get_regmap	= mc13783_get_regmap,
 	.controls	= mc13783_control_list,
 	.num_controls	= ARRAY_SIZE(mc13783_control_list),
 	.dapm_widgets	= mc13783_dapm_widgets,
-- 
1.8.4

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

* [PATCHv2 05/11] ASoc: si476x: Remove the set_cache_io() entirely from ASoC probe.
  2014-03-26  5:40 [PATCHv2 00/11] Remove set_cache_io entirely from ASoC probe Xiubo Li
                   ` (3 preceding siblings ...)
  2014-03-26  5:40 ` [PATCHv2 04/11] ASoc: mc13783: " Xiubo Li
@ 2014-03-26  5:40 ` Xiubo Li
  2014-03-27 14:41   ` Andrey Smirnov
  2014-03-26  5:40 ` [PATCHv2 06/11] ASoc: wm5102: " Xiubo Li
                   ` (7 subsequent siblings)
  12 siblings, 1 reply; 15+ messages in thread
From: Xiubo Li @ 2014-03-26  5:40 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: alsa-devel, lars, shc_work, tiwai, viresh.kumar, patches,
	andrew.smirnov, Xiubo Li, akpm, s.trumtrar, rf, ckeepax,
	vinod.koul

As we can set the CODEC I/O while snd_soc_register_codec(), so the
calling of set_cache_io() from CODEC ASoC probe could be removed
entirely.

And then we can set the CODEC I/O in the device probe instead of
CODEC ASoC probe as earily as possible.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 sound/soc/codecs/si476x.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/sound/soc/codecs/si476x.c b/sound/soc/codecs/si476x.c
index 244c097..961b7e8 100644
--- a/sound/soc/codecs/si476x.c
+++ b/sound/soc/codecs/si476x.c
@@ -208,13 +208,6 @@ out:
 	return err;
 }
 
-static int si476x_codec_probe(struct snd_soc_codec *codec)
-{
-	struct regmap *regmap = dev_get_regmap(codec->dev->parent, NULL);
-
-	return snd_soc_codec_set_cache_io(codec, regmap);
-}
-
 static struct snd_soc_dai_ops si476x_dai_ops = {
 	.hw_params	= si476x_codec_hw_params,
 	.set_fmt	= si476x_codec_set_dai_fmt,
@@ -238,8 +231,13 @@ static struct snd_soc_dai_driver si476x_dai = {
 	.ops		= &si476x_dai_ops,
 };
 
+struct regmap *si476x_get_regmap(struct device *dev)
+{
+	return dev_get_regmap(dev->parent, NULL);
+}
+
 static struct snd_soc_codec_driver soc_codec_dev_si476x = {
-	.probe  = si476x_codec_probe,
+	.get_regmap = si476x_get_regmap,
 	.dapm_widgets = si476x_dapm_widgets,
 	.num_dapm_widgets = ARRAY_SIZE(si476x_dapm_widgets),
 	.dapm_routes = si476x_dapm_routes,
-- 
1.8.4

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

* [PATCHv2 06/11] ASoc: wm5102: Remove the set_cache_io() entirely from ASoC probe.
  2014-03-26  5:40 [PATCHv2 00/11] Remove set_cache_io entirely from ASoC probe Xiubo Li
                   ` (4 preceding siblings ...)
  2014-03-26  5:40 ` [PATCHv2 05/11] ASoc: si476x: " Xiubo Li
@ 2014-03-26  5:40 ` Xiubo Li
  2014-03-26  5:40 ` [PATCHv2 07/11] ASoc: wm5110: " Xiubo Li
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Xiubo Li @ 2014-03-26  5:40 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: alsa-devel, lars, shc_work, tiwai, viresh.kumar, patches,
	andrew.smirnov, Xiubo Li, akpm, s.trumtrar, rf, ckeepax,
	vinod.koul

As we can set the CODEC I/O while snd_soc_register_codec(), so the
calling of set_cache_io() from CODEC ASoC probe could be removed
entirely.

And then we can set the CODEC I/O in the device probe instead of
CODEC ASoC probe as earily as possible.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 sound/soc/codecs/wm5102.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c
index dcf1d12..aa60ba2 100644
--- a/sound/soc/codecs/wm5102.c
+++ b/sound/soc/codecs/wm5102.c
@@ -1760,10 +1760,6 @@ static int wm5102_codec_probe(struct snd_soc_codec *codec)
 	struct wm5102_priv *priv = snd_soc_codec_get_drvdata(codec);
 	int ret;
 
-	ret = snd_soc_codec_set_cache_io(codec, priv->core.arizona->regmap);
-	if (ret != 0)
-		return ret;
-
 	ret = snd_soc_add_codec_controls(codec, wm_adsp2_fw_controls, 2);
 	if (ret != 0)
 		return ret;
@@ -1802,9 +1798,17 @@ static unsigned int wm5102_digital_vu[] = {
 	ARIZONA_DAC_DIGITAL_VOLUME_5R,
 };
 
+struct regmap *wm5102_get_regmap(struct device *dev)
+{
+	struct wm5102_priv *priv = dev_get_drvdata(dev);
+
+	return priv->core.arizona->regmap;
+}
+
 static struct snd_soc_codec_driver soc_codec_dev_wm5102 = {
 	.probe = wm5102_codec_probe,
 	.remove = wm5102_codec_remove,
+	.get_regmap = wm5102_get_regmap,
 
 	.idle_bias_off = true,
 
-- 
1.8.4

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

* [PATCHv2 07/11] ASoc: wm5110: Remove the set_cache_io() entirely from ASoC probe.
  2014-03-26  5:40 [PATCHv2 00/11] Remove set_cache_io entirely from ASoC probe Xiubo Li
                   ` (5 preceding siblings ...)
  2014-03-26  5:40 ` [PATCHv2 06/11] ASoc: wm5102: " Xiubo Li
@ 2014-03-26  5:40 ` Xiubo Li
  2014-03-26  5:40 ` [PATCHv2 08/11] ASoc: wm8350: " Xiubo Li
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Xiubo Li @ 2014-03-26  5:40 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: alsa-devel, lars, shc_work, tiwai, viresh.kumar, patches,
	andrew.smirnov, Xiubo Li, akpm, s.trumtrar, rf, ckeepax,
	vinod.koul

As we can set the CODEC I/O while snd_soc_register_codec(), so the
calling of set_cache_io() from CODEC ASoC probe could be removed
entirely.

And then we can set the CODEC I/O in the device probe instead of
CODEC ASoC probe as earily as possible.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 sound/soc/codecs/wm5110.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c
index df5a38d..4be5f99 100644
--- a/sound/soc/codecs/wm5110.c
+++ b/sound/soc/codecs/wm5110.c
@@ -1589,10 +1589,6 @@ static int wm5110_codec_probe(struct snd_soc_codec *codec)
 
 	priv->core.arizona->dapm = &codec->dapm;
 
-	ret = snd_soc_codec_set_cache_io(codec, priv->core.arizona->regmap);
-	if (ret != 0)
-		return ret;
-
 	arizona_init_spk(codec);
 	arizona_init_gpio(codec);
 
@@ -1633,9 +1629,17 @@ static unsigned int wm5110_digital_vu[] = {
 	ARIZONA_DAC_DIGITAL_VOLUME_6R,
 };
 
+struct regmap *wm5110_get_regmap(struct device *dev)
+{
+	struct wm5110_priv *priv = dev_get_drvdata(dev);
+
+	return priv->core.arizona->regmap;
+}
+
 static struct snd_soc_codec_driver soc_codec_dev_wm5110 = {
 	.probe = wm5110_codec_probe,
 	.remove = wm5110_codec_remove,
+	.get_regmap = wm5110_get_regmap,
 
 	.idle_bias_off = true,
 
-- 
1.8.4

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

* [PATCHv2 08/11] ASoc: wm8350: Remove the set_cache_io() entirely from ASoC probe.
  2014-03-26  5:40 [PATCHv2 00/11] Remove set_cache_io entirely from ASoC probe Xiubo Li
                   ` (6 preceding siblings ...)
  2014-03-26  5:40 ` [PATCHv2 07/11] ASoc: wm5110: " Xiubo Li
@ 2014-03-26  5:40 ` Xiubo Li
  2014-03-26  5:40 ` [PATCHv2 09/11] ASoc: wm8400: " Xiubo Li
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Xiubo Li @ 2014-03-26  5:40 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: alsa-devel, lars, shc_work, tiwai, viresh.kumar, patches,
	andrew.smirnov, Xiubo Li, akpm, s.trumtrar, rf, ckeepax,
	vinod.koul

As we can set the CODEC I/O while snd_soc_register_codec(), so the
calling of set_cache_io() from CODEC ASoC probe could be removed
entirely.

And then we can set the CODEC I/O in the device probe instead of
CODEC ASoC probe as earily as possible.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 sound/soc/codecs/wm8350.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c
index 757256b..6b31a9f 100644
--- a/sound/soc/codecs/wm8350.c
+++ b/sound/soc/codecs/wm8350.c
@@ -1505,8 +1505,6 @@ static  int wm8350_codec_probe(struct snd_soc_codec *codec)
 	if (ret != 0)
 		return ret;
 
-	snd_soc_codec_set_cache_io(codec, wm8350->regmap);
-
 	/* Put the codec into reset if it wasn't already */
 	wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA);
 
@@ -1608,11 +1606,19 @@ static int  wm8350_codec_remove(struct snd_soc_codec *codec)
 	return 0;
 }
 
+struct regmap *wm8350_get_regmap(struct device *dev)
+{
+	struct wm8350 *wm8350 = dev_get_platdata(dev);
+
+	return wm8350->regmap;
+}
+
 static struct snd_soc_codec_driver soc_codec_dev_wm8350 = {
 	.probe =	wm8350_codec_probe,
 	.remove =	wm8350_codec_remove,
 	.suspend = 	wm8350_suspend,
 	.resume =	wm8350_resume,
+	.get_regmap =	wm8350_get_regmap,
 	.set_bias_level = wm8350_set_bias_level,
 
 	.controls = wm8350_snd_controls,
-- 
1.8.4

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

* [PATCHv2 09/11] ASoc: wm8400: Remove the set_cache_io() entirely from ASoC probe.
  2014-03-26  5:40 [PATCHv2 00/11] Remove set_cache_io entirely from ASoC probe Xiubo Li
                   ` (7 preceding siblings ...)
  2014-03-26  5:40 ` [PATCHv2 08/11] ASoc: wm8350: " Xiubo Li
@ 2014-03-26  5:40 ` Xiubo Li
  2014-03-26  5:40 ` [PATCHv2 10/11] ASoc: wm8994: " Xiubo Li
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Xiubo Li @ 2014-03-26  5:40 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: alsa-devel, lars, shc_work, tiwai, viresh.kumar, patches,
	andrew.smirnov, Xiubo Li, akpm, s.trumtrar, rf, ckeepax,
	vinod.koul

As we can set the CODEC I/O while snd_soc_register_codec(), so the
calling of set_cache_io() from CODEC ASoC probe could be removed
entirely.

And then we can set the CODEC I/O in the device probe instead of
CODEC ASoC probe as earily as possible.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 sound/soc/codecs/wm8400.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/wm8400.c b/sound/soc/codecs/wm8400.c
index 146564f..e6410f2 100644
--- a/sound/soc/codecs/wm8400.c
+++ b/sound/soc/codecs/wm8400.c
@@ -1318,8 +1318,6 @@ static int wm8400_codec_probe(struct snd_soc_codec *codec)
 	priv->wm8400 = wm8400;
 	priv->codec = codec;
 
-	snd_soc_codec_set_cache_io(codec, wm8400->regmap);
-
 	ret = devm_regulator_bulk_get(wm8400->dev,
 				 ARRAY_SIZE(power), &power[0]);
 	if (ret != 0) {
@@ -1361,11 +1359,19 @@ static int  wm8400_codec_remove(struct snd_soc_codec *codec)
 	return 0;
 }
 
+struct regmap *wm8400_get_regmap(struct device *dev)
+{
+	struct wm8400 *wm8400 = dev_get_platdata(dev);
+
+	return wm8400->regmap;
+}
+
 static struct snd_soc_codec_driver soc_codec_dev_wm8400 = {
 	.probe =	wm8400_codec_probe,
 	.remove =	wm8400_codec_remove,
 	.suspend =	wm8400_suspend,
 	.resume =	wm8400_resume,
+	.get_regmap =	wm8400_get_regmap,
 	.set_bias_level = wm8400_set_bias_level,
 
 	.controls = wm8400_snd_controls,
-- 
1.8.4

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

* [PATCHv2 10/11] ASoc: wm8994: Remove the set_cache_io() entirely from ASoC probe.
  2014-03-26  5:40 [PATCHv2 00/11] Remove set_cache_io entirely from ASoC probe Xiubo Li
                   ` (8 preceding siblings ...)
  2014-03-26  5:40 ` [PATCHv2 09/11] ASoc: wm8400: " Xiubo Li
@ 2014-03-26  5:40 ` Xiubo Li
  2014-03-26  5:40 ` [PATCHv2 11/11] ASoc: wm8997: " Xiubo Li
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 15+ messages in thread
From: Xiubo Li @ 2014-03-26  5:40 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: alsa-devel, lars, shc_work, tiwai, viresh.kumar, patches,
	andrew.smirnov, Xiubo Li, akpm, s.trumtrar, rf, ckeepax,
	vinod.koul

As we can set the CODEC I/O while snd_soc_register_codec(), so the
calling of set_cache_io() from CODEC ASoC probe could be removed
entirely.

And then we can set the CODEC I/O in the device probe instead of
CODEC ASoC probe as earily as possible.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 sound/soc/codecs/wm8994.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 6303537..daa4edc 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -3999,8 +3999,6 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
 
 	wm8994->hubs.codec = codec;
 
-	snd_soc_codec_set_cache_io(codec, control->regmap);
-
 	mutex_init(&wm8994->accdet_lock);
 	INIT_DELAYED_WORK(&wm8994->jackdet_bootstrap,
 			  wm1811_jackdet_bootstrap);
@@ -4434,11 +4432,19 @@ static int wm8994_codec_remove(struct snd_soc_codec *codec)
 	return 0;
 }
 
+struct regmap *wm8994_get_regmap(struct device *dev)
+{
+	struct wm8994 *control = dev_get_drvdata(dev->parent);
+
+	return control->regmap;
+}
+
 static struct snd_soc_codec_driver soc_codec_dev_wm8994 = {
 	.probe =	wm8994_codec_probe,
 	.remove =	wm8994_codec_remove,
 	.suspend =	wm8994_codec_suspend,
 	.resume =	wm8994_codec_resume,
+	.get_regmap =   wm8994_get_regmap,
 	.set_bias_level = wm8994_set_bias_level,
 };
 
-- 
1.8.4

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

* [PATCHv2 11/11] ASoc: wm8997: Remove the set_cache_io() entirely from ASoC probe.
  2014-03-26  5:40 [PATCHv2 00/11] Remove set_cache_io entirely from ASoC probe Xiubo Li
                   ` (9 preceding siblings ...)
  2014-03-26  5:40 ` [PATCHv2 10/11] ASoc: wm8994: " Xiubo Li
@ 2014-03-26  5:40 ` Xiubo Li
  2014-03-27 13:34 ` [PATCHv2 00/11] Remove set_cache_io " Charles Keepax
  2014-04-02 19:23 ` Mark Brown
  12 siblings, 0 replies; 15+ messages in thread
From: Xiubo Li @ 2014-03-26  5:40 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: alsa-devel, lars, shc_work, tiwai, viresh.kumar, patches,
	andrew.smirnov, Xiubo Li, akpm, s.trumtrar, rf, ckeepax,
	vinod.koul

As we can set the CODEC I/O while snd_soc_register_codec(), so the
calling of set_cache_io() from CODEC ASoC probe could be removed
entirely.

And then we can set the CODEC I/O in the device probe instead of
CODEC ASoC probe as earily as possible.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 sound/soc/codecs/wm8997.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/sound/soc/codecs/wm8997.c b/sound/soc/codecs/wm8997.c
index 004186b..3d50621 100644
--- a/sound/soc/codecs/wm8997.c
+++ b/sound/soc/codecs/wm8997.c
@@ -1051,11 +1051,6 @@ static struct snd_soc_dai_driver wm8997_dai[] = {
 static int wm8997_codec_probe(struct snd_soc_codec *codec)
 {
 	struct wm8997_priv *priv = snd_soc_codec_get_drvdata(codec);
-	int ret;
-
-	ret = snd_soc_codec_set_cache_io(codec, priv->core.arizona->regmap);
-	if (ret != 0)
-		return ret;
 
 	arizona_init_spk(codec);
 
@@ -1086,9 +1081,17 @@ static unsigned int wm8997_digital_vu[] = {
 	ARIZONA_DAC_DIGITAL_VOLUME_5R,
 };
 
+struct regmap *wm8997_get_regmap(struct device *dev)
+{
+	struct wm8997_priv *priv = dev_get_drvdata(dev);
+
+	return priv->core.arizona->regmap;
+}
+
 static struct snd_soc_codec_driver soc_codec_dev_wm8997 = {
 	.probe = wm8997_codec_probe,
 	.remove = wm8997_codec_remove,
+	.get_regmap =   wm8997_get_regmap,
 
 	.idle_bias_off = true,
 
-- 
1.8.4

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

* Re: [PATCHv2 00/11] Remove set_cache_io entirely from ASoC probe
  2014-03-26  5:40 [PATCHv2 00/11] Remove set_cache_io entirely from ASoC probe Xiubo Li
                   ` (10 preceding siblings ...)
  2014-03-26  5:40 ` [PATCHv2 11/11] ASoc: wm8997: " Xiubo Li
@ 2014-03-27 13:34 ` Charles Keepax
  2014-04-02 19:23 ` Mark Brown
  12 siblings, 0 replies; 15+ messages in thread
From: Charles Keepax @ 2014-03-27 13:34 UTC (permalink / raw)
  To: Xiubo Li
  Cc: alsa-devel, lars, shc_work, tiwai, viresh.kumar, patches,
	lgirdwood, andrew.smirnov, broonie, akpm, s.trumtrar, rf,
	vinod.koul

On Wed, Mar 26, 2014 at 01:40:22PM +0800, Xiubo Li wrote:
>   ASoc: wm5102: Remove the set_cache_io() entirely from ASoC probe.
>   ASoc: wm5110: Remove the set_cache_io() entirely from ASoC probe.
>   ASoc: wm8350: Remove the set_cache_io() entirely from ASoC probe.
>   ASoc: wm8400: Remove the set_cache_io() entirely from ASoC probe.
>   ASoc: wm8994: Remove the set_cache_io() entirely from ASoC probe.
>   ASoc: wm8997: Remove the set_cache_io() entirely from ASoC probe.

For the above patches:

Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

Thanks,
Charles

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

* Re: [PATCHv2 05/11] ASoc: si476x: Remove the set_cache_io() entirely from ASoC probe.
  2014-03-26  5:40 ` [PATCHv2 05/11] ASoc: si476x: " Xiubo Li
@ 2014-03-27 14:41   ` Andrey Smirnov
  0 siblings, 0 replies; 15+ messages in thread
From: Andrey Smirnov @ 2014-03-27 14:41 UTC (permalink / raw)
  To: Xiubo Li
  Cc: alsa-devel, lars, shc_work, tiwai, viresh.kumar, patches,
	Liam Girdwood, vinod.koul, Mark Brown, akpm, s.trumtrar, rf,
	ckeepax

On Tue, Mar 25, 2014 at 10:40 PM, Xiubo Li <Li.Xiubo@freescale.com> wrote:
> As we can set the CODEC I/O while snd_soc_register_codec(), so the
> calling of set_cache_io() from CODEC ASoC probe could be removed
> entirely.
>
> And then we can set the CODEC I/O in the device probe instead of
> CODEC ASoC probe as earily as possible.
>
> Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
> ---
>  sound/soc/codecs/si476x.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/sound/soc/codecs/si476x.c b/sound/soc/codecs/si476x.c
> index 244c097..961b7e8 100644
> --- a/sound/soc/codecs/si476x.c
> +++ b/sound/soc/codecs/si476x.c
> @@ -208,13 +208,6 @@ out:
>         return err;
>  }
>
> -static int si476x_codec_probe(struct snd_soc_codec *codec)
> -{
> -       struct regmap *regmap = dev_get_regmap(codec->dev->parent, NULL);
> -
> -       return snd_soc_codec_set_cache_io(codec, regmap);
> -}
> -
>  static struct snd_soc_dai_ops si476x_dai_ops = {
>         .hw_params      = si476x_codec_hw_params,
>         .set_fmt        = si476x_codec_set_dai_fmt,
> @@ -238,8 +231,13 @@ static struct snd_soc_dai_driver si476x_dai = {
>         .ops            = &si476x_dai_ops,
>  };
>
> +struct regmap *si476x_get_regmap(struct device *dev)
> +{
> +       return dev_get_regmap(dev->parent, NULL);
> +}
> +
>  static struct snd_soc_codec_driver soc_codec_dev_si476x = {
> -       .probe  = si476x_codec_probe,
> +       .get_regmap = si476x_get_regmap,
>         .dapm_widgets = si476x_dapm_widgets,
>         .num_dapm_widgets = ARRAY_SIZE(si476x_dapm_widgets),
>         .dapm_routes = si476x_dapm_routes,
> --
> 1.8.4
>
>

Acked-by: Andrey Smirnov <andrew.smirnov@gmail.com>

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

* Re: [PATCHv2 00/11] Remove set_cache_io entirely from ASoC probe
  2014-03-26  5:40 [PATCHv2 00/11] Remove set_cache_io entirely from ASoC probe Xiubo Li
                   ` (11 preceding siblings ...)
  2014-03-27 13:34 ` [PATCHv2 00/11] Remove set_cache_io " Charles Keepax
@ 2014-04-02 19:23 ` Mark Brown
  12 siblings, 0 replies; 15+ messages in thread
From: Mark Brown @ 2014-04-02 19:23 UTC (permalink / raw)
  To: Xiubo Li
  Cc: alsa-devel, lars, shc_work, tiwai, viresh.kumar, patches,
	lgirdwood, andrew.smirnov, akpm, s.trumtrar, rf, ckeepax,
	vinod.koul


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

On Wed, Mar 26, 2014 at 01:40:22PM +0800, Xiubo Li wrote:
> Change in v2:
> - Add .get_regmap() support for struct snd_soc_codec_driver.

Applied all, thanks.

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

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



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

end of thread, other threads:[~2014-04-02 19:24 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-26  5:40 [PATCHv2 00/11] Remove set_cache_io entirely from ASoC probe Xiubo Li
2014-03-26  5:40 ` [PATCHv2 01/11] ASoC: core: Move the default regmap I/O setting to snd_soc_register_codec() Xiubo Li
2014-03-26  5:40 ` [PATCHv2 02/11] ASoc: 88pm860x: Remove the set_cache_io() entirely from ASoC probe Xiubo Li
2014-03-26  5:40 ` [PATCHv2 03/11] ASoc: cq93vc: " Xiubo Li
2014-03-26  5:40 ` [PATCHv2 04/11] ASoc: mc13783: " Xiubo Li
2014-03-26  5:40 ` [PATCHv2 05/11] ASoc: si476x: " Xiubo Li
2014-03-27 14:41   ` Andrey Smirnov
2014-03-26  5:40 ` [PATCHv2 06/11] ASoc: wm5102: " Xiubo Li
2014-03-26  5:40 ` [PATCHv2 07/11] ASoc: wm5110: " Xiubo Li
2014-03-26  5:40 ` [PATCHv2 08/11] ASoc: wm8350: " Xiubo Li
2014-03-26  5:40 ` [PATCHv2 09/11] ASoc: wm8400: " Xiubo Li
2014-03-26  5:40 ` [PATCHv2 10/11] ASoc: wm8994: " Xiubo Li
2014-03-26  5:40 ` [PATCHv2 11/11] ASoc: wm8997: " Xiubo Li
2014-03-27 13:34 ` [PATCHv2 00/11] Remove set_cache_io " Charles Keepax
2014-04-02 19:23 ` Mark Brown

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).