Commit 8b30cdbe authored by Frank Li's avatar Frank Li Committed by Mark Brown

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: default avatarFrank Li <Frank.Li@nxp.com>
Acked-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230713222513.1636591-1-Frank.Li@nxp.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent f0e5ea2c
...@@ -1415,6 +1415,7 @@ static int wm8960_i2c_probe(struct i2c_client *i2c) ...@@ -1415,6 +1415,7 @@ static int wm8960_i2c_probe(struct i2c_client *i2c)
struct wm8960_data *pdata = dev_get_platdata(&i2c->dev); struct wm8960_data *pdata = dev_get_platdata(&i2c->dev);
struct wm8960_priv *wm8960; struct wm8960_priv *wm8960;
int ret; int ret;
u8 val;
wm8960 = devm_kzalloc(&i2c->dev, sizeof(struct wm8960_priv), wm8960 = devm_kzalloc(&i2c->dev, sizeof(struct wm8960_priv),
GFP_KERNEL); GFP_KERNEL);
...@@ -1436,6 +1437,12 @@ static int wm8960_i2c_probe(struct i2c_client *i2c) ...@@ -1436,6 +1437,12 @@ static int wm8960_i2c_probe(struct i2c_client *i2c)
else if (i2c->dev.of_node) else if (i2c->dev.of_node)
wm8960_set_pdata_from_of(i2c, &wm8960->pdata); 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); ret = wm8960_reset(wm8960->regmap);
if (ret != 0) { if (ret != 0) {
dev_err(&i2c->dev, "Failed to issue reset\n"); dev_err(&i2c->dev, "Failed to issue reset\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment