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

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

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /sound/firewire/digi00x/digi00x-proc.c (Version linux-6.12-rc7) and /sound/firewire/digi00x/digi00x-proc.c (Version linux-4.9.337)


  1 // SPDX-License-Identifier: GPL-2.0-only       << 
  2 /*                                                  1 /*
  3  * digi00x-proc.c - a part of driver for Digid      2  * digi00x-proc.c - a part of driver for Digidesign Digi 002/003 family
  4  *                                                  3  *
  5  * Copyright (c) 2014-2015 Takashi Sakamoto         4  * Copyright (c) 2014-2015 Takashi Sakamoto
                                                   >>   5  *
                                                   >>   6  * Licensed under the terms of the GNU General Public License, version 2.
  6  */                                                 7  */
  7                                                     8 
  8 #include "digi00x.h"                                9 #include "digi00x.h"
  9                                                    10 
 10 static int get_optical_iface_mode(struct snd_d     11 static int get_optical_iface_mode(struct snd_dg00x *dg00x,
 11                                   enum snd_dg0     12                                   enum snd_dg00x_optical_mode *mode)
 12 {                                                  13 {
 13         __be32 data;                               14         __be32 data;
 14         int err;                                   15         int err;
 15                                                    16 
 16         err = snd_fw_transaction(dg00x->unit,      17         err = snd_fw_transaction(dg00x->unit, TCODE_READ_QUADLET_REQUEST,
 17                                  DG00X_ADDR_BA     18                                  DG00X_ADDR_BASE + DG00X_OFFSET_OPT_IFACE_MODE,
 18                                  &data, sizeof     19                                  &data, sizeof(data), 0);
 19         if (err >= 0)                              20         if (err >= 0)
 20                 *mode = be32_to_cpu(data) & 0x     21                 *mode = be32_to_cpu(data) & 0x01;
 21                                                    22 
 22         return err;                                23         return err;
 23 }                                                  24 }
 24                                                    25 
 25 static void proc_read_clock(struct snd_info_en     26 static void proc_read_clock(struct snd_info_entry *entry,
 26                             struct snd_info_bu     27                             struct snd_info_buffer *buf)
 27 {                                                  28 {
 28         static const char *const source_name[]     29         static const char *const source_name[] = {
 29                 [SND_DG00X_CLOCK_INTERNAL] = "     30                 [SND_DG00X_CLOCK_INTERNAL] = "internal",
 30                 [SND_DG00X_CLOCK_SPDIF] = "s/p     31                 [SND_DG00X_CLOCK_SPDIF] = "s/pdif",
 31                 [SND_DG00X_CLOCK_ADAT] = "adat     32                 [SND_DG00X_CLOCK_ADAT] = "adat",
 32                 [SND_DG00X_CLOCK_WORD] = "word     33                 [SND_DG00X_CLOCK_WORD] = "word clock",
 33         };                                         34         };
 34         static const char *const optical_name[     35         static const char *const optical_name[] = {
 35                 [SND_DG00X_OPT_IFACE_MODE_ADAT     36                 [SND_DG00X_OPT_IFACE_MODE_ADAT] = "adat",
 36                 [SND_DG00X_OPT_IFACE_MODE_SPDI     37                 [SND_DG00X_OPT_IFACE_MODE_SPDIF] = "s/pdif",
 37         };                                         38         };
 38         struct snd_dg00x *dg00x = entry->priva     39         struct snd_dg00x *dg00x = entry->private_data;
 39         enum snd_dg00x_optical_mode mode;          40         enum snd_dg00x_optical_mode mode;
 40         unsigned int rate;                         41         unsigned int rate;
 41         enum snd_dg00x_clock clock;                42         enum snd_dg00x_clock clock;
 42         bool detect;                               43         bool detect;
 43                                                    44 
 44         if (get_optical_iface_mode(dg00x, &mod     45         if (get_optical_iface_mode(dg00x, &mode) < 0)
 45                 return;                            46                 return;
 46         if (snd_dg00x_stream_get_local_rate(dg     47         if (snd_dg00x_stream_get_local_rate(dg00x, &rate) < 0)
 47                 return;                            48                 return;
 48         if (snd_dg00x_stream_get_clock(dg00x,      49         if (snd_dg00x_stream_get_clock(dg00x, &clock) < 0)
 49                 return;                            50                 return;
 50                                                    51 
 51         snd_iprintf(buf, "Optical mode: %s\n",     52         snd_iprintf(buf, "Optical mode: %s\n", optical_name[mode]);
 52         snd_iprintf(buf, "Sampling Rate: %d\n"     53         snd_iprintf(buf, "Sampling Rate: %d\n", rate);
 53         snd_iprintf(buf, "Clock Source: %s\n",     54         snd_iprintf(buf, "Clock Source: %s\n", source_name[clock]);
 54                                                    55 
 55         if (clock == SND_DG00X_CLOCK_INTERNAL)     56         if (clock == SND_DG00X_CLOCK_INTERNAL)
 56                 return;                            57                 return;
 57                                                    58 
 58         if (snd_dg00x_stream_check_external_cl     59         if (snd_dg00x_stream_check_external_clock(dg00x, &detect) < 0)
 59                 return;                            60                 return;
 60         snd_iprintf(buf, "External source: %s\     61         snd_iprintf(buf, "External source: %s\n", detect ? "detected" : "not");
 61         if (!detect)                               62         if (!detect)
 62                 return;                            63                 return;
 63                                                    64 
 64         if (snd_dg00x_stream_get_external_rate     65         if (snd_dg00x_stream_get_external_rate(dg00x, &rate) >= 0)
 65                 snd_iprintf(buf, "External sam     66                 snd_iprintf(buf, "External sampling rate: %d\n", rate);
 66 }                                                  67 }
 67                                                    68 
 68 void snd_dg00x_proc_init(struct snd_dg00x *dg0     69 void snd_dg00x_proc_init(struct snd_dg00x *dg00x)
 69 {                                                  70 {
 70         struct snd_info_entry *root, *entry;       71         struct snd_info_entry *root, *entry;
 71                                                    72 
 72         /*                                         73         /*
 73          * All nodes are automatically removed     74          * All nodes are automatically removed at snd_card_disconnect(),
 74          * by following to link list.              75          * by following to link list.
 75          */                                        76          */
 76         root = snd_info_create_card_entry(dg00     77         root = snd_info_create_card_entry(dg00x->card, "firewire",
 77                                           dg00     78                                           dg00x->card->proc_root);
 78         if (root == NULL)                          79         if (root == NULL)
 79                 return;                            80                 return;
 80                                                    81 
 81         root->mode = S_IFDIR | 0555;           !!  82         root->mode = S_IFDIR | S_IRUGO | S_IXUGO;
                                                   >>  83         if (snd_info_register(root) < 0) {
                                                   >>  84                 snd_info_free_entry(root);
                                                   >>  85                 return;
                                                   >>  86         }
 82                                                    87 
 83         entry = snd_info_create_card_entry(dg0     88         entry = snd_info_create_card_entry(dg00x->card, "clock", root);
 84         if (entry)                             !!  89         if (entry == NULL) {
 85                 snd_info_set_text_ops(entry, d !!  90                 snd_info_free_entry(root);
                                                   >>  91                 return;
                                                   >>  92         }
                                                   >>  93 
                                                   >>  94         snd_info_set_text_ops(entry, dg00x, proc_read_clock);
                                                   >>  95         if (snd_info_register(entry) < 0) {
                                                   >>  96                 snd_info_free_entry(entry);
                                                   >>  97                 snd_info_free_entry(root);
                                                   >>  98         }
 86 }                                                  99 }
 87                                                   100 

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

kernel.org | git.kernel.org | LWN.net | Project Home | 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.

sflogo.php