aboutsummaryrefslogtreecommitdiff
path: root/sound/firewire
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2011-09-04 22:17:31 +0200
committerClemens Ladisch <clemens@ladisch.de>2013-10-20 22:07:57 +0200
commita644a9473f7f9519e2fe519136959dd0e671572a (patch)
tree450ed1aaa2e1501d566f8425c9bf9be73db0a469 /sound/firewire
parenta7304e3bf0489d3fc0260bdb9c1441427a26a38f (diff)
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 <clemens@ladisch.de>
Diffstat (limited to 'sound/firewire')
-rw-r--r--sound/firewire/dice.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/sound/firewire/dice.c b/sound/firewire/dice.c
index 8804e42a96c..e1d8dff2339 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,