aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-core.c
diff options
context:
space:
mode:
authorXiubo Li <Li.Xiubo@freescale.com>2014-03-26 01:40:23 -0400
committerMark Brown <broonie@linaro.org>2014-04-14 12:22:18 -0400
commita39f75f7907fa3a708751dc283e3ab3e7da526b8 (patch)
tree464d1902678907ac8ab6f8999f6f49381e0fcaa2 /sound/soc/soc-core.c
parentc9eaa447e77efe77b7fa4c953bd62de8297fd6c5 (diff)
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,
1137 1137
1138 codec->dapm.idle_bias_off = driver->idle_bias_off; 1138 codec->dapm.idle_bias_off = driver->idle_bias_off;
1139 1139
1140 if (!codec->write && dev_get_regmap(codec->dev, NULL)) {
1141 /* Set the default I/O up try regmap */
1142 ret = snd_soc_codec_set_cache_io(codec, NULL);
1143 if (ret < 0) {
1144 dev_err(codec->dev,
1145 "Failed to set cache I/O: %d\n", ret);
1146 goto err_probe;
1147 }
1148 }
1149
1150 if (driver->probe) { 1140 if (driver->probe) {
1151 ret = driver->probe(codec); 1141 ret = driver->probe(codec);
1152 if (ret < 0) { 1142 if (ret < 0) {
@@ -4263,6 +4253,7 @@ int snd_soc_register_codec(struct device *dev,
4263 int num_dai) 4253 int num_dai)
4264{ 4254{
4265 struct snd_soc_codec *codec; 4255 struct snd_soc_codec *codec;
4256 struct regmap *regmap;
4266 int ret, i; 4257 int ret, i;
4267 4258
4268 dev_dbg(dev, "codec register %s\n", dev_name(dev)); 4259 dev_dbg(dev, "codec register %s\n", dev_name(dev));
@@ -4294,6 +4285,23 @@ int snd_soc_register_codec(struct device *dev,
4294 codec->num_dai = num_dai; 4285 codec->num_dai = num_dai;
4295 mutex_init(&codec->mutex); 4286 mutex_init(&codec->mutex);
4296 4287
4288 if (!codec->write) {
4289 if (codec_drv->get_regmap)
4290 regmap = codec_drv->get_regmap(dev);
4291 else
4292 regmap = dev_get_regmap(dev, NULL);
4293
4294 if (regmap) {
4295 ret = snd_soc_codec_set_cache_io(codec, regmap);
4296 if (ret && ret != -ENOTSUPP) {
4297 dev_err(codec->dev,
4298 "Failed to set cache I/O:%d\n",
4299 ret);
4300 return ret;
4301 }
4302 }
4303 }
4304
4297 for (i = 0; i < num_dai; i++) { 4305 for (i = 0; i < num_dai; i++) {
4298 fixup_codec_formats(&dai_drv[i].playback); 4306 fixup_codec_formats(&dai_drv[i].playback);
4299 fixup_codec_formats(&dai_drv[i].capture); 4307 fixup_codec_formats(&dai_drv[i].capture);