Skip to content

Commit

Permalink
ALSA: bebob: enable to deliver MIDI messages for multiple ports
Browse files Browse the repository at this point in the history
[ Upstream commit d2b6f15 ]

Current implementation of bebob driver doesn't correctly handle the case
that the device has multiple MIDI ports. The cause is the number of MIDI
conformant data channels is passed to AM824 data block processing layer.

This commit fixes the bug.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210321032831.340278-4-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
takaswie authored and gregkh committed May 19, 2021
1 parent bf95eb7 commit 24cb3ff
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions sound/firewire/bebob/bebob_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,20 +517,22 @@ int snd_bebob_stream_init_duplex(struct snd_bebob *bebob)
static int keep_resources(struct snd_bebob *bebob, struct amdtp_stream *stream,
unsigned int rate, unsigned int index)
{
struct snd_bebob_stream_formation *formation;
unsigned int pcm_channels;
unsigned int midi_ports;
struct cmp_connection *conn;
int err;

if (stream == &bebob->tx_stream) {
formation = bebob->tx_stream_formations + index;
pcm_channels = bebob->tx_stream_formations[index].pcm;
midi_ports = bebob->midi_input_ports;
conn = &bebob->out_conn;
} else {
formation = bebob->rx_stream_formations + index;
pcm_channels = bebob->rx_stream_formations[index].pcm;
midi_ports = bebob->midi_output_ports;
conn = &bebob->in_conn;
}

err = amdtp_am824_set_parameters(stream, rate, formation->pcm,
formation->midi, false);
err = amdtp_am824_set_parameters(stream, rate, pcm_channels, midi_ports, false);
if (err < 0)
return err;

Expand Down

0 comments on commit 24cb3ff

Please sign in to comment.