alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Xiubo Li <Li.Xiubo@freescale.com>
To: broonie@kernel.org
Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	shawn.guo@linaro.org, Xiubo Li <Li.Xiubo@freescale.com>
Subject: [PATCH 2/3] ASoC: core: Set the default I/O up try regmap.
Date: Thu, 27 Feb 2014 17:49:52 +0800	[thread overview]
Message-ID: <1393494593-26310-3-git-send-email-Li.Xiubo@freescale.com> (raw)
In-Reply-To: <1393494593-26310-1-git-send-email-Li.Xiubo@freescale.com>

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>
---
 sound/soc/soc-core.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index e5a535b..c159a34 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -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) {
@@ -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);
-- 
1.8.4

  parent reply	other threads:[~2014-02-27  9:49 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-27  9:49 [PATCH 0/3] To simplify the code for ASoC probe Xiubo Li
2014-02-27  9:49 ` [PATCH 1/3] ASoC: io: Clean up snd_soc_codec_set_cache_io() Xiubo Li
2014-02-28  3:47   ` Mark Brown
2014-02-27  9:49 ` Xiubo Li [this message]
2014-02-28  3:52   ` [PATCH 2/3] ASoC: core: Set the default I/O up try regmap Mark Brown
2014-02-28  4:00     ` Li.Xiubo
2014-02-28  5:29       ` Mark Brown
2014-02-28  5:56         ` Li.Xiubo
2014-02-28  6:38           ` [alsa-devel] " Lars-Peter Clausen
2014-02-28  6:40             ` Li.Xiubo
2014-02-28  6:46               ` Lars-Peter Clausen
2014-02-28  7:08                 ` Li.Xiubo
2014-02-28  7:15                   ` Lars-Peter Clausen
2014-02-28  7:18                     ` Li.Xiubo
2014-02-28  7:50                     ` Li.Xiubo
2014-02-28  8:15                       ` Lars-Peter Clausen
2014-03-01  4:07                         ` Mark Brown
2014-02-27  9:49 ` [PATCH 3/3] ASoC: SGTL5000: Simplify ASoC probe code Xiubo Li
2014-02-28  3:53   ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1393494593-26310-3-git-send-email-Li.Xiubo@freescale.com \
    --to=li.xiubo@freescale.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shawn.guo@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).