mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Perry Yuan <Perry.Yuan@dell.com>,
	pobrn@protonmail.com, oder_chiou@realtek.com, perex@perex.cz,
	tiwai@suse.com, hdegoede@redhat.com, mgross@linux.intel.com,
	Mario.Limonciello@dell.com
Cc: lgirdwood@gmail.com, broonie@kernel.org,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH v4 2/2] ASoC: rt715:add micmute led state control supports
Date: Mon, 1 Mar 2021 08:30:20 -0600	[thread overview]
Message-ID: <98d8b015-c1d6-fd4c-ac94-3f9226b93436@linux.intel.com> (raw)
In-Reply-To: <20210301093834.19524-1-Perry_Yuan@Dell.com>



On 3/1/21 3:38 AM, 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
> When micmute hotkey pressed by user, soft mute will need to be enabled
> firstly in case of pop noise, and codec driver need to react to mic
> mute event to EC(embedded controller) notifying that SW mute is completed
> Then EC will do the hardware mute physically within the timeout reached
> 
> This patch allow codec rt715 and rt715 sdca driver to change the local micmute
> led state. Dell privacy led trigger driver will ack EC when micmute key pressed
> through this micphone led control interface like hda_generic provided
> ACPI method defined in dell-privacy micmute led trigger will be called
> for notifying the EC that software mute has been completed, then hardware
> audio circuit solution controlled by EC will switch the audio input source off/on
> 
> Signed-off-by: Perry Yuan <perry_yuan@dell.com>
> 
> --------
> v3 -> v4:
> * remove unused debug log
> * remove compile flag of DELL privacy
> * move the micmute_led to local from rt715_priv
> * when Jaroslav upstream his gerneric LED trigger driver,I will rebase
>    this patch,please consider merge this at first
>    https://lore.kernel.org/alsa-devel/20210211111400.1131020-1-perex@perex.cz/
> v2 -> v3:
> * simplify the patch to reuse some val value
> * add more detail to the commit info
> v1 -> v2:
> * fix some format issue
> --------
> ---
>   sound/soc/codecs/rt715-sdca.c | 12 ++++++++++++

that file is not yet in Mark Brown's tree, so that patch wouldn't apply.

>   sound/soc/codecs/rt715.c      | 12 ++++++++++++
>   2 files changed, 24 insertions(+)
> 
> diff --git a/sound/soc/codecs/rt715-sdca.c b/sound/soc/codecs/rt715-sdca.c
> index b43ac8559e45..816348ae11a1 100644
> --- a/sound/soc/codecs/rt715-sdca.c
> +++ b/sound/soc/codecs/rt715-sdca.c
> @@ -12,6 +12,7 @@
>   #include <linux/version.h>
>   #include <linux/kernel.h>
>   #include <linux/init.h>
> +#include <linux/leds.h>
>   #include <linux/pm_runtime.h>
>   #include <linux/pm.h>
>   #include <linux/soundwire/sdw.h>
> @@ -269,6 +270,7 @@ static int rt715_sdca_put_volsw(struct snd_kcontrol *kcontrol,
>   	unsigned int reg = mc->reg;
>   	unsigned int max = mc->max;
>   	int err;
> +	bool micmute_led;
>   
>   	val = ucontrol->value.integer.value[0];
>   	if (invert)
> @@ -287,6 +289,16 @@ static int rt715_sdca_put_volsw(struct snd_kcontrol *kcontrol,
>   			return err;
>   	}
>   
> +	/* Micmute LED state changed by muted/unmute switch */
> +	if (mc->invert) {
> +		if (ucontrol->value.integer.value[0] || ucontrol->value.integer.value[1]) {
> +			micmute_led = LED_OFF;
> +		} else {
> +			micmute_led = LED_ON;
> +		}
> +		ledtrig_audio_set(LED_AUDIO_MICMUTE, micmute_led);
> +	}
> +
>   	return 0;
>   }
>   
> diff --git a/sound/soc/codecs/rt715.c b/sound/soc/codecs/rt715.c
> index cdcba70146da..db2c0d2ff9d2 100644
> --- a/sound/soc/codecs/rt715.c
> +++ b/sound/soc/codecs/rt715.c
> @@ -13,6 +13,7 @@
>   #include <linux/init.h>
>   #include <linux/delay.h>
>   #include <linux/i2c.h>
> +#include <linux/leds.h>
>   #include <linux/pm_runtime.h>
>   #include <linux/pm.h>
>   #include <linux/soundwire/sdw.h>
> @@ -88,6 +89,7 @@ static int rt715_set_amp_gain_put(struct snd_kcontrol *kcontrol,
>   		RT715_SET_GAIN_MIX_ADC2_L};
>   	unsigned int addr_h, addr_l, val_h, val_ll, val_lr;
>   	unsigned int read_ll, read_rl, i, j, loop_cnt;
> +	bool micmute_led;
>   
>   	if (strstr(ucontrol->id.name, "Main Capture Switch") ||
>   		strstr(ucontrol->id.name, "Main Capture Volume"))
> @@ -95,6 +97,16 @@ static int rt715_set_amp_gain_put(struct snd_kcontrol *kcontrol,
>   	else
>   		loop_cnt = 1;
>   
> +	/* Micmute LED state changed by muted/unmute switch */
> +	if (mc->invert) {
> +		if (ucontrol->value.integer.value[0] || ucontrol->value.integer.value[1]) {
> +			micmute_led = LED_OFF;
> +		} else {
> +			micmute_led = LED_ON;
> +		}
> +		ledtrig_audio_set(LED_AUDIO_MICMUTE, micmute_led);
> +	}
> +
>   	for (j = 0; j < loop_cnt; j++) {
>   		/* Can't use update bit function, so read the original value first */
>   		if (loop_cnt == 1) {
> 

  reply	other threads:[~2021-03-01 15:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-01  9:38 Perry Yuan
2021-03-01 14:30 ` Pierre-Louis Bossart [this message]
2021-03-08 17:24 ` Mark Brown
2021-03-22  9:25   ` Yuan, Perry
2021-03-22 14:37     ` Jaroslav Kysela
2021-03-22 15:01       ` Hans de Goede
2021-03-25 14:11         ` Yuan, Perry
2021-03-25 15:07           ` Hans de Goede
2021-03-26  7:20             ` Yuan, Perry
2021-03-25  8:19       ` Yuan, Perry
2021-03-25  9:37         ` 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=98d8b015-c1d6-fd4c-ac94-3f9226b93436@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=hdegoede@redhat.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgross@linux.intel.com \
    --cc=oder_chiou@realtek.com \
    --cc=perex@perex.cz \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=pobrn@protonmail.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®