From a7304e3bf0489d3fc0260bdb9c1441427a26a38f Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Sun, 4 Sep 2011 22:16:10 +0200 Subject: ALSA: dice: support dual-wire stream format at 192 kHz Change the AMDTP streaming code to handle the non-standard stream format that DICE devices use at sample rates greater than 96 kHz. Signed-off-by: Clemens Ladisch --- sound/firewire/dice.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'sound/firewire/dice.c') diff --git a/sound/firewire/dice.c b/sound/firewire/dice.c index b4827ff45d6..8804e42a96c 100644 --- a/sound/firewire/dice.c +++ b/sound/firewire/dice.c @@ -375,7 +375,7 @@ 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; + unsigned int rate_index, rate; int err; err = dice_try_lock(dice); @@ -387,12 +387,13 @@ static int dice_open(struct snd_pcm_substream *substream) &clock_sel, 4); if (err < 0) goto err_lock; - rate = (be32_to_cpu(clock_sel) & CLOCK_RATE_MASK) >> CLOCK_RATE_SHIFT; - if (rate >= ARRAY_SIZE(dice_rates)) { + rate_index = (be32_to_cpu(clock_sel) & CLOCK_RATE_MASK) + >> CLOCK_RATE_SHIFT; + if (rate_index >= ARRAY_SIZE(dice_rates)) { err = -ENXIO; goto err_lock; } - rate = dice_rates[rate]; + rate = dice_rates[rate_index]; err = snd_fw_transaction(dice->unit, TCODE_READ_QUADLET_REQUEST, rx_address(dice, RX_NUMBER_AUDIO), @@ -413,9 +414,20 @@ static int dice_open(struct snd_pcm_substream *substream) runtime->hw.channels_min = be32_to_cpu(number_audio); runtime->hw.channels_max = be32_to_cpu(number_audio); - amdtp_out_stream_set_rate(&dice->stream, rate); - amdtp_out_stream_set_pcm(&dice->stream, be32_to_cpu(number_audio)); - amdtp_out_stream_set_midi(&dice->stream, be32_to_cpu(number_midi)); + amdtp_out_stream_set_parameters(&dice->stream, rate, + be32_to_cpu(number_audio), + be32_to_cpu(number_midi)); + + err = snd_pcm_hw_constraint_step(runtime, 0, + SNDRV_PCM_HW_PARAM_PERIOD_SIZE, + amdtp_syt_intervals[rate_index]); + if (err < 0) + goto err_lock; + err = snd_pcm_hw_constraint_step(runtime, 0, + SNDRV_PCM_HW_PARAM_BUFFER_SIZE, + amdtp_syt_intervals[rate_index]); + if (err < 0) + goto err_lock; err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_TIME, @@ -993,7 +1005,8 @@ static int dice_probe(struct fw_unit *unit, const struct ieee1394_device_id *id) goto err_notification_handler; dice->resources.channels_mask = 0x00000000ffffffffuLL; - err = amdtp_out_stream_init(&dice->stream, unit, CIP_BLOCKING); + err = amdtp_out_stream_init(&dice->stream, unit, + CIP_BLOCKING | CIP_HI_DUALWIRE); if (err < 0) goto err_resources; -- cgit v1.2.3-70-g09d2