aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/ac97/ac97_patch.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/ac97/ac97_patch.c')
-rw-r--r--sound/pci/ac97/ac97_patch.c91
1 files changed, 69 insertions, 22 deletions
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
302static 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
323static 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
338static 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
355static 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
360static 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
361static 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
383static int patch_yamaha_ymf753_post_spdif(struct snd_ac97 * ac97) 430static int patch_yamaha_ymf753_post_spdif(struct snd_ac97 * ac97)
384{ 431{
385 int err; 432 int err;