• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6.36/sound/soc/codecs/

Lines Matching refs:codec

2  * wm9712.c  --  ALSA Soc WM9712 codec support
28 static unsigned int ac97_read(struct snd_soc_codec *codec,
30 static int ac97_write(struct snd_soc_codec *codec,
159 * the codec only has a single control that is shared by both channels.
167 l = ac97_read(w->codec, HPL_MIXER);
168 r = ac97_read(w->codec, HPR_MIXER);
169 beep = ac97_read(w->codec, AC97_PC_BEEP);
170 mic = ac97_read(w->codec, AC97_VIDEO);
171 phone = ac97_read(w->codec, AC97_PHONE);
172 line = ac97_read(w->codec, AC97_LINE);
173 pcm = ac97_read(w->codec, AC97_PCM);
174 aux = ac97_read(w->codec, AC97_CD);
177 ac97_write(w->codec, AC97_VIDEO, mic & 0x7fff);
179 ac97_write(w->codec, AC97_VIDEO, mic | 0x8000);
182 ac97_write(w->codec, AC97_PCM, pcm & 0x7fff);
184 ac97_write(w->codec, AC97_PCM, pcm | 0x8000);
187 ac97_write(w->codec, AC97_LINE, line & 0x7fff);
189 ac97_write(w->codec, AC97_LINE, line | 0x8000);
192 ac97_write(w->codec, AC97_PHONE, phone & 0x7fff);
194 ac97_write(w->codec, AC97_PHONE, phone | 0x8000);
197 ac97_write(w->codec, AC97_CD, aux & 0x7fff);
199 ac97_write(w->codec, AC97_CD, aux | 0x8000);
202 ac97_write(w->codec, AC97_PC_BEEP, beep & 0x7fff);
204 ac97_write(w->codec, AC97_PC_BEEP, beep | 0x8000);
433 static int wm9712_add_widgets(struct snd_soc_codec *codec)
435 snd_soc_dapm_new_controls(codec, wm9712_dapm_widgets,
438 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
443 static unsigned int ac97_read(struct snd_soc_codec *codec,
446 u16 *cache = codec->reg_cache;
451 return soc_ac97_ops.read(codec->ac97, reg);
462 static int ac97_write(struct snd_soc_codec *codec, unsigned int reg,
465 u16 *cache = codec->reg_cache;
468 soc_ac97_ops.write(codec->ac97, reg, val);
482 struct snd_soc_codec *codec = socdev->card->codec;
486 vra = ac97_read(codec, AC97_EXTENDED_STATUS);
487 ac97_write(codec, AC97_EXTENDED_STATUS, vra | 0x1);
494 return ac97_write(codec, reg, runtime->rate);
503 struct snd_soc_codec *codec = socdev->card->codec;
506 vra = ac97_read(codec, AC97_EXTENDED_STATUS);
507 ac97_write(codec, AC97_EXTENDED_STATUS, vra | 0x1);
508 xsle = ac97_read(codec, AC97_PCI_SID);
509 ac97_write(codec, AC97_PCI_SID, xsle | 0x8000);
514 return ac97_write(codec, AC97_PCM_SURR_DAC_RATE, runtime->rate);
560 static int wm9712_set_bias_level(struct snd_soc_codec *codec,
568 ac97_write(codec, AC97_POWERDOWN, 0x0000);
572 ac97_write(codec, AC97_EXTENDED_MSTATUS, 0xffff);
573 ac97_write(codec, AC97_POWERDOWN, 0xffff);
576 codec->bias_level = level;
580 static int wm9712_reset(struct snd_soc_codec *codec, int try_warm)
583 soc_ac97_ops.warm_reset(codec->ac97);
584 if (ac97_read(codec, 0) == wm9712_reg[0])
588 soc_ac97_ops.reset(codec->ac97);
590 soc_ac97_ops.warm_reset(codec->ac97);
591 if (ac97_read(codec, 0) != wm9712_reg[0])
604 struct snd_soc_codec *codec = socdev->card->codec;
606 wm9712_set_bias_level(codec, SND_SOC_BIAS_OFF);
613 struct snd_soc_codec *codec = socdev->card->codec;
615 u16 *cache = codec->reg_cache;
617 ret = wm9712_reset(codec, 1);
619 printk(KERN_ERR "could not reset AC97 codec\n");
623 wm9712_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
631 soc_ac97_ops.write(codec->ac97, i, cache[i>>1]);
641 struct snd_soc_codec *codec;
646 socdev->card->codec = kzalloc(sizeof(struct snd_soc_codec),
648 if (socdev->card->codec == NULL)
650 codec = socdev->card->codec;
651 mutex_init(&codec->mutex);
653 codec->reg_cache = kmemdup(wm9712_reg, sizeof(wm9712_reg), GFP_KERNEL);
655 if (codec->reg_cache == NULL) {
659 codec->reg_cache_size = sizeof(wm9712_reg);
660 codec->reg_cache_step = 2;
662 codec->name = "WM9712";
663 codec->owner = THIS_MODULE;
664 codec->dai = wm9712_dai;
665 codec->num_dai = ARRAY_SIZE(wm9712_dai);
666 codec->write = ac97_write;
667 codec->read = ac97_read;
668 codec->set_bias_level = wm9712_set_bias_level;
669 INIT_LIST_HEAD(&codec->dapm_widgets);
670 INIT_LIST_HEAD(&codec->dapm_paths);
672 ret = snd_soc_new_ac97_codec(codec, &soc_ac97_ops, 0);
674 printk(KERN_ERR "wm9712: failed to register AC97 codec\n");
683 ret = wm9712_reset(codec, 0);
690 ac97_write(codec, AC97_VIDEO, ac97_read(codec, AC97_VIDEO) | 0x3000);
692 wm9712_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
693 snd_soc_add_controls(codec, wm9712_snd_ac97_controls,
695 wm9712_add_widgets(codec);
702 snd_soc_free_ac97_codec(codec);
705 kfree(codec->reg_cache);
708 kfree(socdev->card->codec);
709 socdev->card->codec = NULL;
716 struct snd_soc_codec *codec = socdev->card->codec;
718 if (codec == NULL)
723 snd_soc_free_ac97_codec(codec);
724 kfree(codec->reg_cache);
725 kfree(codec);