OpenCloudOS-Kernel/sound/firewire/dice/dice-presonus.c

63 lines
1.5 KiB
C
Raw Normal View History

ALSA: dice: add stream format parameters for PreSonus FireStudio FireStudio was launched by PreSonus 2009. This model consists of three ICs for its packet processing on IEEE 1394 bus: - Texus Instruments TSB41AB2 for physical layer of IEEE 1394 bus - WaveFront semiconductor, Dice II STD ASIC for link layer of IEEE 1394 bus and protocol layer - Xilinx Spartan XG3S500E FPGA for signal processing This model don't support TCAT extended application protocol. For such devices, ALSA dice driver needs to have hard-coded parameters for stream formats. This commit adds hard-coded table for this model. As a result, sampling transfer frequencies of 88.2/96.0 kHz are supported. I note that this patch can be backported to Linux kernel v4.18 and later. $ python2 crpp < /sys/bus/firewire/devices/fw1/config_rom ROM header and bus information block ----------------------------------------------------------------- 400 04042eda bus_info_length 4, crc_length 4, crc 11994 404 31333934 bus_name "1394" 408 e0ff8112 irmc 1, cmc 1, isc 1, bmc 0, pmc 0, cyc_clk_acc 255, max_rec 8 (512), max_rom 1, gen 1, spd 2 (S400) 40c 000a9204 company_id 000a92 | 410 023a8b7f device_id 04023a8b7f | EUI-64 000a9204023a8b7f root directory ----------------------------------------------------------------- 414 000661b6 directory_length 6, crc 25014 418 03000a92 vendor 41c 8100000a --> descriptor leaf at 444 420 17000008 model 424 8100000d --> descriptor leaf at 458 428 0c0087c0 node capabilities per IEEE 1394 42c d1000001 --> unit directory at 430 unit directory at 430 ----------------------------------------------------------------- 430 00041c75 directory_length 4, crc 7285 434 12000a92 specifier id 438 13000001 version 43c 17000008 model 440 8100000c --> descriptor leaf at 470 descriptor leaf at 444 ----------------------------------------------------------------- 444 00047c11 leaf_length 4, crc 31761 448 00000000 textual descriptor 44c 00000000 minimal ASCII 450 50726553 "PreS" 454 6f6e7573 "onus" descriptor leaf at 458 ----------------------------------------------------------------- 458 0005d7b3 leaf_length 5, crc 55219 45c 00000000 textual descriptor 460 00000000 minimal ASCII 464 46495245 "FIRE" 468 53545544 "STUD" 46c 494f0000 "IO" descriptor leaf at 470 ----------------------------------------------------------------- 470 0005d7b3 leaf_length 5, crc 55219 474 00000000 textual descriptor 478 00000000 minimal ASCII 47c 46495245 "FIRE" 480 53545544 "STUD" 484 494f0000 "IO" Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-05-17 10:56:22 +08:00
// SPDX-License-Identifier: GPL-2.0
// dice-presonus.c - a part of driver for DICE based devices
//
// Copyright (c) 2019 Takashi Sakamoto
//
// Licensed under the terms of the GNU General Public License, version 2.
#include "dice.h"
struct dice_presonus_spec {
unsigned int tx_pcm_chs[MAX_STREAMS][SND_DICE_RATE_MODE_COUNT];
unsigned int rx_pcm_chs[MAX_STREAMS][SND_DICE_RATE_MODE_COUNT];
bool has_midi;
};
static const struct dice_presonus_spec dice_presonus_firesutio = {
.tx_pcm_chs = {{16, 16, 0}, {10, 2, 0} },
.rx_pcm_chs = {{16, 16, 0}, {10, 2, 0} },
.has_midi = true,
};
int snd_dice_detect_presonus_formats(struct snd_dice *dice)
{
static const struct {
u32 model_id;
const struct dice_presonus_spec *spec;
} *entry, entries[] = {
{0x000008, &dice_presonus_firesutio},
};
struct fw_csr_iterator it;
int key, val, model_id;
int i;
model_id = 0;
fw_csr_iterator_init(&it, dice->unit->directory);
while (fw_csr_iterator_next(&it, &key, &val)) {
if (key == CSR_MODEL) {
model_id = val;
break;
}
}
for (i = 0; i < ARRAY_SIZE(entries); ++i) {
entry = entries + i;
if (entry->model_id == model_id)
break;
}
if (i == ARRAY_SIZE(entries))
return -ENODEV;
memcpy(dice->tx_pcm_chs, entry->spec->tx_pcm_chs,
MAX_STREAMS * SND_DICE_RATE_MODE_COUNT * sizeof(unsigned int));
memcpy(dice->rx_pcm_chs, entry->spec->rx_pcm_chs,
MAX_STREAMS * SND_DICE_RATE_MODE_COUNT * sizeof(unsigned int));
if (entry->spec->has_midi) {
dice->tx_midi_ports[0] = 1;
dice->rx_midi_ports[0] = 1;
}
return 0;
}