ff-proc.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * ff-proc.c - a part of driver for RME Fireface series
  3. *
  4. * Copyright (c) 2015-2017 Takashi Sakamoto
  5. *
  6. * Licensed under the terms of the GNU General Public License, version 2.
  7. */
  8. #include "./ff.h"
  9. static void proc_dump_clock_config(struct snd_info_entry *entry,
  10. struct snd_info_buffer *buffer)
  11. {
  12. struct snd_ff *ff = entry->private_data;
  13. ff->spec->protocol->dump_clock_config(ff, buffer);
  14. }
  15. static void proc_dump_sync_status(struct snd_info_entry *entry,
  16. struct snd_info_buffer *buffer)
  17. {
  18. struct snd_ff *ff = entry->private_data;
  19. ff->spec->protocol->dump_sync_status(ff, buffer);
  20. }
  21. static void add_node(struct snd_ff *ff, struct snd_info_entry *root,
  22. const char *name,
  23. void (*op)(struct snd_info_entry *e,
  24. struct snd_info_buffer *b))
  25. {
  26. struct snd_info_entry *entry;
  27. entry = snd_info_create_card_entry(ff->card, name, root);
  28. if (entry == NULL)
  29. return;
  30. snd_info_set_text_ops(entry, ff, op);
  31. if (snd_info_register(entry) < 0)
  32. snd_info_free_entry(entry);
  33. }
  34. void snd_ff_proc_init(struct snd_ff *ff)
  35. {
  36. struct snd_info_entry *root;
  37. /*
  38. * All nodes are automatically removed at snd_card_disconnect(),
  39. * by following to link list.
  40. */
  41. root = snd_info_create_card_entry(ff->card, "firewire",
  42. ff->card->proc_root);
  43. if (root == NULL)
  44. return;
  45. root->mode = S_IFDIR | 0555;
  46. if (snd_info_register(root) < 0) {
  47. snd_info_free_entry(root);
  48. return;
  49. }
  50. add_node(ff, root, "clock-config", proc_dump_clock_config);
  51. add_node(ff, root, "sync-status", proc_dump_sync_status);
  52. }