int snd_ak4114_build(ak4114_t *ak4114, snd_pcm_substream_t *ply_substream, snd_pcm_substream_t *cap_substream) { snd_kcontrol_t *kctl; unsigned int idx; int err; snd_assert(cap_substream, return -EINVAL); ak4114->playback_substream = ply_substream; ak4114->capture_substream = cap_substream; for (idx = 0; idx < AK4114_CONTROLS; idx++) { kctl = snd_ctl_new1(&snd_ak4114_iec958_controls[idx], ak4114); if (kctl == NULL) return -ENOMEM; if (!strstr(kctl->id.name, "Playback")) { if (ply_substream == NULL) { snd_ctl_free_one(kctl); ak4114->kctls[idx] = NULL; continue; } kctl->id.device = ply_substream->pcm->device; kctl->id.subdevice = ply_substream->number; } else { kctl->id.device = cap_substream->pcm->device; kctl->id.subdevice = cap_substream->number; } err = snd_ctl_add(ak4114->card, kctl); if (err < 0) return err; ak4114->kctls[idx] = kctl; } return 0; }
int snd_ak4114_build(struct ak4114 *ak4114, struct snd_pcm_substream *ply_substream, struct snd_pcm_substream *cap_substream) { struct snd_kcontrol *kctl; unsigned int idx; int err; if (snd_BUG_ON(!cap_substream)) return -EINVAL; ak4114->playback_substream = ply_substream; ak4114->capture_substream = cap_substream; for (idx = 0; idx < AK4114_CONTROLS; idx++) { kctl = snd_ctl_new1(&snd_ak4114_iec958_controls[idx], ak4114); if (kctl == NULL) return -ENOMEM; if (strstr(kctl->id.name, "Playback")) { if (ply_substream == NULL) { snd_ctl_free_one(kctl); ak4114->kctls[idx] = NULL; continue; } kctl->id.device = ply_substream->pcm->device; kctl->id.subdevice = ply_substream->number; } else { kctl->id.device = cap_substream->pcm->device; kctl->id.subdevice = cap_substream->number; } err = snd_ctl_add(ak4114->card, kctl); if (err < 0) return err; ak4114->kctls[idx] = kctl; } snd_ak4114_proc_init(ak4114); /* trigger workq */ schedule_delayed_work(&ak4114->work, HZ / 10); return 0; }
int pxa3xx_wm9713l_snd_mixer(snd_card_t * card) { snd_kcontrol_t *kctl; int i; int err; /* * Add controls */ for (i = 0; i < ARRAY_SIZE(wm9713_controls); i++) { kctl = snd_ctl_new1(&wm9713_controls[i], NULL); if (!kctl) return -ENOMEM; err = snd_ctl_add(card, kctl); if (err < 0) { snd_ctl_free_one(kctl); return err; } } return 0; }