linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xiubo Li <Li.Xiubo@freescale.com>
To: <broonie@kernel.org>, <lars@metafoo.de>
Cc: <alsa-devel@alsa-project.org>, <linux-kernel@vger.kernel.org>,
	Xiubo Li <Li.Xiubo@freescale.com>
Subject: [PATCHv2 3/3] ASoC: core: Fix check before setting default I/O up try regmap
Date: Fri, 28 Feb 2014 17:04:27 +0800	[thread overview]
Message-ID: <1393578267-18255-4-git-send-email-Li.Xiubo@freescale.com> (raw)
In-Reply-To: <1393578267-18255-1-git-send-email-Li.Xiubo@freescale.com>

Same with 'ASoC: core: Fix check before defaulting to regmap':

(Check if the chip has provided a write operation (which is mandatory for
I/O) rather than looking for control data as some of the MFDs use a global
for this. Also skip the attempt if there's no regmap available by device
in case things get confused by the attempt to default.)

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
---
 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 6880fad..a14155b 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-02-28 10:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-28  9:04 [PATCHv2 0/3] Simplify the CODEC ASoC probe code Xiubo Li
2014-02-28  9:04 ` [PATCHv2 1/3] ASoC: codec: Simplify " Xiubo Li
2014-02-28 14:41   ` [alsa-devel] " Lars-Peter Clausen
2014-03-03  1:58     ` Li.Xiubo
2014-03-01  4:28   ` Mark Brown
2014-03-03  3:01     ` Li.Xiubo
2014-03-03  4:50       ` Mark Brown
2014-02-28  9:04 ` [PATCHv2 2/3] ASoC: io: New signature for snd_soc_codec_set_cache_io() Xiubo Li
2014-03-01  4:29   ` Mark Brown
2014-03-01  4:34   ` Mark Brown
2014-03-01 13:05     ` [alsa-devel] " Lars-Peter Clausen
2014-02-28  9:04 ` 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=1393578267-18255-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=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).