From patchwork Fri Apr 4 09:03:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 14038213 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (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 CAC2A1A4F2F for ; Fri, 4 Apr 2025 08:46:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743756410; cv=none; b=Oqad9TkOztJJXYoU/TVTL8Y/anSLRK+cqFnOlsHoR+oh3kwDP9oWcd2rFRRlIcrc8lI9ML7cvEkGyRNYPT3C5246d6x4+fLVwEifl2prcZlL0zpuC6e4VciCw3idRL+fT9qO0TWH1eigzKjSiZGUM9m+nEAcrJrcyDLssxVhRTs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743756410; c=relaxed/simple; bh=yoc0w8a4H3KJkNdv8mUj4MYqIus1JnhQoeSdG3HGMjc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=FWHUiUjDw9Idc1CBLuhU7H4ExtfpoDAcrw79BeYTMUgxX1GB/0Cp/qcWBtPdIFz6m3AB0hpv32bOd0JqxGlv0tR38FqGSPIl/Xy4JcAoipeXr96Cr37Pfu4fMtOOEpl+h3i5Jk7qV+Xi4pH32GgJXg9V3MaSWBpx0KR4QQTGYxY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Qgma6YVD; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Qgma6YVD" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1743756408; x=1775292408; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yoc0w8a4H3KJkNdv8mUj4MYqIus1JnhQoeSdG3HGMjc=; b=Qgma6YVDnhHldss4JaGQTVpOWcpI1CMwh5PmiP56byuxV0671qshPIPB ttsC7723L/hZJacnxIRu92YNpKfB190RHY+25dPYkYhTVlhVNP8CNQ6p7 F6oKcnptfddbvuSDks0zE9Mpx1FLHcCfx2zPIbPqE8cF7+FTK3ZvnGqVu xhIBxMi4uQQNX77CNIS3z02EJrFLbBHYfiJoJFbymcfS/BA9XbVHhnpmS FgUdoXTSY00FT4FjL4RFWYumPZKSitWb7gY/HZ76JBUnnPq7f5XgW/fCA gzG7QDCyU1hVn+NAaQ152vWC9D04mpQRUAIo5gWETDfM+sXN1p1bJAlQv g==; X-CSE-ConnectionGUID: shF+1md2TFy/GKM8YlCA7A== X-CSE-MsgGUID: fkX+xFmqSxePRZRGFhaCug== X-IronPort-AV: E=McAfee;i="6700,10204,11393"; a="55854563" X-IronPort-AV: E=Sophos;i="6.15,187,1739865600"; d="scan'208";a="55854563" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Apr 2025 01:46:47 -0700 X-CSE-ConnectionGUID: bMmaoKVWTIiZ7BFx8y81Ww== X-CSE-MsgGUID: AtNz2MBQQKSAAokUm90bzQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,187,1739865600"; d="scan'208";a="164464217" Received: from crojewsk-ctrl.igk.intel.com ([10.237.149.0]) by orviesa001.jf.intel.com with ESMTP; 04 Apr 2025 01:46:45 -0700 From: Cezary Rojewski To: broonie@kernel.org Cc: tiwai@suse.com, perex@perex.cz, amadeuszx.slawinski@linux.intel.com, linux-sound@vger.kernel.org, hdegoede@redhat.com, Cezary Rojewski , Andy Shevchenko Subject: [PATCH 1/8] lib/string_helpers: Introduce parse_int_array() Date: Fri, 4 Apr 2025 11:03:30 +0200 Message-Id: <20250404090337.3564117-2-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250404090337.3564117-1-cezary.rojewski@intel.com> References: <20250404090337.3564117-1-cezary.rojewski@intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Existing parse_inte_array_user() works with __user buffers only. Separate array parsing from __user bits so the functionality can be utilized with kernel buffers too. Cc: Andy Shevchenko Reviewed-by: Amadeusz Sławiński Signed-off-by: Cezary Rojewski Reviewed-by: Andy Shevchenko --- include/linux/string_helpers.h | 1 + lib/string_helpers.c | 39 ++++++++++++++++++---------------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h index e93fbb5b0c01..3fb88a1e9898 100644 --- a/include/linux/string_helpers.h +++ b/include/linux/string_helpers.h @@ -31,6 +31,7 @@ enum string_size_units { int string_get_size(u64 size, u64 blk_size, const enum string_size_units units, char *buf, int len); +int parse_int_array(const char *buf, size_t count, int **array); int parse_int_array_user(const char __user *from, size_t count, int **array); #define UNESCAPE_SPACE BIT(0) diff --git a/lib/string_helpers.c b/lib/string_helpers.c index 91fa37b5c510..ffb8ead6d4cd 100644 --- a/lib/string_helpers.c +++ b/lib/string_helpers.c @@ -138,6 +138,25 @@ int string_get_size(u64 size, u64 blk_size, const enum string_size_units units, } EXPORT_SYMBOL(string_get_size); +int parse_int_array(const char *buf, size_t count, int **array) +{ + int *ints, nints; + + get_options(buf, 0, &nints); + if (!nints) + return -ENOENT; + + ints = kcalloc(nints + 1, sizeof(*ints), GFP_KERNEL); + if (!ints) + return -ENOMEM; + + get_options(buf, nints + 1, ints); + *array = ints; + + return 0; +} +EXPORT_SYMBOL(parse_int_array); + /** * parse_int_array_user - Split string into a sequence of integers * @from: The user space buffer to read from @@ -153,30 +172,14 @@ EXPORT_SYMBOL(string_get_size); */ int parse_int_array_user(const char __user *from, size_t count, int **array) { - int *ints, nints; char *buf; - int ret = 0; + int ret; buf = memdup_user_nul(from, count); if (IS_ERR(buf)) return PTR_ERR(buf); - get_options(buf, 0, &nints); - if (!nints) { - ret = -ENOENT; - goto free_buf; - } - - ints = kcalloc(nints + 1, sizeof(*ints), GFP_KERNEL); - if (!ints) { - ret = -ENOMEM; - goto free_buf; - } - - get_options(buf, nints + 1, ints); - *array = ints; - -free_buf: + ret = parse_int_array(buf, count, array); kfree(buf); return ret; } From patchwork Fri Apr 4 09:03:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 14038214 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (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 1FB2F1A5B8A for ; Fri, 4 Apr 2025 08:46:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743756411; cv=none; b=ksZKd7YADcuqhwivYHLEjqKbFUhQuum3LD8to5c2qdOrn7SuXUaQt8T1F9odjm5rOBvESO8gq8++gdafWxI4ubvz98V+RY2NS4nbbD/i9R6JKaKqCybMUlm2PkgetsjyZUTvI5sqaMMxK6tvI7RXzvTBfVE4d/b6psvdXl4/kiM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743756411; c=relaxed/simple; bh=jX6+uVyJQFQ5otAvIQmCy2vwNbWsg1A3CVQNea9ixHw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=HmTAvqdhjmKbXqX/6JXPfsazdL+EFXNy0m+6IH2onKIimYhTnsBRMk7SHEMElBsmncumdc90r+Rqzi9Pf/wbDFeU24SVFtJ79OyYcWQW/8SPOMpYtp/qOU6BUIEda856inaysEUC91dkNnoHrzN0jSO4wSyeopytgPugIOvZt/g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=OF4skqRO; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="OF4skqRO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1743756409; x=1775292409; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jX6+uVyJQFQ5otAvIQmCy2vwNbWsg1A3CVQNea9ixHw=; b=OF4skqROdwdkHLfW7mVnLW1Ek04Xr92GOtYZ6y8gdSK4gzceHHlO9Nzz 4UV7tegLbGit50G8fzSk0Nb8ZkaP16ruA0hkmMl/kqiZcP427X4hTrM0Z hjVFU12NR1E2n+6CdEjOLlBXA0bGY0eX3+zGdHUGV9DYcKBB/q4FSqhA9 rJG0beFe3wM39SFuWmWLLbAzo5z5l53KgASvT7OFml4xCH6FtjJsbPjat VHEiEvCAGRHeoUZwHp9M2W3s3C31MVvo/JtVNxbpzd2E/hQqvs3Aj7vZH 57ZdrItFvVQyMoCBunAyf7yT1Q6tMxfuAzvhie9A5TFOCvTDUmQJud1gG w==; X-CSE-ConnectionGUID: uzo5tbURQumBQTrCS7a+mQ== X-CSE-MsgGUID: MH9TZh8zSlKpTgjVxcBgpQ== X-IronPort-AV: E=McAfee;i="6700,10204,11393"; a="55854572" X-IronPort-AV: E=Sophos;i="6.15,187,1739865600"; d="scan'208";a="55854572" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Apr 2025 01:46:49 -0700 X-CSE-ConnectionGUID: yulYaKI4Sz+sSqxPW07jaw== X-CSE-MsgGUID: w10/Ee73TFG2OVWaiIkrfw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,187,1739865600"; d="scan'208";a="164464228" Received: from crojewsk-ctrl.igk.intel.com ([10.237.149.0]) by orviesa001.jf.intel.com with ESMTP; 04 Apr 2025 01:46:47 -0700 From: Cezary Rojewski To: broonie@kernel.org Cc: tiwai@suse.com, perex@perex.cz, amadeuszx.slawinski@linux.intel.com, linux-sound@vger.kernel.org, hdegoede@redhat.com, Cezary Rojewski Subject: [PATCH 2/8] ALSA: hda: Allow for 16 channels configuration Date: Fri, 4 Apr 2025 11:03:31 +0200 Message-Id: <20250404090337.3564117-3-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250404090337.3564117-1-cezary.rojewski@intel.com> References: <20250404090337.3564117-1-cezary.rojewski@intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 As per HDAudio specification, up to 16 channels are supported. Reflect that in the code. Reviewed-by: Amadeusz Sławiński Signed-off-by: Cezary Rojewski --- sound/hda/hdac_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/hda/hdac_device.c b/sound/hda/hdac_device.c index 3fbb9793dcfc..0053831eed2d 100644 --- a/sound/hda/hdac_device.c +++ b/sound/hda/hdac_device.c @@ -801,7 +801,7 @@ unsigned int snd_hdac_stream_format(unsigned int channels, unsigned int bits, un if (!rate_bits[i].hz) return 0; - if (channels == 0 || channels > 8) + if (channels == 0 || channels > 16) return 0; val |= channels - 1; From patchwork Fri Apr 4 09:03:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 14038215 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (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 611B41CDA2E for ; Fri, 4 Apr 2025 08:46:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743756416; cv=none; b=J7j9fFhPXSidWoegGjg8NRx+0HbcLMqUfs04pDK+IAXajFSfmgRZ18wlW3U8NIbj9jMSLCFYULEC6YT2pSrByLXnxoy2PCDZ4CGCQVXY6mKYMFp2tr3yF/R5TRQj6KGe0EWFzNovyICI29HQTMER8nDJMripQ+uGG75tMAxd+EQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743756416; c=relaxed/simple; bh=/UevfbcnTbZEaJA+Qe7d8HKfUxCq/djTs56rCJbxT0w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=rzxbfYgfef79RRFcVChrGnkPP6ns9dbjEjU9bnjwYmyBquMoblaqj+KJSrfB3SKbCz+4TPef6okrSc0nxF7DQV0PWeNoc3kclm0aEusTQz4SZRoXVX03oNiTk4suXffYuL4eCTVihkBY+1MSJ18YbKLCgEkgQV9WrtiKqmj3aIE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=goKlX0am; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="goKlX0am" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1743756414; x=1775292414; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/UevfbcnTbZEaJA+Qe7d8HKfUxCq/djTs56rCJbxT0w=; b=goKlX0amLKV+qhp0aSWev5aCQ7FsMkOQU67FF7qkqYFb7ijZEHhampyZ XD90lg1m9ObR8BENZQtjOjOmb47aHpo/SAhv48tjb1mnVepGDv+AuSRkX UZCz+ngZOG3GE0Yd9CwstHh8PvfH/0iNzyiW1wdSIZxnnomLeOsxlCBnD CBupjLQgkAnXJrQHbd+agvbW5Q4SRM/WVI4MMiPd7od89ailLcJqglqoL RNrftgAQ1brzB/p2aEEgn7Oej6yOaC1vo1btYVEXQ5odNFzGi/x9aLb1y ueRIJBAnhtgrbz0htJQC32cHF+aMLivPpF5H6Q37EGa4m49mInl43+E64 Q==; X-CSE-ConnectionGUID: CrxTvNw6QZGV9bm5Qbe3kw== X-CSE-MsgGUID: 0F32tzazSquCqB12LeQ2fQ== X-IronPort-AV: E=McAfee;i="6700,10204,11393"; a="55854579" X-IronPort-AV: E=Sophos;i="6.15,187,1739865600"; d="scan'208";a="55854579" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Apr 2025 01:46:51 -0700 X-CSE-ConnectionGUID: tqeUirR/R2COpZrxdqNPsQ== X-CSE-MsgGUID: HPCYCE8VTV6QKCHNO1e8yA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,187,1739865600"; d="scan'208";a="164464235" Received: from crojewsk-ctrl.igk.intel.com ([10.237.149.0]) by orviesa001.jf.intel.com with ESMTP; 04 Apr 2025 01:46:49 -0700 From: Cezary Rojewski To: broonie@kernel.org Cc: tiwai@suse.com, perex@perex.cz, amadeuszx.slawinski@linux.intel.com, linux-sound@vger.kernel.org, hdegoede@redhat.com, Cezary Rojewski Subject: [PATCH 3/8] ASoC: Intel: avs: Rename AVS_CHANNELS_MAX define Date: Fri, 4 Apr 2025 11:03:32 +0200 Message-Id: <20250404090337.3564117-4-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250404090337.3564117-1-cezary.rojewski@intel.com> References: <20250404090337.3564117-1-cezary.rojewski@intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Amadeusz Sławiński It is used for coefficient table in updown mixer module, which supports maximum of 8 channels. However it does not represent HW capability. Reviewed-by: Cezary Rojewski Signed-off-by: Amadeusz Sławiński Signed-off-by: Cezary Rojewski --- sound/soc/intel/avs/messages.h | 4 ++-- sound/soc/intel/avs/path.c | 2 +- sound/soc/intel/avs/topology.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/soc/intel/avs/messages.h b/sound/soc/intel/avs/messages.h index 2f243802ccc2..673e4577df14 100644 --- a/sound/soc/intel/avs/messages.h +++ b/sound/soc/intel/avs/messages.h @@ -697,7 +697,7 @@ enum avs_sample_type { AVS_SAMPLE_TYPE_FLOAT = 4, }; -#define AVS_CHANNELS_MAX 8 +#define AVS_COEFF_CHANNELS_MAX 8 #define AVS_ALL_CHANNELS_MASK UINT_MAX struct avs_audio_format { @@ -846,7 +846,7 @@ struct avs_updown_mixer_cfg { struct avs_modcfg_base base; u32 out_channel_config; u32 coefficients_select; - s32 coefficients[AVS_CHANNELS_MAX]; + s32 coefficients[AVS_COEFF_CHANNELS_MAX]; u32 channel_map; } __packed; static_assert(sizeof(struct avs_updown_mixer_cfg) == 84); diff --git a/sound/soc/intel/avs/path.c b/sound/soc/intel/avs/path.c index ef0c1d125d66..d5cce357b162 100644 --- a/sound/soc/intel/avs/path.c +++ b/sound/soc/intel/avs/path.c @@ -452,7 +452,7 @@ static int avs_updown_mix_create(struct avs_dev *adev, struct avs_path_module *m cfg.base.audio_fmt = *t->in_fmt; cfg.out_channel_config = t->cfg_ext->updown_mix.out_channel_config; cfg.coefficients_select = t->cfg_ext->updown_mix.coefficients_select; - for (i = 0; i < AVS_CHANNELS_MAX; i++) + for (i = 0; i < AVS_COEFF_CHANNELS_MAX; i++) cfg.coefficients[i] = t->cfg_ext->updown_mix.coefficients[i]; cfg.channel_map = t->cfg_ext->updown_mix.channel_map; diff --git a/sound/soc/intel/avs/topology.h b/sound/soc/intel/avs/topology.h index 304880997717..f5601a4e3ec8 100644 --- a/sound/soc/intel/avs/topology.h +++ b/sound/soc/intel/avs/topology.h @@ -87,7 +87,7 @@ struct avs_tplg_modcfg_ext { struct { u32 out_channel_config; u32 coefficients_select; - s32 coefficients[AVS_CHANNELS_MAX]; + s32 coefficients[AVS_COEFF_CHANNELS_MAX]; u32 channel_map; } updown_mix; struct { From patchwork Fri Apr 4 09:03:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 14038216 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (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 BF8C81A725A for ; Fri, 4 Apr 2025 08:46:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743756417; cv=none; b=KdTs8TMhPsEgIKnoKpPuJcf0z/N3/WusrXvJum6zZwZBJw/fg5QQyy5U7ELv+zoY897BpeBCq5knJ1r/EEc4eomrkEn/LQ06kiygYv7+nampl3skwkxdC8PwCCHXTadz5t4Y0HeE8jL4LBwp8LYkEEHLw2XEnX67h6o3a8gX4To= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743756417; c=relaxed/simple; bh=esHqllad9d3bCX/up3Xg8psV9YgkubZmfpPpaB/uN2o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=Z9MxgjBKPWp2htFZbhRfFRjDp/56haF3mteZM/fAoV5neHDEH73Rpd2Da9Qg0Y/NGMEG9Smgiam8OsvUn5a0ZzMyZ6Gxtq4Xa6JLPq/ONnZ1dPYHrYow+OvxNHljZrQ+NARHX0mXGDgNJN6OMMSbwA+skI8KOth4o2Ds+u1BDpE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=i/KRigKs; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="i/KRigKs" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1743756416; x=1775292416; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=esHqllad9d3bCX/up3Xg8psV9YgkubZmfpPpaB/uN2o=; b=i/KRigKsnRv0Mc448XWstxRbGFw0Bcqw+7qGHQfWFz6L3UpyoYeogOx7 cLkVWI5zdBTkWMkm3pmNQbOjVp/PLIdt5jh5W7auWwp3KQkM9DIVr11Uh 7I04pVJWSJJ2WO5J4RB2Nc0PAYbTEE0WBgLJNqvMySVKehiLUuuS0KFRd TvGOmfAcA7kd8BQvVwUWGaAd9kFfyPBWqqre8S/2cR+JlB+MzCEXMqDeJ uCzOrXkoOocZ08lQdMNZeFkLBer4TX9cDUQ2EzlVCMisv9iwPGP2UGZju +LtRPj7tU7bC99L4rWTiiL/zZiE5li19TANfXTxlEEG4qkLgTf7a369B7 A==; X-CSE-ConnectionGUID: Xu3GxxEDRgyk00zWKvN7AQ== X-CSE-MsgGUID: Y+9i98cFQReZH7LGaqgygA== X-IronPort-AV: E=McAfee;i="6700,10204,11393"; a="55854586" X-IronPort-AV: E=Sophos;i="6.15,187,1739865600"; d="scan'208";a="55854586" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Apr 2025 01:46:52 -0700 X-CSE-ConnectionGUID: Bc9NlUoDTaiB35ky5iy8rw== X-CSE-MsgGUID: UKqDNnR6STOW0kqNaZpGVw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,187,1739865600"; d="scan'208";a="164464245" Received: from crojewsk-ctrl.igk.intel.com ([10.237.149.0]) by orviesa001.jf.intel.com with ESMTP; 04 Apr 2025 01:46:51 -0700 From: Cezary Rojewski To: broonie@kernel.org Cc: tiwai@suse.com, perex@perex.cz, amadeuszx.slawinski@linux.intel.com, linux-sound@vger.kernel.org, hdegoede@redhat.com, Cezary Rojewski Subject: [PATCH 4/8] ASoC: Intel: avs: Allow for 16 channels configuration Date: Fri, 4 Apr 2025 11:03:33 +0200 Message-Id: <20250404090337.3564117-5-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250404090337.3564117-1-cezary.rojewski@intel.com> References: <20250404090337.3564117-1-cezary.rojewski@intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add define representing maximum number of channels that are allowed by HDAudio standard and as such supported by HW - 16 channels. With that done, reflect the max in BE DAIs capabilities. Reviewed-by: Cezary Rojewski Signed-off-by: Amadeusz Sławiński Signed-off-by: Cezary Rojewski --- sound/soc/intel/avs/messages.h | 1 + sound/soc/intel/avs/pcm.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sound/soc/intel/avs/messages.h b/sound/soc/intel/avs/messages.h index 673e4577df14..e27c7587be9d 100644 --- a/sound/soc/intel/avs/messages.h +++ b/sound/soc/intel/avs/messages.h @@ -699,6 +699,7 @@ enum avs_sample_type { #define AVS_COEFF_CHANNELS_MAX 8 #define AVS_ALL_CHANNELS_MASK UINT_MAX +#define AVS_CHANNELS_MAX 16 struct avs_audio_format { u32 sampling_freq; diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c index dac463390da1..7d57a5735157 100644 --- a/sound/soc/intel/avs/pcm.c +++ b/sound/soc/intel/avs/pcm.c @@ -1337,7 +1337,7 @@ static const struct snd_soc_dai_driver i2s_dai_template = { .ops = &avs_dai_nonhda_be_ops, .playback = { .channels_min = 1, - .channels_max = 8, + .channels_max = AVS_CHANNELS_MAX, .rates = SNDRV_PCM_RATE_8000_192000 | SNDRV_PCM_RATE_12000 | SNDRV_PCM_RATE_24000 | @@ -1350,7 +1350,7 @@ static const struct snd_soc_dai_driver i2s_dai_template = { }, .capture = { .channels_min = 1, - .channels_max = 8, + .channels_max = AVS_CHANNELS_MAX, .rates = SNDRV_PCM_RATE_8000_192000 | SNDRV_PCM_RATE_12000 | SNDRV_PCM_RATE_24000 | @@ -1431,7 +1431,7 @@ static const struct snd_soc_dai_driver hda_cpu_dai = { .ops = &avs_dai_hda_be_ops, .playback = { .channels_min = 1, - .channels_max = 8, + .channels_max = AVS_CHANNELS_MAX, .rates = SNDRV_PCM_RATE_8000_192000, .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE, @@ -1441,7 +1441,7 @@ static const struct snd_soc_dai_driver hda_cpu_dai = { }, .capture = { .channels_min = 1, - .channels_max = 8, + .channels_max = AVS_CHANNELS_MAX, .rates = SNDRV_PCM_RATE_8000_192000, .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE, From patchwork Fri Apr 4 09:03:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 14038217 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (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 52D8B1D47AD for ; Fri, 4 Apr 2025 08:46:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743756418; cv=none; b=Ioh8PmaJc/NHgXswXAmufhZRmgyHyxw6hXeGNTFgfNyk0m2KxzhCLOujFiYwXzpCrd9ye9dO4EcnEXbJdRjI9hOBWCP8QhUzZ56a2TzemxhhZVRKWUYvEwt3/45BidrXSJnT4O1ilVNScITQF56jAY40oIaXLWUL4/Pmm++upCg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743756418; c=relaxed/simple; bh=LoAaiWwW6ncYtSYrnNbitXF+PS1/owY0LVFLaaBhkHs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=Qgt5s2IyVGkXXqAK2dViLMcuhouJYepSurZWBvubRf37NZSkQe+b3zd6jCISveeYr3rTJrdz3uRrKWBLLEmBYvJPi+2Z/OaPEtVhct+1uHi0qp+o15I5kuIP9CQD5WzqDn8BnqVGsFIM5jG+1bxxFsf3ylrnFjEwmwvSWsKBgbg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=jiNc/PU0; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="jiNc/PU0" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1743756416; x=1775292416; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LoAaiWwW6ncYtSYrnNbitXF+PS1/owY0LVFLaaBhkHs=; b=jiNc/PU09f7K7nupzfC36z3vLdIFAlfVhsku59bp0G39Qypc9UYNZzuf VSJkcmP5+TEohVU3fvt+usL1M1RT60AWmGHQaq8GLpdpC/+yEpZgBhPtj hl8y0COlKPVoXh4pHIk0rBBKfU7XbrHrTwAMwaTu+Hx6jeaHna4RyEdWd LZT+On4yankG3CXkHULUV/0dX9Mw8lGtxUIJZADRis5wNmdFWQIDm9VMg edG1rKn1npTKD6ClkTh+5EB3tdodjIEHlF0JwnfY2SW4Ha1C2X4LjiuUL iV7MJ38sluAwAEJwxY1IKFLfNuyUKrGIuk6/r0pIGmXaOcW20MJ/oFN6Z w==; X-CSE-ConnectionGUID: Vbp+izQ+RO2vYwQqXicUeg== X-CSE-MsgGUID: /gh7PHzUTYWG5Nt1Iu2ieg== X-IronPort-AV: E=McAfee;i="6700,10204,11393"; a="55854594" X-IronPort-AV: E=Sophos;i="6.15,187,1739865600"; d="scan'208";a="55854594" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Apr 2025 01:46:55 -0700 X-CSE-ConnectionGUID: 2pbDLjKWTX+hOB5/04ORrA== X-CSE-MsgGUID: Jj/2wqcSQbKC81VImVQIwQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,187,1739865600"; d="scan'208";a="164464251" Received: from crojewsk-ctrl.igk.intel.com ([10.237.149.0]) by orviesa001.jf.intel.com with ESMTP; 04 Apr 2025 01:46:53 -0700 From: Cezary Rojewski To: broonie@kernel.org Cc: tiwai@suse.com, perex@perex.cz, amadeuszx.slawinski@linux.intel.com, linux-sound@vger.kernel.org, hdegoede@redhat.com, Cezary Rojewski Subject: [PATCH 5/8] ASoC: Intel: avs: Allow to specify custom configurations with i2s_test Date: Fri, 4 Apr 2025 11:03:34 +0200 Message-Id: <20250404090337.3564117-6-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250404090337.3564117-1-cezary.rojewski@intel.com> References: <20250404090337.3564117-1-cezary.rojewski@intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Amadeusz Sławiński Change 'i2s_test' module option from enable-flag to string allowing to specify which SSP port and in what TDM configuration should be enabled. Reviewed-by: Cezary Rojewski Signed-off-by: Amadeusz Sławiński Signed-off-by: Cezary Rojewski --- sound/soc/intel/avs/board_selection.c | 134 +++++++++++++------------- 1 file changed, 68 insertions(+), 66 deletions(-) diff --git a/sound/soc/intel/avs/board_selection.c b/sound/soc/intel/avs/board_selection.c index 2d706edcbf92..30444b67dd91 100644 --- a/sound/soc/intel/avs/board_selection.c +++ b/sound/soc/intel/avs/board_selection.c @@ -17,10 +17,11 @@ #include #include #include "avs.h" +#include "utils.h" -static bool i2s_test; -module_param(i2s_test, bool, 0444); -MODULE_PARM_DESC(i2s_test, "Probe I2S test-board and skip all other I2S boards"); +static char *i2s_test; +module_param(i2s_test, charp, 0444); +MODULE_PARM_DESC(i2s_test, "Use I2S test-board instead of ACPI, i2s_test=ssp0tdm,ssp1tdm,... 0 to ignore port"); static const struct dmi_system_id kbl_dmi_table[] = { { @@ -324,52 +325,6 @@ static struct snd_soc_acpi_mach avs_mbl_i2s_machines[] = { {} }; -static struct snd_soc_acpi_mach avs_test_i2s_machines[] = { - { - .drv_name = "avs_i2s_test", - .mach_params = { - .i2s_link_mask = AVS_SSP(0), - }, - .tplg_filename = "i2s-test-tplg.bin", - }, - { - .drv_name = "avs_i2s_test", - .mach_params = { - .i2s_link_mask = AVS_SSP(1), - }, - .tplg_filename = "i2s-test-tplg.bin", - }, - { - .drv_name = "avs_i2s_test", - .mach_params = { - .i2s_link_mask = AVS_SSP(2), - }, - .tplg_filename = "i2s-test-tplg.bin", - }, - { - .drv_name = "avs_i2s_test", - .mach_params = { - .i2s_link_mask = AVS_SSP(3), - }, - .tplg_filename = "i2s-test-tplg.bin", - }, - { - .drv_name = "avs_i2s_test", - .mach_params = { - .i2s_link_mask = AVS_SSP(4), - }, - .tplg_filename = "i2s-test-tplg.bin", - }, - { - .drv_name = "avs_i2s_test", - .mach_params = { - .i2s_link_mask = AVS_SSP(5), - }, - .tplg_filename = "i2s-test-tplg.bin", - }, - /* no NULL terminator, as we depend on ARRAY SIZE due to .id == NULL */ -}; - struct avs_acpi_boards { int id; struct snd_soc_acpi_mach *machs; @@ -529,6 +484,68 @@ static int avs_register_i2s_board(struct avs_dev *adev, struct snd_soc_acpi_mach return 0; } +static int avs_register_i2s_test_board(struct avs_dev *adev, int ssp_port, int tdm_slot) +{ + struct snd_soc_acpi_mach *mach; + int tdm_mask = BIT(tdm_slot); + unsigned long *tdm_cfg; + char *tplg_name; + int ret; + + mach = devm_kzalloc(adev->dev, sizeof(*mach), GFP_KERNEL); + tdm_cfg = devm_kcalloc(adev->dev, ssp_port + 1, sizeof(unsigned long), GFP_KERNEL); + tplg_name = devm_kasprintf(adev->dev, GFP_KERNEL, AVS_STRING_FMT("i2s", "-test-tplg.bin", + ssp_port, tdm_slot)); + if (!mach || !tdm_cfg || !tplg_name) + return -ENOMEM; + + mach->drv_name = "avs_i2s_test"; + mach->mach_params.i2s_link_mask = AVS_SSP(ssp_port); + tdm_cfg[ssp_port] = tdm_mask; + mach->pdata = tdm_cfg; + mach->tplg_filename = tplg_name; + + ret = avs_register_i2s_board(adev, mach); + if (ret < 0) { + dev_warn(adev->dev, "register i2s %s failed: %d\n", mach->drv_name, ret); + return ret; + } + + return 0; +} + +static int avs_register_i2s_test_boards(struct avs_dev *adev) +{ + int max_ssps = adev->hw_cfg.i2s_caps.ctrl_count; + int ssp_port, tdm_slot, ret; + unsigned long tdm_slots; + u32 *array, num_elems; + + ret = parse_int_array(i2s_test, strlen(i2s_test), (int **)&array); + if (ret < 0) { + dev_err(adev->dev, "failed to parse i2s_test parameter\n"); + return ret; + } + + num_elems = *array; + if (num_elems > max_ssps) { + dev_err(adev->dev, "board supports only %d SSP, %d specified\n", + max_ssps, num_elems); + return -EINVAL; + } + + for (ssp_port = 0; ssp_port < num_elems; ssp_port++) { + tdm_slots = array[1 + ssp_port]; + for_each_set_bit(tdm_slot, &tdm_slots, 16) { + ret = avs_register_i2s_test_board(adev, ssp_port, tdm_slot); + if (ret) + return ret; + } + } + + return 0; +} + static int avs_register_i2s_boards(struct avs_dev *adev) { const struct avs_acpi_boards *boards; @@ -540,23 +557,8 @@ static int avs_register_i2s_boards(struct avs_dev *adev) return 0; } - if (i2s_test) { - int i, num_ssps; - - num_ssps = adev->hw_cfg.i2s_caps.ctrl_count; - /* constrain just in case FW says there can be more SSPs than possible */ - num_ssps = min_t(int, ARRAY_SIZE(avs_test_i2s_machines), num_ssps); - - mach = avs_test_i2s_machines; - - for (i = 0; i < num_ssps; i++) { - ret = avs_register_i2s_board(adev, &mach[i]); - if (ret < 0) - dev_warn(adev->dev, "register i2s %s failed: %d\n", mach->drv_name, - ret); - } - return 0; - } + if (i2s_test) + return avs_register_i2s_test_boards(adev); boards = avs_get_i2s_boards(adev); if (!boards) { From patchwork Fri Apr 4 09:03:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 14038218 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (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 A2BFF1D63C6 for ; Fri, 4 Apr 2025 08:46:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743756419; cv=none; b=MNhwAOnBp+cxZnbRQ0UiZrvLLUzYn40uOngGN25U0ShQ7ZbiZMBjcYCGlP7bdKbdzuyNYK9+x9OJLg9qvp6dxcnKDHyN59Q3mj9deTd9hH9s9tMG+QMNaVyTMZ/nZ0yLKJ+cJqNuBy0f3ft1iDJtR6zcGnjZlT66pfBD/V16ggk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743756419; c=relaxed/simple; bh=s6AyaU5EBLASfM9cSYfDutyg0zd30BNi3R50hPDOjEc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=JAt6hvumMH8x8dcS/eHsnaTENDjtjnAzTtPkoHQJjuWSYYTxUYIqYMFPOW6UghOqto98an0SenNBK44HoWi3wbRLlJytAf2WbrDy5RnJ5lAm37QjlW4UJjGeK7eeqN49j+WfMhNmUiy7B8846ldh1UEHQcUQnBzdqK01aTHtYb0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=feORCarG; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="feORCarG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1743756417; x=1775292417; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=s6AyaU5EBLASfM9cSYfDutyg0zd30BNi3R50hPDOjEc=; b=feORCarGVKvEQn1shvUfTysJdm0y4538ALXt9v5XSap0tBx4yu6h47/B nLpiigzUjZPqlXpmeixaNGRo7MofAsqNV7+NRe1C9R0QpSqNvTWemioh/ UYYX7aZbXvFJFizXCQ2b2bhapcvgzzM1OJiVm2Cq7266OYNruqz79HRGx ho7DsdER8MZFfMVBStkIxtYQ3ZNIVd6uNj0X4NbNHLA+MFgyrxpdl2cgA 4KLr5hEuszCtp0qF/tPIq/WM/mS/KCSzvQMZTAoTxnKvRGd0BfNeqX5r0 6d97Y5u+dDgYN3HYrFDdTohMigdgdRWyGxqAUgsvoMVqBsKI2AKTABHLV g==; X-CSE-ConnectionGUID: a9FCuzHQT7qGnkqROifwyA== X-CSE-MsgGUID: SK1ud3XeRh+9yhWRDx8Kqw== X-IronPort-AV: E=McAfee;i="6700,10204,11393"; a="55854600" X-IronPort-AV: E=Sophos;i="6.15,187,1739865600"; d="scan'208";a="55854600" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Apr 2025 01:46:57 -0700 X-CSE-ConnectionGUID: wAJKmppJTR2WuWMv7ubnCg== X-CSE-MsgGUID: PkJy3CiPSZytx3txN32Hyg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,187,1739865600"; d="scan'208";a="164464259" Received: from crojewsk-ctrl.igk.intel.com ([10.237.149.0]) by orviesa001.jf.intel.com with ESMTP; 04 Apr 2025 01:46:55 -0700 From: Cezary Rojewski To: broonie@kernel.org Cc: tiwai@suse.com, perex@perex.cz, amadeuszx.slawinski@linux.intel.com, linux-sound@vger.kernel.org, hdegoede@redhat.com, Cezary Rojewski Subject: [PATCH 6/8] ASoC: Intel: avs: Assign unique ID to platform devices Date: Fri, 4 Apr 2025 11:03:35 +0200 Message-Id: <20250404090337.3564117-7-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250404090337.3564117-1-cezary.rojewski@intel.com> References: <20250404090337.3564117-1-cezary.rojewski@intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Amadeusz Sławiński When creating machine boards there are two types, per endpoint or compound board. For compound board we can just use I2S mask as its ID, however, per endpoint can also be separated per TDM, which causes problem because two boards would have same I2S mask. Shift it and add the value of TDM to generate a unique ID. Reviewed-by: Cezary Rojewski Signed-off-by: Amadeusz Sławiński Signed-off-by: Cezary Rojewski --- sound/soc/intel/avs/board_selection.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sound/soc/intel/avs/board_selection.c b/sound/soc/intel/avs/board_selection.c index 30444b67dd91..286d94df5f46 100644 --- a/sound/soc/intel/avs/board_selection.c +++ b/sound/soc/intel/avs/board_selection.c @@ -448,6 +448,7 @@ static int avs_register_i2s_board(struct avs_dev *adev, struct snd_soc_acpi_mach int num_ssps; char *name; int ret; + int uid; num_ssps = adev->hw_cfg.i2s_caps.ctrl_count; if (fls(mach->mach_params.i2s_link_mask) > num_ssps) { @@ -457,8 +458,11 @@ static int avs_register_i2s_board(struct avs_dev *adev, struct snd_soc_acpi_mach return -ENODEV; } - name = devm_kasprintf(adev->dev, GFP_KERNEL, "%s.%d-platform", mach->drv_name, - mach->mach_params.i2s_link_mask); + uid = mach->mach_params.i2s_link_mask; + if (avs_mach_singular_ssp(mach)) + uid = (uid << AVS_CHANNELS_MAX) + avs_mach_ssp_tdm(mach, avs_mach_ssp_port(mach)); + + name = devm_kasprintf(adev->dev, GFP_KERNEL, "%s.%d-platform", mach->drv_name, uid); if (!name) return -ENOMEM; @@ -468,7 +472,7 @@ static int avs_register_i2s_board(struct avs_dev *adev, struct snd_soc_acpi_mach mach->mach_params.platform = name; - board = platform_device_register_data(NULL, mach->drv_name, mach->mach_params.i2s_link_mask, + board = platform_device_register_data(NULL, mach->drv_name, uid, (const void *)mach, sizeof(*mach)); if (IS_ERR(board)) { dev_err(adev->dev, "ssp board register failed\n"); From patchwork Fri Apr 4 09:03:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 14038219 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (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 EF7FC1A76AE for ; Fri, 4 Apr 2025 08:46:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743756420; cv=none; b=eLol5vQtaT/Kz8n7ow2c73XErXhem2Ut1tQBQaTQjtjp3FUj4/LatEZYdc1U5ex/8ziar/+MV5XfYmWXYUJuVuoTgOgoQ/SxxgSAenRJpMUluyHqSqnbse1L9GA9Y4eKxXLGM2z2zI+XW9K+yq/mWMn8XY0GMfP1QXBh4z28saA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743756420; c=relaxed/simple; bh=aOpNgbxxrQnKNENb/N+cnm855Me/zWHHEymkNL6hEBw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=R5fMYw7s4gugDFwBRXJIbqpjwo8Bj5Kz6VgCfRVtlZOMOqbPeXn2emQyV0UkN574bPJTJC9uDdb1L3scfAwZC8kOgmj4UdBtW70umz03qjsmOFPu1+/dZQ2kmxrG2A7MKIGjfsSN+0hCwKoiQ6f90OYz+zMgug1RzZsr+ZD2Cxk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=IzLp+sPk; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="IzLp+sPk" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1743756419; x=1775292419; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aOpNgbxxrQnKNENb/N+cnm855Me/zWHHEymkNL6hEBw=; b=IzLp+sPkhpQVaiagNhRKQq+mf096kFg7eaPALvPU3hGmNW9ypDl3Nc4k kHYOigJOMpOvT0y1VOFvwVHNjT1LkvY1XC8NMyUYfWg2Ckt1WLdfsYXZi M4KtFyiXZH1VFWk6IgOZ1L2bg9ZyP8pMMsAPnbygCVt91Lg9JK53rU2jg 118v+gI4Y/rTqoBmW0P3QBI1QsT7IbaQWpvgrVN6UX3U61xMh+5CDaAHB 9AxzUgkq5ZxWKfHHZC1cMDkpsnj/a29P2qsQSa4zdgu5UiHQAnv+ZIUrl c+BgvF/mmwTkA2naRlIpcl3kw0sycaf9Ckz3j0g2922hDzHBTdpyUCxtM w==; X-CSE-ConnectionGUID: /p9ncmsYSDac6wlWPQeoAg== X-CSE-MsgGUID: VKmAIZXRQm6m2ZOU5ViKTw== X-IronPort-AV: E=McAfee;i="6700,10204,11393"; a="55854607" X-IronPort-AV: E=Sophos;i="6.15,187,1739865600"; d="scan'208";a="55854607" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Apr 2025 01:46:59 -0700 X-CSE-ConnectionGUID: 76eID68tRlWvevBXrMxMlA== X-CSE-MsgGUID: x0CuAt/RSQmKeeEUyNzWaA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,187,1739865600"; d="scan'208";a="164464265" Received: from crojewsk-ctrl.igk.intel.com ([10.237.149.0]) by orviesa001.jf.intel.com with ESMTP; 04 Apr 2025 01:46:57 -0700 From: Cezary Rojewski To: broonie@kernel.org Cc: tiwai@suse.com, perex@perex.cz, amadeuszx.slawinski@linux.intel.com, linux-sound@vger.kernel.org, hdegoede@redhat.com, Cezary Rojewski Subject: [PATCH 7/8] ASoC: Intel: avs: Iterate over correct number of TDMs Date: Fri, 4 Apr 2025 11:03:36 +0200 Message-Id: <20250404090337.3564117-8-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250404090337.3564117-1-cezary.rojewski@intel.com> References: <20250404090337.3564117-1-cezary.rojewski@intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Amadeusz Sławiński When handling TDMs, don't iterate over number of SSP ports, but over possible number of TDMs. Reviewed-by: Cezary Rojewski Signed-off-by: Amadeusz Sławiński Signed-off-by: Cezary Rojewski --- sound/soc/intel/avs/pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c index 7d57a5735157..9dd5215b2c72 100644 --- a/sound/soc/intel/avs/pcm.c +++ b/sound/soc/intel/avs/pcm.c @@ -1406,7 +1406,7 @@ int avs_i2s_platform_register(struct avs_dev *adev, const char *name, unsigned l goto plat_register; for_each_set_bit(i, &port_mask, ssp_count) { - for_each_set_bit(j, &tdms[i], ssp_count) { + for_each_set_bit(j, &tdms[i], AVS_CHANNELS_MAX) { memcpy(dai, &i2s_dai_template, sizeof(*dai)); dai->name = From patchwork Fri Apr 4 09:03:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 14038220 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (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 7EBD01A5B8F for ; Fri, 4 Apr 2025 08:47:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743756423; cv=none; b=NlWeZDptistGnblBy/XzHXAkp4j4UePxbyqMdQIuoBJ+QfMZd+zsABP1ZtcHcoDFRZ3iUI8QWfcaDvmzeIo/IhfaTTWzBhfrwika8CiGHRDC8Go9sITFrGOinh4s4yF0rbQoN9l05VDt22ljDMmEB5o5L30ZPnup31lhJwbMeHU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743756423; c=relaxed/simple; bh=Zpe4UESyi0Rq1FzI7qKGY5CrVJB3C0bJa/dXpslg/eo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=ocAroxYVOCSOok2gd9EiraoW8hqQANFUR88uMUTBOii2SDKwPHNDlsEJEqlejDTj1+DgFgDR0x7wgDqr85ZnJolhhcap8H57IpKCSSya8CQrSmWWwgO7qIQWxN0Z29V6SOn86j6vChwH/0i+vc7riNYPSZkpezh9s2dj+3NbmKU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=asfnOAsP; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="asfnOAsP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1743756421; x=1775292421; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Zpe4UESyi0Rq1FzI7qKGY5CrVJB3C0bJa/dXpslg/eo=; b=asfnOAsP3v3ctWfdqEm+HsA75+IfkUnTlAnUUZeFHwpDNYemMLKTPl6S fQsRhi2uQZMIqQr2MpBePz5ywliaSECBPoXxsOJyK8y/lWbIc5C46zOQJ jc/Lp1f14UbAdBbYeYD3govtPsacMVBW12r6x3fGYZ3u+FuMt5RoS5T/8 oUsTnt5jTYJG9vCW6qxLR0qib9wyzWNCQSgayVcg8/tfWx0ihVLWROv9P zoNYqB3LKj6L4dl2Vp8jRIYwggrOr7giydL5WKO3d+GUhaNpl7KrDybD9 tWAJZ1SNjWYNbejUo1hwCRsQjroyALrHHS1uT8aGxpsva0OSL5qXBRWZs Q==; X-CSE-ConnectionGUID: C0D3Ek/3SeGZ1lgWv/3FGg== X-CSE-MsgGUID: 6IIICwdSRtqh/cEmKd9ryA== X-IronPort-AV: E=McAfee;i="6700,10204,11393"; a="55854613" X-IronPort-AV: E=Sophos;i="6.15,187,1739865600"; d="scan'208";a="55854613" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Apr 2025 01:47:01 -0700 X-CSE-ConnectionGUID: WP9h+MawS1GaFVz/sJFNMA== X-CSE-MsgGUID: R5OQtuPvTFCihay7PhjXgw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,187,1739865600"; d="scan'208";a="164464272" Received: from crojewsk-ctrl.igk.intel.com ([10.237.149.0]) by orviesa001.jf.intel.com with ESMTP; 04 Apr 2025 01:46:59 -0700 From: Cezary Rojewski To: broonie@kernel.org Cc: tiwai@suse.com, perex@perex.cz, amadeuszx.slawinski@linux.intel.com, linux-sound@vger.kernel.org, hdegoede@redhat.com, Cezary Rojewski Subject: [PATCH 8/8] ASoC: Intel: avs: Support 16 TDMs in dynamic assignment Date: Fri, 4 Apr 2025 11:03:37 +0200 Message-Id: <20250404090337.3564117-9-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250404090337.3564117-1-cezary.rojewski@intel.com> References: <20250404090337.3564117-1-cezary.rojewski@intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Amadeusz Sławiński When assigning new widget name there needs to be enough place in buffer to assign name. Reviewed-by: Cezary Rojewski Signed-off-by: Amadeusz Sławiński Signed-off-by: Cezary Rojewski --- sound/soc/intel/avs/topology.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/intel/avs/topology.c b/sound/soc/intel/avs/topology.c index 3c222c352701..f2e4ad8b8e14 100644 --- a/sound/soc/intel/avs/topology.c +++ b/sound/soc/intel/avs/topology.c @@ -1668,8 +1668,8 @@ static int avs_widget_load(struct snd_soc_component *comp, int index, /* See parse_link_formatted_string() for dynamic naming when(s). */ if (avs_mach_singular_tdm(mach, ssp_port)) { - /* size is based on possible %d -> SSP:TDM, where SSP and TDM < 10 + '\0' */ - size_t size = strlen(dw->name) + 2; + /* size is based on possible %d -> SSP:TDM, where SSP and TDM < 16 + '\0' */ + size_t size = strlen(dw->name) + 3; char *buf; tdm_slot = avs_mach_ssp_tdm(mach, ssp_port);