summaryrefslogtreecommitdiff
path: root/sound/soc/soc-core.c
diff options
context:
space:
mode:
authorXiubo Li <Li.Xiubo@freescale.com>2014-03-26 13:40:23 +0800
committerMark Brown <broonie@linaro.org>2014-04-14 17:22:18 +0100
commita39f75f7907fa3a708751dc283e3ab3e7da526b8 (patch)
tree464d1902678907ac8ab6f8999f6f49381e0fcaa2 /sound/soc/soc-core.c
parentc9eaa447e77efe77b7fa4c953bd62de8297fd6c5 (diff)
downloadlwn-a39f75f7907fa3a708751dc283e3ab3e7da526b8.tar.gz
lwn-a39f75f7907fa3a708751dc283e3ab3e7da526b8.zip
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. Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r--sound/soc/soc-core.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 051c006281f5..5071a3a0ac83 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) {
@@ -4263,6 +4253,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));
@@ -4294,6 +4285,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);