Skip to contentSkip to conversation

Remove set_cache_io entirely from ASoC probe

PATCH Applied Xiubo Li 4 participants 15 messages Mar 26, 2014 – Apr 2, 2014

Subsystems (3)
lore
Share & tools
lore

Xiubo Li

author
#0 lore raw

v2 cover Remove set_cache_io entirely from ASoC probe

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(-)
Signature · 1 line
1.8.4
author
#1 lore raw

PATCH v2 1/11 ASoC: core: Move the default regmap I/O setting to snd_soc_register_codec()

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.

---
 include/sound/soc.h  |  1 +
 sound/soc/soc-core.c | 28 ++++++++++++++++++----------
 sound/soc/soc-io.c   |  9 +++------
 3 files changed, 22 insertions(+), 16 deletions(-)
include/sound/soc.h +1 -0
index 0b83168..2f62436 100644
@@ -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 *,
sound/soc/soc-core.c +18 -10
index b322cf2..465a367 100644
@@ -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);
sound/soc/soc-io.c +3 -6
index 260efc8..6480e8f 100644
@@ -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;
Signature · 1 line
1.8.4
author
#2 lore raw

PATCH v2 2/11 ASoc: 88pm860x: Remove the set_cache_io() entirely from ASoC probe.

In reply to Xiubo Li

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.

---
 sound/soc/codecs/88pm860x-codec.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
sound/soc/codecs/88pm860x-codec.c +8 -4
index b07e171..dc9e6b9 100644
@@ -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),
Signature · 1 line
1.8.4
author
#3 lore raw

PATCH v2 3/11 ASoc: cq93vc: Remove the set_cache_io() entirely from ASoC probe.

In reply to Xiubo Li

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.

---
 sound/soc/codecs/cq93vc.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
sound/soc/codecs/cq93vc.c +8 -2
index 1e25c7a..5e5518d 100644
@@ -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),
 };
Signature · 1 line
1.8.4
author
#4 lore raw

PATCH v2 4/11 ASoc: mc13783: Remove the set_cache_io() entirely from ASoC probe.

In reply to Xiubo Li

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.

---
 sound/soc/codecs/mc13783.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
sound/soc/codecs/mc13783.c +6 -8
index 2c59b1f..8c0cec3 100644
@@ -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,
Signature · 1 line
1.8.4
author
#5 lore raw

PATCH v2 5/11 ASoc: si476x: Remove the set_cache_io() entirely from ASoC probe.

In reply to Xiubo Li

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.

---
 sound/soc/codecs/si476x.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
sound/soc/codecs/si476x.c +6 -8
index 244c097..961b7e8 100644
@@ -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,
Signature · 1 line
1.8.4
Acked-by on v2 5/11
#6 lore raw

Re: [PATCHv2 05/11] ASoc: si476x: Remove the set_cache_io() entirely from ASoC probe.

Quoted 46 lines · Xiubo Li

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.

---
 sound/soc/codecs/si476x.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
sound/soc/codecs/si476x.c +6 -9
index 244c097..961b7e8 100644
@@ -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,
--
Quoted 3 lines

1.8.4

author
#7 lore raw

PATCH v2 6/11 ASoc: wm5102: Remove the set_cache_io() entirely from ASoC probe.

In reply to Xiubo Li

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.

---
 sound/soc/codecs/wm5102.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
sound/soc/codecs/wm5102.c +8 -4
index dcf1d12..aa60ba2 100644
@@ -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,
 
Signature · 1 line
1.8.4
author
#8 lore raw

PATCH v2 7/11 ASoc: wm5110: Remove the set_cache_io() entirely from ASoC probe.

In reply to Xiubo Li

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.

---
 sound/soc/codecs/wm5110.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
sound/soc/codecs/wm5110.c +8 -4
index df5a38d..4be5f99 100644
@@ -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,
 
Signature · 1 line
1.8.4
author
#9 lore raw

PATCH v2 8/11 ASoc: wm8350: Remove the set_cache_io() entirely from ASoC probe.

In reply to Xiubo Li

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.

---
 sound/soc/codecs/wm8350.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
sound/soc/codecs/wm8350.c +8 -2
index 757256b..6b31a9f 100644
@@ -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,
Signature · 1 line
1.8.4
author
#10 lore raw

PATCH v2 9/11 ASoc: wm8400: Remove the set_cache_io() entirely from ASoC probe.

In reply to Xiubo Li

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.

---
 sound/soc/codecs/wm8400.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
sound/soc/codecs/wm8400.c +8 -2
index 146564f..e6410f2 100644
@@ -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,
Signature · 1 line
1.8.4
author
#11 lore raw

PATCH v2 10/11 ASoc: wm8994: Remove the set_cache_io() entirely from ASoC probe.

In reply to Xiubo Li

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.

---
 sound/soc/codecs/wm8994.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
sound/soc/codecs/wm8994.c +8 -2
index 6303537..daa4edc 100644
@@ -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,
 };
 
Signature · 1 line
1.8.4
author
#12 lore raw

PATCH v2 11/11 ASoc: wm8997: Remove the set_cache_io() entirely from ASoC probe.

In reply to Xiubo Li

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.

---
 sound/soc/codecs/wm8997.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
sound/soc/codecs/wm8997.c +8 -5
index 004186b..3d50621 100644
@@ -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,
 
Signature · 1 line
1.8.4
Acked-by on the v2 series
#13 lore raw
In reply to Xiubo Li
Quoted 6 lines · Xiubo Li

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:

Thanks,
Charles

maintainer Applied
#14 lore raw
In reply to Xiubo Li
Quoted 2 lines · Xiubo Li

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

Applied all, thanks.