Skip to content

Commit

Permalink
ALSA: dice: get the number of MBLA data channel at opening PCM substream
Browse files Browse the repository at this point in the history
This commit is a preparation to remove members related to channel cache
for the number of channels for multi bit linear audio data and MIDI
ports. This commit changes the way to get the number of multi bit linear
audio data channel. It's directly retrieved by asynchronous transactions
to some registers.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Takashi Sakamoto authored and Takashi Iwai committed Feb 9, 2016
1 parent b9022f4 commit c300765
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions sound/firewire/dice/dice-pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,17 +294,30 @@ int snd_dice_create_pcm(struct snd_dice *dice)
.page = snd_pcm_lib_get_vmalloc_page,
.mmap = snd_pcm_lib_mmap_vmalloc,
};
__be32 reg;
struct snd_pcm *pcm;
unsigned int i, capture, playback;
unsigned int capture, playback;
int err;

capture = playback = 0;
for (i = 0; i < 3; i++) {
if (dice->tx_channels[i] > 0)
capture = 1;
if (dice->rx_channels[i] > 0)
playback = 1;
}
/*
* Check whether PCM substreams are required.
*
* TODO: in the case that any PCM substreams are not avail at a certain
* sampling transfer frequency?
*/
err = snd_dice_transaction_read_tx(dice, TX_NUMBER_AUDIO,
&reg, sizeof(reg));
if (err < 0)
return err;
if (be32_to_cpu(reg) > 0)
capture = 1;

err = snd_dice_transaction_read_rx(dice, RX_NUMBER_AUDIO,
&reg, sizeof(reg));
if (err < 0)
return err;
if (be32_to_cpu(reg) > 0)
playback = 1;

err = snd_pcm_new(dice->card, "DICE", 0, playback, capture, &pcm);
if (err < 0)
Expand Down

0 comments on commit c300765

Please sign in to comment.