diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2017-03-22 21:30:25 +0900 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2017-03-28 12:34:06 +0200 |
commit | 5aaab1bf37ede45df4f5d13d735faf824edf3ec8 (patch) | |
tree | b1c358629796556f57cf52faf832d226b7b2338d /sound/firewire/motu/motu-hwdep.c | |
parent | 71c3797779d3cd8378767f5b2d8cfd3b2f88c5c1 (diff) | |
download | linux-next-5aaab1bf37ede45df4f5d13d735faf824edf3ec8.tar.gz |
ALSA: firewire-motu: enable to read transaction cache via hwdep interface
MOTU FireWire series can transfer messages to registered address. These
messages are transferred for the status of internal clock synchronization
just after starting streams.
When the synchronization is stable, it's 0x01ffffff. Else, it's 0x05ffffff.
This commit adds a functionality for user space applications to receive
content of the message.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/motu/motu-hwdep.c')
-rw-r--r-- | sound/firewire/motu/motu-hwdep.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sound/firewire/motu/motu-hwdep.c b/sound/firewire/motu/motu-hwdep.c index e795a5219a21..b87ccb69d597 100644 --- a/sound/firewire/motu/motu-hwdep.c +++ b/sound/firewire/motu/motu-hwdep.c @@ -26,7 +26,7 @@ static long hwdep_read(struct snd_hwdep *hwdep, char __user *buf, long count, spin_lock_irq(&motu->lock); - while (!motu->dev_lock_changed) { + while (!motu->dev_lock_changed && motu->msg == 0) { prepare_to_wait(&motu->hwdep_wait, &wait, TASK_INTERRUPTIBLE); spin_unlock_irq(&motu->lock); schedule(); @@ -43,6 +43,12 @@ static long hwdep_read(struct snd_hwdep *hwdep, char __user *buf, long count, motu->dev_lock_changed = false; count = min_t(long, count, sizeof(event.lock_status)); + } else { + event.motu_notification.type = SNDRV_FIREWIRE_EVENT_MOTU_NOTIFICATION; + event.motu_notification.message = motu->msg; + motu->msg = 0; + + count = min_t(long, count, sizeof(event.motu_notification)); } spin_unlock_irq(&motu->lock); @@ -62,7 +68,7 @@ static unsigned int hwdep_poll(struct snd_hwdep *hwdep, struct file *file, poll_wait(file, &motu->hwdep_wait, wait); spin_lock_irq(&motu->lock); - if (motu->dev_lock_changed) + if (motu->dev_lock_changed || motu->msg) events = POLLIN | POLLRDNORM; else events = 0; |