Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2382212lqp; Sun, 24 Mar 2024 16:58:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWpgsoheiIDZmFcxnvCr3huwMZBKzeI941IpHuh2kuwm0qMsZyMn+CpgkbtUxAQiq7c+kEltTrvLQQfqUi+MYJfDJzVywHTFDFuPPAtbw== X-Google-Smtp-Source: AGHT+IFlRpnDQnX/UBhdNTc5666C6W6LvDK9aU/N3s217nVnlqCZqi4ouq6GrbFXCP3OY7V58+os X-Received: by 2002:a05:6214:2346:b0:696:4192:c5ce with SMTP id hu6-20020a056214234600b006964192c5cemr5436493qvb.35.1711324706927; Sun, 24 Mar 2024 16:58:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711324706; cv=pass; d=google.com; s=arc-20160816; b=WjKXYNhfs6nSbwfQ6fwbcmL3C6PlFAnHmVTzKGYbOHEx5dPu/q6dXV8kKmoDNQgbPh rgDjfLNF1sOAh3wVqVghHkhgc3IufIfd4iEFnkH/lMssrj3kC0OJ50zByfUvbQCI+Tw9 XFHzPasRUo4EyEIWXVTNnsWQer4QTQf9qBFDXrF1q9XJN4VY5VcbKN/ROgRtWAG1oerX UPEF3c+tEvgISlB80ijYVUvnzBAaFXGOO7wwYHioIOnHe2pvOf7v56BMgQKCBFkG/wKx vC3t4N3D2asKH2HJ5odx8OQ3OkMx7odWGkyjbeqngnuQDFXzcu+Gp1H2UIQga7qgw95/ q6kQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=K2whREnyPCTcbny7lMaVbd/Pnr+HrM50iUR6efXVWwk=; fh=GkMbWRGINtjPomkfNsWoS5aEJUy6QlbukwUPDKPyAgY=; b=QND/KWHbj5byD0RF5RQUxear+AjeV+vgeSKLYTk05jYtQNAeIhJo+nH87MbCUnkdBI yxqgFpVUQPtmD3/rTTZdYS7/3tgmGJA1lJDa23RLBprkcL5N6PWDObk1sVa8qkdlcbG+ 1ejoET8w4d8o0MTZay7kNuaaPJnhvxMz7jIEZTxVMTFuAVnY71sQm5c1x+wcRbTY3wWV NyxmFEG8nzOegjilVpORNLbagHBT0aTf14xWzNRTaj+Of+W8BQPn9HlqZ5vEHwi83GWL 6VmOeGbk+Z5Aw2OQ88awCAmUBFzXg2fnuKWL6UkXBR7uDGEHgDQmxWh9PD2DVPNvSj6Z rMeA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ft8AyGUj; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113272-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113272-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id c7-20020a056214224700b00690b92e28ecsi7074969qvc.307.2024.03.24.16.58.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 16:58:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113272-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ft8AyGUj; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113272-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113272-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A4B721C2308E for ; Sun, 24 Mar 2024 23:58:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 720A618AFF3; Sun, 24 Mar 2024 22:41:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ft8AyGUj" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 78F7D18AFD7; Sun, 24 Mar 2024 22:41:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320072; cv=none; b=OVI4866mr9FuXer52iqjOr9EONIIP80A0fAhK0RhyhFwtNTzn2kC/+RAM3nMyA3hBdJOXKXGGhjUXXiMKgTER7N29Q7168iLjguuqTLzFY2H827sePR8JWMJRl/OWUEBhKqVmhDC492GEBL3X4SuibyfApunDDcMesZqUeWt/ow= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320072; c=relaxed/simple; bh=xifQRL+fORxpmntrffE/NQn4dgpIQhHCBsc94lA7hxE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PPRP7FABPHi/ketZxz5B+EiBjslcPp2+/XGlSHjLXTtkKEebyAJTsdZeIl4Hh7QFWNVioe8a/2LPpbqVAjdbHmJsmY9cIF2lh8zHYiWd6ok5OzrcnrTqGvPaVBzAneqPTJxYFQX0sgXuGS9yCfjqEBFS0z9eOeAFKv9RvXuI7JI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ft8AyGUj; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF1BAC43394; Sun, 24 Mar 2024 22:41:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320072; bh=xifQRL+fORxpmntrffE/NQn4dgpIQhHCBsc94lA7hxE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ft8AyGUjPpXmsOzgIheUhqJtLsr3P3e+sZedTXvMj7PKE6LsTROP3v1EnI4iH3X6F C7Wr14o69aztAZskXcKANpsaUKlVP4mkOD+8TXOP6Nvh1fizzo4dRHtpbHyjW3zdJo GZlDe32/vYEqYTEvj0D0fXOoHL3sUE+rmShNeOJaoFxayqqxAV2rP5w1zOhIjvPWdU xSBXqB636DF+Dwud0jjwAdgFdaNeIY9ZfujwrKlkUdPQCtnP0bF86GHh0Nr0yFqIct BllmGyw8kRfQ1G1vbxpJb7Zv7uS9mNSyA5RUv8eJRCE31zrPZIrlR1ciuNjMkCZE22 4rs3HuoM1nkGQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Stefan Binding , Takashi Iwai , Sasha Levin Subject: [PATCH 6.8 381/715] ALSA: hda: cs35l41: Set Channel Index correctly when system is missing _DSD Date: Sun, 24 Mar 2024 18:29:20 -0400 Message-ID: <20240324223455.1342824-382-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Stefan Binding [ Upstream commit 135096ebfab656823d0037102a00776f3914fee3 ] Current method to set Channel Index when the system is missing _DSD assumes that the channels alternate, which is not guaranteed. Instead use the same methodology as the main driver does when _DSD exists. Fixes: 8c4c216db8fb ("ALSA: hda: cs35l41: Add config table to support many laptops without _DSD") Signed-off-by: Stefan Binding Link: https://lore.kernel.org/r/20240126164005.367021-2-sbinding@opensource.cirrus.com Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/pci/hda/cs35l41_hda_property.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/sound/pci/hda/cs35l41_hda_property.c b/sound/pci/hda/cs35l41_hda_property.c index e436d4dab317f..86ddaff915de1 100644 --- a/sound/pci/hda/cs35l41_hda_property.c +++ b/sound/pci/hda/cs35l41_hda_property.c @@ -210,6 +210,7 @@ static int generic_dsd_config(struct cs35l41_hda *cs35l41, struct device *physde struct spi_device *spi; bool dsd_found; int ret; + int i; for (cfg = cs35l41_config_table; cfg->ssid; cfg++) { if (!strcasecmp(cfg->ssid, cs35l41->acpi_subsystem_id)) @@ -295,16 +296,6 @@ static int generic_dsd_config(struct cs35l41_hda *cs35l41, struct device *physde cs35l41->index = id == 0x40 ? 0 : 1; } - if (cfg->num_amps == 3) - /* 3 amps means a center channel, so no duplicate channels */ - cs35l41->channel_index = 0; - else - /* - * if 4 amps, there are duplicate channels, so they need different indexes - * if 2 amps, no duplicate channels, channel_index would be 0 - */ - cs35l41->channel_index = cs35l41->index / 2; - cs35l41->reset_gpio = fwnode_gpiod_get_index(acpi_fwnode_handle(cs35l41->dacpi), "reset", cs35l41->index, GPIOD_OUT_LOW, "cs35l41-reset"); @@ -312,6 +303,11 @@ static int generic_dsd_config(struct cs35l41_hda *cs35l41, struct device *physde hw_cfg->spk_pos = cfg->channel[cs35l41->index]; + cs35l41->channel_index = 0; + for (i = 0; i < cs35l41->index; i++) + if (cfg->channel[i] == hw_cfg->spk_pos) + cs35l41->channel_index++; + if (cfg->boost_type == INTERNAL) { hw_cfg->bst_type = CS35L41_INT_BOOST; hw_cfg->bst_ind = cfg->boost_ind_nanohenry; -- 2.43.0