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

Lines Matching refs:card

47 int (*snd_mixer_oss_notify_callback)(struct snd_card *card, int free_flag);
55 snd_iprintf(buffer, "%s\n", entry->card->id);
58 static inline int init_info_for_card(struct snd_card *card)
63 if ((err = snd_info_card_register(card)) < 0) {
64 snd_printd("unable to create card info\n");
67 if ((entry = snd_info_create_card_entry(card, "id", card->proc_root)) == NULL) {
68 snd_printd("unable to create card entry\n");
76 card->proc_id = entry;
80 #define init_info_for_card(card)
85 * @idx: card index (address) [0 ... (SNDRV_CARDS-1)]
86 * @xid: card identification (ASCII string)
98 struct snd_card *card;
103 card = kzalloc(sizeof(*card) + extra_size, GFP_KERNEL);
104 if (card == NULL)
109 strlcpy(card->id, xid, sizeof(card->id));
142 card->number = idx;
143 card->module = module;
144 INIT_LIST_HEAD(&card->devices);
145 init_rwsem(&card->controls_rwsem);
146 rwlock_init(&card->ctl_files_rwlock);
147 INIT_LIST_HEAD(&card->controls);
148 INIT_LIST_HEAD(&card->ctl_files);
149 spin_lock_init(&card->files_lock);
150 init_waitqueue_head(&card->shutdown_sleep);
152 mutex_init(&card->power_lock);
153 init_waitqueue_head(&card->power_sleep);
157 if ((err = snd_ctl_create(card)) < 0) {
161 if ((err = snd_info_card_create(card)) < 0) {
162 snd_printd("unable to create card info\n");
166 card->private_data = (char *)card + sizeof(struct snd_card);
167 return card;
170 snd_device_free_all(card, SNDRV_DEV_CMD_PRE);
172 kfree(card);
178 /* return non-zero if a card is already locked */
179 int snd_card_locked(int card)
184 locked = snd_cards_lock & (1 << card);
264 * @card: soundcard structure
273 int snd_card_disconnect(struct snd_card *card)
279 spin_lock(&card->files_lock);
280 if (card->shutdown) {
281 spin_unlock(&card->files_lock);
284 card->shutdown = 1;
285 spin_unlock(&card->files_lock);
289 snd_cards[card->number] = NULL;
294 spin_lock(&card->files_lock);
295 mfile = card->files;
312 spin_unlock(&card->files_lock);
319 snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_DISCONNECT);
323 err = snd_device_disconnect_all(card);
325 snd_printk(KERN_ERR "not all devices for card %i can be disconnected\n", card->number);
327 snd_info_card_disconnect(card);
335 * @card: soundcard structure
344 static int snd_card_do_free(struct snd_card *card)
348 snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_FREE);
350 if (snd_device_free_all(card, SNDRV_DEV_CMD_PRE) < 0) {
354 if (snd_device_free_all(card, SNDRV_DEV_CMD_NORMAL) < 0) {
358 if (snd_device_free_all(card, SNDRV_DEV_CMD_POST) < 0) {
362 if (card->private_free)
363 card->private_free(card);
364 snd_info_free_entry(card->proc_id);
365 if (snd_info_card_free(card) < 0) {
366 snd_printk(KERN_WARNING "unable to free card info\n");
370 if (card->card_dev)
371 device_unregister(card->card_dev);
373 kfree(card);
377 static int snd_card_free_prepare(struct snd_card *card)
379 if (card == NULL)
381 (void) snd_card_disconnect(card);
383 snd_cards[card->number] = NULL;
384 snd_cards_lock &= ~(1 << card->number);
387 wake_up(&card->power_sleep);
392 int snd_card_free_when_closed(struct snd_card *card)
395 int ret = snd_card_free_prepare(card);
399 spin_lock(&card->files_lock);
400 if (card->files == NULL)
403 card->free_on_last_close = 1;
404 spin_unlock(&card->files_lock);
407 snd_card_do_free(card);
413 int snd_card_free(struct snd_card *card)
415 int ret = snd_card_free_prepare(card);
420 wait_event(card->shutdown_sleep, card->files == NULL);
421 snd_card_do_free(card);
427 static void choose_default_id(struct snd_card *card)
432 id = spos = card->shortname;
438 id = card->id;
442 *id++ = isalpha(card->shortname[0]) ? card->shortname[0] : 'D';
443 while (*spos != '\0' && (size_t)(id - card->id) < sizeof(card->id) - 1) {
450 id = card->id;
457 snd_printk(KERN_ERR "unable to choose default card id (%s)\n", id);
458 strcpy(card->id, card->proc_root->name);
476 } else if ((size_t)len <= sizeof(card->id) - 3) {
481 if ((size_t)len <= sizeof(card->id) - 2)
493 * @card: soundcard structure
498 * of the initialization of the card.
502 int snd_card_register(struct snd_card *card)
506 snd_assert(card != NULL, return -EINVAL);
508 if (!card->card_dev) {
509 card->card_dev = device_create(sound_class, card->dev, 0,
510 "card%i", card->number);
511 if (IS_ERR(card->card_dev))
512 card->card_dev = NULL;
515 if ((err = snd_device_register_all(card)) < 0)
518 if (snd_cards[card->number]) {
523 if (card->id[0] == '\0')
524 choose_default_id(card);
525 snd_cards[card->number] = card;
527 init_info_for_card(card);
530 snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_REGISTER);
544 struct snd_card *card;
548 if ((card = snd_cards[idx]) != NULL) {
552 card->id,
553 card->driver,
554 card->shortname);
556 card->longname);
569 struct snd_card *card;
573 if ((card = snd_cards[idx]) != NULL) {
575 snd_iprintf(buffer, "%s\n", card->longname);
592 struct snd_card *card;
596 if ((card = snd_cards[idx]) != NULL)
598 idx, card->module->name);
645 * @card: soundcard structure
654 int snd_component_add(struct snd_card *card, const char *component)
659 ptr = strstr(card->components, component);
664 if (strlen(card->components) + 1 + len + 1 > sizeof(card->components)) {
668 if (card->components[0] != '\0')
669 strcat(card->components, " ");
670 strcat(card->components, component);
677 * snd_card_file_add - add the file to the file list of the card
678 * @card: soundcard structure
681 * This function adds the file to the file linked-list of the card.
687 int snd_card_file_add(struct snd_card *card, struct file *file)
697 spin_lock(&card->files_lock);
698 if (card->shutdown) {
699 spin_unlock(&card->files_lock);
703 mfile->next = card->files;
704 card->files = mfile;
705 spin_unlock(&card->files_lock);
713 * @card: soundcard structure
716 * This function removes the file formerly added to the card via
724 int snd_card_file_remove(struct snd_card *card, struct file *file)
729 spin_lock(&card->files_lock);
730 mfile = card->files;
736 card->files = mfile->next;
748 if (card->files == NULL)
750 spin_unlock(&card->files_lock);
752 wake_up(&card->shutdown_sleep);
753 if (card->free_on_last_close)
754 snd_card_do_free(card);
757 snd_printk(KERN_ERR "ALSA card file remove problem (%p)\n", file);
769 * @card: soundcard structure
776 int snd_power_wait(struct snd_card *card, unsigned int power_state)
782 if (snd_power_get_state(card) == power_state)
785 add_wait_queue(&card->power_sleep, &wait);
787 if (card->shutdown) {
791 if (snd_power_get_state(card) == power_state)
794 snd_power_unlock(card);
796 snd_power_lock(card);
798 remove_wait_queue(&card->power_sleep, &wait);