ac97_patch.c (13043984e7e3952b0030ec8f27eb1e66b6529770) | ac97_patch.c (43115f58e215f2c88c3cc2514dbf47e4643cab5b) |
---|---|
1/* 2 * Copyright (c) by Jaroslav Kysela <perex@suse.cz> 3 * Universal interface for Audio Codec '97 4 * 5 * For more details look to AC '97 component specification revision 2.2 6 * by Intel Corporation (http://developer.intel.com) and to datasheets 7 * for specific codecs. 8 * --- 190 unchanged lines hidden (view full) --- 199/* system has shared jacks with mic in enabled */ 200static inline int is_shared_micin(struct snd_ac97 *ac97) 201{ 202 return !ac97->indep_surround && !is_clfe_on(ac97); 203} 204 205 206/* The following snd_ac97_ymf753_... items added by David Shust (dshust@shustring.com) */ | 1/* 2 * Copyright (c) by Jaroslav Kysela <perex@suse.cz> 3 * Universal interface for Audio Codec '97 4 * 5 * For more details look to AC '97 component specification revision 2.2 6 * by Intel Corporation (http://developer.intel.com) and to datasheets 7 * for specific codecs. 8 * --- 190 unchanged lines hidden (view full) --- 199/* system has shared jacks with mic in enabled */ 200static inline int is_shared_micin(struct snd_ac97 *ac97) 201{ 202 return !ac97->indep_surround && !is_clfe_on(ac97); 203} 204 205 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/* It is possible to indicate to the Yamaha YMF7x3 the type of 209 speakers being used. */ 210 211static int snd_ac97_ymf7x3_info_speaker(struct snd_kcontrol *kcontrol, 212 struct snd_ctl_elem_info *uinfo) 213{ 214 static char *texts[3] = { --- 78 unchanged lines hidden (view full) --- 293 unsigned short val; 294 295 if (ucontrol->value.enumerated.item[0] > 1) 296 return -EINVAL; 297 val = ucontrol->value.enumerated.item[0] << 1; 298 return snd_ac97_update_bits(ac97, AC97_YMF7X3_DIT_CTRL, 0x0002, val); 299} 300 | 208 209/* It is possible to indicate to the Yamaha YMF7x3 the type of 210 speakers being used. */ 211 212static int snd_ac97_ymf7x3_info_speaker(struct snd_kcontrol *kcontrol, 213 struct snd_ctl_elem_info *uinfo) 214{ 215 static char *texts[3] = { --- 78 unchanged lines hidden (view full) --- 294 unsigned short val; 295 296 if (ucontrol->value.enumerated.item[0] > 1) 297 return -EINVAL; 298 val = ucontrol->value.enumerated.item[0] << 1; 299 return snd_ac97_update_bits(ac97, AC97_YMF7X3_DIT_CTRL, 0x0002, val); 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. 302 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. 304 There is also a bit to mute S/PDIF output in a vendor-specific register. */ 305static int snd_ac97_ymf753_spdif_output_pin_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 306{ 307 static char *texts[3] = { "Disabled", "Pin 43", "Pin 48" }; 308 --- 44 unchanged lines hidden (view full) --- 353 .info = snd_ac97_ymf753_spdif_output_pin_info, 354 .get = snd_ac97_ymf753_spdif_output_pin_get, 355 .put = snd_ac97_ymf753_spdif_output_pin_put, 356 }, 357 AC97_SINGLE(SNDRV_CTL_NAME_IEC958("", NONE, NONE) "Mute", 358 AC97_YMF7X3_DIT_CTRL, 2, 1, 1) 359}; 360 | 370/* The AC'97 spec states that the S/PDIF signal is to be output at pin 48. 371 The YMF753 will output the S/PDIF signal to pin 43, 47 (EAPD), or 48. 372 By default, no output pin is selected, and the S/PDIF signal is not output. 373 There is also a bit to mute S/PDIF output in a vendor-specific register. */ 374static int snd_ac97_ymf753_spdif_output_pin_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 375{ 376 static char *texts[3] = { "Disabled", "Pin 43", "Pin 48" }; 377 --- 44 unchanged lines hidden (view full) --- 422 .info = snd_ac97_ymf753_spdif_output_pin_info, 423 .get = snd_ac97_ymf753_spdif_output_pin_get, 424 .put = snd_ac97_ymf753_spdif_output_pin_put, 425 }, 426 AC97_SINGLE(SNDRV_CTL_NAME_IEC958("", NONE, NONE) "Mute", 427 AC97_YMF7X3_DIT_CTRL, 2, 1, 1) 428}; 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) 384{ 385 int err; 386 387 if ((err = patch_build_controls(ac97, snd_ac97_ymf753_controls_spdif, ARRAY_SIZE(snd_ac97_ymf753_controls_spdif))) < 0) 388 return err; 389 return 0; 390} --- 3148 unchanged lines hidden --- | 430static int patch_yamaha_ymf753_post_spdif(struct snd_ac97 * ac97) 431{ 432 int err; 433 434 if ((err = patch_build_controls(ac97, snd_ac97_ymf753_controls_spdif, ARRAY_SIZE(snd_ac97_ymf753_controls_spdif))) < 0) 435 return err; 436 return 0; 437} --- 3148 unchanged lines hidden --- |