Re: [PATCH 7/8] ALSA: pcm: Add card sync_irq field

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 11/17/19 2:53 AM, Takashi Iwai wrote:
Many PCI and other drivers performs snd_pcm_period_elapsed() simply in
its interrupt handler, so the sync_stop operation is just to call
synchronize_irq().  Instead of putting this call multiple times,
introduce the common card->sync_irq field.  When this field is set,
PCM core performs synchronize_irq() for sync-stop operation.  Each
driver just needs to copy its local IRQ number to card->sync_irq, and
that's all we need.

Maybe a red-herring or complete non-sense, but I wonder if this is going to get in the way of Ranjani's multi-client work, where we could have multiple cards created but with a single IRQ handled by the parent PCI device?

Ranjani, you may want to double-check this and chime in, thanks!


Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
---
  include/sound/core.h    | 1 +
  sound/core/init.c       | 1 +
  sound/core/pcm_native.c | 2 ++
  3 files changed, 4 insertions(+)

diff --git a/include/sound/core.h b/include/sound/core.h
index ee238f100f73..af3dce956c17 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -117,6 +117,7 @@ struct snd_card {
  	struct device card_dev;		/* cardX object for sysfs */
  	const struct attribute_group *dev_groups[4]; /* assigned sysfs attr */
  	bool registered;		/* card_dev is registered? */
+	int sync_irq;			/* assigned irq, used for PCM sync */
  	wait_queue_head_t remove_sleep;
#ifdef CONFIG_PM
diff --git a/sound/core/init.c b/sound/core/init.c
index db99b7fad6ad..faa9f03c01ca 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -215,6 +215,7 @@ int snd_card_new(struct device *parent, int idx, const char *xid,
  	init_waitqueue_head(&card->power_sleep);
  #endif
  	init_waitqueue_head(&card->remove_sleep);
+	card->sync_irq = -1;
device_initialize(&card->card_dev);
  	card->card_dev.parent = parent;
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 163d621ff238..1fe581167b7b 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -574,6 +574,8 @@ static void snd_pcm_sync_stop(struct snd_pcm_substream *substream)
  		substream->runtime->stop_operating = false;
  		if (substream->ops->sync_stop)
  			substream->ops->sync_stop(substream);
+		else if (substream->pcm->card->sync_irq > 0)
+			synchronize_irq(substream->pcm->card->sync_irq);
  	}
  }
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux