• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/sound/core/

Lines Matching refs:card

95 int (*snd_mixer_oss_notify_callback)(struct snd_card *card, int free_flag);
103 snd_iprintf(buffer, "%s\n", entry->card->id);
106 static inline int init_info_for_card(struct snd_card *card)
111 if ((err = snd_info_card_register(card)) < 0) {
112 snd_printd("unable to create card info\n");
115 if ((entry = snd_info_create_card_entry(card, "id", card->proc_root)) == NULL) {
116 snd_printd("unable to create card entry\n");
124 card->proc_id = entry;
128 #define init_info_for_card(card)
133 * @idx: card index (address) [0 ... (SNDRV_CARDS-1)]
134 * @xid: card identification (ASCII string)
137 * @card_ret: the pointer to store the created card instance
151 struct snd_card *card;
160 card = kzalloc(sizeof(*card) + extra_size, GFP_KERNEL);
161 if (!card)
164 strlcpy(card->id, xid, sizeof(card->id));
204 card->number = idx;
205 card->module = module;
206 INIT_LIST_HEAD(&card->devices);
207 init_rwsem(&card->controls_rwsem);
208 rwlock_init(&card->ctl_files_rwlock);
209 INIT_LIST_HEAD(&card->controls);
210 INIT_LIST_HEAD(&card->ctl_files);
211 spin_lock_init(&card->files_lock);
212 INIT_LIST_HEAD(&card->files_list);
213 init_waitqueue_head(&card->shutdown_sleep);
215 mutex_init(&card->power_lock);
216 init_waitqueue_head(&card->power_sleep);
220 err = snd_ctl_create(card);
225 err = snd_info_card_create(card);
227 snd_printk(KERN_ERR "unable to create card info\n");
231 card->private_data = (char *)card + sizeof(struct snd_card);
232 *card_ret = card;
236 snd_device_free_all(card, SNDRV_DEV_CMD_PRE);
238 kfree(card);
243 /* return non-zero if a card is already locked */
244 int snd_card_locked(int card)
249 locked = snd_cards_lock & (1 << card);
333 * @card: soundcard structure
342 int snd_card_disconnect(struct snd_card *card)
348 if (!card)
351 spin_lock(&card->files_lock);
352 if (card->shutdown) {
353 spin_unlock(&card->files_lock);
356 card->shutdown = 1;
357 spin_unlock(&card->files_lock);
361 snd_cards[card->number] = NULL;
362 snd_cards_lock &= ~(1 << card->number);
367 spin_lock(&card->files_lock);
368 list_for_each_entry(mfile, &card->files_list, list) {
382 spin_unlock(&card->files_lock);
389 snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_DISCONNECT);
393 err = snd_device_disconnect_all(card);
395 snd_printk(KERN_ERR "not all devices for card %i can be disconnected\n", card->number);
397 snd_info_card_disconnect(card);
399 if (card->card_dev) {
400 device_unregister(card->card_dev);
401 card->card_dev = NULL;
405 wake_up(&card->power_sleep);
414 * @card: soundcard structure
423 static int snd_card_do_free(struct snd_card *card)
427 snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_FREE);
429 if (snd_device_free_all(card, SNDRV_DEV_CMD_PRE) < 0) {
433 if (snd_device_free_all(card, SNDRV_DEV_CMD_NORMAL) < 0) {
437 if (snd_device_free_all(card, SNDRV_DEV_CMD_POST) < 0) {
441 if (card->private_free)
442 card->private_free(card);
443 snd_info_free_entry(card->proc_id);
444 if (snd_info_card_free(card) < 0) {
445 snd_printk(KERN_WARNING "unable to free card info\n");
448 kfree(card);
452 int snd_card_free_when_closed(struct snd_card *card)
455 int ret = snd_card_disconnect(card);
459 spin_lock(&card->files_lock);
460 if (list_empty(&card->files_list))
463 card->free_on_last_close = 1;
464 spin_unlock(&card->files_lock);
467 snd_card_do_free(card);
473 int snd_card_free(struct snd_card *card)
475 int ret = snd_card_disconnect(card);
480 wait_event(card->shutdown_sleep, list_empty(&card->files_list));
481 snd_card_do_free(card);
487 static void snd_card_set_id_no_lock(struct snd_card *card, const char *nid)
494 id = card->shortname;
504 id = card->id;
509 while (*spos != '\0' && (size_t)(id - card->id) < sizeof(card->id) - 1) {
516 id = card->id;
523 snd_printk(KERN_ERR "unable to set card id (%s)\n", id);
524 strcpy(card->id, card->proc_root->name);
542 } else if ((size_t)len <= sizeof(card->id) - 3) {
547 if ((size_t)len <= sizeof(card->id) - 2)
558 * snd_card_set_id - set card identification name
559 * @card: soundcard structure
562 * This function sets the card identification and checks for name
565 void snd_card_set_id(struct snd_card *card, const char *nid)
567 /* check if user specified own card->id */
568 if (card->id[0] != '\0')
571 snd_card_set_id_no_lock(card, nid);
581 struct snd_card *card = dev_get_drvdata(dev);
582 return snprintf(buf, PAGE_SIZE, "%s\n", card ? card->id : "(null)");
589 struct snd_card *card = dev_get_drvdata(dev);
590 char buf1[sizeof(card->id)];
591 size_t copy = count > sizeof(card->id) - 1 ?
592 sizeof(card->id) - 1 : count;
613 strcpy(card->id, buf1);
614 snd_info_card_id_change(card);
627 struct snd_card *card = dev_get_drvdata(dev);
628 return snprintf(buf, PAGE_SIZE, "%i\n", card ? card->number : -1);
637 * @card: soundcard structure
642 * of the initialization of the card.
646 int snd_card_register(struct snd_card *card)
650 if (snd_BUG_ON(!card))
653 if (!card->card_dev) {
654 card->card_dev = device_create(sound_class, card->dev,
655 MKDEV(0, 0), card,
656 "card%i", card->number);
657 if (IS_ERR(card->card_dev))
658 card->card_dev = NULL;
661 if ((err = snd_device_register_all(card)) < 0)
664 if (snd_cards[card->number]) {
669 snd_card_set_id_no_lock(card, card->id[0] == '\0' ? NULL : card->id);
670 snd_cards[card->number] = card;
672 init_info_for_card(card);
675 snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_REGISTER);
678 if (card->card_dev) {
679 err = device_create_file(card->card_dev, &card_id_attrs);
682 err = device_create_file(card->card_dev, &card_number_attrs);
699 struct snd_card *card;
703 if ((card = snd_cards[idx]) != NULL) {
707 card->id,
708 card->driver,
709 card->shortname);
711 card->longname);
724 struct snd_card *card;
728 if ((card = snd_cards[idx]) != NULL) {
730 snd_iprintf(buffer, "%s\n", card->longname);
747 struct snd_card *card;
751 if ((card = snd_cards[idx]) != NULL)
753 idx, card->module->name);
800 * @card: soundcard structure
809 int snd_component_add(struct snd_card *card, const char *component)
814 ptr = strstr(card->components, component);
819 if (strlen(card->components) + 1 + len + 1 > sizeof(card->components)) {
823 if (card->components[0] != '\0')
824 strcat(card->components, " ");
825 strcat(card->components, component);
832 * snd_card_file_add - add the file to the file list of the card
833 * @card: soundcard structure
836 * This function adds the file to the file linked-list of the card.
842 int snd_card_file_add(struct snd_card *card, struct file *file)
851 spin_lock(&card->files_lock);
852 if (card->shutdown) {
853 spin_unlock(&card->files_lock);
857 list_add(&mfile->list, &card->files_list);
858 spin_unlock(&card->files_lock);
866 * @card: soundcard structure
869 * This function removes the file formerly added to the card via
877 int snd_card_file_remove(struct snd_card *card, struct file *file)
882 spin_lock(&card->files_lock);
883 list_for_each_entry(mfile, &card->files_list, list) {
892 if (list_empty(&card->files_list))
894 spin_unlock(&card->files_lock);
896 wake_up(&card->shutdown_sleep);
897 if (card->free_on_last_close)
898 snd_card_do_free(card);
901 snd_printk(KERN_ERR "ALSA card file remove problem (%p)\n", file);
913 * @card: soundcard structure
920 int snd_power_wait(struct snd_card *card, unsigned int power_state)
926 if (snd_power_get_state(card) == power_state)
929 add_wait_queue(&card->power_sleep, &wait);
931 if (card->shutdown) {
935 if (snd_power_get_state(card) == power_state)
938 snd_power_unlock(card);
940 snd_power_lock(card);
942 remove_wait_queue(&card->power_sleep, &wait);