1 // SPDX-License-Identifier: GPL-2.0
2 // dice-weiss.c - a part of driver for DICE based devices
4 // Copyright (c) 2023 Rolf Anderegg and Michele Perrone
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
];
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} },
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} },
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} },
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} },
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} },
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} },
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} },
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} },
61 int snd_dice_detect_weiss_formats(struct snd_dice
*dice
)
65 const struct dice_weiss_spec
*spec
;
66 } *entry
, entries
[] = {
68 {0x000008, &dac202
}, // Maya edition: same audio I/O as DAC202.
73 {0x000003, &dac2_minerva
},
77 struct fw_csr_iterator it
;
78 int key
, val
, model_id
;
82 fw_csr_iterator_init(&it
, dice
->unit
->directory
);
83 while (fw_csr_iterator_next(&it
, &key
, &val
)) {
84 if (key
== CSR_MODEL
) {
90 for (i
= 0; i
< ARRAY_SIZE(entries
); ++i
) {
92 if (entry
->model_id
== model_id
)
95 if (i
== ARRAY_SIZE(entries
))
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));