Skip to content

Commit

Permalink
ASoC: core: Fix check before setting default I/O up try regmap
Browse files Browse the repository at this point in the history
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 <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
  • Loading branch information
Xiubo Li authored and Mark Brown committed Mar 11, 2014
1 parent 092eba9 commit a32c17b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions sound/soc/soc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a32c17b

Please sign in to comment.