All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: clemens@ladisch.de, tiwai@suse.de
Cc: alsa-devel@alsa-project.org
Subject: [PATCH 11/12] ALSA: dice: update isochronous resources when starting packet streaming after bus-reset
Date: Tue, 11 Jun 2019 22:21:17 +0900	[thread overview]
Message-ID: <20190611132118.8378-12-o-takashi@sakamocchi.jp> (raw)
In-Reply-To: <20190611132118.8378-1-o-takashi@sakamocchi.jp>

After bus reset, isochronous resource manager releases all of allocated
isochronous resources. The nodes to transfer isochronous packet should
request reallocation of the resources.

However, between the bus-reset and invocation of 'struct fw_driver.update'
handler, ALSA PCM application can detect this situation by XRUN because
the target device cancelled to transmit packets once bus-reset occurs.

Due to the above mechanism, ALSA fireface driver just stops packet
streaming in the update handler, thus pcm.prepare handler should
request the reallocation.

This commit requests the reallocation in pcm.prepare callback when
bus generation is changed.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 sound/firewire/dice/dice-stream.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/sound/firewire/dice/dice-stream.c b/sound/firewire/dice/dice-stream.c
index 6bbf7421a53c..f61b99a72655 100644
--- a/sound/firewire/dice/dice-stream.c
+++ b/sound/firewire/dice/dice-stream.c
@@ -399,6 +399,7 @@ static int start_streams(struct snd_dice *dice, enum amdtp_stream_direction dir,
  */
 int snd_dice_stream_start_duplex(struct snd_dice *dice)
 {
+	unsigned int generation = dice->rx_resources[0].generation;
 	struct reg_params tx_params, rx_params;
 	unsigned int i;
 	unsigned int rate;
@@ -421,6 +422,15 @@ int snd_dice_stream_start_duplex(struct snd_dice *dice)
 		}
 	}
 
+	if (generation != fw_parent_device(dice->unit)->card->generation) {
+		for (i = 0; i < MAX_STREAMS; ++i) {
+			if (i < tx_params.count)
+				fw_iso_resources_update(dice->tx_resources + i);
+			if (i < rx_params.count)
+				fw_iso_resources_update(dice->rx_resources + i);
+		}
+	}
+
 	// Check required streams are running or not.
 	err = snd_dice_transaction_get_rate(dice, &rate);
 	if (err < 0)
-- 
2.20.1

  parent reply	other threads:[~2019-06-11 13:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-11 13:21 [PATCH 00/12] ALSA: firewire-digi00x/dice: reserve/release isochronous resources in pcm.hw_params/hw_free callbacks Takashi Sakamoto
2019-06-11 13:21 ` [PATCH 01/12] ALSA: firewire-digi00x: refactoring to move timing of registration for isochronous channel Takashi Sakamoto
2019-06-11 13:21 ` [PATCH 02/12] ALSA: firewire-digi00x: code refactoring to finish streaming session Takashi Sakamoto
2019-06-11 13:21 ` [PATCH 03/12] ALSA: firewire-digi00x: simplify error path to begin " Takashi Sakamoto
2019-06-11 13:21 ` [PATCH 04/12] ALSA: firewire-digi00x: code refactoring to keep isochronous resources Takashi Sakamoto
2019-06-11 13:21 ` [PATCH 05/12] ALSA: firewire-digi00x: reserve/release isochronous resources in pcm.hw_params/hw_free callbacks Takashi Sakamoto
2019-06-11 13:21 ` [PATCH 06/12] ALSA: firewire-digi00x: update isochronous resources when starting packet streaming after bus-reset Takashi Sakamoto
2019-06-11 13:21 ` [PATCH 07/12] ALSA: firewire-digi00x: code refactoring for pcm.hw_params/hw_free callbacks Takashi Sakamoto
2019-06-11 13:21 ` [PATCH 08/12] ALSA: dice: code refactoring to stop packet streaming Takashi Sakamoto
2019-06-11 13:21 ` [PATCH 09/12] ALSA: dice: code refactoring to keep isochronous resources Takashi Sakamoto
2019-06-11 13:21 ` [PATCH 10/12] ALSA: dice: reserve/release isochronous resources in pcm.hw_params/hw_free callbacks Takashi Sakamoto
2019-06-11 13:21 ` Takashi Sakamoto [this message]
2019-06-11 13:21 ` [PATCH 12/12] ALSA: dice: code refactoring for " Takashi Sakamoto
2019-06-11 15:51 ` [PATCH 00/12] ALSA: firewire-digi00x/dice: reserve/release isochronous resources in " Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190611132118.8378-12-o-takashi@sakamocchi.jp \
    --to=o-takashi@sakamocchi.jp \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.