Linux Sound subsystem development
 help / color / mirror / Atom feed
From: "Amadeusz Sławiński" <amadeuszx.slawinski@linux.intel.com>
To: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.de>
Cc: Takashi Iwai <tiwai@suse.com>, Mark Brown <broonie@kernel.org>,
	Cezary Rojewski <cezary.rojewski@intel.com>,
	linux-sound@vger.kernel.org
Subject: Re: [RFC PATCH 0/4] Add support for detection
Date: Tue, 22 Oct 2024 17:11:28 +0200	[thread overview]
Message-ID: <0c620aa7-ddad-42ae-b82f-91c4aaf80c83@linux.intel.com> (raw)
In-Reply-To: <bb3cc47b-0a5a-4604-9343-17e0be3c7a06@perex.cz>

On 10/18/2024 7:15 PM, Jaroslav Kysela wrote:
> On 18. 10. 24 16:16, Amadeusz Sławiński wrote:
> 
>> Our use case is to:
> 
> Inlined my proposal:
> 
>> 1. Program DSP with all pipelines it needs to implement whole scenario
>> (hw_params)
> 
> SNDRV_PCM_IOCTL_HW_PARAMS
> 
>> 2. Perform additional configuration from usespace
> 
> Can be done using control API (/dev/snd/controlC*). E.g. We have already:
> 
> numid=19,iface=PCM,name='ELD',device=3
> numid=32,iface=PCM,name='Playback Channel Map',device=3
> 
> Those controls can be R/W as you like.
> 
>> 3. Start detection pipelines
> 
> SNDRV_PCM_IOCTL_PREPARE
> 

Will check, but from what I recall streams should not be started in 
prepare due to it being used for xrun recovery, but maybe it doesn't 
matter for detection ones.

>> 4. Wait for event to happen (it can take however long necessary, for
>> example hours)
> 
> Can be done using control API (/dev/snd/controlC*). There is a mechanism 
> for event handling already.
> 
> Something like (boolean type):
> 
> iface=PCM,device=2,name="Event X"   # first event type
> iface=PCM,device=2,name="Event Y"   # second event type ...
> 
> The PCM stream may be active only when at least one event from the above 
> set is active.
> 
>> 5. When event happens start drain pipelines and process data in
>> userspace likes in standard capture scenario
> 
> SNDRV_PCM_IOCTL_START
> 
> The driver may set the correct timestamp when the capturing was started. 
> The sample buffers are already allocated and ready for transfers, so we 
> can assume that the time window between the event notification (event) 
> and START ioctl is small, so no samples should be lost.
> 
>> 6. When no more data is needed, either stop drain pipelines and go back
>> to 3 or just close stream
> 
> SNDRV_PCM_IOCTL_STOP / DRAIN, SNDRV_PCM_IOCTL_HW_PARAMS or close(fd)
> 
> Basically, I think that this extension can be implemented with minimal 
> changes to the PCM API - it's just about to slightly extend existing APIs.
> 
>                  Jaroslav
> 


  reply	other threads:[~2024-10-22 15:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-16 13:02 [RFC PATCH 0/4] Add support for detection Amadeusz Sławiński
2024-10-16 13:02 ` [RFC PATCH 1/4] ALSA: core: Add support for running detect on capture stream Amadeusz Sławiński
2024-10-16 13:02 ` [RFC PATCH 2/4] ALSA: core: Allow polling for detection Amadeusz Sławiński
2024-10-16 13:02 ` [RFC PATCH 3/4] ASoC: pcm: Add support for running detect on capture stream Amadeusz Sławiński
2024-10-16 13:02 ` [RFC PATCH 4/4] ASoC: Propagate DETECT trigger Amadeusz Sławiński
2024-10-16 13:11 ` [RFC PATCH 0/4] Add support for detection Takashi Iwai
2024-10-16 13:29   ` Amadeusz Sławiński
2024-10-16 13:47     ` Takashi Iwai
2024-10-18 14:16       ` Amadeusz Sławiński
2024-10-18 17:15         ` Jaroslav Kysela
2024-10-22 15:11           ` Amadeusz Sławiński [this message]
2024-10-16 13:41 ` Jaroslav Kysela

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=0c620aa7-ddad-42ae-b82f-91c4aaf80c83@linux.intel.com \
    --to=amadeuszx.slawinski@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=cezary.rojewski@intel.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox