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

TOMOYO Linux Cross Reference
Linux/sound/firewire/dice/dice-weiss.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ 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.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 // dice-weiss.c - a part of driver for DICE based devices
  3 //
  4 // Copyright (c) 2023 Rolf Anderegg and Michele Perrone
  5 
  6 #include "dice.h"
  7 
  8 struct dice_weiss_spec {
  9         unsigned int tx_pcm_chs[MAX_STREAMS][SND_DICE_RATE_MODE_COUNT];
 10         unsigned int rx_pcm_chs[MAX_STREAMS][SND_DICE_RATE_MODE_COUNT];
 11 };
 12 
 13 // Weiss DAC202: 192kHz 2-channel DAC
 14 static const struct dice_weiss_spec dac202 = {
 15         .tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
 16         .rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
 17 };
 18 
 19 // Weiss MAN301: 192kHz 2-channel music archive network player
 20 static const struct dice_weiss_spec man301 = {
 21         .tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
 22         .rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
 23 };
 24 
 25 // Weiss INT202: 192kHz unidirectional 2-channel digital Firewire nterface
 26 static const struct dice_weiss_spec int202 = {
 27         .tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
 28         .rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
 29 };
 30 
 31 // Weiss INT203: 192kHz bidirectional 2-channel digital Firewire nterface
 32 static const struct dice_weiss_spec int203 = {
 33         .tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
 34         .rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
 35 };
 36 
 37 // Weiss ADC2: 192kHz A/D converter with microphone preamps and line nputs
 38 static const struct dice_weiss_spec adc2 = {
 39         .tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
 40         .rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
 41 };
 42 
 43 // Weiss DAC2/Minerva: 192kHz 2-channel DAC
 44 static const struct dice_weiss_spec dac2_minerva = {
 45         .tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
 46         .rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
 47 };
 48 
 49 // Weiss Vesta: 192kHz 2-channel Firewire to AES/EBU interface
 50 static const struct dice_weiss_spec vesta = {
 51         .tx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
 52         .rx_pcm_chs = {{2, 2, 2}, {0, 0, 0} },
 53 };
 54 
 55 // Weiss AFI1: 192kHz 24-channel Firewire to ADAT or AES/EBU interface
 56 static const struct dice_weiss_spec afi1 = {
 57         .tx_pcm_chs = {{24, 16, 8}, {0, 0, 0} },
 58         .rx_pcm_chs = {{24, 16, 8}, {0, 0, 0} },
 59 };
 60 
 61 int snd_dice_detect_weiss_formats(struct snd_dice *dice)
 62 {
 63         static const struct {
 64                 u32 model_id;
 65                 const struct dice_weiss_spec *spec;
 66         } *entry, entries[] = {
 67                 {0x000007, &dac202},
 68                 {0x000008, &dac202}, // Maya edition: same audio I/O as DAC202.
 69                 {0x000006, &int202},
 70                 {0x00000a, &int203},
 71                 {0x00000b, &man301},
 72                 {0x000001, &adc2},
 73                 {0x000003, &dac2_minerva},
 74                 {0x000002, &vesta},
 75                 {0x000004, &afi1},
 76         };
 77         struct fw_csr_iterator it;
 78         int key, val, model_id;
 79         int i;
 80 
 81         model_id = 0;
 82         fw_csr_iterator_init(&it, dice->unit->directory);
 83         while (fw_csr_iterator_next(&it, &key, &val)) {
 84                 if (key == CSR_MODEL) {
 85                         model_id = val;
 86                         break;
 87                 }
 88         }
 89 
 90         for (i = 0; i < ARRAY_SIZE(entries); ++i) {
 91                 entry = entries + i;
 92                 if (entry->model_id == model_id)
 93                         break;
 94         }
 95         if (i == ARRAY_SIZE(entries))
 96                 return -ENODEV;
 97 
 98         memcpy(dice->tx_pcm_chs, entry->spec->tx_pcm_chs,
 99                MAX_STREAMS * SND_DICE_RATE_MODE_COUNT * sizeof(unsigned int));
100         memcpy(dice->rx_pcm_chs, entry->spec->rx_pcm_chs,
101                MAX_STREAMS * SND_DICE_RATE_MODE_COUNT * sizeof(unsigned int));
102 
103         return 0;
104 }
105 

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