From patchwork Wed Jul 1 10:51:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kai-Heng Feng X-Patchwork-Id: 1320392 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49xdMH6DVtz9sTZ; Wed, 1 Jul 2020 20:51:39 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1jqaL2-0007sd-Ti; Wed, 01 Jul 2020 10:51:36 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jqaL1-0007rs-5w for kernel-team@lists.ubuntu.com; Wed, 01 Jul 2020 10:51:35 +0000 Received: from 61-220-137-37.hinet-ip.hinet.net ([61.220.137.37] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jqaL0-0003eU-Fg for kernel-team@lists.ubuntu.com; Wed, 01 Jul 2020 10:51:34 +0000 From: Kai-Heng Feng To: kernel-team@lists.ubuntu.com Subject: [PATCH 01/13] ALSA: hda: generic: Always call led-trigger for mic mute LED Date: Wed, 1 Jul 2020 18:51:16 +0800 Message-Id: <20200701105128.16899-2-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200701105128.16899-1-kai.heng.feng@canonical.com> References: <20200701105128.16899-1-kai.heng.feng@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Takashi Iwai BugLink: https://bugs.launchpad.net/bugs/1885896 Instead of adding a special hook to trigger the mic-mute LED device, call it always from the common callback function. It won't hurt even if no corresponding led cdev is present. This is basically a preliminary change for the later patches to convert the all mic-mute LED handling to LED class cdev. Tested-by: Kai-Heng Feng Link: https://lore.kernel.org/r/20200618110842.27238-2-tiwai@suse.de Signed-off-by: Takashi Iwai (cherry picked from commit bf61c42a446f58eb61b7af05e9ff0b79aba348b6 linux-next) Signed-off-by: Kai-Heng Feng --- sound/pci/hda/hda_generic.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index f4e9d9445e18..c95ccffbd0cf 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c @@ -3923,6 +3923,10 @@ static void call_micmute_led_update(struct hda_codec *codec) spec->micmute_led.led_value = val; if (spec->micmute_led.update) spec->micmute_led.update(codec); +#if IS_REACHABLE(CONFIG_LEDS_TRIGGER_AUDIO) + ledtrig_audio_set(LED_AUDIO_MICMUTE, + spec->micmute_led.led_value ? LED_ON : LED_OFF); +#endif } static void update_micmute_led(struct hda_codec *codec, @@ -4023,16 +4027,6 @@ int snd_hda_gen_add_micmute_led(struct hda_codec *codec, } EXPORT_SYMBOL_GPL(snd_hda_gen_add_micmute_led); -#if IS_REACHABLE(CONFIG_LEDS_TRIGGER_AUDIO) -static void call_ledtrig_micmute(struct hda_codec *codec) -{ - struct hda_gen_spec *spec = codec->spec; - - ledtrig_audio_set(LED_AUDIO_MICMUTE, - spec->micmute_led.led_value ? LED_ON : LED_OFF); -} -#endif - /** * snd_hda_gen_fixup_micmute_led - A fixup for mic-mute LED trigger * @@ -4051,10 +4045,8 @@ static void call_ledtrig_micmute(struct hda_codec *codec) void snd_hda_gen_fixup_micmute_led(struct hda_codec *codec, const struct hda_fixup *fix, int action) { -#if IS_REACHABLE(CONFIG_LEDS_TRIGGER_AUDIO) if (action == HDA_FIXUP_ACT_PROBE) - snd_hda_gen_add_micmute_led(codec, call_ledtrig_micmute); -#endif + snd_hda_gen_add_micmute_led(codec, NULL); } EXPORT_SYMBOL_GPL(snd_hda_gen_fixup_micmute_led);