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: Oder Chiou <oder_chiou@realtek.com>,
	alsa-devel@alsa-project.org, Liam Girdwood <lgirdwood@gmail.com>,
	Hans de Goede <hdegoede@redhat.com>,
	Mark Brown <broonie@kernel.org>, Bard Liao <bard.liao@intel.com>
Subject: Re: [RFC 2/2] ASoC: rt5670: Add LED trigger support
Date: Thu, 25 Feb 2021 19:09:44 +0100	[thread overview]
Message-ID: <254af1a7-6ed4-60be-01b5-76cf08b7f8da@perex.cz> (raw)
In-Reply-To: <s5hzgzspg2i.wl-tiwai@suse.de>

Dne 25. 02. 21 v 12:00 Takashi Iwai napsal(a):
> On Wed, 24 Feb 2021 18:57:42 +0100,
> Jaroslav Kysela wrote:
>>
>> Dne 24. 02. 21 v 13:42 Takashi Iwai napsal(a):
>>> On Wed, 24 Feb 2021 13:08:55 +0100,
>>> Jaroslav Kysela wrote:
>>>>
>>>> Dne 24. 02. 21 v 12:43 Takashi Iwai napsal(a):
>>>>
>>>>>>> So far, a user control is merely storing the value, let read/write via
>>>>>>> the control API.  That's all, and nothing wrong can happen just by
>>>>>>> that.  Now if it interacts with other subsystem...
>>>>>>>
>>>>>>> A more serious concern is rather the fragility of the setup; for
>>>>>>> enabling the mute LED control, you'd have to create a new user-space
>>>>>>> control, the function of the control has to be ignored by some
>>>>>>> application and some not, etc.  This has to be done on each machine
>>>>>>
>>>>>> You're using "ignore", but as I explained before, the user space switch will
>>>>>> be used in the whole chain:
>>>>>>
>>>>>> capture stream ->
>>>>>>   alsa-lib mute switch / silence PCM stream ->
>>>>>>   PA mute switch / silence PCM stream
>>>>>>
>>>>>> So PA can use this switch like the traditional hardware mute switch.
>>>>>
>>>>> Does it mean PA would work as of now without any change?  Or does it
>>>>> need patching?
>>>>
>>>> Yes, no PA modifications are required with my mechanism. The PA will just see
>>>> the new user space control - mute switch - created in alsa-lib - which will be
>>>> synced the internal PA path mute state like for the hardware mute
>>>> switch.
>>>
>>> OK, but how would we create and manage the user control element?  And
>>> why it has to be user control?
>>
>> The softvol or alsactl can create the user control element. The alsa-lib
>> softvol plugin and PA can silence stream according the state.
> 
> And that's tricky if it's only with PA, as PA won't open a softvol PCM
> stream...

The protection is in alsa-lib, so we can skip to check this hint flag for this
particular case like:

https://github.com/alsa-project/alsa-lib/pull/121/commits/1acc1c7eccab0359996b25de54a6b6e0aa1e0c17

So it may depend on the softvol config not PA itself.

Even for the solution bellow, we need to modify softvol to handle the kernel
control elements, too. Actually softvol is not active, when the specified
control element is found and this element is not from the user space.

>> I see your point to create this control in the kernel space, but any other
>> name than "Mic Capture Switch" (in the ACP case) will be misleading for users,
>> because the user-space does the appropriate real silencing job instead of hw.
>>
>> And if we create "Mic Capture Switch" in the kernel space, it may be
>> misleading for applications (they can think that there's hardware mute control).
>>
>> Perhaps, we can create "Mic Phantom Capture Switch" in kernel which may
>> resolve both problems (no hw mute information + no user confusion).
> 
> Yes, something like that would work.
> The advantage of in-kernel implementation is that it's self-contained,
> so just deploying the new kernel makes everything working.

Ok, so let settle the naming for those controls which depends on the user
space code which does the real work (silencing). Is "Phantom" prefix good -
we're using it for jacks, or someone has a better idea?

						Jaroslav

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

  reply	other threads:[~2021-02-25 18:10 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-15 14:24 [RFC 0/2] ASoC: rt5670: Add LED trigger support Hans de Goede
2021-02-15 14:24 ` [RFC 1/2] ASoC: Add new SOC_DOUBLE*_ACCESS() macros Hans de Goede
2021-02-15 14:24 ` [RFC 2/2] ASoC: rt5670: Add LED trigger support Hans de Goede
2021-02-23 13:45   ` Mark Brown
2021-02-23 13:59     ` Hans de Goede
2021-02-23 14:09       ` Mark Brown
2021-02-23 14:21         ` Takashi Iwai
2021-02-23 16:14           ` Jaroslav Kysela
2021-02-23 16:20             ` Takashi Iwai
2021-02-23 20:56               ` Jaroslav Kysela
2021-02-24  7:12                 ` Takashi Iwai
2021-02-24  8:14                   ` Jaroslav Kysela
2021-02-24  8:52                     ` Takashi Iwai
2021-02-24  9:27                       ` Jaroslav Kysela
2021-02-24  9:38                         ` Takashi Iwai
2021-02-24  9:49                           ` Jaroslav Kysela
2021-02-24 10:33                             ` Takashi Iwai
2021-02-24 10:56                               ` Jaroslav Kysela
2021-02-24 11:43                                 ` Takashi Iwai
2021-02-24 12:08                                   ` Jaroslav Kysela
2021-02-24 12:42                                     ` Takashi Iwai
2021-02-24 17:57                                       ` Jaroslav Kysela
2021-02-25 11:00                                         ` Takashi Iwai
2021-02-25 18:09                                           ` Jaroslav Kysela [this message]
2021-02-26  8:41                                             ` Takashi Iwai
2021-02-26  9:22                                               ` Jaroslav Kysela
2021-02-23 17:07             ` Hans de Goede
2021-02-23 17:20             ` Mark Brown
2021-02-23 19:03               ` Hans de Goede
2021-02-24 12:59                 ` Mark Brown
2021-02-24 19:14                   ` Hans de Goede
2021-02-24 19:36                     ` Mark Brown
2021-02-24 20:09                       ` Hans de Goede
2021-02-25 14:59                         ` Mark Brown
2021-02-25 18:45                           ` Hans de Goede
2021-03-01 13:23                             ` Mark Brown
2021-03-01 13:39                               ` Hans de Goede
2021-03-01 19:15                                 ` Mark Brown
2021-03-01 19:49                                   ` Hans de Goede
2021-03-01 20:43                                     ` Mark Brown
2021-03-01 21:26                                       ` Hans de Goede
2021-03-02 12:41                                         ` Mark Brown
2021-03-02 21:14                                         ` Jaroslav Kysela
2021-03-04 19:39                                           ` Hans de Goede
2021-03-05 13:02                                             ` Jaroslav Kysela
2021-03-07 13:51                                               ` Hans de Goede

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=254af1a7-6ed4-60be-01b5-76cf08b7f8da@perex.cz \
    --to=perex@perex.cz \
    --cc=alsa-devel@alsa-project.org \
    --cc=bard.liao@intel.com \
    --cc=broonie@kernel.org \
    --cc=hdegoede@redhat.com \
    --cc=lgirdwood@gmail.com \
    --cc=oder_chiou@realtek.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).