diff options
| author | Ivan Orlov <ivan.orlov0322@gmail.com> | 2024-08-13 13:07:00 +0100 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2024-08-18 09:55:54 +0200 |
| commit | 37745918e0e7575bc40f38da93a99b9fa6406224 (patch) | |
| tree | 2865a5c2eba53900f5e82a725ccf739428c5b04d /sound/core/Kconfig | |
| parent | 8fad71b6771afc1f12f1cdf616ae0fca628802e9 (diff) | |
ALSA: timer: Introduce virtual userspace-driven timers
Implement two ioctl calls in order to support virtual userspace-driven
ALSA timers.
The first ioctl is SNDRV_TIMER_IOCTL_CREATE, which gets the
snd_timer_uinfo struct as a parameter and puts a file descriptor of a
virtual timer into the `fd` field of the snd_timer_unfo structure. It
also updates the `id` field of the snd_timer_uinfo struct, which
provides a unique identifier for the timer (basically, the subdevice
number which can be used when creating timer instances).
This patch also introduces a tiny id allocator for the userspace-driven
timers, which guarantees that we don't have more than 128 of them in the
system.
Another ioctl is SNDRV_TIMER_IOCTL_TRIGGER, which allows us to trigger
the virtual timer (and calls snd_timer_interrupt for the timer under
the hood), causing all of the timer instances binded to this timer to
execute their callbacks.
The maximum amount of ticks available for the timer is 1 for the sake of
simplicity of the userspace API. 'start', 'stop', 'open' and 'close'
callbacks for the userspace-driven timers are empty since we don't
really do any hardware initialization here.
Suggested-by: Axel Holzinger <aholzinger@gmx.de>
Signed-off-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20240813120701.171743-4-ivan.orlov0322@gmail.com
Diffstat (limited to 'sound/core/Kconfig')
| -rw-r--r-- | sound/core/Kconfig | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sound/core/Kconfig b/sound/core/Kconfig index f0ba87d4e504..2c5b9f964703 100644 --- a/sound/core/Kconfig +++ b/sound/core/Kconfig @@ -242,6 +242,16 @@ config SND_JACK_INJECTION_DEBUG Say Y if you are debugging via jack injection interface. If unsure select "N". +config SND_UTIMER + bool "Enable support for userspace-controlled virtual timers" + depends on SND_TIMER + help + Say Y to enable the support of userspace-controlled timers. These + timers are purely virtual, and they are supposed to be triggered + from userspace. They could be quite useful when synchronizing the + sound timing with userspace applications (for instance, when sending + data through snd-aloop). + config SND_VMASTER bool |
