alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] ASoC: codec: wm8960: add additional probe check for codec identification
@ 2023-07-13 22:25 Frank Li
  2023-07-17  9:52 ` Charles Keepax
  2023-07-18 12:10 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Frank Li @ 2023-07-13 22:25 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Vladimir Oltean, Uwe Kleine-König, Krzysztof Hałasa,
	Wolfram Sang, Heikki Krogerus,
	open list:WOLFSON MICROELECTRONICS DRIVERS,
	moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	open list
  Cc: imx, shengjiu.wang

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] ASoC: codec: wm8960: add additional probe check for codec identification
  2023-07-13 22:25 [PATCH 1/1] ASoC: codec: wm8960: add additional probe check for codec identification Frank Li
@ 2023-07-17  9:52 ` Charles Keepax
  2023-07-18 12:10 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Charles Keepax @ 2023-07-17  9:52 UTC (permalink / raw)
  To: Frank Li
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Vladimir Oltean, Uwe Kleine-König, Krzysztof Hałasa,
	Wolfram Sang, Heikki Krogerus,
	open list:WOLFSON MICROELECTRONICS DRIVERS,
	moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,
	open list, imx, shengjiu.wang

On Thu, Jul 13, 2023 at 06:25:12PM -0400, Frank Li wrote:
> 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>
> ---

Seems reasonable to me:

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] ASoC: codec: wm8960: add additional probe check for codec identification
  2023-07-13 22:25 [PATCH 1/1] ASoC: codec: wm8960: add additional probe check for codec identification Frank Li
  2023-07-17  9:52 ` Charles Keepax
@ 2023-07-18 12:10 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2023-07-18 12:10 UTC (permalink / raw)
  To: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Vladimir Oltean,
	Uwe Kleine-König, Krzysztof Hałasa, Wolfram Sang,
	Heikki Krogerus, patches, alsa-devel, linux-kernel, Frank Li
  Cc: imx, shengjiu.wang

On Thu, 13 Jul 2023 18:25:12 -0400, Frank Li wrote:
> 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.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: codec: wm8960: add additional probe check for codec identification
      commit: 8b30cdbe0b911562fc1496078162dc9547b69be5

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-18 12:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-13 22:25 [PATCH 1/1] ASoC: codec: wm8960: add additional probe check for codec identification Frank Li
2023-07-17  9:52 ` Charles Keepax
2023-07-18 12:10 ` Mark Brown

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