From patchwork Thu Jun 18 11:08:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 11611835 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 085AD618 for ; Thu, 18 Jun 2020 11:17:07 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 85597207E8 for ; Thu, 18 Jun 2020 11:17:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="eGhxJcJl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 85597207E8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 102DA175E; Thu, 18 Jun 2020 13:16:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 102DA175E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1592479025; bh=mNdxdwM1on5s/rtcnU+sNNfNYAKoYSJNu/DDzjjifk4=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=eGhxJcJl4wfLPRRi9UBDw5ej9pN2JqFPLxBNO0eZx7kIeV4am/rdemsnrGVlb1igA T4jedzMnc/Zo/kc9KGQAyfHOvRgG+DKrn4pU5G9t2KpHv0QD56kRSSHd6/W5y/kKad llodM/e0HKOj6jwtqyKnso7EWZFiGQMqne0xSwGo= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 265B2F80329; Thu, 18 Jun 2020 13:09:36 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 28239F802DF; Thu, 18 Jun 2020 13:09:23 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 14D94F8028F for ; Thu, 18 Jun 2020 13:08:52 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 14D94F8028F X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id DB802AF32; Thu, 18 Jun 2020 11:08:49 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 11/13] ALSA: hda/sigmatel: Use the new vmaster mute LED helper Date: Thu, 18 Jun 2020 13:08:40 +0200 Message-Id: <20200618110842.27238-12-tiwai@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20200618110842.27238-1-tiwai@suse.de> References: <20200618110842.27238-1-tiwai@suse.de> Cc: Kai-Heng Feng X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Convert the mute LED handling in Sigmatel/IDT codec to the new vmaster mute helper. A point to be cautiously handled is that the value passed to the callback is inverted; the vmaster passes "enabled" (0 = mute), while LED classdev passes "brightness" (1 = mute). A positive side-effect by this change is that the driver gets also the enum controls for the mute behavior like other drivers already had. Tested-by: Kai-Heng Feng Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_sigmatel.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 3b796d0d7a67..d8ed69cb9df1 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -369,10 +369,9 @@ static unsigned int stac_vref_led_power_filter(struct hda_codec *codec, } /* update mute-LED accoring to the master switch */ -static void stac_update_led_status(struct hda_codec *codec, int enabled) +static void stac_update_led_status(struct hda_codec *codec, bool muted) { struct sigmatel_spec *spec = codec->spec; - int muted = !enabled; if (!spec->gpio_led) return; @@ -396,9 +395,13 @@ static void stac_update_led_status(struct hda_codec *codec, int enabled) } /* vmaster hook to update mute LED */ -static void stac_vmaster_hook(void *private_data, int val) +static int stac_vmaster_hook(struct led_classdev *led_cdev, + enum led_brightness brightness) { - stac_update_led_status(private_data, val); + struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); + + stac_update_led_status(codec, brightness); + return 0; } /* automute hook to handle GPIO mute and EAPD updates */ @@ -4316,7 +4319,7 @@ static int stac_parse_auto_config(struct hda_codec *codec) #endif if (spec->gpio_led) - spec->gen.vmaster_mute.hook = stac_vmaster_hook; + snd_hda_gen_add_mute_led_cdev(codec, stac_vmaster_hook); if (spec->aloopback_ctl && snd_hda_get_bool_hint(codec, "loopback") == 1) {