Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0f73644f authored by Axel Lin's avatar Axel Lin Committed by Mark Brown
Browse files

ASoC: ad1980: Return proper error if vendor id mismatch



Return -ENODEV instead of 0 if vendor id mismatch.

Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
Acked-by: default avatarLiam Girdwood <lrg@ti.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 3ed46465
Loading
Loading
Loading
Loading
+7 −3
Original line number Original line Diff line number Diff line
@@ -200,19 +200,23 @@ static int ad1980_soc_probe(struct snd_soc_codec *codec)
	}
	}


	/* Read out vendor ID to make sure it is ad1980 */
	/* Read out vendor ID to make sure it is ad1980 */
	if (ac97_read(codec, AC97_VENDOR_ID1) != 0x4144)
	if (ac97_read(codec, AC97_VENDOR_ID1) != 0x4144) {
		ret = -ENODEV;
		goto reset_err;
		goto reset_err;
	}


	vendor_id2 = ac97_read(codec, AC97_VENDOR_ID2);
	vendor_id2 = ac97_read(codec, AC97_VENDOR_ID2);


	if (vendor_id2 != 0x5370) {
	if (vendor_id2 != 0x5370) {
		if (vendor_id2 != 0x5374)
		if (vendor_id2 != 0x5374) {
			ret = -ENODEV;
			goto reset_err;
			goto reset_err;
		else
		} else {
			printk(KERN_WARNING "ad1980: "
			printk(KERN_WARNING "ad1980: "
				"Found AD1981 - only 2/2 IN/OUT Channels "
				"Found AD1981 - only 2/2 IN/OUT Channels "
				"supported\n");
				"supported\n");
		}
		}
	}


	/* unmute captures and playbacks volume */
	/* unmute captures and playbacks volume */
	ac97_write(codec, AC97_MASTER, 0x0000);
	ac97_write(codec, AC97_MASTER, 0x0000);