From: Clemens Ladisch Date: Sun, 4 Sep 2011 20:17:31 +0000 (+0200) Subject: ALSA: dice: optimize reading of consecutive registers X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=a644a9473f7f9519e2fe519136959dd0e671572a;p=linux-beck.git ALSA: dice: optimize reading of consecutive registers Instead of reading two consecutive register with two quadlet requests, use one block read request. Signed-off-by: Clemens Ladisch --- diff --git a/sound/firewire/dice.c b/sound/firewire/dice.c index 8804e42a96c6..e1d8dff23397 100644 --- a/sound/firewire/dice.c +++ b/sound/firewire/dice.c @@ -374,8 +374,8 @@ static int dice_open(struct snd_pcm_substream *substream) }; struct dice *dice = substream->private_data; struct snd_pcm_runtime *runtime = substream->runtime; - __be32 clock_sel, number_audio, number_midi; - unsigned int rate_index, rate; + __be32 clock_sel, data[2]; + unsigned int rate_index, number_audio, number_midi; int err; err = dice_try_lock(dice); @@ -393,30 +393,25 @@ static int dice_open(struct snd_pcm_substream *substream) err = -ENXIO; goto err_lock; } - rate = dice_rates[rate_index]; - err = snd_fw_transaction(dice->unit, TCODE_READ_QUADLET_REQUEST, + err = snd_fw_transaction(dice->unit, TCODE_READ_BLOCK_REQUEST, rx_address(dice, RX_NUMBER_AUDIO), - &number_audio, 4); - if (err < 0) - goto err_lock; - err = snd_fw_transaction(dice->unit, TCODE_READ_QUADLET_REQUEST, - rx_address(dice, RX_NUMBER_MIDI), - &number_midi, 4); + data, 2 * 4); if (err < 0) goto err_lock; + number_audio = be32_to_cpu(data[0]); + number_midi = be32_to_cpu(data[1]); runtime->hw = hardware; - runtime->hw.rates = snd_pcm_rate_to_rate_bit(rate); + runtime->hw.rates = snd_pcm_rate_to_rate_bit(dice_rates[rate_index]); snd_pcm_limit_hw_rates(runtime); - runtime->hw.channels_min = be32_to_cpu(number_audio); - runtime->hw.channels_max = be32_to_cpu(number_audio); + runtime->hw.channels_min = number_audio; + runtime->hw.channels_max = number_audio; - amdtp_out_stream_set_parameters(&dice->stream, rate, - be32_to_cpu(number_audio), - be32_to_cpu(number_midi)); + amdtp_out_stream_set_parameters(&dice->stream, dice_rates[rate_index], + number_audio, number_midi); err = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE,