mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-04 04:06:26 +00:00
ASoC: wm8940: Read chip ID when wm8940 codec probing
The wm8940 provides the chip ID information via I2C. In this patch this information is read and if not matching expected value, the probe function is aborted. This prevents from using (i.e. inserting) other wm89* modules which use the same I2C bus address. Signed-off-by: Lukasz Majewski <lukma@denx.de> Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20221216094624.3849278-3-lukma@denx.de Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
294833fc9e
commit
a5c26ee572
@ -760,6 +760,17 @@ static int wm8940_probe(struct snd_soc_component *component)
|
||||
int ret;
|
||||
u16 reg;
|
||||
|
||||
/*
|
||||
* Check chip ID for wm8940 - value of 0x00 offset
|
||||
* SOFTWARE_RESET on write
|
||||
* CHIP_ID on read
|
||||
*/
|
||||
reg = snd_soc_component_read(component, WM8940_SOFTRESET);
|
||||
if (reg != WM8940_CHIP_ID) {
|
||||
dev_err(component->dev, "Wrong wm8940 chip ID: 0x%x\n", reg);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
ret = wm8940_reset(component);
|
||||
if (ret < 0) {
|
||||
dev_err(component->dev, "Failed to issue reset\n");
|
||||
|
@ -95,5 +95,8 @@ struct wm8940_setup_data {
|
||||
#define WM8940_OPCLKDIV_3 2
|
||||
#define WM8940_OPCLKDIV_4 3
|
||||
|
||||
/* Chip ID */
|
||||
#define WM8940_CHIP_ID 0x8940
|
||||
|
||||
#endif /* _WM8940_H */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user