Lines Matching refs:hwdep
17 #include <sound/hwdep.h>
34 struct snd_hwdep *hwdep;
36 list_for_each_entry(hwdep, &snd_hwdep_devices, list)
37 if (hwdep->card == card && hwdep->device == device)
38 return hwdep;
299 struct snd_hwdep *hwdep;
304 hwdep = snd_hwdep_search(card, device);
305 if (hwdep)
306 err = snd_hwdep_info(hwdep, info);
346 * snd_hwdep_new - create a new hwdep instance
350 * @rhwdep: the pointer to store the new hwdep instance
352 * Creates a new hwdep instance with the given index on the card.
353 * The callbacks (hwdep->ops) must be set on the returned instance
361 struct snd_hwdep *hwdep;
373 hwdep = kzalloc(sizeof(*hwdep), GFP_KERNEL);
374 if (!hwdep)
377 init_waitqueue_head(&hwdep->open_wait);
378 mutex_init(&hwdep->open_mutex);
379 hwdep->card = card;
380 hwdep->device = device;
382 strlcpy(hwdep->id, id, sizeof(hwdep->id));
384 snd_device_initialize(&hwdep->dev, card);
385 hwdep->dev.release = release_hwdep_device;
386 dev_set_name(&hwdep->dev, "hwC%iD%i", card->number, device);
388 hwdep->oss_type = -1;
391 err = snd_device_new(card, SNDRV_DEV_HWDEP, hwdep, &ops);
393 put_device(&hwdep->dev);
398 *rhwdep = hwdep;
405 struct snd_hwdep *hwdep = device->device_data;
406 if (!hwdep)
408 if (hwdep->private_free)
409 hwdep->private_free(hwdep);
410 put_device(&hwdep->dev);
416 struct snd_hwdep *hwdep = device->device_data;
417 struct snd_card *card = hwdep->card;
421 if (snd_hwdep_search(card, hwdep->device)) {
425 list_add_tail(&hwdep->list, &snd_hwdep_devices);
427 hwdep->card, hwdep->device,
428 &snd_hwdep_f_ops, hwdep, &hwdep->dev);
430 dev_err(&hwdep->dev, "unable to register\n");
431 list_del(&hwdep->list);
437 hwdep->ossreg = 0;
438 if (hwdep->oss_type >= 0) {
439 if (hwdep->oss_type == SNDRV_OSS_DEVICE_TYPE_DMFM &&
440 hwdep->device)
441 dev_warn(&hwdep->dev,
442 "only hwdep device 0 can be registered as OSS direct FM device!\n");
443 else if (snd_register_oss_device(hwdep->oss_type,
444 card, hwdep->device,
445 &snd_hwdep_f_ops, hwdep) < 0)
446 dev_warn(&hwdep->dev,
449 hwdep->ossreg = 1;
458 struct snd_hwdep *hwdep = device->device_data;
460 if (snd_BUG_ON(!hwdep))
463 if (snd_hwdep_search(hwdep->card, hwdep->device) != hwdep) {
467 mutex_lock(&hwdep->open_mutex);
468 wake_up(&hwdep->open_wait);
470 if (hwdep->ossreg)
471 snd_unregister_oss_device(hwdep->oss_type, hwdep->card, hwdep->device);
473 snd_unregister_device(&hwdep->dev);
474 list_del_init(&hwdep->list);
475 mutex_unlock(&hwdep->open_mutex);
488 struct snd_hwdep *hwdep;
491 list_for_each_entry(hwdep, &snd_hwdep_devices, list)
493 hwdep->card->number, hwdep->device, hwdep->name);
503 if ((entry = snd_info_create_module_entry(THIS_MODULE, "hwdep", NULL)) != NULL) {