1 // SPDX-License-Identifier: GPL-2.0
2 // dice-presonus.c - a part of driver for DICE based devices
4 // Copyright (c) 2019 Takashi Sakamoto
8 struct dice_presonus_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
];
14 static const struct dice_presonus_spec dice_presonus_firesutio
= {
15 .tx_pcm_chs
= {{16, 16, 0}, {10, 2, 0} },
16 .rx_pcm_chs
= {{16, 16, 0}, {10, 2, 0} },
20 int snd_dice_detect_presonus_formats(struct snd_dice
*dice
)
24 const struct dice_presonus_spec
*spec
;
25 } *entry
, entries
[] = {
26 {0x000008, &dice_presonus_firesutio
},
28 struct fw_csr_iterator it
;
29 int key
, val
, model_id
;
33 fw_csr_iterator_init(&it
, dice
->unit
->directory
);
34 while (fw_csr_iterator_next(&it
, &key
, &val
)) {
35 if (key
== CSR_MODEL
) {
41 for (i
= 0; i
< ARRAY_SIZE(entries
); ++i
) {
43 if (entry
->model_id
== model_id
)
46 if (i
== ARRAY_SIZE(entries
))
49 memcpy(dice
->tx_pcm_chs
, entry
->spec
->tx_pcm_chs
,
50 MAX_STREAMS
* SND_DICE_RATE_MODE_COUNT
* sizeof(unsigned int));
51 memcpy(dice
->rx_pcm_chs
, entry
->spec
->rx_pcm_chs
,
52 MAX_STREAMS
* SND_DICE_RATE_MODE_COUNT
* sizeof(unsigned int));
54 if (entry
->spec
->has_midi
) {
55 dice
->tx_midi_ports
[0] = 1;
56 dice
->rx_midi_ports
[0] = 1;