Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1029060ybe; Wed, 4 Sep 2019 11:23:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqyNghnKIKdyCADL1vR04kSdvTlW6TbrwMXHkQTvmshxc1oledBa7l+rtN8n2aazmT+RIsRV X-Received: by 2002:a65:6817:: with SMTP id l23mr36344107pgt.46.1567621400814; Wed, 04 Sep 2019 11:23:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567621400; cv=none; d=google.com; s=arc-20160816; b=kMqMi5Zi8r8z//eNT48rt7vBP+3SBke+8twBQqjMuFT6dlNqY8ZpAJkoFSFOcddFd/ AzgkcNOMIeTPSiZeQ87XcRkyt6BwG5HX/ETMzbT+jvvvFaxtzuNPsgHtmyHp7Zi4yLSz 53pj96cw1rXsHGFWKPp1uxMMkLRjlaski8FMDgXC8Skae6RDOW/b6v8h56TY84hibTYr 0ghIbLtHCAPS/0HW7jj1kMgxGBkHzvTSp/fZwetcxCrZRZ0dSQFfP8yzvCcqgrhzEHiu V36XhcS+n+nFBrgbwSt4bd3O51SFd4OrteOKe8jmI/88OSGB4Md9oeKf2Y0nxifmVEb/ XuIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qHYlI+GgWIeHzfDYETZWkfbKIwpAVMP6Zq51OQBKqiI=; b=pPtVZDkk8uV5ky0hUhl40OnJB0cjqpF3k+dsgpXw31rPmG7WAOOfK8peA4XI0TYVct IISsya+umpQ53SbLWZG+Qk2FU1Pw0BP7s/09N+fiyH+CQAWCdtB0AEgyQKzBGPQeESxv 7Fh3P6h0kT9dWYkax8MqYNQ7ZqpHpqTzPL5IVH++FqnPuijmmidRMMxlTSVKIgwQmW0y TNh9UB9cZO+1GnCFDk7ezFWFHwpB9DV8wP7/QSFXuaKTwasOY752bkGVc8wquAzbjJq/ tlR3VwNJlH6n0E5w/wA1orW0LmAoDcdP6LYyZao6RuEnrto4VenRayexCYKK7IkQXrvc Iilg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dY8CTduX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t189si1633078pgt.428.2019.09.04.11.23.05; Wed, 04 Sep 2019 11:23:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dY8CTduX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388957AbfIDSG5 (ORCPT + 99 others); Wed, 4 Sep 2019 14:06:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:49160 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389530AbfIDSGz (ORCPT ); Wed, 4 Sep 2019 14:06:55 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B47F222CF7; Wed, 4 Sep 2019 18:06:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567620414; bh=sNp1iCWqqSjNHRiC6wD9vtQxe8Rg2SduOCPRQX4RkrQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dY8CTduXzT/eWGEYP6qimZIvF5yAvjl4dzCt+E5yVtfd8rSgWA92fwEkiH78eo6YW p44dtz6bv+/Hql1+CQOeJfB/3aS/i2HfpmCJtu1Wbp9zE3zL1S0m6/pvgukUhcCp9p FhsDRmSmYLHWmu/3SEofwEzJfvAHK7+ACvgavEwU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Jeronimo Borque Subject: [PATCH 4.19 42/93] ALSA: hda - Fixes inverted Conexant GPIO mic mute led Date: Wed, 4 Sep 2019 19:53:44 +0200 Message-Id: <20190904175306.808754513@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190904175302.845828956@linuxfoundation.org> References: <20190904175302.845828956@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jeronimo Borque commit f9ef724d4896763479f3921afd1ee61552fc9836 upstream. "enabled" parameter historically referred to the device input or output, not to the led indicator. After the changes added with the led helper functions the mic mute led logic refers to the led and not to the mic input which caused led indicator to be negated. Fixing logic in cxt_update_gpio_led and updated cxt_fixup_gpio_mute_hook Also updated debug messages to ease further debugging if necessary. Fixes: 184e302b46c9 ("ALSA: hda/conexant - Use the mic-mute LED helper") Suggested-by: Takashi Iwai Signed-off-by: Jeronimo Borque Cc: Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/pci/hda/patch_conexant.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -624,18 +624,20 @@ static void cxt_fixup_hp_gate_mic_jack(s /* update LED status via GPIO */ static void cxt_update_gpio_led(struct hda_codec *codec, unsigned int mask, - bool enabled) + bool led_on) { struct conexant_spec *spec = codec->spec; unsigned int oldval = spec->gpio_led; if (spec->mute_led_polarity) - enabled = !enabled; + led_on = !led_on; - if (enabled) - spec->gpio_led &= ~mask; - else + if (led_on) spec->gpio_led |= mask; + else + spec->gpio_led &= ~mask; + codec_dbg(codec, "mask:%d enabled:%d gpio_led:%d\n", + mask, led_on, spec->gpio_led); if (spec->gpio_led != oldval) snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, spec->gpio_led); @@ -646,8 +648,8 @@ static void cxt_fixup_gpio_mute_hook(voi { struct hda_codec *codec = private_data; struct conexant_spec *spec = codec->spec; - - cxt_update_gpio_led(codec, spec->gpio_mute_led_mask, enabled); + /* muted -> LED on */ + cxt_update_gpio_led(codec, spec->gpio_mute_led_mask, !enabled); } /* turn on/off mic-mute LED via GPIO per capture hook */ @@ -669,7 +671,6 @@ static void cxt_fixup_mute_led_gpio(stru { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03 }, {} }; - codec_info(codec, "action: %d gpio_led: %d\n", action, spec->gpio_led); if (action == HDA_FIXUP_ACT_PRE_PROBE) { spec->gen.vmaster_mute.hook = cxt_fixup_gpio_mute_hook;