mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Mark Brown <broonie@kernel.org>, Perry Yuan <Perry.Yuan@dell.com>
Cc: oder_chiou@realtek.com, alsa-devel@alsa-project.org,
	lgirdwood@gmail.com,
	Limonciello Mario <Mario.Limonciello@dell.com>,
	linux-kernel@vger.kernel.org, tiwai@suse.com
Subject: Re: [PATCH] ASoC: rt715:add Mic Mute LED control support
Date: Tue, 3 Nov 2020 10:13:03 -0600	[thread overview]
Message-ID: <5f2c1282-4401-276a-8dad-127fa1f449fd@linux.intel.com> (raw)
In-Reply-To: <20201103131253.GA5545@sirena.org.uk>

Somehow this patch was filtered by alsa-devel servers?

On 11/3/20 7:12 AM, Mark Brown wrote:
> On Tue, Nov 03, 2020 at 04:58:59AM -0800, Perry Yuan wrote:
>> From: perry_yuan <perry_yuan@dell.com>
>>
>> Some new Dell system is going to support audio internal micphone
>> privacy setting from hardware level with micmute led state changing
>>
>> This patch allow to change micmute led state through this micphone
>> led control interface like hda_generic provided.
> 
> If this is useful it should be done at the subsystem level rather than
> open coded in a specific CODEC driver, however I don't undersand why it
> is.
> 
>> +static int rt715_micmute_led_mode_put(struct snd_kcontrol *kcontrol,
>> +      struct snd_ctl_elem_value *ucontrol)
>> +{
>> +    struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
>> +    struct rt715_priv *rt715 = snd_soc_component_get_drvdata(component);
>> +    int led_mode = ucontrol->value.integer.value[0];
>> +
>> +    rt715->micmute_led = led_mode;
>> +#if IS_ENABLED(CONFIG_LEDS_TRIGGER_AUDIO)
>> +    ledtrig_audio_set(LED_AUDIO_MICMUTE,
>> +               rt715->micmute_led ? LED_ON : LED_OFF);
>> +#endif
>> +  return 0;
>> +}
> 
> This is just adding a userspace API to set a LED via the standard LED
> APIs.  Since the LED subsystem already has a perfectly good userspace
> API why not use that?  There is no visible value in this being in the
> sound subsystem.

I also don't quite follow. This looks as inspired from HDaudio code, but 
with a lot of simplifications.

If the intent was that when userspace decides to mute the LED is turned 
on, wouldn't it be enough to just track the state of a 'capture switch' 
responsible for mute, i.e. when the capture Switch is 'off' the LED is 
on. I don't see the point of having a new control, you would be adding 
more work for PulseAudio/UCM whereas connecting the capture switch to a 
led comes with zero work in userspace. See e.g. how the mute mic LED was 
handled in the SOF code handling DMICs, we didn't add a new control but 
turned the LED in the switch .put callback, see

https://elixir.bootlin.com/linux/latest/source/sound/soc/sof/control.c#L18

https://elixir.bootlin.com/linux/latest/source/sound/soc/sof/control.c#L153

Actually thinking more about it, having two controls for 'mute LED' and 
'capture switch' could lead to inconsistent states where the LED is on 
without mute being activated. we should really bolt the LED activation 
to the capture switch, that way the mute and LED states are aligned.



  reply	other threads:[~2020-11-03 16:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-03 12:58 Perry Yuan
2020-11-03 13:12 ` Mark Brown
2020-11-03 16:13   ` Pierre-Louis Bossart [this message]
2020-11-03 17:51     ` Limonciello, Mario
2020-11-03 17:59     ` Mark Brown
2020-11-03 18:04       ` Limonciello, Mario
2020-11-03 18:31         ` Mark Brown
2020-11-03 19:01           ` Limonciello, Mario
2020-11-03 18:35         ` Pierre-Louis Bossart
2020-11-03 19:03 ` kernel test robot

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=5f2c1282-4401-276a-8dad-127fa1f449fd@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=Mario.Limonciello@dell.com \
    --cc=Perry.Yuan@dell.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oder_chiou@realtek.com \
    --cc=tiwai@suse.com \
    /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

all inboxes | Powered by JetHome®