From nobody Fri Dec 19 16:02:39 2025 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ft8AyGUj" 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: quoted-printable Content-Type: text/plain; charset="utf-8" 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_h= da_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 *cs35l= 41, struct device *physde struct spi_device *spi; bool dsd_found; int ret; + int i; =20 for (cfg =3D 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 *cs35= l41, struct device *physde cs35l41->index =3D id =3D=3D 0x40 ? 0 : 1; } =20 - if (cfg->num_amps =3D=3D 3) - /* 3 amps means a center channel, so no duplicate channels */ - cs35l41->channel_index =3D 0; - else - /* - * if 4 amps, there are duplicate channels, so they need different index= es - * if 2 amps, no duplicate channels, channel_index would be 0 - */ - cs35l41->channel_index =3D cs35l41->index / 2; - cs35l41->reset_gpio =3D 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 *cs35= l41, struct device *physde =20 hw_cfg->spk_pos =3D cfg->channel[cs35l41->index]; =20 + cs35l41->channel_index =3D 0; + for (i =3D 0; i < cs35l41->index; i++) + if (cfg->channel[i] =3D=3D hw_cfg->spk_pos) + cs35l41->channel_index++; + if (cfg->boost_type =3D=3D INTERNAL) { hw_cfg->bst_type =3D CS35L41_INT_BOOST; hw_cfg->bst_ind =3D cfg->boost_ind_nanohenry; --=20 2.43.0