alistair23-linux/sound/firewire/dice/dice-alesis.c
Takashi Sakamoto 3a9236e972 ALSA: dice: fix wrong packet parameter for Alesis iO26
At higher sampling rate (e.g. 192.0 kHz), Alesis iO26 transfers 4 data
channels per data block in CIP.

Both iO14 and iO26 have the same contents in their configuration ROM.
For this reason, ALSA Dice driver attempts to distinguish them according
to the value of TX0_AUDIO register at probe callback. Although the way is
valid at lower and middle sampling rate, it's lastly invalid at higher
sampling rate because because the two models returns the same value for
read transaction to the register.

In the most cases, users just plug-in the device and ALSA dice driver
detects it. In the case, the device runs at lower sampling rate and
the driver detects expectedly. For this reason, this commit leaves the
way to detect as is.

Fixes: 28b208f600 ("ALSA: dice: add parameters of stream formats for models produced by Alesis")
Cc: <stable@vger.kernel.org> # v4.18+
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20190916101851.30409-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-09-16 23:46:14 +02:00

53 lines
1.2 KiB
C

// SPDX-License-Identifier: GPL-2.0
/*
* dice-alesis.c - a part of driver for DICE based devices
*
* Copyright (c) 2018 Takashi Sakamoto
*/
#include "dice.h"
static const unsigned int
alesis_io14_tx_pcm_chs[MAX_STREAMS][SND_DICE_RATE_MODE_COUNT] = {
{6, 6, 4}, /* Tx0 = Analog + S/PDIF. */
{8, 4, 0}, /* Tx1 = ADAT1. */
};
static const unsigned int
alesis_io26_tx_pcm_chs[MAX_STREAMS][SND_DICE_RATE_MODE_COUNT] = {
{10, 10, 4}, /* Tx0 = Analog + S/PDIF. */
{16, 8, 0}, /* Tx1 = ADAT1 + ADAT2. */
};
int snd_dice_detect_alesis_formats(struct snd_dice *dice)
{
__be32 reg;
u32 data;
int i;
int err;
err = snd_dice_transaction_read_tx(dice, TX_NUMBER_AUDIO, &reg,
sizeof(reg));
if (err < 0)
return err;
data = be32_to_cpu(reg);
if (data == 4 || data == 6) {
memcpy(dice->tx_pcm_chs, alesis_io14_tx_pcm_chs,
MAX_STREAMS * SND_DICE_RATE_MODE_COUNT *
sizeof(unsigned int));
} else {
memcpy(dice->tx_pcm_chs, alesis_io26_tx_pcm_chs,
MAX_STREAMS * SND_DICE_RATE_MODE_COUNT *
sizeof(unsigned int));
}
for (i = 0; i < SND_DICE_RATE_MODE_COUNT; ++i)
dice->rx_pcm_chs[0][i] = 8;
dice->tx_midi_ports[0] = 1;
dice->rx_midi_ports[0] = 1;
return 0;
}