alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Xiubo Li <Li.Xiubo@freescale.com>
To: broonie@kernel.org, lgirdwood@gmail.com, alsa-devel@alsa-project.org
Cc: lars@metafoo.de, linux-kernel@vger.kernel.org,
	Xiubo Li <Li.Xiubo@freescale.com>
Subject: [PATCHv3 resend 3/3] ASoC: core: Fix check before setting default I/O up try regmap
Date: Tue, 11 Mar 2014 12:43:22 +0800	[thread overview]
Message-ID: <1394513002-21946-4-git-send-email-Li.Xiubo@freescale.com> (raw)
In-Reply-To: <1394513002-21946-1-git-send-email-Li.Xiubo@freescale.com>

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>
---

This patch has nothing changed.



 sound/soc/soc-core.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index acef9bd..e692e98 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);
-- 
1.8.4

      parent reply	other threads:[~2014-03-11  4:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-11  4:43 [PATCHv3 resend 0/3] Simplify the CODEC ASoC probe code Xiubo Li
2014-03-11  4:43 ` [PATCHv3 resend 1/3] ASoC: codec: Simplify " Xiubo Li
2014-03-11 10:00   ` Mark Brown
2014-03-12  3:12     ` Li.Xiubo
2014-03-11  4:43 ` [PATCHv3 resend 2/3] ASoC: io: New signature for snd_soc_codec_set_cache_io() Xiubo Li
2014-03-11  4:43 ` Xiubo Li [this message]

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=1394513002-21946-4-git-send-email-Li.Xiubo@freescale.com \
    --to=li.xiubo@freescale.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.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).