From patchwork Fri Aug 30 08:41:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bard Liao X-Patchwork-Id: 13784555 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (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 B127916726E for ; Fri, 30 Aug 2024 08:41:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725007282; cv=none; b=dURZSuFcNPGYRtQp75toxap7LRIWMVaCozCF3n4luyNNKnu5oQioZDcKjooD3OqR+hfONhTy2Wpu2rMPc7lJEe9OWOBmKCzDmCzNbjT0sNvx4hIiUPTCdx/RbcOhfzrV/tmeh1E1KvVYI0N7tSfnPSvy7TOPMhpQWrPdcC4v+e8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725007282; c=relaxed/simple; bh=NVPZwxuSH44cdCkCcMlfMF0JRyvUIfR45Q3Tn/DYLPA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=r8J8wr9q+qL662xhi2Q+bMV9tRPgHLhWPtLMpomSfaYLwrCiV5yUa4rO8JoF0UfCcXk0ySu5iE8kr6bkuAdAUBMctnsNjAdOJ3ofVKXLf+dRczGMqOEbwNM79dYV2SXHp4tHApRRsjjVPXoCLtChZ1ZBZPyQ3tHQCnCPyz/SmEA= 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=SVGmGpc7; arc=none smtp.client-ip=192.198.163.13 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="SVGmGpc7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1725007281; x=1756543281; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NVPZwxuSH44cdCkCcMlfMF0JRyvUIfR45Q3Tn/DYLPA=; b=SVGmGpc7Q7LBzhJDxRUQKPUFgZVtm70N79QG8lh/6VBJ75UC+hn+ptpR N+EDbN1iZxb1D5s3vJsrV3A54NjvWRUiWKgkenrgpp4qGeiKCz11g2nP/ Y7Qk4BbxE7QIY3mUx4+S/87w87iTsDs5PnweNKbp1eHziECrEVoi8neRF cTPxLApEmV579UKa1mEh0xiS/v0rmuGfxolmS5Id9P+L/z7OY8BfW/3dK ufCBloppI4Rm3R97kGeEB563yiSZx11EXis3Vl8FcCkjO3fVmGgNPfjM4 5tqia6sL6yCmIc9LTgRzyd8Pz7mCnNGNCwWkvZVKma/0zmgPZGQ8EKk2c Q==; X-CSE-ConnectionGUID: HpsCQpdVS46KeO5sBiGVCw== X-CSE-MsgGUID: n0gvURZEQzu41NpBVo7HXA== X-IronPort-AV: E=McAfee;i="6700,10204,11179"; a="26536436" X-IronPort-AV: E=Sophos;i="6.10,188,1719903600"; d="scan'208";a="26536436" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Aug 2024 01:41:20 -0700 X-CSE-ConnectionGUID: jlPrQclVRouStpUNIzrRLg== X-CSE-MsgGUID: I1KgNAXXSqWFhwcwZrXe1Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,188,1719903600"; d="scan'208";a="94665912" Received: from unknown (HELO yungchua-desk.intel.com) ([10.247.118.125]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Aug 2024 01:41:18 -0700 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de Cc: linux-sound@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com, peter.ujfalusi@linux.intel.com Subject: [PATCH 1/4] ALSA/hda: intel-sdw-acpi: cleanup sdw_intel_scan_controller Date: Fri, 30 Aug 2024 16:41:02 +0800 Message-ID: <20240830084105.154062-2-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240830084105.154062-1-yung-chuan.liao@linux.intel.com> References: <20240830084105.154062-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 Fri Aug 30 08:41:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bard Liao X-Patchwork-Id: 13784556 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (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 3667516726E for ; Fri, 30 Aug 2024 08:41:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725007284; cv=none; b=QX9SjDw97PQZlFPsvPgKeoRyvVtKTY4GL+T0Q3BEYfikzS1fZWYmZ9JfJmXu8i5n8xTc6bRKc36ku3GrOS0UOVSMQP2wardBiaMoHXFzo3cBFso9V97HE4o9rXbknrj9UNvJ3uWQKC6FZPzGsy7Yeg9522CPfusR/HDGEKcn93Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725007284; c=relaxed/simple; bh=mDY5o8AD6W/04rsJCL84/cv/LReCvRURM8YdB+lYQd8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=i/i2WSkFtcXa2mM23QiAV1kO17QnP3uH5qpeorwPdKgCtOnNHGFJCE3ELrPBoUGnCVyVWgs5xBMI53Zj7g1k6Q8RIpXq92gpbxXcXuhA++gUYVsHCK0F4rSeJBhzwp/pAVO+rR5fdXTgTKmKmNNVuPJ2xUy985UifyyfOk3NRa0= 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=Bzo//C6i; arc=none smtp.client-ip=192.198.163.13 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="Bzo//C6i" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1725007283; x=1756543283; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mDY5o8AD6W/04rsJCL84/cv/LReCvRURM8YdB+lYQd8=; b=Bzo//C6iI+7vYzwUElKBBNc6UAmOE3DCQZtjZ/IMMTj9zq0hDFoCZAa3 XOvwWaV4YmLikFE7KSklVXYTGkStdot/CgsSQEce+1nVrR5xNxCd9TkWN u0/2Pn2yOA8ZuZZsR6THKEapG4UNnVYQUannqi5rvM1z8IXOI2MAd5taH nx0eNh/bgqLDePRtuFARJUh9PK+BSxDt/+D4wXxpnqyUZwWJxKF7w+lE8 gv3Wg6MG2pZ5j480Gm9+6vIvt8zD5v5B51EmaJJ2g/xXIQwR3KRS7i/1J aP/0B9ei2+nyqXLRYGeqID4renHU1dDnnWcEdC1SCqcY+BvS+Gv5uHLgs Q==; X-CSE-ConnectionGUID: idOAVmdXRV+caxuaVmpMZg== X-CSE-MsgGUID: t4kCfse3RGKgCzCOTjRn/g== X-IronPort-AV: E=McAfee;i="6700,10204,11179"; a="26536442" X-IronPort-AV: E=Sophos;i="6.10,188,1719903600"; d="scan'208";a="26536442" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Aug 2024 01:41:23 -0700 X-CSE-ConnectionGUID: aa97UwNhS7izX0CP8SrUBA== X-CSE-MsgGUID: eugAs43wSfuziTvuem+Wqg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,188,1719903600"; d="scan'208";a="94665921" Received: from unknown (HELO yungchua-desk.intel.com) ([10.247.118.125]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Aug 2024 01:41:21 -0700 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de Cc: linux-sound@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com, peter.ujfalusi@linux.intel.com Subject: [PATCH 2/4] ALSA/hda: intel-sdw-acpi: fetch fwnode once in sdw_intel_scan_controller() Date: Fri, 30 Aug 2024 16:41:03 +0800 Message-ID: <20240830084105.154062-3-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240830084105.154062-1-yung-chuan.liao@linux.intel.com> References: <20240830084105.154062-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 Fri Aug 30 08:41:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bard Liao X-Patchwork-Id: 13784557 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (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 9C74216726E for ; Fri, 30 Aug 2024 08:41:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725007287; cv=none; b=ufDGKTsoGhKYEpub6fdiyVjAJ+qgpX1MeiSFGxrDgEgy7zFSY3K5MqoqySHlPZ2I+oBQfazb+soVBT1dZpKsX0Tu7V3gCA0NL0YYr7SOdhzGUIRcWsxk31tKsE2bpBx7PeKoq1JC+8kyd7Ih4Bd8kXVdHPSrQoB67Z//0hyrJqo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725007287; c=relaxed/simple; bh=3sL6IgCE1ws9iA6hRFiFBk19JDaySIROpKkdZNwYThk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oGcG9gnywZPX/Fdv1muAKMY7FgcktQXmSoC80G5vWBOvt54hgyyR+iYedWHus+TvpXiABsE7RvMVdf/XodVy/ocMLyg3AC+73ZekJuM5qr4a231hjGTZcTWQxX0VNX2KiwITiyO62DI18dJLX3M2HSWKDnhcFlF3SY+uhGAp5Is= 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=QsdUQUnc; arc=none smtp.client-ip=192.198.163.13 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="QsdUQUnc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1725007286; x=1756543286; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3sL6IgCE1ws9iA6hRFiFBk19JDaySIROpKkdZNwYThk=; b=QsdUQUnc/VIWoNlOZHVs/ng2gLbYTzEwhJObfrFCUmbAMK56E0vOudsG 6ytatJa436Fx0S5ViEEJjKe8ZFHO4bC2HS1uRRO5GmYLIT59VpJlbHmL6 oeUgV5aDWZO9uEftCiHg7xFZ381bVX3XjjXvhS+tHtKUNbZucpIhLmJ1j N/BwNkfm5UufuGM/InERw+Fo915m+FMRPtdqO/2pxRPBwXmLjlVrdanoB RNgoWBU0AiFW7RAutl/TTD6Z6jNikyWQYCriyxYkjSVXvBF/PimphPIte W8pCl/XnY9emmSvFSuBFwAXsdZdT5ce3EHSTt9Xhu43I3jrCDO0xPDsRE A==; X-CSE-ConnectionGUID: QYCJWHeWQHC4I2sCl3R/ZA== X-CSE-MsgGUID: 8zUm4koTRxWNSqdP+oH06Q== X-IronPort-AV: E=McAfee;i="6700,10204,11179"; a="26536445" X-IronPort-AV: E=Sophos;i="6.10,188,1719903600"; d="scan'208";a="26536445" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Aug 2024 01:41:25 -0700 X-CSE-ConnectionGUID: 8Crz6DseQNO8pCm97eiu6Q== X-CSE-MsgGUID: bnatcNcmTku9FGMcMoNTCg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,188,1719903600"; d="scan'208";a="94665926" Received: from unknown (HELO yungchua-desk.intel.com) ([10.247.118.125]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Aug 2024 01:41:23 -0700 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de Cc: linux-sound@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com, peter.ujfalusi@linux.intel.com Subject: [PATCH 3/4] ALSA/hda: intel-sdw-acpi: simplify sdw-master-count property read Date: Fri, 30 Aug 2024 16:41:04 +0800 Message-ID: <20240830084105.154062-4-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240830084105.154062-1-yung-chuan.liao@linux.intel.com> References: <20240830084105.154062-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 Fri Aug 30 08:41:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bard Liao X-Patchwork-Id: 13784558 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (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 1F4E516726E for ; Fri, 30 Aug 2024 08:41:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725007289; cv=none; b=K5JHvmbLJceQKnAVKpjiB8pC0Xfo+a01CFFKlBOCX8Id+rXBmSsXcV+7Krc87fhWX539z7Wok3JR6hCgB5CeGRcFC9hjw6t3Lxd3jZsYVo8c/aWcoAs+cEgDCqlkif+07QU3fx/W++9Wvn4BNuPZvKAfbXo2ucd2bHloGZW+T10= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725007289; c=relaxed/simple; bh=QeBcgQC6Uqqhj+R1iY8wI6U65X+2oHSnvrbaAGjiUgg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HM3npHIO6OuvQ1GBjZNkJBkWdHwklHuHzMuKDWTa60Hp/ko9VCLZByKpw8k7MZbHS/Divua7lL7eqlqI3Nn/Gcv4Px67IJepkXjCaeb8nrTCIn6o5NWFF0yUN6DZOlQOiiBwfStvVewf6AYEBE+JGDcKjhWXsn0B1bYitidZFDg= 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=GVz8Q9by; arc=none smtp.client-ip=192.198.163.13 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="GVz8Q9by" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1725007288; x=1756543288; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QeBcgQC6Uqqhj+R1iY8wI6U65X+2oHSnvrbaAGjiUgg=; b=GVz8Q9bymPXfgjivthSObsE98bcvBRkeBQRdtN1L6a8izixLWbdEayP8 IhunlrWFCZBqSkG9xSZ+AmaQrtJsdRQLuj+fVRqGmB5loqHqc9rjsMlBh c6v+K5/j+8Hy4usVvcC1Pe0G3oiZRf2NuPezmMRt7Kvlu354wQLUF6JAU ol72vr4oOy5JsbT3z+LQ7j+UL/KKNZxkqfdEgvCP/Bd51VxzPS7w2BcXC 0PmeM66aeTr6lsO7r6clHcNC9r0jsh9vtmq6COkZvA5SCz9DO5G3WUv1b wBI5aEIXlUD7IeSfqXQNXWMZFuJm48Fnp2LU36LOGH9YCQJitM8gRJ4WV Q==; X-CSE-ConnectionGUID: 9TtNEc9AQ1+FjNTlkzLTVQ== X-CSE-MsgGUID: bf8b1sLfTtS00XuUFi4Meg== X-IronPort-AV: E=McAfee;i="6700,10204,11179"; a="26536449" X-IronPort-AV: E=Sophos;i="6.10,188,1719903600"; d="scan'208";a="26536449" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Aug 2024 01:41:28 -0700 X-CSE-ConnectionGUID: eA5vWyG0QoG4bgqym3raWw== X-CSE-MsgGUID: TMutcFBPTBuYpyjttieI2g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,188,1719903600"; d="scan'208";a="94665929" Received: from unknown (HELO yungchua-desk.intel.com) ([10.247.118.125]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Aug 2024 01:41:26 -0700 From: Bard Liao To: broonie@kernel.org, tiwai@suse.de Cc: linux-sound@vger.kernel.org, pierre-louis.bossart@linux.intel.com, bard.liao@intel.com, peter.ujfalusi@linux.intel.com Subject: [PATCH 4/4] ALSA/hda: intel-sdw-acpi: add support for sdw-manager-list property read Date: Fri, 30 Aug 2024 16:41:05 +0800 Message-ID: <20240830084105.154062-5-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240830084105.154062-1-yung-chuan.liao@linux.intel.com> References: <20240830084105.154062-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);