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

TOMOYO Linux Cross Reference
Linux/sound/firewire/tascam/tascam-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  * tascam-proc.h - a part of driver for TASCAM FireWire series
  3  *
  4  * Copyright (c) 2015 Takashi Sakamoto
  5  *
  6  * Licensed under the terms of the GNU General Public License, version 2.
  7  */
  8 
  9 #include "./tascam.h"
 10 
 11 static void proc_read_firmware(struct snd_info_entry *entry,
 12                                struct snd_info_buffer *buffer)
 13 {
 14         struct snd_tscm *tscm = entry->private_data;
 15         __be32 data;
 16         unsigned int reg, fpga, arm, hw;
 17         int err;
 18 
 19         err = snd_fw_transaction(tscm->unit, TCODE_READ_QUADLET_REQUEST,
 20                         TSCM_ADDR_BASE + TSCM_OFFSET_FIRMWARE_REGISTER,
 21                         &data, sizeof(data), 0);
 22         if (err < 0)
 23                 return;
 24         reg = be32_to_cpu(data);
 25 
 26         err = snd_fw_transaction(tscm->unit, TCODE_READ_QUADLET_REQUEST,
 27                         TSCM_ADDR_BASE + TSCM_OFFSET_FIRMWARE_FPGA,
 28                         &data, sizeof(data), 0);
 29         if (err < 0)
 30                 return;
 31         fpga = be32_to_cpu(data);
 32 
 33         err = snd_fw_transaction(tscm->unit, TCODE_READ_QUADLET_REQUEST,
 34                         TSCM_ADDR_BASE + TSCM_OFFSET_FIRMWARE_ARM,
 35                         &data, sizeof(data), 0);
 36         if (err < 0)
 37                 return;
 38         arm = be32_to_cpu(data);
 39 
 40         err = snd_fw_transaction(tscm->unit, TCODE_READ_QUADLET_REQUEST,
 41                         TSCM_ADDR_BASE + TSCM_OFFSET_FIRMWARE_HW,
 42                         &data, sizeof(data), 0);
 43         if (err < 0)
 44                 return;
 45         hw = be32_to_cpu(data);
 46 
 47         snd_iprintf(buffer, "Register: %d (0x%08x)\n", reg & 0xffff, reg);
 48         snd_iprintf(buffer, "FPGA:     %d (0x%08x)\n", fpga & 0xffff, fpga);
 49         snd_iprintf(buffer, "ARM:      %d (0x%08x)\n", arm & 0xffff, arm);
 50         snd_iprintf(buffer, "Hardware: %d (0x%08x)\n", hw >> 16, hw);
 51 }
 52 
 53 static void add_node(struct snd_tscm *tscm, struct snd_info_entry *root,
 54                      const char *name,
 55                      void (*op)(struct snd_info_entry *e,
 56                                 struct snd_info_buffer *b))
 57 {
 58         struct snd_info_entry *entry;
 59 
 60         entry = snd_info_create_card_entry(tscm->card, name, root);
 61         if (entry == NULL)
 62                 return;
 63 
 64         snd_info_set_text_ops(entry, tscm, op);
 65         if (snd_info_register(entry) < 0)
 66                 snd_info_free_entry(entry);
 67 }
 68 
 69 void snd_tscm_proc_init(struct snd_tscm *tscm)
 70 {
 71         struct snd_info_entry *root;
 72 
 73         /*
 74          * All nodes are automatically removed at snd_card_disconnect(),
 75          * by following to link list.
 76          */
 77         root = snd_info_create_card_entry(tscm->card, "firewire",
 78                                           tscm->card->proc_root);
 79         if (root == NULL)
 80                 return;
 81         root->mode = S_IFDIR | S_IRUGO | S_IXUGO;
 82         if (snd_info_register(root) < 0) {
 83                 snd_info_free_entry(root);
 84                 return;
 85         }
 86 
 87         add_node(tscm, root, "firmware", proc_read_firmware);
 88 }
 89 

~ [ 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