Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp977290pxb; Sat, 30 Oct 2021 03:06:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPK+De6cBVcLyiEesSMiOLZf5LPZza3rzGLIei5jvlaG4ocrcV97MN3xwGiR1KP88sBN8A X-Received: by 2002:a50:9eaa:: with SMTP id a39mr22815304edf.1.1635588377643; Sat, 30 Oct 2021 03:06:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635588377; cv=none; d=google.com; s=arc-20160816; b=e0MHBU6aXVYXj3jz40QUwuQaHLRfdYmq/nVGC/9wDVLS2729BfIrZ21jDlYUGePqwM KcaZps0JgJCtv6AROnlv6FD1RlfUT17SxiwkoHjmDWwFw/k8yfTBL4BD5iAb+xxrD3aO KuAIHysfgv3DIfmuF+PATYE+Hr3SYQgo5q21syouFG0XB7eWD9xFmX2cT4q1uzpeu0lL 0JBPxlInwMsUKRKXElLkyC1157CRCio1T/6zIdppLDgcsmkRWkNPGzei0pXbTIpEu+TE IIyoqDw01MtveA/pETY9aM0xvt+BhA2PKXF12kjPjpq5nbEUUiYdu9KdXGxCXKHzztxX VLkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature:dkim-signature; bh=aFMGLmJCawcoI6OdS2VCxYC6lot14lLtQM9mdxNkEx0=; b=xd2hbFG6deai1m+X6zf/e01P8dFOK4HteXeUoS2Ey2NdyJk2k1P3kK157OegZVRqLq hke/YXcGjr4RUs4V0QXOgIFKzu+iTl7F1xpUYfvt9SKzpv+CW58aZpSXqmxfs6oWDhcF 4+MBqRhkG8eCcsK2rryT+2oCCY6nyJm9YXUagJy50TYR2j472uwLta+4lv3qZxEzZ/J5 SsdHo33QZXosE2cQDPJU4lq4OHC8oda0Xo8Y2YbTWHtoxKedBQ+FtuK74yo0qdqZRhOe 5fscmVXcJ1caqDXf0lAQlveWD5Bz7NBx38G4092pIhWkTrlsODP3ATEZrwddirLMa7XP EMCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=o664jVw7; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; 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=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w1si12171485edc.344.2021.10.30.03.05.04; Sat, 30 Oct 2021 03:06:17 -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; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=o664jVw7; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; 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=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231815AbhJ3KDf (ORCPT + 99 others); Sat, 30 Oct 2021 06:03:35 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:43120 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230427AbhJ3KDe (ORCPT ); Sat, 30 Oct 2021 06:03:34 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 0202D2191A; Sat, 30 Oct 2021 10:01:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1635588064; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=aFMGLmJCawcoI6OdS2VCxYC6lot14lLtQM9mdxNkEx0=; b=o664jVw7DTQNfoj99XSD+HM6crjQz6QR46qAUteTWFrfkaGRAv22UkpIzipS12RJXv0WJG VmYtXHMLdawSahItfuCF54SnKQPAQp+94gx875SijzIjOJLwpb/xu4TERrqkzss0G1jq3L 6Ia6XetyfnF9ua2kaEsv/ierfPwYT8k= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1635588064; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=aFMGLmJCawcoI6OdS2VCxYC6lot14lLtQM9mdxNkEx0=; b=S2Fqa1yejVE5rMtXesA+ob4E5C3xdp0pCxq/ysj6ZLXspgNOkqjH0/fC7RF6StwsPwjNRq oCGqSQV5va/GvDBg== Received: from alsa1.suse.de (alsa1.suse.de [10.160.4.42]) by relay2.suse.de (Postfix) with ESMTP id EE76AA3B83; Sat, 30 Oct 2021 10:01:03 +0000 (UTC) Date: Sat, 30 Oct 2021 12:01:03 +0200 Message-ID: From: Takashi Iwai To: Jonathan Clarke Cc: linux-kernel@vger.kernel.org, Takashi Iwai , alsa-devel@alsa-project.org Subject: Re: [PATCH] Make top/rear speaker, mute and micmute leds work on HP x360 14-ea000 laptops that use Realtek 245 codec In-Reply-To: <20211029154313.1005394-1-jonathan.a.clarke@gmail.com> References: <20211029154313.1005394-1-jonathan.a.clarke@gmail.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 29 Oct 2021 17:43:13 +0200, Jonathan Clarke wrote: > > BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=210633 > Signed-off-by: Jonathan Clarke Could you give more descriptions? The patch isn't trivial at all, and it needs more explanations. > --- > sound/pci/hda/patch_realtek.c | 46 +++++++++++++++++++++++++++++++++++ > 1 file changed, 46 insertions(+) > > diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c > index 22d27b12c..e3c6d17ea 100644 > --- a/sound/pci/hda/patch_realtek.c > +++ b/sound/pci/hda/patch_realtek.c > @@ -4409,6 +4409,13 @@ static void alc245_fixup_hp_x360_amp(struct hda_codec *codec, > case HDA_FIXUP_ACT_PRE_PROBE: > spec->gpio_mask |= 0x01; > spec->gpio_dir |= 0x01; > + > + /* use only amp at 0x02 for bottom(front) speaker, > + * otherwise it is set to use 0x02,0x03,0x06 and when used in conjunction > + * with top(rear) speaker 0x14, gets locked at full volume */ > + static const hda_nid_t conn1[] = { 0x02 }; > + snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1); > + > break; > case HDA_FIXUP_ACT_INIT: > /* need to toggle GPIO to enable the amp */ > @@ -4503,6 +4510,26 @@ static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec, > } > } > > +static void alc245_fixup_hp_x360_mute_leds(struct hda_codec *codec, > + const struct hda_fixup *fix, int action) > +{ > + struct alc_spec *spec = codec->spec; > + if (action == HDA_FIXUP_ACT_PRE_PROBE) { > + /* mic mute is set via gpio 0x04 */ > + spec->micmute_led_polarity = 1; > + codec->power_filter = led_power_filter; > + alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04); > + > + /* output mute is set via SET_COEF_INDEX,SET_PROC_COEF */ > + spec->mute_led_polarity = 0; > + spec->mute_led_coef.idx = 0x0b; > + spec->mute_led_coef.mask = 0xffff; > + spec->mute_led_coef.on = 0xa02f; > + spec->mute_led_coef.off = 0x7774; > + snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); I guess this COEF isn't only about mute-LED but actually does mute the output? IIRC, the bit 0x08 corresponds to the LED. If so, it's better to split. Basically this snd_hda_gen_add_mute_led_cdev() and mute_led_coef stuff are only for the mute LED control. e.g. you can change the mute LED independently via sysfs. thanks, Takashi