~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/sound/firewire/oxfw/oxfw-proc.c

Version: ~ [ linux-5.4-rc3 ] ~ [ linux-5.3.6 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.79 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.149 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.196 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.196 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.75 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * oxfw_proc.c - a part of driver for OXFW970/971 based devices
  3  *
  4  * Copyright (c) 2014 Takashi Sakamoto
  5  *
  6  * Licensed under the terms of the GNU General Public License, version 2.
  7  */
  8 
  9 #include "./oxfw.h"
 10 
 11 static void proc_read_formation(struct snd_info_entry *entry,
 12                                 struct snd_info_buffer *buffer)
 13 {
 14         struct snd_oxfw *oxfw = entry->private_data;
 15         struct snd_oxfw_stream_formation formation, curr;
 16         u8 *format;
 17         char flag;
 18         int i, err;
 19 
 20         /* Show input. */
 21         err = snd_oxfw_stream_get_current_formation(oxfw,
 22                                                     AVC_GENERAL_PLUG_DIR_IN,
 23                                                     &curr);
 24         if (err < 0)
 25                 return;
 26 
 27         snd_iprintf(buffer, "Input Stream to device:\n");
 28         snd_iprintf(buffer, "\tRate\tPCM\tMIDI\n");
 29         for (i = 0; i < SND_OXFW_STREAM_FORMAT_ENTRIES; i++) {
 30                 format = oxfw->rx_stream_formats[i];
 31                 if (format == NULL)
 32                         continue;
 33 
 34                 err = snd_oxfw_stream_parse_format(format, &formation);
 35                 if (err < 0)
 36                         continue;
 37 
 38                 if (memcmp(&formation, &curr, sizeof(curr)) == 0)
 39                         flag = '*';
 40                 else
 41                         flag = ' ';
 42 
 43                 snd_iprintf(buffer, "%c\t%d\t%d\t%d\n", flag,
 44                             formation.rate, formation.pcm, formation.midi);
 45         }
 46 
 47         if (!oxfw->has_output)
 48                 return;
 49 
 50         /* Show output. */
 51         err = snd_oxfw_stream_get_current_formation(oxfw,
 52                                                     AVC_GENERAL_PLUG_DIR_OUT,
 53                                                     &curr);
 54         if (err < 0)
 55                 return;
 56 
 57         snd_iprintf(buffer, "Output Stream from device:\n");
 58         snd_iprintf(buffer, "\tRate\tPCM\tMIDI\n");
 59         for (i = 0; i < SND_OXFW_STREAM_FORMAT_ENTRIES; i++) {
 60                 format = oxfw->tx_stream_formats[i];
 61                 if (format == NULL)
 62                         continue;
 63 
 64                 err = snd_oxfw_stream_parse_format(format, &formation);
 65                 if (err < 0)
 66                         continue;
 67 
 68                 if (memcmp(&formation, &curr, sizeof(curr)) == 0)
 69                         flag = '*';
 70                 else
 71                         flag = ' ';
 72 
 73                 snd_iprintf(buffer, "%c\t%d\t%d\t%d\n", flag,
 74                             formation.rate, formation.pcm, formation.midi);
 75         }
 76 }
 77 
 78 static void add_node(struct snd_oxfw *oxfw, struct snd_info_entry *root,
 79                      const char *name,
 80                      void (*op)(struct snd_info_entry *e,
 81                                 struct snd_info_buffer *b))
 82 {
 83         struct snd_info_entry *entry;
 84 
 85         entry = snd_info_create_card_entry(oxfw->card, name, root);
 86         if (entry == NULL)
 87                 return;
 88 
 89         snd_info_set_text_ops(entry, oxfw, op);
 90         if (snd_info_register(entry) < 0)
 91                 snd_info_free_entry(entry);
 92 }
 93 
 94 void snd_oxfw_proc_init(struct snd_oxfw *oxfw)
 95 {
 96         struct snd_info_entry *root;
 97 
 98         /*
 99          * All nodes are automatically removed at snd_card_disconnect(),
100          * by following to link list.
101          */
102         root = snd_info_create_card_entry(oxfw->card, "firewire",
103                                           oxfw->card->proc_root);
104         if (root == NULL)
105                 return;
106         root->mode = S_IFDIR | S_IRUGO | S_IXUGO;
107         if (snd_info_register(root) < 0) {
108                 snd_info_free_entry(root);
109                 return;
110         }
111 
112         add_node(oxfw, root, "formation", proc_read_formation);
113 }
114 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp