Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp720931rdb; Fri, 26 Jan 2024 08:40:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IFtZrWYSAC1os0Ux9rxmAykJdrxZ0GEQwPTY1Z3xlCSIllIfVV60sEertwj3QSVgvuOCXuk X-Received: by 2002:a17:906:d8b4:b0:a2f:8533:af74 with SMTP id qc20-20020a170906d8b400b00a2f8533af74mr2102171ejb.32.1706287250871; Fri, 26 Jan 2024 08:40:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706287250; cv=pass; d=google.com; s=arc-20160816; b=Qj60dNefBCahl79TPKPgs/Yyu4urffn2oFgW54LmVbp/jlA8CSGXPC9VLBDrHivlSj HnBljV4Nb27f797i7ooldOsPE0WJvME5Qn5RjM5TdkFeloy/3dhtc/uZ3z/YmCP5QllA wIkpzq/vtdKp8ZQcmx+Eg9rekvF5gnSkOX7YiHC0Xk03c+a54Z/8keJHnZHiarV6cY+y zy1D2eUBYgEt8TpZ9HiKyeL08ItvcctHGcET+1R0YGD8mz80m67lWQPN8g7H2l8PFq6B p7xZADjw+6/3ZmK8IKsC++ysxMOedAn6IuKhbsvaT5eSUx4ycydbFWv0FpTZC7fiSW8J VUMA== 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=HrfhbL45vt5QCqOJGS84ZDQ1gvDhC+TWwuE32OZjF54=; fh=CIzheBTUL5fyGH3nbQHnzCXjO4Ty5MYCLcLsWbV53xg=; b=cid96EtOB7u24g4XmA1QgSrE9IB9H6Ni2GBYZ20YDVrxYuwoK39IYunznPYgqGOyZy PWSmxQWBM/qCcafpRDbR+yAxe3jfAJYUbP2rOsepG/b6O/kgLHzgrVxxsB6ad8sIMYSB 4uHe+vqDNMWeoF/3jAOmZzx+/fE56hgkWMzd5KoAuCmI8bQv+/aHDK1epre4CWg/P2jF 3IlXIgJXbLq0+00NBAvz5CA8SbzyPcw8Q7sI2dtETDxhojO3xHqyM8E6l9x50vyDnaTF EOfmg/U8HX2pwTPJqmIne/TDDZKS0jmB7SsSf7UghY52U+/6Q/jrCy7bw3N4KaMGC6N0 ABWQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=ngYqHtrH; arc=pass (i=1 spf=pass spfdomain=opensource.cirrus.com dkim=pass dkdomain=cirrus.com dmarc=pass fromdomain=opensource.cirrus.com); spf=pass (google.com: domain of linux-kernel+bounces-40355-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40355-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id gw14-20020a170906f14e00b00a311247368esi771510ejb.617.2024.01.26.08.40.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 08:40:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-40355-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=ngYqHtrH; arc=pass (i=1 spf=pass spfdomain=opensource.cirrus.com dkim=pass dkdomain=cirrus.com dmarc=pass fromdomain=opensource.cirrus.com); spf=pass (google.com: domain of linux-kernel+bounces-40355-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40355-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 840291F234C5 for ; Fri, 26 Jan 2024 16:40:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D45701DFD6; Fri, 26 Jan 2024 16:40:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="ngYqHtrH" Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) (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 3B4CE1D559; Fri, 26 Jan 2024 16:40:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.152.168 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706287233; cv=none; b=B23gig/177X20LZswpg3qD9Uzqu8yUj+yHbAqTE27wQ16XkBJlluDe2IQ0u5qoHYBEwLFFe0dSRe77es/0PxTDlH+0iOyhlog9cYf6bkHzUG9BXBjt61XJ/wSHzRj7s6ozfGUafIcQS/BaGRvLRxuFoz881RLNOF/qU+w3CYWyE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706287233; c=relaxed/simple; bh=4zbQUjsj3dgdWCURhXT0L/NIrT+3lvP4U5SKuqfZawE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LCMJv48QFgU4RQU+d/0KdmxXXcKgRrEInzuAfj41ce4dad83vxSWl1no82+MdGKBV7P+/XLg+AeRJqsJ7YCr7mLxIZOn8ZRUiJQv9bmO9Ql5jlXmOD0M4R05bemCwew9gEAAML8ZYXLl+znbBLWbSzHmdvGg76T0HlrQLVrnOnA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com; spf=pass smtp.mailfrom=opensource.cirrus.com; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b=ngYqHtrH; arc=none smtp.client-ip=67.231.152.168 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=opensource.cirrus.com Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40QCpqG2002494; Fri, 26 Jan 2024 10:40:16 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= PODMain02222019; bh=HrfhbL45vt5QCqOJGS84ZDQ1gvDhC+TWwuE32OZjF54=; b= ngYqHtrH1ZECetKCapLQcFIZaNFPdBj0XK3vJeYkr8IbT20IA3yc9HCUwEzZ9u0G Yo3xna+cSst6plHzXQ9BhV5qMBA5bmeaYPw6qgMRyFVYRlNeHDX3Upyrg0eQbtc1 BZ+9kkRE1+uxcUmztnTOul1ik6dqBWRt9Z9Fg12NZGgXZmeVPmJcab90iPftwBDC Nk/cc6K0YvDAXwn3UlGz2JFv/l7APILQ3XMLth4afZojDixzpInZU7d7gcD1K7LA 0oDzK9jVASi7/nYb/cFdA9prjz+TtTOlYoTacfNvkrekG+niCtJqgTakZ0XETBWr 5l9IsJrWhX75PF/clhJ07w== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 3vtmf9v1u9-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 26 Jan 2024 10:40:16 -0600 (CST) Received: from ediex01.ad.cirrus.com (198.61.84.80) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Fri, 26 Jan 2024 16:40:14 +0000 Received: from ediswmail9.ad.cirrus.com (198.61.86.93) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40 via Frontend Transport; Fri, 26 Jan 2024 16:40:14 +0000 Received: from sbinding-cirrus-dsktp2.ad.cirrus.com (LONNG2L6RQ3.ad.cirrus.com [198.90.238.116]) by ediswmail9.ad.cirrus.com (Postfix) with ESMTP id 5F84F820248; Fri, 26 Jan 2024 16:40:14 +0000 (UTC) From: Stefan Binding To: Jaroslav Kysela , Takashi Iwai CC: , , , , "Stefan Binding" Subject: [PATCH v2 1/4] ALSA: hda: cs35l41: Set Channel Index correctly when system is missing _DSD Date: Fri, 26 Jan 2024 16:40:02 +0000 Message-ID: <20240126164005.367021-2-sbinding@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240126164005.367021-1-sbinding@opensource.cirrus.com> References: <20240126164005.367021-1-sbinding@opensource.cirrus.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: 6jzpNKOedBzDXbsAqT-SZz05-1xgOFAQ X-Proofpoint-ORIG-GUID: 6jzpNKOedBzDXbsAqT-SZz05-1xgOFAQ X-Proofpoint-Spam-Reason: safe 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 --- 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 35277ce890a4..87edf0d2fbb0 100644 --- a/sound/pci/hda/cs35l41_hda_property.c +++ b/sound/pci/hda/cs35l41_hda_property.c @@ -203,6 +203,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)) @@ -288,16 +289,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"); @@ -305,6 +296,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.34.1