Skip to content

Commit

Permalink
ASoC: core: Set the default I/O up try regmap.
Browse files Browse the repository at this point in the history
For most CODEC drivers which the REGMAP is used, the soc_probe_codec()
will do the stuff work of snd_soc_codec_set_cache_io(), which the CODEC
drivers' ASoC probe will do too, and almost at the same time.

This patch set the default I/O up try regmap, and then the CODEC drivers'
stuff work of snd_soc_codec_set_cache_io() will be redundant, while if one
CODEC driver needed to set it's own I/O, then it can rewrite the default ones.
Then could we just discard the snd_soc_codec_set_cache_io() from the CODEC
drivers' ASoC probe to simplify the code.

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 Feb 28, 2014
1 parent 9aa8210 commit fe2265e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sound/soc/soc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1137,6 +1137,10 @@ 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, 0, 0, SND_SOC_REGMAP);

if (driver->probe) {
ret = driver->probe(codec);
if (ret < 0) {
Expand All @@ -1150,10 +1154,6 @@ static int soc_probe_codec(struct snd_soc_card *card,
codec->name);
}

/* If the driver didn't set I/O up try regmap */
if (!codec->write && dev_get_regmap(codec->dev, NULL))
snd_soc_codec_set_cache_io(codec, 0, 0, SND_SOC_REGMAP);

if (driver->controls)
snd_soc_add_codec_controls(codec, driver->controls,
driver->num_controls);
Expand Down

0 comments on commit fe2265e

Please sign in to comment.