alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Jaroslav Kysela <perex@perex.cz>
To: Takashi Iwai <tiwai@suse.de>
Cc: Hans de Goede <hdegoede@redhat.com>,
	ALSA development <alsa-devel@alsa-project.org>,
	Perry Yuan <Perry.Yuan@dell.com>
Subject: Re: [PATCH 0/5] ALSA: control - add generic LED trigger code
Date: Mon, 15 Feb 2021 18:49:09 +0100	[thread overview]
Message-ID: <11a778dd-2ce3-0fbd-557a-c0dd5f35ce27@perex.cz> (raw)
In-Reply-To: <s5him6tbwhf.wl-tiwai@suse.de>

Dne 15. 02. 21 v 8:50 Takashi Iwai napsal(a):
> On Sun, 14 Feb 2021 19:55:21 +0100,
> Jaroslav Kysela wrote:
>>
>> Dne 12. 02. 21 v 13:28 Takashi Iwai napsal(a):
>>> On Fri, 12 Feb 2021 11:32:38 +0100,
>>> Jaroslav Kysela wrote:
>>>>
>>>> Dne 12. 02. 21 v 10:23 Takashi Iwai napsal(a):
>>>>> On Thu, 11 Feb 2021 18:53:20 +0100,
>>>>> Jaroslav Kysela wrote:
>>>>>>
>>>>>> Dne 11. 02. 21 v 18:15 Takashi Iwai napsal(a):
>>>>>>
>>>>>>>> Jaroslav Kysela (5):
>>>>>>>>   ALSA: control - introduce snd_ctl_notify_one() helper
>>>>>>>>   ALSA: control - add layer registration routines
>>>>>>>>   ALSA: control - add generic LED trigger module as the new control
>>>>>>>>     layer
>>>>>>>>   ALSA: HDA - remove the custom implementation for the audio LED trigger
>>>>>>>>   ALSA: control - add sysfs support to the LED trigger module
>>>>>>
>>>>>>> One thing I still miss from the picture is how to deal with the case
>>>>>>> like AMD ACP.  It has no mixer control to bundle with the LED trigger.
>>>>>>> Your idea is to make a (dummy) user element and tie the LED trigger
>>>>>>> with it?
>>>>>>
>>>>>> Yes, the user-space code which guarantee the silence stream should create an
>>>>>> user space control with the appropriate LED group access bits. The alsa-lib's
>>>>>> softvol PCM plugin can do this silencing for example.
>>>>>
>>>>> What control would it create?  In the case of softvol, it's a volume
>>>>> control that really changes the volume.  For the mute LED, it's a
>>>>> control turn on/off the mute?  If so, I wonder what makes better than
>>>>> creating it from the kernel driver.  (Of course, we can list up like
>>>>> "flexibility", etc, but it has a flip side of "complexity" and
>>>>> "fragility"...)
>>>>
>>>> The current code handles both switch / volume for the marked control (assuming
>>>> that the minimal value - usually zero - is full mute). And actually, there are
>>>> snd_pcm_areas_silence() calls in the softvol plugin, so we know that the PCM
>>>> stream is not passed to the application at this point.
>>>>
>>>> Condition:
>>>>
>>>>       if (info.type == SNDRV_CTL_ELEM_TYPE_BOOLEAN ||
>>>>           info.type == SNDRV_CTL_ELEM_TYPE_INTEGER)
>>>>           ... value.value.integer.value[i] != info.value.integer.min
>>>>
>>>> The softvol plugin may be extended to add the mute switch control, of course.
>>>
>>> Well, my question was what kind of mixer control will be added at all,
>>> although the chip does neither volume nor mute function.  Would we add
>>> a fake volume/switch like softvol, or would we add rather a control
>>> that is directly tied with the LED state?
>>
>> I don't understand your question. If the user space marks the own vol/sw
>> control with the LED group, then it's tied with the LED state. I believe that
>> the control should be created in the code which make sure that the PCM stream
>> is silenced (like alsa-lib's softvol plugin).
> 
> The softvol (or similar effect) is to be ignored by PA, as it's not
> suitable with the timer-scheduled type of PCM streaming.  So the
> control shouldn't have any actual effect of PCM stream itself but
> merely for controlling the LED state.  If that's the case, it
> shouldn't be named like "XXX Switch" or "XXX Volume", but it's a
> control like "Mic Mute LED Status" -- and ironically, that's a kind of
> thing we didn't want to take in the kernel side implementation...

I see your point now. We can force softvol switch (not volume) for this kind
of hardware (AMD ACP) even for PA, so we know, that there's a code which
modifies the PCM stream in the chain.

Regarding time-scheduled I/O - for the capture, we're fine, because we can
silence the samples before they're processed in the user space. We also even
know, that the standard use for the microphone input is real-time, so the
buffering is really short. For playback, yes, the driver queued samples cannot
be altered, but it's usually no big security problem. The latency may be
seconds (or a bit more) in the corner case. If we need a proper solution, the
kernel PCM driver should be improved to take care (software based silence) or
the buffering must be reduced. I don't think that we need to change something
for ACP right now.

Also note that PA does the own stream silencing when the mixer path is muted,
so it's double win here (alsa-lib + PA) and the latency should be identical.

					Jaroslav

-- 
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

  reply	other threads:[~2021-02-15 17:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-11 11:13 [PATCH 0/5] ALSA: control - add generic LED trigger code Jaroslav Kysela
2021-02-11 11:13 ` [PATCH 1/5] ALSA: control - introduce snd_ctl_notify_one() helper Jaroslav Kysela
2021-02-11 11:13 ` [PATCH 2/5] ALSA: control - add layer registration routines Jaroslav Kysela
2021-02-11 11:13 ` [PATCH 3/5] ALSA: control - add generic LED trigger module as the new control layer Jaroslav Kysela
2021-02-11 11:13 ` [PATCH 4/5] ALSA: HDA - remove the custom implementation for the audio LED trigger Jaroslav Kysela
2021-02-11 12:19   ` kernel test robot
2021-02-11 13:03     ` Jaroslav Kysela
2021-02-22  7:28   ` [ALSA] a7fc56df5a: WARNING:possible_circular_locking_dependency_detected kernel test robot
2021-02-11 11:14 ` [PATCH 5/5] ALSA: control - add sysfs support to the LED trigger module Jaroslav Kysela
2021-02-11 12:43   ` kernel test robot
2021-02-11 17:15 ` [PATCH 0/5] ALSA: control - add generic LED trigger code Takashi Iwai
2021-02-11 17:53   ` Jaroslav Kysela
2021-02-12  9:23     ` Takashi Iwai
2021-02-12 10:32       ` Jaroslav Kysela
2021-02-12 12:28         ` Takashi Iwai
2021-02-14 18:55           ` Jaroslav Kysela
2021-02-15  7:50             ` Takashi Iwai
2021-02-15 17:49               ` Jaroslav Kysela [this message]
2021-02-12 20:31 ` Hans de Goede
2021-02-15 12:02   ` Hans de Goede
2021-02-15 12:35     ` 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=11a778dd-2ce3-0fbd-557a-c0dd5f35ce27@perex.cz \
    --to=perex@perex.cz \
    --cc=Perry.Yuan@dell.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=hdegoede@redhat.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;
as well as URLs for NNTP newsgroup(s).