From patchwork Tue Oct 1 07:06:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bard Liao X-Patchwork-Id: 13817565 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (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 E5E6A1BC9F9 for ; Tue, 1 Oct 2024 07:06:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727766391; cv=none; b=GGjPL9rM2SA4U4ATMTz9PfkV4a4vMmN+z7EOkf0RQbJukNs5S1t1FS31u0kKlqfNhh2FFTsWiiXb4lmJHxYmSgw0u/JmeBam8wTVRiI98YHYg+J7NTdGrAoHcUBfZh8FTeZSNYR1BZWiwFRNt5tW8pJ70iDFqx/mQRnb226IcXI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727766391; c=relaxed/simple; bh=NVPZwxuSH44cdCkCcMlfMF0JRyvUIfR45Q3Tn/DYLPA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rqOk+Zz347Kf3UwlI9tvwWPpG9wGw9ptF1X4AstPa/mcZ6JCyZJDUyNpAYQX+yTM2Wg+qv1MmlLn013paew7KArWTSaM1j+JIYyIeCAUM27sRa0UseoNpVsayAigf09ZiXY2n9D/OWbMPQ/xKkyaQBA+s39Um6sIQi9idCGAkhs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ULG/Ph0A; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ULG/Ph0A" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1727766390; x=1759302390; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NVPZwxuSH44cdCkCcMlfMF0JRyvUIfR45Q3Tn/DYLPA=; b=ULG/Ph0ADf1ZSGi1jo+o93Tn0x9PjPlDreGHZVALkhC7Bq2gEX1NLEVY mNRBtPTvRweJTJXkPGr3KZ1v2BFNs5/K5DEOzhduahmu44TKswDzTnL+p UytZHbUhCwRMwUa6cRqy2Y7q/S5cHLuqTsoiaLQ49RwLuvQqQfCg7lr7P cEbtYlGdsoJGaLMz7lT7dORLeAhmHC0Ev8lWS0MpXCK+NeWG22iKukKxE OIeeSpiMvZjraRv7gnz6c24brurNq+C7c5hnNHiHN2CyWtiWYfMxOtjwe JLUSEyaE2mK/plfxxO9Q8wUyDKj6K7W9bLaMVGPucTHwNEHKd7sXV5NMR g==; X-CSE-ConnectionGUID: sGYmj40FRhKRgNyyjoKEYg== X-CSE-MsgGUID: hbkr+uCESm2OlglzwhLWHw== X-IronPort-AV: E=McAfee;i="6700,10204,11211"; a="37556040" X-IronPort-AV: E=Sophos;i="6.11,167,1725346800"; d="scan'208";a="37556040" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Oct 2024 00:06:29 -0700 X-CSE-ConnectionGUID: Jm5Y0HWxQp+LiyRFOBPUSQ== X-CSE-MsgGUID: svukjIzPQgydtUDC+nXfvA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,167,1725346800"; d="scan'208";a="78096803" Received: from anmitta2-mobl4.gar.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.119.243]) by fmviesa004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Oct 2024 00:06:27 -0700 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de Cc: linux-sound@vger.kernel.org, pierre-louis.bossart@linux.dev, bard.liao@intel.com, peter.ujfalusi@linux.intel.com Subject: [PATCH RESEND 1/4] ALSA/hda: intel-sdw-acpi: cleanup sdw_intel_scan_controller Date: Tue, 1 Oct 2024 15:06:08 +0800 Message-ID: <20241001070611.63288-2-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241001070611.63288-1-yung-chuan.liao@linux.intel.com> References: <20241001070611.63288-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Pierre-Louis Bossart Remove unnecessary initialization and un-shadow return code. Suggested-by: Andy Shevchenko Signed-off-by: Pierre-Louis Bossart Signed-off-by: Bard Liao --- sound/hda/intel-sdw-acpi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/hda/intel-sdw-acpi.c b/sound/hda/intel-sdw-acpi.c index 04d6b6beabca..770dabe0124f 100644 --- a/sound/hda/intel-sdw-acpi.c +++ b/sound/hda/intel-sdw-acpi.c @@ -63,7 +63,6 @@ sdw_intel_scan_controller(struct sdw_intel_acpi_info *info) return -EINVAL; /* Found controller, find links supported */ - count = 0; ret = fwnode_property_read_u8_array(acpi_fwnode_handle(adev), "mipi-sdw-master-count", &count, 1); @@ -82,7 +81,7 @@ sdw_intel_scan_controller(struct sdw_intel_acpi_info *info) if (ret) { dev_err(&adev->dev, "Failed to read mipi-sdw-master-count: %d\n", ret); - return -EINVAL; + return ret; } /* Check count is within bounds */ From patchwork Tue Oct 1 07:06:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bard Liao X-Patchwork-Id: 13817566 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (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 794A11BDA85 for ; Tue, 1 Oct 2024 07:06:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727766393; cv=none; b=j+b62cW7XZxx5L9KRkf8soD31gUakb/E/hb7lSz6CWDDmWDuZD57TfzUGmRnFMWIvfcfPnOXwYjjhETAiB2ReDaZYhAQ6mQpewHkrdWuWk0l9VgRBASTMbCmsbn3yvj0NN6D/VedIoIhHto81Jk0nHH96C/yNK2vEpqAUc3QMMk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727766393; c=relaxed/simple; bh=mDY5o8AD6W/04rsJCL84/cv/LReCvRURM8YdB+lYQd8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JPK3tDGhY0gKY0hFXArqzjD0BaN1dWvoHs+ESOkcxiKL8JEGntsb1iEQAZw//9GO00ROqin1fqeWOJuOJJQMYIvf4oy/tRScOTYBVp3PlzO19mLw/TK/IiwikwvUR62zQX29ycB1fiCsway+QpRq8w2qNTTYgWG6V5cR3BFTXUI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=PPy267Hi; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="PPy267Hi" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1727766392; x=1759302392; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mDY5o8AD6W/04rsJCL84/cv/LReCvRURM8YdB+lYQd8=; b=PPy267HicNQ6glkOkHXqzl5ptyUeDlYsI2TvlCAgNkR05NJokqXJYzIi EMw4kyYNX9qK2Ou4AsY9OzDwTqKfxqEEKReDNz3ue0ftxPzwVBrPJ8NeK 2on1d4NIQCHE4E/A2B75w69XHvDrBX0MrwANm4moxxgKuhZC4Ozet3yAr xf2keV/7+riByXgiLbz1teRy0U+Yefao1xLQa8vkRbpt6qrvSFf1WsCzD 5q41w9LfCIZHK7MSTOI5xRaqh9d1tgs/xFOrPoDMbyvmMTvBtc6o/1nN3 pBlc+zlLnBwPq5xbhcsZLZEvacb3QUGhxz4/HzjjOTVMeNSF3zeXwawG6 Q==; X-CSE-ConnectionGUID: Vhqx4361SAm9LkuuqmcUSQ== X-CSE-MsgGUID: mntNyuhpSaCJwpv0I4MecA== X-IronPort-AV: E=McAfee;i="6700,10204,11211"; a="37556047" X-IronPort-AV: E=Sophos;i="6.11,167,1725346800"; d="scan'208";a="37556047" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Oct 2024 00:06:32 -0700 X-CSE-ConnectionGUID: nra8gxtmTOKul4bSsaig0w== X-CSE-MsgGUID: uP7wppFxQBWsOsRM7jfJZw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,167,1725346800"; d="scan'208";a="78096811" Received: from anmitta2-mobl4.gar.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.119.243]) by fmviesa004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Oct 2024 00:06:30 -0700 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de Cc: linux-sound@vger.kernel.org, pierre-louis.bossart@linux.dev, bard.liao@intel.com, peter.ujfalusi@linux.intel.com Subject: [PATCH RESEND 2/4] ALSA/hda: intel-sdw-acpi: fetch fwnode once in sdw_intel_scan_controller() Date: Tue, 1 Oct 2024 15:06:09 +0800 Message-ID: <20241001070611.63288-3-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241001070611.63288-1-yung-chuan.liao@linux.intel.com> References: <20241001070611.63288-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Pierre-Louis Bossart Optimize a bit by using an intermediate 'fwnode' variable. Suggested-by: Andy Shevchenko Signed-off-by: Pierre-Louis Bossart Signed-off-by: Bard Liao --- sound/hda/intel-sdw-acpi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sound/hda/intel-sdw-acpi.c b/sound/hda/intel-sdw-acpi.c index 770dabe0124f..7a3735e94545 100644 --- a/sound/hda/intel-sdw-acpi.c +++ b/sound/hda/intel-sdw-acpi.c @@ -56,15 +56,17 @@ static int sdw_intel_scan_controller(struct sdw_intel_acpi_info *info) { struct acpi_device *adev = acpi_fetch_acpi_dev(info->handle); + struct fwnode_handle *fwnode; u8 count, i; int ret; if (!adev) return -EINVAL; + fwnode = acpi_fwnode_handle(adev); + /* Found controller, find links supported */ - ret = fwnode_property_read_u8_array(acpi_fwnode_handle(adev), - "mipi-sdw-master-count", &count, 1); + ret = fwnode_property_read_u8_array(fwnode, "mipi-sdw-master-count", &count, 1); /* * In theory we could check the number of links supported in @@ -107,7 +109,7 @@ sdw_intel_scan_controller(struct sdw_intel_acpi_info *info) continue; } - if (!is_link_enabled(acpi_fwnode_handle(adev), i)) { + if (!is_link_enabled(fwnode, i)) { dev_dbg(&adev->dev, "Link %d not selected in firmware\n", i); continue; From patchwork Tue Oct 1 07:06:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bard Liao X-Patchwork-Id: 13817567 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (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 183681BDA85 for ; Tue, 1 Oct 2024 07:06:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727766396; cv=none; b=PffY6tWImHj7GWzrMdVixoC0Ngm8hpUUd9f+jJpl3y8xvjGmmdBJEJ6UitmEfCsWJlsTYBVRFe9IJq+u02q6ggltE2fz96uuNHwTt+PRBmGASZ3hM+Q2AYVfOfQDVqSirbPFYmMYkScEXpu1wfp9pmepl4iTAzGguGdm7s6cdCo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727766396; c=relaxed/simple; bh=3sL6IgCE1ws9iA6hRFiFBk19JDaySIROpKkdZNwYThk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kdDknBffeMkYhOUz+3x88DemFzw5RmRk4ejF8276flMS4qs0c2eWtQ023QVuat5Sj29TWrvGqhMC26/GhyDM/3vCa4Zo4ZubRjHQha3s2EVHJ8lFnv3GrULZ7z7RhX7kiiyfQMdezwbhSmkYx3GKob5tm2J/NPXvicyprPfNWbE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=VcLx2w1U; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="VcLx2w1U" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1727766395; x=1759302395; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3sL6IgCE1ws9iA6hRFiFBk19JDaySIROpKkdZNwYThk=; b=VcLx2w1U6DGe/tGO27ue34jWyU4bhYN2jOHdgx4iLZycym3GOVwEFCV6 c/Mdy05c4Rzj0thm8EMfQ33OMIKHNBF0xEXtiXLnkL0h9/VJiTVJne05b BFjSIkrV8Qly8CbiPzuNHbCZF9x7RgXqmiB8oKmBzaonyKDPK5D50Rx0S 6WXV5+z+1oIm2kL18BwYQ8F+GDaut4+pJYhaY6NEu50Dd31eGDQFnBno7 BGOP/So7KF9VauAK8uxiFbbzq9sgFisvxz2XxxwOYOJOx0MEuUknGrOhz llMmr30kqRNLb9owzCu1vlCCmPXbk9AxFe/GZ8EGXM+mNGJyXari825KR A==; X-CSE-ConnectionGUID: RTD/wrUvR5WgrfrBobEwZg== X-CSE-MsgGUID: b0GsVvqGQEKKJKVjUVTmKg== X-IronPort-AV: E=McAfee;i="6700,10204,11211"; a="37556052" X-IronPort-AV: E=Sophos;i="6.11,167,1725346800"; d="scan'208";a="37556052" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Oct 2024 00:06:35 -0700 X-CSE-ConnectionGUID: FKxc1agQTauoSf5XxkuRqA== X-CSE-MsgGUID: Zadqj8l4TZGfpKjtlyLy7w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,167,1725346800"; d="scan'208";a="78096819" Received: from anmitta2-mobl4.gar.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.119.243]) by fmviesa004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Oct 2024 00:06:32 -0700 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de Cc: linux-sound@vger.kernel.org, pierre-louis.bossart@linux.dev, bard.liao@intel.com, peter.ujfalusi@linux.intel.com Subject: [PATCH RESEND 3/4] ALSA/hda: intel-sdw-acpi: simplify sdw-master-count property read Date: Tue, 1 Oct 2024 15:06:10 +0800 Message-ID: <20241001070611.63288-4-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241001070611.63288-1-yung-chuan.liao@linux.intel.com> References: <20241001070611.63288-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Pierre-Louis Bossart For some reason we used an array of one u8 when the specification requires a u32. Signed-off-by: Pierre-Louis Bossart Signed-off-by: Bard Liao --- sound/hda/intel-sdw-acpi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sound/hda/intel-sdw-acpi.c b/sound/hda/intel-sdw-acpi.c index 7a3735e94545..582e761e7b9f 100644 --- a/sound/hda/intel-sdw-acpi.c +++ b/sound/hda/intel-sdw-acpi.c @@ -57,7 +57,8 @@ sdw_intel_scan_controller(struct sdw_intel_acpi_info *info) { struct acpi_device *adev = acpi_fetch_acpi_dev(info->handle); struct fwnode_handle *fwnode; - u8 count, i; + unsigned int i; + u32 count; int ret; if (!adev) @@ -66,7 +67,7 @@ sdw_intel_scan_controller(struct sdw_intel_acpi_info *info) fwnode = acpi_fwnode_handle(adev); /* Found controller, find links supported */ - ret = fwnode_property_read_u8_array(fwnode, "mipi-sdw-master-count", &count, 1); + ret = fwnode_property_read_u32(fwnode, "mipi-sdw-master-count", &count); /* * In theory we could check the number of links supported in From patchwork Tue Oct 1 07:06:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bard Liao X-Patchwork-Id: 13817568 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (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 B741C1BDA95 for ; Tue, 1 Oct 2024 07:06:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727766399; cv=none; b=HxDFCtKOt3O4RdvCE+dft4gVnZaRehnHkuCIfJOlpVXxPJYM2DXaOVu/hPu+mu9cE8KZewcwzuI4ZOEApzt/sLitA8iOec2nIaxHCkDaVqb48oMTn9ZgL/yc55JOm5UqPYum1H83ngeyZdTQwIG1wnwmWxHOJjkZRmY1RJ1EDak= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727766399; c=relaxed/simple; bh=QeBcgQC6Uqqhj+R1iY8wI6U65X+2oHSnvrbaAGjiUgg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jJkGOrmx1QoDnSAI3JNlQxcCsraQJB/1P/eKrjsFdyTuXFSo7GJnvjuSoEEmd2ppwhBg8RsscwbDq3aGrs441qAKu/FwO/JxLM1uErMbNG/BARcFLtwTw5Tn4OnAhg9HGOjmOD9DSQdfR4wtybbuqp48PKYRz0NHbQR8zhI71ro= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Yahbsu3L; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Yahbsu3L" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1727766398; x=1759302398; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QeBcgQC6Uqqhj+R1iY8wI6U65X+2oHSnvrbaAGjiUgg=; b=Yahbsu3Ls6DzLS9Q2AYl5PveuTp6Og+sOpTGYMo83SOOZDIF6oMx7LkS H4rsYjftbKR8z4AUdIg5xTBOn5SuiMsBJQo49TxlJDETb8dfOxouefzB/ /I9w4fi1nF3/CsMKxMVXNKyDUNRSnQI+Ca7JgV3wwXZObY3gTk4swcavp lbounoJVvVS7JX1E6A9u2qkfyRizr/4orhZggnXQFcke2Fl8Y/fXQbVos cc2HGn1PccX3V6JZh7TfZYHx+uJvRuVlvNRaV8h+um2ln0aSqRvc+3NLJ 0nOILzyIZmFV8T3PoGY0XbknmOC8sc3Ds65AADFwO15gUtBd2tuDJ1CtZ Q==; X-CSE-ConnectionGUID: tRXij7PyRMq10g0wUkP8rQ== X-CSE-MsgGUID: nJQsgpRZTzWOue0ZgfPi7A== X-IronPort-AV: E=McAfee;i="6700,10204,11211"; a="37556060" X-IronPort-AV: E=Sophos;i="6.11,167,1725346800"; d="scan'208";a="37556060" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Oct 2024 00:06:37 -0700 X-CSE-ConnectionGUID: xHOBf3AOTGC9U3IDfThtDw== X-CSE-MsgGUID: Qpb90ep0TjS3Kc2sjAlxBw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,167,1725346800"; d="scan'208";a="78096825" Received: from anmitta2-mobl4.gar.corp.intel.com (HELO yungchua-desk.intel.com) ([10.247.119.243]) by fmviesa004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Oct 2024 00:06:35 -0700 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de Cc: linux-sound@vger.kernel.org, pierre-louis.bossart@linux.dev, bard.liao@intel.com, peter.ujfalusi@linux.intel.com Subject: [PATCH RESEND 4/4] ALSA/hda: intel-sdw-acpi: add support for sdw-manager-list property read Date: Tue, 1 Oct 2024 15:06:11 +0800 Message-ID: <20241001070611.63288-5-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241001070611.63288-1-yung-chuan.liao@linux.intel.com> References: <20241001070611.63288-1-yung-chuan.liao@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Pierre-Louis Bossart The DisCo for SoundWire 2.0 spec adds support for a new sdw-manager-list property. Add it in backwards-compatible mode with 'sdw-master-count', which assumed that all links between 0..count-1 exist. Signed-off-by: Pierre-Louis Bossart Signed-off-by: Bard Liao --- include/linux/soundwire/sdw_intel.h | 2 +- sound/hda/intel-sdw-acpi.c | 25 +++++++++++++++++-------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/include/linux/soundwire/sdw_intel.h b/include/linux/soundwire/sdw_intel.h index 37ae69365fe2..734dc1fa3b5b 100644 --- a/include/linux/soundwire/sdw_intel.h +++ b/include/linux/soundwire/sdw_intel.h @@ -227,7 +227,7 @@ struct sdw_intel_ops { /** * struct sdw_intel_acpi_info - Soundwire Intel information found in ACPI tables * @handle: ACPI controller handle - * @count: link count found with "sdw-master-count" property + * @count: link count found with "sdw-master-count" or "sdw-manager-list" property * @link_mask: bit-wise mask listing links enabled by BIOS menu * * this structure could be expanded to e.g. provide all the _ADR diff --git a/sound/hda/intel-sdw-acpi.c b/sound/hda/intel-sdw-acpi.c index 582e761e7b9f..ed530e0dd4dd 100644 --- a/sound/hda/intel-sdw-acpi.c +++ b/sound/hda/intel-sdw-acpi.c @@ -57,8 +57,10 @@ sdw_intel_scan_controller(struct sdw_intel_acpi_info *info) { struct acpi_device *adev = acpi_fetch_acpi_dev(info->handle); struct fwnode_handle *fwnode; + unsigned long list; unsigned int i; u32 count; + u32 tmp; int ret; if (!adev) @@ -66,10 +68,9 @@ sdw_intel_scan_controller(struct sdw_intel_acpi_info *info) fwnode = acpi_fwnode_handle(adev); - /* Found controller, find links supported */ - ret = fwnode_property_read_u32(fwnode, "mipi-sdw-master-count", &count); - /* + * Found controller, find links supported + * * In theory we could check the number of links supported in * hardware, but in that step we cannot assume SoundWire IP is * powered. @@ -80,11 +81,19 @@ sdw_intel_scan_controller(struct sdw_intel_acpi_info *info) * * We will check the hardware capabilities in the startup() step */ - + ret = fwnode_property_read_u32(fwnode, "mipi-sdw-manager-list", &tmp); if (ret) { - dev_err(&adev->dev, - "Failed to read mipi-sdw-master-count: %d\n", ret); - return ret; + ret = fwnode_property_read_u32(fwnode, "mipi-sdw-master-count", &count); + if (ret) { + dev_err(&adev->dev, + "Failed to read mipi-sdw-master-count: %d\n", + ret); + return ret; + } + list = GENMASK(count - 1, 0); + } else { + list = tmp; + count = hweight32(list); } /* Check count is within bounds */ @@ -103,7 +112,7 @@ sdw_intel_scan_controller(struct sdw_intel_acpi_info *info) info->count = count; info->link_mask = 0; - for (i = 0; i < count; i++) { + for_each_set_bit(i, &list, SDW_INTEL_MAX_LINKS) { if (ctrl_link_mask && !(ctrl_link_mask & BIT(i))) { dev_dbg(&adev->dev, "Link %d masked, will not be enabled\n", i);