diff options
author | Keita Maehara <maehara@debian.org> | 2007-09-19 08:29:37 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2007-10-16 10:50:57 -0400 |
commit | 43115f58e215f2c88c3cc2514dbf47e4643cab5b (patch) | |
tree | f132467fa1ccac6fe4f1bd44cabb98252fcc24c6 /sound/pci/ac97 | |
parent | 13043984e7e3952b0030ec8f27eb1e66b6529770 (diff) |
[ALSA] ac97: YMF743 missing controls support (2/2)
These patches enable a few YMF743 controls (Tone/3D/IEC958) that won't
be detected with the current version of ALSA.
The second one contains following changes:
- A chip-specific SPDIF support for YMF743 (It doesn't have AC97
standard SPDIF registers seen on YMF753).
- The implementation for 'IEC958 Playback Source' and 'IEC958 Mute'
are identical to the ones for YMF753. But there is no 'IEC958 Output
Pin' for YMF743.
Signed-off-by: Keita Maehara <maehara@debian.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/ac97')
-rw-r--r-- | sound/pci/ac97/ac97_codec.c | 11 | ||||
-rw-r--r-- | sound/pci/ac97/ac97_id.h | 1 | ||||
-rw-r--r-- | sound/pci/ac97/ac97_patch.c | 91 | ||||
-rw-r--r-- | sound/pci/ac97/ac97_proc.c | 8 |
4 files changed, 85 insertions, 26 deletions
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index 0906f1717f2b..e13893d72a2c 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c | |||
@@ -176,7 +176,7 @@ static const struct ac97_codec_id snd_ac97_codec_ids[] = { | |||
176 | { 0x574d4C09, 0xffffffff, "WM9709", NULL, NULL}, | 176 | { 0x574d4C09, 0xffffffff, "WM9709", NULL, NULL}, |
177 | { 0x574d4C12, 0xffffffff, "WM9711,WM9712", patch_wolfson11, NULL}, | 177 | { 0x574d4C12, 0xffffffff, "WM9711,WM9712", patch_wolfson11, NULL}, |
178 | { 0x574d4c13, 0xffffffff, "WM9713,WM9714", patch_wolfson13, NULL, AC97_DEFAULT_POWER_OFF}, | 178 | { 0x574d4c13, 0xffffffff, "WM9713,WM9714", patch_wolfson13, NULL, AC97_DEFAULT_POWER_OFF}, |
179 | { 0x594d4800, 0xffffffff, "YMF743", NULL, NULL }, | 179 | { 0x594d4800, 0xffffffff, "YMF743", patch_yamaha_ymf743, NULL }, |
180 | { 0x594d4802, 0xffffffff, "YMF752", NULL, NULL }, | 180 | { 0x594d4802, 0xffffffff, "YMF752", NULL, NULL }, |
181 | { 0x594d4803, 0xffffffff, "YMF753", patch_yamaha_ymf753, NULL }, | 181 | { 0x594d4803, 0xffffffff, "YMF753", patch_yamaha_ymf753, NULL }, |
182 | { 0x83847600, 0xffffffff, "STAC9700,83,84", patch_sigmatel_stac9700, NULL }, | 182 | { 0x83847600, 0xffffffff, "STAC9700,83,84", patch_sigmatel_stac9700, NULL }, |
@@ -779,6 +779,12 @@ static int snd_ac97_spdif_default_put(struct snd_kcontrol *kcontrol, struct snd_ | |||
779 | change |= snd_ac97_update_bits_nolock(ac97, AC97_CXR_AUDIO_MISC, | 779 | change |= snd_ac97_update_bits_nolock(ac97, AC97_CXR_AUDIO_MISC, |
780 | AC97_CXR_SPDIF_MASK | AC97_CXR_COPYRGT, | 780 | AC97_CXR_SPDIF_MASK | AC97_CXR_COPYRGT, |
781 | v); | 781 | v); |
782 | } else if (ac97->id == AC97_ID_YMF743) { | ||
783 | change |= snd_ac97_update_bits_nolock(ac97, | ||
784 | AC97_YMF7X3_DIT_CTRL, | ||
785 | 0xff38, | ||
786 | ((val << 4) & 0xff00) | | ||
787 | ((val << 2) & 0x0038)); | ||
782 | } else { | 788 | } else { |
783 | unsigned short extst = snd_ac97_read_cache(ac97, AC97_EXTENDED_STATUS); | 789 | unsigned short extst = snd_ac97_read_cache(ac97, AC97_EXTENDED_STATUS); |
784 | snd_ac97_update_bits_nolock(ac97, AC97_EXTENDED_STATUS, AC97_EA_SPDIF, 0); /* turn off */ | 790 | snd_ac97_update_bits_nolock(ac97, AC97_EXTENDED_STATUS, AC97_EA_SPDIF, 0); /* turn off */ |
@@ -1375,7 +1381,8 @@ static int snd_ac97_mixer_build(struct snd_ac97 * ac97) | |||
1375 | for (idx = 0; idx < 2; idx++) { | 1381 | for (idx = 0; idx < 2; idx++) { |
1376 | if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_tone[idx], ac97))) < 0) | 1382 | if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_tone[idx], ac97))) < 0) |
1377 | return err; | 1383 | return err; |
1378 | if (ac97->id == AC97_ID_YMF753) { | 1384 | if (ac97->id == AC97_ID_YMF743 || |
1385 | ac97->id == AC97_ID_YMF753) { | ||
1379 | kctl->private_value &= ~(0xff << 16); | 1386 | kctl->private_value &= ~(0xff << 16); |
1380 | kctl->private_value |= 7 << 16; | 1387 | kctl->private_value |= 7 << 16; |
1381 | } | 1388 | } |
diff --git a/sound/pci/ac97/ac97_id.h b/sound/pci/ac97/ac97_id.h index 6d73514dc49e..0a7dadc244fd 100644 --- a/sound/pci/ac97/ac97_id.h +++ b/sound/pci/ac97/ac97_id.h | |||
@@ -54,6 +54,7 @@ | |||
54 | #define AC97_ID_ALC658 0x414c4780 | 54 | #define AC97_ID_ALC658 0x414c4780 |
55 | #define AC97_ID_ALC658D 0x414c4781 | 55 | #define AC97_ID_ALC658D 0x414c4781 |
56 | #define AC97_ID_ALC850 0x414c4790 | 56 | #define AC97_ID_ALC850 0x414c4790 |
57 | #define AC97_ID_YMF743 0x594d4800 | ||
57 | #define AC97_ID_YMF753 0x594d4803 | 58 | #define AC97_ID_YMF753 0x594d4803 |
58 | #define AC97_ID_VT1616 0x49434551 | 59 | #define AC97_ID_VT1616 0x49434551 |
59 | #define AC97_ID_CM9738 0x434d4941 | 60 | #define AC97_ID_CM9738 0x434d4941 |
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c index 075ac4e14bcb..2e683dd4e861 100644 --- a/sound/pci/ac97/ac97_patch.c +++ b/sound/pci/ac97/ac97_patch.c | |||
@@ -204,6 +204,7 @@ static inline int is_shared_micin(struct snd_ac97 *ac97) | |||
204 | 204 | ||
205 | 205 | ||
206 | /* The following snd_ac97_ymf753_... items added by David Shust (dshust@shustring.com) */ | 206 | /* The following snd_ac97_ymf753_... items added by David Shust (dshust@shustring.com) */ |
207 | /* Modified for YMF743 by Keita Maehara <maehara@debian.org> */ | ||
207 | 208 | ||
208 | /* It is possible to indicate to the Yamaha YMF7x3 the type of | 209 | /* It is possible to indicate to the Yamaha YMF7x3 the type of |
209 | speakers being used. */ | 210 | speakers being used. */ |
@@ -298,6 +299,74 @@ static int snd_ac97_ymf7x3_spdif_source_put(struct snd_kcontrol *kcontrol, | |||
298 | return snd_ac97_update_bits(ac97, AC97_YMF7X3_DIT_CTRL, 0x0002, val); | 299 | return snd_ac97_update_bits(ac97, AC97_YMF7X3_DIT_CTRL, 0x0002, val); |
299 | } | 300 | } |
300 | 301 | ||
302 | static int patch_yamaha_ymf7x3_3d(struct snd_ac97 *ac97) | ||
303 | { | ||
304 | struct snd_kcontrol *kctl; | ||
305 | int err; | ||
306 | |||
307 | kctl = snd_ac97_cnew(&snd_ac97_controls_3d[0], ac97); | ||
308 | err = snd_ctl_add(ac97->bus->card, kctl); | ||
309 | if (err < 0) | ||
310 | return err; | ||
311 | strcpy(kctl->id.name, "3D Control - Wide"); | ||
312 | kctl->private_value = AC97_SINGLE_VALUE(AC97_3D_CONTROL, 9, 7, 0); | ||
313 | snd_ac97_write_cache(ac97, AC97_3D_CONTROL, 0x0000); | ||
314 | err = snd_ctl_add(ac97->bus->card, | ||
315 | snd_ac97_cnew(&snd_ac97_ymf7x3_controls_speaker, | ||
316 | ac97)); | ||
317 | if (err < 0) | ||
318 | return err; | ||
319 | snd_ac97_write_cache(ac97, AC97_YMF7X3_3D_MODE_SEL, 0x0c00); | ||
320 | return 0; | ||
321 | } | ||
322 | |||
323 | static const struct snd_kcontrol_new snd_ac97_yamaha_ymf743_controls_spdif[3] = | ||
324 | { | ||
325 | AC97_SINGLE(SNDRV_CTL_NAME_IEC958("", PLAYBACK, SWITCH), | ||
326 | AC97_YMF7X3_DIT_CTRL, 0, 1, 0), | ||
327 | { | ||
328 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
329 | .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, NONE) "Source", | ||
330 | .info = snd_ac97_ymf7x3_spdif_source_info, | ||
331 | .get = snd_ac97_ymf7x3_spdif_source_get, | ||
332 | .put = snd_ac97_ymf7x3_spdif_source_put, | ||
333 | }, | ||
334 | AC97_SINGLE(SNDRV_CTL_NAME_IEC958("", NONE, NONE) "Mute", | ||
335 | AC97_YMF7X3_DIT_CTRL, 2, 1, 1) | ||
336 | }; | ||
337 | |||
338 | static int patch_yamaha_ymf743_build_spdif(struct snd_ac97 *ac97) | ||
339 | { | ||
340 | int err; | ||
341 | |||
342 | err = patch_build_controls(ac97, &snd_ac97_controls_spdif[0], 3); | ||
343 | if (err < 0) | ||
344 | return err; | ||
345 | err = patch_build_controls(ac97, | ||
346 | snd_ac97_yamaha_ymf743_controls_spdif, 3); | ||
347 | if (err < 0) | ||
348 | return err; | ||
349 | /* set default PCM S/PDIF params */ | ||
350 | /* PCM audio,no copyright,no preemphasis,PCM coder,original */ | ||
351 | snd_ac97_write_cache(ac97, AC97_YMF7X3_DIT_CTRL, 0xa201); | ||
352 | return 0; | ||
353 | } | ||
354 | |||
355 | static struct snd_ac97_build_ops patch_yamaha_ymf743_ops = { | ||
356 | .build_spdif = patch_yamaha_ymf743_build_spdif, | ||
357 | .build_3d = patch_yamaha_ymf7x3_3d, | ||
358 | }; | ||
359 | |||
360 | static int patch_yamaha_ymf743(struct snd_ac97 *ac97) | ||
361 | { | ||
362 | ac97->build_ops = &patch_yamaha_ymf743_ops; | ||
363 | ac97->caps |= AC97_BC_BASS_TREBLE; | ||
364 | ac97->caps |= 0x04 << 10; /* Yamaha 3D enhancement */ | ||
365 | ac97->rates[AC97_RATES_SPDIF] = SNDRV_PCM_RATE_48000; /* 48k only */ | ||
366 | ac97->ext_id |= AC97_EI_SPDIF; /* force the detection of spdif */ | ||
367 | return 0; | ||
368 | } | ||
369 | |||
301 | /* The AC'97 spec states that the S/PDIF signal is to be output at pin 48. | 370 | /* The AC'97 spec states that the S/PDIF signal is to be output at pin 48. |
302 | The YMF753 will output the S/PDIF signal to pin 43, 47 (EAPD), or 48. | 371 | The YMF753 will output the S/PDIF signal to pin 43, 47 (EAPD), or 48. |
303 | By default, no output pin is selected, and the S/PDIF signal is not output. | 372 | By default, no output pin is selected, and the S/PDIF signal is not output. |
@@ -358,28 +427,6 @@ static const struct snd_kcontrol_new snd_ac97_ymf753_controls_spdif[3] = { | |||
358 | AC97_YMF7X3_DIT_CTRL, 2, 1, 1) | 427 | AC97_YMF7X3_DIT_CTRL, 2, 1, 1) |
359 | }; | 428 | }; |
360 | 429 | ||
361 | static int patch_yamaha_ymf7x3_3d(struct snd_ac97 *ac97) | ||
362 | { | ||
363 | struct snd_kcontrol *kctl; | ||
364 | int err; | ||
365 | |||
366 | kctl = snd_ac97_cnew(&snd_ac97_controls_3d[0], ac97); | ||
367 | err = snd_ctl_add(ac97->bus->card, kctl); | ||
368 | if (err < 0) | ||
369 | return err; | ||
370 | strcpy(kctl->id.name, "3D Control - Wide"); | ||
371 | kctl->private_value = AC97_SINGLE_VALUE(AC97_3D_CONTROL, 9, 7, 0); | ||
372 | snd_ac97_write_cache(ac97, AC97_3D_CONTROL, 0x0000); | ||
373 | |||
374 | err = snd_ctl_add(ac97->bus->card, | ||
375 | snd_ac97_cnew(&snd_ac97_ymf7x3_controls_speaker, | ||
376 | ac97)); | ||
377 | if (err < 0) | ||
378 | return err; | ||
379 | snd_ac97_write_cache(ac97, AC97_YMF7X3_3D_MODE_SEL, 0x0c00); | ||
380 | return 0; | ||
381 | } | ||
382 | |||
383 | static int patch_yamaha_ymf753_post_spdif(struct snd_ac97 * ac97) | 430 | static int patch_yamaha_ymf753_post_spdif(struct snd_ac97 * ac97) |
384 | { | 431 | { |
385 | int err; | 432 | int err; |
diff --git a/sound/pci/ac97/ac97_proc.c b/sound/pci/ac97/ac97_proc.c index a3fdd7da911c..f547986d845c 100644 --- a/sound/pci/ac97/ac97_proc.c +++ b/sound/pci/ac97/ac97_proc.c | |||
@@ -236,10 +236,14 @@ static void snd_ac97_proc_read_main(struct snd_ac97 *ac97, struct snd_info_buffe | |||
236 | val = snd_ac97_read(ac97, AC97_PCM_MIC_ADC_RATE); | 236 | val = snd_ac97_read(ac97, AC97_PCM_MIC_ADC_RATE); |
237 | snd_iprintf(buffer, "PCM MIC ADC : %iHz\n", val); | 237 | snd_iprintf(buffer, "PCM MIC ADC : %iHz\n", val); |
238 | } | 238 | } |
239 | if ((ext & AC97_EI_SPDIF) || (ac97->flags & AC97_CS_SPDIF)) { | 239 | if ((ext & AC97_EI_SPDIF) || (ac97->flags & AC97_CS_SPDIF) || |
240 | (ac97->id == AC97_ID_YMF743)) { | ||
240 | if (ac97->flags & AC97_CS_SPDIF) | 241 | if (ac97->flags & AC97_CS_SPDIF) |
241 | val = snd_ac97_read(ac97, AC97_CSR_SPDIF); | 242 | val = snd_ac97_read(ac97, AC97_CSR_SPDIF); |
242 | else | 243 | else if (ac97->id == AC97_ID_YMF743) { |
244 | val = snd_ac97_read(ac97, AC97_YMF7X3_DIT_CTRL); | ||
245 | val = 0x2000 | (val & 0xff00) >> 4 | (val & 0x38) >> 2; | ||
246 | } else | ||
243 | val = snd_ac97_read(ac97, AC97_SPDIF); | 247 | val = snd_ac97_read(ac97, AC97_SPDIF); |
244 | 248 | ||
245 | snd_iprintf(buffer, "SPDIF Control :%s%s%s%s Category=0x%x Generation=%i%s%s%s\n", | 249 | snd_iprintf(buffer, "SPDIF Control :%s%s%s%s Category=0x%x Generation=%i%s%s%s\n", |