diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2011-09-04 16:17:31 -0400 |
---|---|---|
committer | Clemens Ladisch <clemens@ladisch.de> | 2013-10-20 16:07:57 -0400 |
commit | a644a9473f7f9519e2fe519136959dd0e671572a (patch) | |
tree | 450ed1aaa2e1501d566f8425c9bf9be73db0a469 | |
parent | a7304e3bf0489d3fc0260bdb9c1441427a26a38f (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>
-rw-r--r-- | sound/firewire/dice.c | 27 |
1 files changed, 11 insertions, 16 deletions
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) | |||
374 | }; | 374 | }; |
375 | struct dice *dice = substream->private_data; | 375 | struct dice *dice = substream->private_data; |
376 | struct snd_pcm_runtime *runtime = substream->runtime; | 376 | struct snd_pcm_runtime *runtime = substream->runtime; |
377 | __be32 clock_sel, number_audio, number_midi; | 377 | __be32 clock_sel, data[2]; |
378 | unsigned int rate_index, rate; | 378 | unsigned int rate_index, number_audio, number_midi; |
379 | int err; | 379 | int err; |
380 | 380 | ||
381 | err = dice_try_lock(dice); | 381 | err = dice_try_lock(dice); |
@@ -393,30 +393,25 @@ static int dice_open(struct snd_pcm_substream *substream) | |||
393 | err = -ENXIO; | 393 | err = -ENXIO; |
394 | goto err_lock; | 394 | goto err_lock; |
395 | } | 395 | } |
396 | rate = dice_rates[rate_index]; | ||
397 | 396 | ||
398 | err = snd_fw_transaction(dice->unit, TCODE_READ_QUADLET_REQUEST, | 397 | err = snd_fw_transaction(dice->unit, TCODE_READ_BLOCK_REQUEST, |
399 | rx_address(dice, RX_NUMBER_AUDIO), | 398 | rx_address(dice, RX_NUMBER_AUDIO), |
400 | &number_audio, 4); | 399 | data, 2 * 4); |
401 | if (err < 0) | ||
402 | goto err_lock; | ||
403 | err = snd_fw_transaction(dice->unit, TCODE_READ_QUADLET_REQUEST, | ||
404 | rx_address(dice, RX_NUMBER_MIDI), | ||
405 | &number_midi, 4); | ||
406 | if (err < 0) | 400 | if (err < 0) |
407 | goto err_lock; | 401 | goto err_lock; |
402 | number_audio = be32_to_cpu(data[0]); | ||
403 | number_midi = be32_to_cpu(data[1]); | ||
408 | 404 | ||
409 | runtime->hw = hardware; | 405 | runtime->hw = hardware; |
410 | 406 | ||
411 | runtime->hw.rates = snd_pcm_rate_to_rate_bit(rate); | 407 | runtime->hw.rates = snd_pcm_rate_to_rate_bit(dice_rates[rate_index]); |
412 | snd_pcm_limit_hw_rates(runtime); | 408 | snd_pcm_limit_hw_rates(runtime); |
413 | 409 | ||
414 | runtime->hw.channels_min = be32_to_cpu(number_audio); | 410 | runtime->hw.channels_min = number_audio; |
415 | runtime->hw.channels_max = be32_to_cpu(number_audio); | 411 | runtime->hw.channels_max = number_audio; |
416 | 412 | ||
417 | amdtp_out_stream_set_parameters(&dice->stream, rate, | 413 | amdtp_out_stream_set_parameters(&dice->stream, dice_rates[rate_index], |
418 | be32_to_cpu(number_audio), | 414 | number_audio, number_midi); |
419 | be32_to_cpu(number_midi)); | ||
420 | 415 | ||
421 | err = snd_pcm_hw_constraint_step(runtime, 0, | 416 | err = snd_pcm_hw_constraint_step(runtime, 0, |
422 | SNDRV_PCM_HW_PARAM_PERIOD_SIZE, | 417 | SNDRV_PCM_HW_PARAM_PERIOD_SIZE, |