Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: codec: wm8960: add additional probe check for codec identification

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>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230713222513.1636591-1-Frank.Li@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Frank Li and committed by
Mark Brown
8b30cdbe f0e5ea2c

+7
+7
sound/soc/codecs/wm8960.c
··· 1415 1415 struct wm8960_data *pdata = dev_get_platdata(&i2c->dev); 1416 1416 struct wm8960_priv *wm8960; 1417 1417 int ret; 1418 + u8 val; 1418 1419 1419 1420 wm8960 = devm_kzalloc(&i2c->dev, sizeof(struct wm8960_priv), 1420 1421 GFP_KERNEL); ··· 1436 1435 memcpy(&wm8960->pdata, pdata, sizeof(struct wm8960_data)); 1437 1436 else if (i2c->dev.of_node) 1438 1437 wm8960_set_pdata_from_of(i2c, &wm8960->pdata); 1438 + 1439 + ret = i2c_master_recv(i2c, &val, sizeof(val)); 1440 + if (ret >= 0) { 1441 + dev_err(&i2c->dev, "Not wm8960, wm8960 reg can not read by i2c\n"); 1442 + return -EINVAL; 1443 + } 1439 1444 1440 1445 ret = wm8960_reset(wm8960->regmap); 1441 1446 if (ret != 0) {