From: Xiubo Li Date: Tue, 11 Mar 2014 04:43:22 +0000 (+0800) Subject: ASoC: core: Fix check before setting default I/O up try regmap X-Git-Tag: v3.15-rc1~36^2~1^2~3^2~3^3~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a32c17b87c17f5e2e68edcf4d163ee42f9490652;p=platform%2Fkernel%2Flinux-exynos.git ASoC: core: Fix check before setting default I/O up try regmap Since the CODEC driver could specify its own I/O(read and write) while registering the CODEC for some reason, maybe the MFDs is used, etc. So just do check it, if they are not specified by CODEC driver then try to set up the default regmap I/O if regmap is used. Signed-off-by: Xiubo Li Signed-off-by: Mark Brown --- diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 6510a8e..cbddbd5 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1137,9 +1137,15 @@ static int soc_probe_codec(struct snd_soc_card *card, codec->dapm.idle_bias_off = driver->idle_bias_off; - /* Set the default I/O up try regmap */ - if (dev_get_regmap(codec->dev, NULL)) - snd_soc_codec_set_cache_io(codec, NULL); + 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);