From: Frank Li <Frank.Li@nxp.com>
To: "Liam Girdwood" <lgirdwood@gmail.com>,
"Mark Brown" <broonie@kernel.org>,
"Jaroslav Kysela" <perex@perex.cz>,
"Takashi Iwai" <tiwai@suse.com>,
"Vladimir Oltean" <olteanv@gmail.com>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Krzysztof Hałasa" <khalasa@piap.pl>,
"Wolfram Sang" <wsa@kernel.org>,
"Heikki Krogerus" <heikki.krogerus@linux.intel.com>,
patches@opensource.cirrus.com (open list:WOLFSON
MICROELECTRONICS DRIVERS),
alsa-devel@alsa-project.org (moderated list:SOUND - SOC LAYER /
DYNAMIC AUDIO POWER MANAGEM...),
linux-kernel@vger.kernel.org (open list)
Cc: imx@lists.linux.dev, shengjiu.wang@nxp.com
Subject: [PATCH 1/1] ASoC: codec: wm8960: add additional probe check for codec identification
Date: Thu, 13 Jul 2023 18:25:12 -0400 [thread overview]
Message-ID: <20230713222513.1636591-1-Frank.Li@nxp.com> (raw)
The wm8960 codec is not readable, resulting in a NACK for address 0x3d (8-bit).
This can partially indicate it. For example: wm8962 codec use the same address
but is readable. This additional probe check will help prevent loading the wm8960
module incorrectly on wm8962 hardware.
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
sound/soc/codecs/wm8960.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
index 0d167238a369..783c85912c59 100644
--- a/sound/soc/codecs/wm8960.c
+++ b/sound/soc/codecs/wm8960.c
@@ -1415,6 +1415,7 @@ static int wm8960_i2c_probe(struct i2c_client *i2c)
struct wm8960_data *pdata = dev_get_platdata(&i2c->dev);
struct wm8960_priv *wm8960;
int ret;
+ u8 val;
wm8960 = devm_kzalloc(&i2c->dev, sizeof(struct wm8960_priv),
GFP_KERNEL);
@@ -1436,6 +1437,12 @@ static int wm8960_i2c_probe(struct i2c_client *i2c)
else if (i2c->dev.of_node)
wm8960_set_pdata_from_of(i2c, &wm8960->pdata);
+ ret = i2c_master_recv(i2c, &val, sizeof(val));
+ if (ret >= 0) {
+ dev_err(&i2c->dev, "Not wm8960, wm8960 reg can not read by i2c\n");
+ return -EINVAL;
+ }
+
ret = wm8960_reset(wm8960->regmap);
if (ret != 0) {
dev_err(&i2c->dev, "Failed to issue reset\n");
--
2.34.1
next reply other threads:[~2023-07-13 22:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-13 22:25 Frank Li [this message]
2023-07-17 9:52 ` Charles Keepax
2023-07-18 12:10 ` 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=20230713222513.1636591-1-Frank.Li@nxp.com \
--to=frank.li@nxp.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=imx@lists.linux.dev \
--cc=khalasa@piap.pl \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=patches@opensource.cirrus.com \
--cc=perex@perex.cz \
--cc=shengjiu.wang@nxp.com \
--cc=tiwai@suse.com \
--cc=u.kleine-koenig@pengutronix.de \
--cc=wsa@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
all inboxes | Powered by JetHome®