diff options
Diffstat (limited to 'sound/soc/codecs/ad1980.c')
-rw-r--r-- | sound/soc/codecs/ad1980.c | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/sound/soc/codecs/ad1980.c b/sound/soc/codecs/ad1980.c index 3cc69a626454..9ef20dbccbe3 100644 --- a/sound/soc/codecs/ad1980.c +++ b/sound/soc/codecs/ad1980.c | |||
@@ -202,19 +202,21 @@ static struct snd_soc_dai_driver ad1980_dai = { | |||
202 | .formats = SND_SOC_STD_AC97_FMTS, }, | 202 | .formats = SND_SOC_STD_AC97_FMTS, }, |
203 | }; | 203 | }; |
204 | 204 | ||
205 | #define AD1980_VENDOR_ID 0x41445300 | ||
206 | #define AD1980_VENDOR_MASK 0xffffff00 | ||
207 | |||
205 | static int ad1980_reset(struct snd_soc_codec *codec, int try_warm) | 208 | static int ad1980_reset(struct snd_soc_codec *codec, int try_warm) |
206 | { | 209 | { |
207 | struct snd_ac97 *ac97 = snd_soc_codec_get_drvdata(codec); | 210 | struct snd_ac97 *ac97 = snd_soc_codec_get_drvdata(codec); |
208 | unsigned int retry_cnt = 0; | 211 | unsigned int retry_cnt = 0; |
212 | int ret; | ||
209 | 213 | ||
210 | do { | 214 | do { |
211 | if (try_warm && soc_ac97_ops->warm_reset) { | 215 | ret = snd_ac97_reset(ac97, true, AD1980_VENDOR_ID, |
212 | soc_ac97_ops->warm_reset(ac97); | 216 | AD1980_VENDOR_MASK); |
213 | if (snd_soc_read(codec, AC97_RESET) == 0x0090) | 217 | if (ret >= 0) |
214 | return 1; | 218 | return 0; |
215 | } | ||
216 | 219 | ||
217 | soc_ac97_ops->reset(ac97); | ||
218 | /* | 220 | /* |
219 | * Set bit 16slot in register 74h, then every slot will has only | 221 | * Set bit 16slot in register 74h, then every slot will has only |
220 | * 16 bits. This command is sent out in 20bit mode, in which | 222 | * 16 bits. This command is sent out in 20bit mode, in which |
@@ -223,8 +225,6 @@ static int ad1980_reset(struct snd_soc_codec *codec, int try_warm) | |||
223 | */ | 225 | */ |
224 | snd_soc_write(codec, AC97_AD_SERIAL_CFG, 0x9900); | 226 | snd_soc_write(codec, AC97_AD_SERIAL_CFG, 0x9900); |
225 | 227 | ||
226 | if (snd_soc_read(codec, AC97_RESET) == 0x0090) | ||
227 | return 0; | ||
228 | } while (retry_cnt++ < 10); | 228 | } while (retry_cnt++ < 10); |
229 | 229 | ||
230 | dev_err(codec->dev, "Failed to reset: AC97 link error\n"); | 230 | dev_err(codec->dev, "Failed to reset: AC97 link error\n"); |
@@ -240,7 +240,7 @@ static int ad1980_soc_probe(struct snd_soc_codec *codec) | |||
240 | u16 vendor_id2; | 240 | u16 vendor_id2; |
241 | u16 ext_status; | 241 | u16 ext_status; |
242 | 242 | ||
243 | ac97 = snd_soc_new_ac97_codec(codec); | 243 | ac97 = snd_soc_new_ac97_codec(codec, 0, 0); |
244 | if (IS_ERR(ac97)) { | 244 | if (IS_ERR(ac97)) { |
245 | ret = PTR_ERR(ac97); | 245 | ret = PTR_ERR(ac97); |
246 | dev_err(codec->dev, "Failed to register AC97 codec: %d\n", ret); | 246 | dev_err(codec->dev, "Failed to register AC97 codec: %d\n", ret); |
@@ -260,22 +260,10 @@ static int ad1980_soc_probe(struct snd_soc_codec *codec) | |||
260 | if (ret < 0) | 260 | if (ret < 0) |
261 | goto reset_err; | 261 | goto reset_err; |
262 | 262 | ||
263 | /* Read out vendor ID to make sure it is ad1980 */ | ||
264 | if (snd_soc_read(codec, AC97_VENDOR_ID1) != 0x4144) { | ||
265 | ret = -ENODEV; | ||
266 | goto reset_err; | ||
267 | } | ||
268 | |||
269 | vendor_id2 = snd_soc_read(codec, AC97_VENDOR_ID2); | 263 | vendor_id2 = snd_soc_read(codec, AC97_VENDOR_ID2); |
270 | 264 | if (vendor_id2 == 0x5374) { | |
271 | if (vendor_id2 != 0x5370) { | 265 | dev_warn(codec->dev, |
272 | if (vendor_id2 != 0x5374) { | 266 | "Found AD1981 - only 2/2 IN/OUT Channels supported\n"); |
273 | ret = -ENODEV; | ||
274 | goto reset_err; | ||
275 | } else { | ||
276 | dev_warn(codec->dev, | ||
277 | "Found AD1981 - only 2/2 IN/OUT Channels supported\n"); | ||
278 | } | ||
279 | } | 267 | } |
280 | 268 | ||
281 | /* unmute captures and playbacks volume */ | 269 | /* unmute captures and playbacks volume */ |