From patchwork Thu Jan 9 12:52:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 13932472 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (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 5D5A81E531 for ; Thu, 9 Jan 2025 12:38:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736426284; cv=none; b=oA6F8lfgkPNyWdDng6qPPiJrY8fa3F034LbB+WXmEvZMe57z1DcPSAZrHgtKo+iPyFLk/aV4FTNSO/Y/srW4SiZtlNxarLP20Pw/45++rsE1N8ypQAqHuZilNRxzwHYf6A+AUTiVqz4H6dLWwkey/17n9jF/sDfoZk0SSDn6O2A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736426284; c=relaxed/simple; bh=NVfIqmO0JXExlYZ7gWv0lOOr3mWwUDJyOFWcaMGhjIc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NanviFGuZ8z4ErmcyusJ1aVRfcKZgkS06VYmm5wo/TAD5MEMN6krHQnYzdMttv4Fj3UfdMpUA7oHGcfFYO45KQLXTFW5uZpbhhFYKcSBwlbO9KylnEPjnG+2HnYHNig1EeN1t6s0fNSO6Ziwe30LZ/zXvNexb7diyiQwIsSMG0E= 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=cSTCfs5W; arc=none smtp.client-ip=198.175.65.14 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="cSTCfs5W" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736426284; x=1767962284; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NVfIqmO0JXExlYZ7gWv0lOOr3mWwUDJyOFWcaMGhjIc=; b=cSTCfs5WkAGNU43stMxVBy4GCR91rxL3j1Wz9bHIfTDuKuQpyXuT3uYQ 2+2c9RlBXt3i15GYduuFvaoScDx6ZQMHVxD40qcPAyY6ZyDHDa3HWGxOz TGJIy4ihLMRPs1A1PUN9vo+iVYg9UUTbqLmd5Y+cS/5di3wTYLhjDp9dt +A5op5qqK5D6tXFs7CGaPvHb2eZHmmSwzPy+MWKG5atsKF5zYSt4ReBqk bxMMXkB0iQVyrc6YJFxGcEGzlE5e8qAJKQZJgBUOYJ1GJItSsHz+fO1sj yBeVDWOdbd3TZocg/a2xXTCKK2Sl9U6h0pMtiMLv3bQ/BDhjpoARJAWJl A==; X-CSE-ConnectionGUID: HDsR6Q/uSd2LnjC1l975Fg== X-CSE-MsgGUID: wBeo8RdQS8CZv2zQja2t7A== X-IronPort-AV: E=McAfee;i="6700,10204,11310"; a="40449779" X-IronPort-AV: E=Sophos;i="6.12,301,1728975600"; d="scan'208";a="40449779" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2025 04:38:01 -0800 X-CSE-ConnectionGUID: in2tJQ2tTuueheSfkm0ycw== X-CSE-MsgGUID: JH/JsAmZTi6N243rrBpy1g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,301,1728975600"; d="scan'208";a="103194325" Received: from crojewsk-ctrl.igk.intel.com ([10.237.149.254]) by fmviesa006.fm.intel.com with ESMTP; 09 Jan 2025 04:37:59 -0800 From: Cezary Rojewski To: tiwai@suse.com Cc: linux-sound@vger.kernel.org, broonie@kernel.org, perex@perex.cz, amadeuszx.slawinski@linux.intel.com, Cezary Rojewski Subject: [PATCH 1/3] ALSA: hda: Fix compilation of snd_hdac_adsp_xxx() helpers Date: Thu, 9 Jan 2025 13:52:02 +0100 Message-Id: <20250109125204.3668961-2-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250109125204.3668961-1-cezary.rojewski@intel.com> References: <20250109125204.3668961-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 The snd_hdac_adsp_xxx() wrap snd_hdac_reg_xxx() helpers to simplify register access for AudioDSP drivers e.g.: the avs-driver. Byte- and word-variants of said helps do not expand to bare readx/writex() operations but functions instead and, due to pointer type incompatibility, cause compilation to fail. As AudioDSP drivers e.g.: the avs-driver utilize struct hda_bus (and thus struct hdac_bus) as the base structure, add casts to address the problem. Fixes: c19bd02e9029 ("ALSA: hda: Add helper macros for DSP capable devices") Signed-off-by: Cezary Rojewski --- include/sound/hdaudio_ext.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/include/sound/hdaudio_ext.h b/include/sound/hdaudio_ext.h index 957295364a5e..79a010dd0062 100644 --- a/include/sound/hdaudio_ext.h +++ b/include/sound/hdaudio_ext.h @@ -120,21 +120,21 @@ int snd_hdac_ext_bus_link_put(struct hdac_bus *bus, struct hdac_ext_link *hlink) void snd_hdac_ext_bus_link_power(struct hdac_device *codec, bool enable); #define snd_hdac_adsp_writeb(chip, reg, value) \ - snd_hdac_reg_writeb(chip, (chip)->dsp_ba + (reg), value) + snd_hdac_reg_writeb((struct hdac_bus *)(chip), (chip)->dsp_ba + (reg), value) #define snd_hdac_adsp_readb(chip, reg) \ - snd_hdac_reg_readb(chip, (chip)->dsp_ba + (reg)) + snd_hdac_reg_readb((struct hdac_bus *)(chip), (chip)->dsp_ba + (reg)) #define snd_hdac_adsp_writew(chip, reg, value) \ - snd_hdac_reg_writew(chip, (chip)->dsp_ba + (reg), value) + snd_hdac_reg_writew((struct hdac_bus *)(chip), (chip)->dsp_ba + (reg), value) #define snd_hdac_adsp_readw(chip, reg) \ - snd_hdac_reg_readw(chip, (chip)->dsp_ba + (reg)) + snd_hdac_reg_readw((struct hdac_bus *)(chip), (chip)->dsp_ba + (reg)) #define snd_hdac_adsp_writel(chip, reg, value) \ - snd_hdac_reg_writel(chip, (chip)->dsp_ba + (reg), value) + snd_hdac_reg_writel((struct hdac_bus *)(chip), (chip)->dsp_ba + (reg), value) #define snd_hdac_adsp_readl(chip, reg) \ - snd_hdac_reg_readl(chip, (chip)->dsp_ba + (reg)) + snd_hdac_reg_readl((struct hdac_bus *)(chip), (chip)->dsp_ba + (reg)) #define snd_hdac_adsp_writeq(chip, reg, value) \ - snd_hdac_reg_writeq(chip, (chip)->dsp_ba + (reg), value) + snd_hdac_reg_writeq((struct hdac_bus *)(chip), (chip)->dsp_ba + (reg), value) #define snd_hdac_adsp_readq(chip, reg) \ - snd_hdac_reg_readq(chip, (chip)->dsp_ba + (reg)) + snd_hdac_reg_readq((struct hdac_bus *)(chip), (chip)->dsp_ba + (reg)) #define snd_hdac_adsp_updateb(chip, reg, mask, val) \ snd_hdac_adsp_writeb(chip, reg, \ From patchwork Thu Jan 9 12:52:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 13932473 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (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 77BD7217667 for ; Thu, 9 Jan 2025 12:38:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736426285; cv=none; b=GwPzo0ZeqHYq1NHZ7rKbfII9+//1yHf1ZBlvi77Pa0qDhz5gNpbTHJo3Lf8sUm00sHy29DSKvFzoQh+y/LqAAdfTFmupcy0JuaSuAOyyltpfJ2hbS5haauBvEHsbSMjWcnWO+80ji8iYKh4MwAcVkL01poUwDpj8SKGv6qGMdfA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736426285; c=relaxed/simple; bh=QQ93ztWZgVFjryLO/cktX+Up93zJbTepRuaL/pLm7hE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jgOvi1H/riud5FC0SeqC9Ww6i/CaF75zhqzwe/n+8Ccgam0lYN3iOCf68HoFEszQFbZypo7l14ptX4fcxfJ1W2PmuUPpKih0QloHGIWqt7tpArXjwvYv2x0wkEbA12wGGycM4tTHP2h+LCsyyKgrSVWdv8X8Pxr1fnAacZNPzxM= 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=M16AqScW; arc=none smtp.client-ip=198.175.65.14 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="M16AqScW" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736426284; x=1767962284; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QQ93ztWZgVFjryLO/cktX+Up93zJbTepRuaL/pLm7hE=; b=M16AqScWI8HBDd4WKfRPL5wMRvZvf3NqYeCkNOi4UZTuUb2ZLtAtBfln Bmd5zaZ3izxUrHlJxnQfEaZAzFP5zFAtOVwPW3+7VFeFjiklBuZeeSaDv 3DfvW2TdMpXDWzqHOWnHPV677KV4P/WkwPeflViW7b0EOPrzO4kOIpjxG uFHe07rc3tYCS0Smm36HYlF6lAfRxylt552q4+AUifJzAPJuSKKNqxOds P3/XUGSOMuqJInA7OZ/oTfU5kSNUodI/KkxAICgFkMeG14F7H5Q7PFJCb LJ9ECtqK1WOAyY3naYWb1IqGoP+vd50CssWakgtoGEZPYtjGM9h9or2lT Q==; X-CSE-ConnectionGUID: ZVrkyU/mQsWr9i3CZpQNPg== X-CSE-MsgGUID: BWWxqcTWQC6/6yxKPiTg8A== X-IronPort-AV: E=McAfee;i="6700,10204,11310"; a="40449789" X-IronPort-AV: E=Sophos;i="6.12,301,1728975600"; d="scan'208";a="40449789" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2025 04:38:03 -0800 X-CSE-ConnectionGUID: EpCJ11sPSj+8rDBPKsjR0A== X-CSE-MsgGUID: XIXKgLHFRXOj4aWA8xtnTw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,301,1728975600"; d="scan'208";a="103194348" Received: from crojewsk-ctrl.igk.intel.com ([10.237.149.254]) by fmviesa006.fm.intel.com with ESMTP; 09 Jan 2025 04:38:01 -0800 From: Cezary Rojewski To: tiwai@suse.com Cc: linux-sound@vger.kernel.org, broonie@kernel.org, perex@perex.cz, amadeuszx.slawinski@linux.intel.com, Cezary Rojewski Subject: [PATCH 2/3] ALSA: hda: Transfer firmware in two chunks Date: Thu, 9 Jan 2025 13:52:03 +0100 Message-Id: <20250109125204.3668961-3-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250109125204.3668961-1-cezary.rojewski@intel.com> References: <20250109125204.3668961-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 specification, SDxLVI shall be at least 1 i.e.: two chunks to perform a valid transfer. This is true for the PCM transfer code but not firmware-transfer one. Technical background: - the LVI > 0 rule shall be obeyed in PCM transfer - HW permits LVI == 0 when transfer is SW-controlled (SPIB) - FW download is not a PCM transfer and is SW-controlled (SPIB) The above is the fundament which AudioDSP firmware loading functions have been built upon and worked since 2016. The presented changes are to align the loading flows and avoid rising more questions in the future. Signed-off-by: Cezary Rojewski --- sound/hda/hdac_stream.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/hda/hdac_stream.c b/sound/hda/hdac_stream.c index 2670792f43b4..18d74a28a246 100644 --- a/sound/hda/hdac_stream.c +++ b/sound/hda/hdac_stream.c @@ -455,6 +455,7 @@ static int setup_bdle(struct hdac_bus *bus, struct hdac_stream *azx_dev, __le32 **bdlp, int ofs, int size, int with_ioc) { + u32 bdle_size = size / 2; __le32 *bdl = *bdlp; while (size > 0) { @@ -469,7 +470,7 @@ static int setup_bdle(struct hdac_bus *bus, bdl[0] = cpu_to_le32((u32)addr); bdl[1] = cpu_to_le32(upper_32_bits(addr)); /* program the size field of the BDL entry */ - chunk = snd_sgbuf_get_chunk_size(dmab, ofs, size); + chunk = snd_sgbuf_get_chunk_size(dmab, ofs, bdle_size); /* one BDLE cannot cross 4K boundary on CTHDA chips */ if (bus->align_bdle_4k) { u32 remain = 0x1000 - (ofs & 0xfff); From patchwork Thu Jan 9 12:52:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 13932474 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (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 CF940217668 for ; Thu, 9 Jan 2025 12:38:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736426286; cv=none; b=D4Ikw824KQaV3HcCBJwrTWmzCkFO/JII1wt35SODgG1EKTpmMpFRKXNrMQlJdrNaPNgktwGna2VEcA8KM1KTbV7y11W8T95yE+hrIMzYpZLGAImocwtgoC/U0sAlsDRMskXKkErnze5xMn4O/hqSdUwNv4e3zlOyREIRR0tR45s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736426286; c=relaxed/simple; bh=l2zrBulFLMUNmXK8A8FxgFjLViM7ne+P/mUgPIQzjFI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=CCL0kqgCBC3V1ZkVk99XLcEBg5v12cVtuEENypL3c3RQF4FPL60cDDIZHDH2+5NsCuP/WvtfInsZWzoCrsW19RgJe45a+OWimRptZQ1BK4CAQItfSkwl5NL4FcHn7Nw2I+w99yeuig1B9Hq3dbDgI1S+oRQQsOq08TEj3jGXPEg= 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=jh+XZHGf; arc=none smtp.client-ip=198.175.65.14 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="jh+XZHGf" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1736426285; x=1767962285; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=l2zrBulFLMUNmXK8A8FxgFjLViM7ne+P/mUgPIQzjFI=; b=jh+XZHGfbBvcIPyf0DG4LaBgkn/eohYlgbQvw7bG1dDIS4JXAcmYjRpl +W0DmSWGTFtLb7ur5uoi19DMbDpUbAio6ZpjmOKcEqR2labyHkAQqHFyg IUISrs/a7+bNiNhFTKH0XGtIRniOjhlY+nFArdG/MASEUZkewdRZi97x7 S7Sy0hnoPhqb6utsRi/dK3nKRjH/4BbXxQ0N61ixoeLz3QJD8FY12kyng aSm80XwzzA5BDzj+AtXYgxh4u9Eq/7vAWsdMWKFzS/OZvVba5znzlNSBv fyY1nFJyLNoQcLPXhuCOWAmkvWFnEmnMGKjRHQiddgcI1i/AOlTdfrNg7 A==; X-CSE-ConnectionGUID: S1ONI6SESiinb4rjI3kATQ== X-CSE-MsgGUID: nMUJ2J5fSmyV5YAAELHBBQ== X-IronPort-AV: E=McAfee;i="6700,10204,11310"; a="40449794" X-IronPort-AV: E=Sophos;i="6.12,301,1728975600"; d="scan'208";a="40449794" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2025 04:38:05 -0800 X-CSE-ConnectionGUID: VnAJdbZDSDGWsoegsx4CyQ== X-CSE-MsgGUID: /ShiI/amQtqI9S3y688z5A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,301,1728975600"; d="scan'208";a="103194363" Received: from crojewsk-ctrl.igk.intel.com ([10.237.149.254]) by fmviesa006.fm.intel.com with ESMTP; 09 Jan 2025 04:38:03 -0800 From: Cezary Rojewski To: tiwai@suse.com Cc: linux-sound@vger.kernel.org, broonie@kernel.org, perex@perex.cz, amadeuszx.slawinski@linux.intel.com, Cezary Rojewski Subject: [PATCH 3/3] ALSA: control: Fix argument type mismatch Date: Thu, 9 Jan 2025 13:52:04 +0100 Message-Id: <20250109125204.3668961-4-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250109125204.3668961-1-cezary.rojewski@intel.com> References: <20250109125204.3668961-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 strscpy() expects argument of type "char *", not "unsigned char *". Found out by Coverity static analyzer. Fixes: 68fa05d4a82b ("ALSA: control: Introduce snd_ctl_find_id_mixer()") Signed-off-by: Cezary Rojewski --- include/sound/control.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/sound/control.h b/include/sound/control.h index e07f6b960641..f7e18a1d144f 100644 --- a/include/sound/control.h +++ b/include/sound/control.h @@ -161,7 +161,7 @@ snd_ctl_find_id_mixer(struct snd_card *card, const char *name) struct snd_ctl_elem_id id = {}; id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; - strscpy(id.name, name, sizeof(id.name)); + strscpy((char *)id.name, name, sizeof(id.name)); return snd_ctl_find_id(card, &id); }