Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1603710ybz; Thu, 30 Apr 2020 02:14:31 -0700 (PDT) X-Google-Smtp-Source: APiQypIqFzGxL52NQhxWylLktBxykifsO75ZCA/lPmAcJQyumIukjCyPnDh6oiMeGMNVQXHEvs6N X-Received: by 2002:a05:6402:1482:: with SMTP id e2mr1668734edv.113.1588238071698; Thu, 30 Apr 2020 02:14:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588238071; cv=none; d=google.com; s=arc-20160816; b=hy7o2xovzi+7u5mZG4QJX41JL+hYIAIpnuwh0bYwD3IdG+GPwp2lDAbQSga+DUKX/N 6hPIUjUsAnqoeZyp3+4jv7tRB1EEmPaihmn1UZjKVird06YJDUbmoypMMqRTxhj6CC6i j/Un0a1HK336u4NKVGReFTpK76TQH7yd+0O+T2z8u7+AuW4Pmgu/EEay2c9m7QjZBC9P 6bvc7IWMBomi94YcoWCv1V8rMgxtsa5WQb6y+BTwhZslwnjMm7cFxZrpOHnrUdMcPsch SYzXsg/44kHROXGp6khsZgNGyhrPID4ZhsbzrXRoKkxlcBPw9wXAiwfCtWo30AOIuyWu 9Dcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=oDL8fVKH0cG2/a5rcnDjWKgKeXFqzmUMdDY9hCTNXQg=; b=CIq8uH2kJZJyjfUhUxdiamWTdzBnmghR//wP8sJO3/H2J6Zrx0VZEIEsajZLeK0Zn5 kzGcUCfDDwfZY/fPjNcAdiZJ4YOdQYMvH8etwgNYui71iwuSt1QZiJ1XtVnd2zmNaxmh iGn7zo/IAKO+Q7HCl8I+aRl3DSwZW04fdX05eK1H/tx55yIjKgODGCdDRspgZjd9Yapg h3LU37Skc+F3SI/94m812ndtzx51XvNjFoAU14z02a2Pg/a1WM0RJ/tyl18SlH0wvzFc zIcUye9PCu2g9gwGoVw9I9jYRKBdWk2DxJWaAZi6idn+H7WQncuRwaUW8hVjE7ehv9hA ytLg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m13si5484233ejc.7.2020.04.30.02.14.07; Thu, 30 Apr 2020 02:14:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726791AbgD3JMO (ORCPT + 99 others); Thu, 30 Apr 2020 05:12:14 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:39763 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726531AbgD3JMO (ORCPT ); Thu, 30 Apr 2020 05:12:14 -0400 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 1jU5EZ-00063O-A0; Thu, 30 Apr 2020 09:11:56 +0000 From: Kai-Heng Feng To: pierre-louis.bossart@linux.intel.com, lgirdwood@gmail.com, ranjani.sridharan@linux.intel.com, kai.vehmanen@linux.intel.com, daniel.baluta@nxp.com Cc: Kai-Heng Feng , Mark Brown , Jaroslav Kysela , Takashi Iwai , Jaska Uimonen , sound-open-firmware@alsa-project.org (moderated list:SOUND - SOUND OPEN FIRMWARE (SOF) DRIVERS), alsa-devel@alsa-project.org (moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] ASoC: SOF: Update correct LED status at the first time usage of update_mute_led() Date: Thu, 30 Apr 2020 17:11:39 +0800 Message-Id: <20200430091139.7003-1-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At the first time update_mute_led() gets called, if channels are already muted, the temp value equals to led_value as 0, skipping the following LED setting. So set led_value to -1 as an uninitialized state, to update the correct LED status at first time usage. Fixes: 5d43001ae436 ("ASoC: SOF: acpi led support for switch controls") Signed-off-by: Kai-Heng Feng --- sound/soc/sof/control.c | 4 ++-- sound/soc/sof/sof-audio.h | 2 +- sound/soc/sof/topology.c | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/sound/soc/sof/control.c b/sound/soc/sof/control.c index dfc412e2d956..6d63768d42aa 100644 --- a/sound/soc/sof/control.c +++ b/sound/soc/sof/control.c @@ -19,8 +19,8 @@ static void update_mute_led(struct snd_sof_control *scontrol, struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - unsigned int temp = 0; - unsigned int mask; + int temp = 0; + int mask; int i; mask = 1U << snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); diff --git a/sound/soc/sof/sof-audio.h b/sound/soc/sof/sof-audio.h index bf65f31af858..875a5fc13297 100644 --- a/sound/soc/sof/sof-audio.h +++ b/sound/soc/sof/sof-audio.h @@ -56,7 +56,7 @@ struct snd_sof_pcm { struct snd_sof_led_control { unsigned int use_led; unsigned int direction; - unsigned int led_value; + int led_value; }; /* ALSA SOF Kcontrol device */ diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index fe8ba3e05e08..ab2b69de1d4d 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -1203,6 +1203,8 @@ static int sof_control_load(struct snd_soc_component *scomp, int index, return ret; } + scontrol->led_ctl.led_value = -1; + dobj->private = scontrol; list_add(&scontrol->list, &sdev->kcontrol_list); return ret; -- 2.17.1