• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/src/linux/linux-2.6/sound/soc/codecs/

Lines Matching refs:codec

2  * wm9712.c  --  ALSA Soc WM9712 codec support
32 static unsigned int ac97_read(struct snd_soc_codec *codec,
34 static int ac97_write(struct snd_soc_codec *codec,
162 static int wm9712_add_controls(struct snd_soc_codec *codec)
167 err = snd_ctl_add(codec->card,
168 snd_soc_cnew(&wm9712_snd_ac97_controls[i],codec, NULL));
176 * the codec only has a single control that is shared by both channels.
183 l = ac97_read(w->codec, HPL_MIXER);
184 r = ac97_read(w->codec, HPR_MIXER);
185 beep = ac97_read(w->codec, AC97_PC_BEEP);
186 mic = ac97_read(w->codec, AC97_VIDEO);
187 phone = ac97_read(w->codec, AC97_PHONE);
188 line = ac97_read(w->codec, AC97_LINE);
189 pcm = ac97_read(w->codec, AC97_PCM);
190 aux = ac97_read(w->codec, AC97_CD);
193 ac97_write(w->codec, AC97_VIDEO, mic & 0x7fff);
195 ac97_write(w->codec, AC97_VIDEO, mic | 0x8000);
198 ac97_write(w->codec, AC97_PCM, pcm & 0x7fff);
200 ac97_write(w->codec, AC97_PCM, pcm | 0x8000);
203 ac97_write(w->codec, AC97_LINE, line & 0x7fff);
205 ac97_write(w->codec, AC97_LINE, line | 0x8000);
208 ac97_write(w->codec, AC97_PHONE, phone & 0x7fff);
210 ac97_write(w->codec, AC97_PHONE, phone | 0x8000);
213 ac97_write(w->codec, AC97_CD, aux & 0x7fff);
215 ac97_write(w->codec, AC97_CD, aux | 0x8000);
218 ac97_write(w->codec, AC97_PC_BEEP, beep & 0x7fff);
220 ac97_write(w->codec, AC97_PC_BEEP, beep | 0x8000);
452 static int wm9712_add_widgets(struct snd_soc_codec *codec)
457 snd_soc_dapm_new_control(codec, &wm9712_dapm_widgets[i]);
462 snd_soc_dapm_connect_input(codec, audio_map[i][0],
466 snd_soc_dapm_new_widgets(codec);
470 static unsigned int ac97_read(struct snd_soc_codec *codec,
473 u16 *cache = codec->reg_cache;
478 return soc_ac97_ops.read(codec->ac97, reg);
489 static int ac97_write(struct snd_soc_codec *codec, unsigned int reg,
492 u16 *cache = codec->reg_cache;
494 soc_ac97_ops.write(codec->ac97, reg, val);
507 struct snd_soc_codec *codec = socdev->codec;
511 vra = ac97_read(codec, AC97_EXTENDED_STATUS);
512 ac97_write(codec, AC97_EXTENDED_STATUS, vra | 0x1);
519 return ac97_write(codec, reg, runtime->rate);
527 struct snd_soc_codec *codec = socdev->codec;
530 vra = ac97_read(codec, AC97_EXTENDED_STATUS);
531 ac97_write(codec, AC97_EXTENDED_STATUS, vra | 0x1);
532 xsle = ac97_read(codec, AC97_PCI_SID);
533 ac97_write(codec, AC97_PCI_SID, xsle | 0x8000);
538 return ac97_write(codec, AC97_PCM_SURR_DAC_RATE, runtime->rate);
577 static int wm9712_dapm_event(struct snd_soc_codec *codec, int event)
584 reg = ac97_read(codec, AC97_EXTENDED_MID) & 0xdfff;
585 ac97_write(codec, AC97_EXTENDED_MID, reg);
592 reg = ac97_read(codec, AC97_EXTENDED_MID) & 0xbbff;
593 ac97_write(codec, AC97_EXTENDED_MID, reg);
594 ac97_write(codec, AC97_POWERDOWN, 0x0000);
598 ac97_write(codec, AC97_EXTENDED_MID, 0xffff);
599 ac97_write(codec, AC97_EXTENDED_MSTATUS, 0xffff);
600 ac97_write(codec, AC97_POWERDOWN, 0xffff);
603 codec->dapm_state = event;
607 static int wm9712_reset(struct snd_soc_codec *codec, int try_warm)
610 soc_ac97_ops.warm_reset(codec->ac97);
611 if (!(ac97_read(codec, 0) & 0x8000))
615 soc_ac97_ops.reset(codec->ac97);
616 if (ac97_read(codec, 0) & 0x8000)
629 struct snd_soc_codec *codec = socdev->codec;
631 wm9712_dapm_event(codec, SNDRV_CTL_POWER_D3cold);
638 struct snd_soc_codec *codec = socdev->codec;
640 u16 *cache = codec->reg_cache;
642 ret = wm9712_reset(codec, 1);
644 printk(KERN_ERR "could not reset AC97 codec\n");
648 wm9712_dapm_event(codec, SNDRV_CTL_POWER_D3hot);
656 soc_ac97_ops.write(codec->ac97, i, cache[i>>1]);
660 if (codec->suspend_dapm_state == SNDRV_CTL_POWER_D0)
661 wm9712_dapm_event(codec, SNDRV_CTL_POWER_D0);
669 struct snd_soc_codec *codec;
674 socdev->codec = kzalloc(sizeof(struct snd_soc_codec), GFP_KERNEL);
675 if (socdev->codec == NULL)
677 codec = socdev->codec;
678 mutex_init(&codec->mutex);
680 codec->reg_cache = kmemdup(wm9712_reg, sizeof(wm9712_reg), GFP_KERNEL);
682 if (codec->reg_cache == NULL) {
686 codec->reg_cache_size = sizeof(wm9712_reg);
687 codec->reg_cache_step = 2;
689 codec->name = "WM9712";
690 codec->owner = THIS_MODULE;
691 codec->dai = wm9712_dai;
692 codec->num_dai = ARRAY_SIZE(wm9712_dai);
693 codec->write = ac97_write;
694 codec->read = ac97_read;
695 codec->dapm_event = wm9712_dapm_event;
696 INIT_LIST_HEAD(&codec->dapm_widgets);
697 INIT_LIST_HEAD(&codec->dapm_paths);
699 ret = snd_soc_new_ac97_codec(codec, &soc_ac97_ops, 0);
701 printk(KERN_ERR "wm9712: failed to register AC97 codec\n");
710 ret = wm9712_reset(codec, 0);
717 ac97_write(codec, AC97_VIDEO, ac97_read(codec, AC97_VIDEO) | 0x3000);
719 wm9712_dapm_event(codec, SNDRV_CTL_POWER_D3hot);
720 wm9712_add_controls(codec);
721 wm9712_add_widgets(codec);
734 snd_soc_free_ac97_codec(codec);
737 kfree(codec->reg_cache);
740 kfree(socdev->codec);
741 socdev->codec = NULL;
748 struct snd_soc_codec *codec = socdev->codec;
750 if (codec == NULL)
755 snd_soc_free_ac97_codec(codec);
756 kfree(codec->reg_cache);
757 kfree(codec);