1 // SPDX-License-Identifier: GPL-2.0
3 * dice-tc_electronic.c - a part of driver for DICE based devices
5 * Copyright (c) 2018 Takashi Sakamoto
11 unsigned int tx_pcm_chs
[MAX_STREAMS
][SND_DICE_RATE_MODE_COUNT
];
12 unsigned int rx_pcm_chs
[MAX_STREAMS
][SND_DICE_RATE_MODE_COUNT
];
16 static const struct dice_tc_spec desktop_konnekt6
= {
17 .tx_pcm_chs
= {{6, 6, 2}, {0, 0, 0} },
18 .rx_pcm_chs
= {{6, 6, 4}, {0, 0, 0} },
22 static const struct dice_tc_spec impact_twin
= {
23 .tx_pcm_chs
= {{14, 10, 6}, {0, 0, 0} },
24 .rx_pcm_chs
= {{14, 10, 6}, {0, 0, 0} },
28 static const struct dice_tc_spec konnekt_8
= {
29 .tx_pcm_chs
= {{4, 4, 3}, {0, 0, 0} },
30 .rx_pcm_chs
= {{4, 4, 3}, {0, 0, 0} },
34 static const struct dice_tc_spec konnekt_24d
= {
35 .tx_pcm_chs
= {{16, 16, 6}, {0, 0, 0} },
36 .rx_pcm_chs
= {{16, 16, 6}, {0, 0, 0} },
40 static const struct dice_tc_spec konnekt_live
= {
41 .tx_pcm_chs
= {{16, 16, 16}, {0, 0, 0} },
42 .rx_pcm_chs
= {{16, 16, 16}, {0, 0, 0} },
46 static const struct dice_tc_spec studio_konnekt_48
= {
47 .tx_pcm_chs
= {{16, 16, 8}, {16, 16, 7} },
48 .rx_pcm_chs
= {{16, 16, 8}, {14, 14, 7} },
52 static const struct dice_tc_spec digital_konnekt_x32
= {
53 .tx_pcm_chs
= {{16, 16, 4}, {0, 0, 0} },
54 .rx_pcm_chs
= {{16, 16, 4}, {0, 0, 0} },
58 int snd_dice_detect_tcelectronic_formats(struct snd_dice
*dice
)
62 const struct dice_tc_spec
*spec
;
63 } *entry
, entries
[] = {
64 {0x00000020, &konnekt_24d
},
65 {0x00000021, &konnekt_8
},
66 {0x00000022, &studio_konnekt_48
},
67 {0x00000023, &konnekt_live
},
68 {0x00000024, &desktop_konnekt6
},
69 {0x00000027, &impact_twin
},
70 {0x00000030, &digital_konnekt_x32
},
72 struct fw_csr_iterator it
;
73 int key
, val
, model_id
;
77 fw_csr_iterator_init(&it
, dice
->unit
->directory
);
78 while (fw_csr_iterator_next(&it
, &key
, &val
)) {
79 if (key
== CSR_MODEL
) {
85 for (i
= 0; i
< ARRAY_SIZE(entries
); ++i
) {
87 if (entry
->model_id
== model_id
)
90 if (i
== ARRAY_SIZE(entries
))
93 memcpy(dice
->tx_pcm_chs
, entry
->spec
->tx_pcm_chs
,
94 MAX_STREAMS
* SND_DICE_RATE_MODE_COUNT
* sizeof(unsigned int));
95 memcpy(dice
->rx_pcm_chs
, entry
->spec
->rx_pcm_chs
,
96 MAX_STREAMS
* SND_DICE_RATE_MODE_COUNT
* sizeof(unsigned int));
98 if (entry
->spec
->has_midi
) {
99 dice
->tx_midi_ports
[0] = 1;
100 dice
->rx_midi_ports
[0] = 1;