From patchwork Thu Dec 16 11:57:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 12680865 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C5557C433F5 for ; Thu, 16 Dec 2021 11:57:03 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 14A8D1B56; Thu, 16 Dec 2021 12:56:12 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 14A8D1B56 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1639655822; bh=YtnmP6+HKJ2lDHhBkQ45AXl3aMknl9BzQG4vhz+CIHw=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=cTv+W8htSx5B6Dumtkpcm2iAWSUhzf/0XKavuayIg8M+x4k3K1/SLMNdSf+67742K 58TWkWriNqDj+TJInPNU9cijS2zZwKdxEgswj29HxOPLNO4DQmxZe8LfET0aqVetFs 35r+AVEK+UHvEDDy5FKEHFZDsoCQaFLhRV0noWd4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 80D77F8015B; Thu, 16 Dec 2021 12:56:11 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7EE73F8016E; Thu, 16 Dec 2021 12:56:09 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 38B35F800B0 for ; Thu, 16 Dec 2021 12:56:04 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 38B35F800B0 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="amjmxq2a" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1639655767; x=1671191767; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YtnmP6+HKJ2lDHhBkQ45AXl3aMknl9BzQG4vhz+CIHw=; b=amjmxq2aWnF/ZtF9BXB7GcsZfO6NjZqwKrPMpSLTbpubHc5qz+WFiUeg Du9od6zy+HAQePtOGm2HYerldRWckc/SgM6AC365H24vOkHXd/KT4xnEf O1jLjknkITB0TYFintQ+k7t/MsWC1ZGasc78dpauToVE46sGa0shTv8j+ J6prdp6DzskOtFxvohxqs7F/GruoOaXjVOH66clBfEbItXQd8QYJivI0+ cBhAdiYKB8NRQopIxwUp+PKlLDacRIsnnch69McJEwCG9gidGGsyvyxdi FVPdOSzx50Tes/68TpQP6fx8mrhtfQyqK5hptlzmOig5wYMMETNes5CJR A==; X-IronPort-AV: E=McAfee;i="6200,9189,10199"; a="239692037" X-IronPort-AV: E=Sophos;i="5.88,211,1635231600"; d="scan'208";a="239692037" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Dec 2021 03:56:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,211,1635231600"; d="scan'208";a="506248419" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by orsmga007.jf.intel.com with ESMTP; 16 Dec 2021 03:55:59 -0800 From: Cezary Rojewski To: alsa-devel@alsa-project.org Subject: [PATCH 1/5] ASoC: Intel: catpt: Test dmaengine_submit() result before moving on Date: Thu, 16 Dec 2021 12:57:39 +0100 Message-Id: <20211216115743.2130622-2-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211216115743.2130622-1-cezary.rojewski@intel.com> References: <20211216115743.2130622-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Cc: Kevin Tian , Cezary Rojewski , broonie@kernel.org, Dave Jiang , tiwai@suse.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" After calling dmaengine_submit(), the submitted transfer descriptor belongs to the DMA engine. Pointer to that descriptor may no longer be valid after the call and should be tested before awaiting transfer completion. Reported-by: Kevin Tian Suggested-by: Dave Jiang Fixes: 4fac9b31d0b9 ("ASoC: Intel: Add catpt base members") Signed-off-by: Cezary Rojewski --- sound/soc/intel/catpt/dsp.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sound/soc/intel/catpt/dsp.c b/sound/soc/intel/catpt/dsp.c index 9c5fd18f2600..346bec000306 100644 --- a/sound/soc/intel/catpt/dsp.c +++ b/sound/soc/intel/catpt/dsp.c @@ -65,6 +65,7 @@ static int catpt_dma_memcpy(struct catpt_dev *cdev, struct dma_chan *chan, { struct dma_async_tx_descriptor *desc; enum dma_status status; + int ret; desc = dmaengine_prep_dma_memcpy(chan, dst_addr, src_addr, size, DMA_CTRL_ACK); @@ -77,13 +78,22 @@ static int catpt_dma_memcpy(struct catpt_dev *cdev, struct dma_chan *chan, catpt_updatel_shim(cdev, HMDC, CATPT_HMDC_HDDA(CATPT_DMA_DEVID, chan->chan_id), CATPT_HMDC_HDDA(CATPT_DMA_DEVID, chan->chan_id)); - dmaengine_submit(desc); + + ret = dma_submit_error(dmaengine_submit(desc)); + if (ret) { + dev_err(cdev->dev, "submit tx failed: %d\n", ret); + goto clear_hdda; + } + status = dma_wait_for_async_tx(desc); + ret = (status == DMA_COMPLETE) ? 0 : -EPROTO; + +clear_hdda: /* regardless of status, disable access to HOST memory in demand mode */ catpt_updatel_shim(cdev, HMDC, CATPT_HMDC_HDDA(CATPT_DMA_DEVID, chan->chan_id), 0); - return (status == DMA_COMPLETE) ? 0 : -EPROTO; + return ret; } int catpt_dma_memcpy_todsp(struct catpt_dev *cdev, struct dma_chan *chan, From patchwork Thu Dec 16 11:57:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 12680869 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BA37FC433F5 for ; Thu, 16 Dec 2021 11:57:54 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id EEA4E1E72; Thu, 16 Dec 2021 12:57:02 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz EEA4E1E72 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1639655873; bh=L3dXPB6xC9umFovRHn3/BXBj2TeY/SOLQYJKF+fyMpM=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=sDRUNCnbgFmqpcZ7KdX7+jMjB9uaN0PO3/Alq0+D93D5L3ZCzh/lvZP4KYBQFtw9R 41mutWapM7kVOWs8wJMImz4xLfwprcVLr0rAInksGk22RqeeiXurN4dZ8jlMCqXIDW KwzukvOqrM2VKukJI+5nX0ylkJrFkCS/XRAhYrk8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E8530F80311; Thu, 16 Dec 2021 12:56:13 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D1291F8047B; Thu, 16 Dec 2021 12:56:12 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id B41CAF8014C for ; Thu, 16 Dec 2021 12:56:05 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B41CAF8014C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ZBxXAunN" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1639655768; x=1671191768; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=L3dXPB6xC9umFovRHn3/BXBj2TeY/SOLQYJKF+fyMpM=; b=ZBxXAunNUIZDlYs3vKVt9eMxCmECDtMyYOkswO+bOS3/4iF1WeFVto8M EOVU6MJuDiS+rBWu2ejYmYG7Ox6Kc3MbxvMazGun6p7dEXJYAGZ/QoHZT SJZg6mmqbZwRz79o0VHOiqcPoyyigMCfLXClCfjCvVpqtl8Lg5Qp31E1i 2t6PePVKILK2V6SUKx437puDGLbHshMXrrT9Gc6RE/TvMkxtUmwq3CmPN 0y8J73emm9hfMtGFvhe73T3nMZWiZ9h2IBNLNtRrYOTvjwnCmAgWich1A S9IMBe3w1JO9y9yfzEs7bD+GFuqX9Ww0X5FMqIJdeS5GikOdCN1NBtHp3 g==; X-IronPort-AV: E=McAfee;i="6200,9189,10199"; a="239692039" X-IronPort-AV: E=Sophos;i="5.88,211,1635231600"; d="scan'208";a="239692039" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Dec 2021 03:56:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,211,1635231600"; d="scan'208";a="506248427" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by orsmga007.jf.intel.com with ESMTP; 16 Dec 2021 03:56:00 -0800 From: Cezary Rojewski To: alsa-devel@alsa-project.org Subject: [PATCH 2/5] ASoC: Intel: catpt: Reduce size of catpt_component_open() Date: Thu, 16 Dec 2021 12:57:40 +0100 Message-Id: <20211216115743.2130622-3-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211216115743.2130622-1-cezary.rojewski@intel.com> References: <20211216115743.2130622-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , broonie@kernel.org, tiwai@suse.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" With some improved if-logy, function's size can be reduced slightly. Signed-off-by: Cezary Rojewski --- sound/soc/intel/catpt/pcm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sound/soc/intel/catpt/pcm.c b/sound/soc/intel/catpt/pcm.c index ebb27daeb1c7..16146c693c08 100644 --- a/sound/soc/intel/catpt/pcm.c +++ b/sound/soc/intel/catpt/pcm.c @@ -595,9 +595,8 @@ static int catpt_component_open(struct snd_soc_component *component, { struct snd_soc_pcm_runtime *rtm = substream->private_data; - if (rtm->dai_link->no_pcm) - return 0; - snd_soc_set_runtime_hwparams(substream, &catpt_pcm_hardware); + if (!rtm->dai_link->no_pcm) + snd_soc_set_runtime_hwparams(substream, &catpt_pcm_hardware); return 0; } From patchwork Thu Dec 16 11:57:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 12680873 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2D97BC433F5 for ; Thu, 16 Dec 2021 11:58:29 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 737E31EDE; Thu, 16 Dec 2021 12:57:37 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 737E31EDE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1639655907; bh=AbK7Yq7+uugQLKla80wDQhfAnMDVnoH/1TFs7lVnlIQ=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=hnddMfyjwpW79BC73zMzXg2ulu6LurCjlbO4FVAQcgI5dWC38m6aDcI5o4/im9ZtF uiY9z0WKWiai4dBiy4aE1fQpQk1PpuO/xSOkj934obED/73zdJBiQmzeWRwtbk7tPI BVketwDH+hCDX8KoUlq14oSp0NeGfYqG2i92z+Mw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 17C54F804CA; Thu, 16 Dec 2021 12:56:17 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 67109F80116; Thu, 16 Dec 2021 12:56:15 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 72B1CF80116 for ; Thu, 16 Dec 2021 12:56:08 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 72B1CF80116 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="JU0R67+h" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1639655769; x=1671191769; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AbK7Yq7+uugQLKla80wDQhfAnMDVnoH/1TFs7lVnlIQ=; b=JU0R67+hhSijBnEjl78S3ME3uE66ZWP5Jq8BhgTwF+KZXU4BQZxeit5p YcELwdOw/+CriN5r3pD5OygiNK229+M5/CYx2eTrbRpaYglF+BPSFeww7 6O7uzPuWBw0V7kcT2TywzsUO500pRD/Pnw45QrkyywE5b8/Fu+VqpPF/e l4auyMtJvpx4fN5CqvRdNPSYF6zmBYsgfYh6lcC/WrzUu4S7iOimdFVgt NMCIseNT7qIztmthNXHbRT84RoxLjeTB8Z7PSytA709vEW8hrYbhSfGHM D4mhbJ0LWpfmC2+s1oGPSImAlnWOet3/s52Tus7PmdgEnKamjDVdrAe4F Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10199"; a="239692042" X-IronPort-AV: E=Sophos;i="5.88,211,1635231600"; d="scan'208";a="239692042" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Dec 2021 03:56:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,211,1635231600"; d="scan'208";a="506248439" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by orsmga007.jf.intel.com with ESMTP; 16 Dec 2021 03:56:02 -0800 From: Cezary Rojewski To: alsa-devel@alsa-project.org Subject: [PATCH 3/5] ASoC: Intel: catpt: Streamline locals declaration for PCM-functions Date: Thu, 16 Dec 2021 12:57:41 +0100 Message-Id: <20211216115743.2130622-4-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211216115743.2130622-1-cezary.rojewski@intel.com> References: <20211216115743.2130622-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , broonie@kernel.org, tiwai@suse.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Group all the catpt_xxx structs together in PCM related functions so they look more cohesive. Signed-off-by: Cezary Rojewski --- sound/soc/intel/catpt/pcm.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/sound/soc/intel/catpt/pcm.c b/sound/soc/intel/catpt/pcm.c index 16146c693c08..939a9b801dec 100644 --- a/sound/soc/intel/catpt/pcm.c +++ b/sound/soc/intel/catpt/pcm.c @@ -259,9 +259,9 @@ static enum catpt_channel_config catpt_get_channel_config(u32 num_channels) static int catpt_dai_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - struct catpt_dev *cdev = dev_get_drvdata(dai->dev); struct catpt_stream_template *template; struct catpt_stream_runtime *stream; + struct catpt_dev *cdev = dev_get_drvdata(dai->dev); struct resource *res; int ret; @@ -306,8 +306,8 @@ static int catpt_dai_startup(struct snd_pcm_substream *substream, static void catpt_dai_shutdown(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - struct catpt_dev *cdev = dev_get_drvdata(dai->dev); struct catpt_stream_runtime *stream; + struct catpt_dev *cdev = dev_get_drvdata(dai->dev); stream = snd_soc_dai_get_dma_data(dai, substream); @@ -329,9 +329,9 @@ static int catpt_set_dspvol(struct catpt_dev *cdev, u8 stream_id, long *ctlvol); static int catpt_dai_apply_usettings(struct snd_soc_dai *dai, struct catpt_stream_runtime *stream) { - struct catpt_dev *cdev = dev_get_drvdata(dai->dev); struct snd_soc_component *component = dai->component; struct snd_kcontrol *pos; + struct catpt_dev *cdev = dev_get_drvdata(dai->dev); const char *name; int ret; u32 id = stream->info.stream_hw_id; @@ -374,12 +374,12 @@ static int catpt_dai_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { - struct catpt_dev *cdev = dev_get_drvdata(dai->dev); + struct snd_pcm_runtime *rtm = substream->runtime; + struct snd_dma_buffer *dmab; struct catpt_stream_runtime *stream; struct catpt_audio_format afmt; struct catpt_ring_info rinfo; - struct snd_pcm_runtime *rtm = substream->runtime; - struct snd_dma_buffer *dmab; + struct catpt_dev *cdev = dev_get_drvdata(dai->dev); int ret; stream = snd_soc_dai_get_dma_data(dai, substream); @@ -427,8 +427,8 @@ static int catpt_dai_hw_params(struct snd_pcm_substream *substream, static int catpt_dai_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - struct catpt_dev *cdev = dev_get_drvdata(dai->dev); struct catpt_stream_runtime *stream; + struct catpt_dev *cdev = dev_get_drvdata(dai->dev); stream = snd_soc_dai_get_dma_data(dai, substream); if (!stream->allocated) @@ -444,8 +444,8 @@ static int catpt_dai_hw_free(struct snd_pcm_substream *substream, static int catpt_dai_prepare(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { - struct catpt_dev *cdev = dev_get_drvdata(dai->dev); struct catpt_stream_runtime *stream; + struct catpt_dev *cdev = dev_get_drvdata(dai->dev); int ret; stream = snd_soc_dai_get_dma_data(dai, substream); @@ -467,9 +467,9 @@ static int catpt_dai_prepare(struct snd_pcm_substream *substream, static int catpt_dai_trigger(struct snd_pcm_substream *substream, int cmd, struct snd_soc_dai *dai) { - struct catpt_dev *cdev = dev_get_drvdata(dai->dev); - struct catpt_stream_runtime *stream; struct snd_pcm_runtime *runtime = substream->runtime; + struct catpt_stream_runtime *stream; + struct catpt_dev *cdev = dev_get_drvdata(dai->dev); snd_pcm_uframes_t pos; int ret; @@ -604,10 +604,10 @@ static snd_pcm_uframes_t catpt_component_pointer(struct snd_soc_component *component, struct snd_pcm_substream *substream) { - struct catpt_dev *cdev = dev_get_drvdata(component->dev); - struct catpt_stream_runtime *stream; struct snd_soc_pcm_runtime *rtm = substream->private_data; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtm, 0); + struct catpt_stream_runtime *stream; + struct catpt_dev *cdev = dev_get_drvdata(component->dev); u32 pos; if (rtm->dai_link->no_pcm) @@ -632,8 +632,8 @@ static int catpt_dai_pcm_new(struct snd_soc_pcm_runtime *rtm, struct snd_soc_dai *dai) { struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtm, 0); - struct catpt_dev *cdev = dev_get_drvdata(dai->dev); struct catpt_ssp_device_format devfmt; + struct catpt_dev *cdev = dev_get_drvdata(dai->dev); int ret; devfmt.iface = dai->driver->id; @@ -893,8 +893,8 @@ static int catpt_stream_volume_get(struct snd_kcontrol *kcontrol, { struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); - struct catpt_dev *cdev = dev_get_drvdata(component->dev); struct catpt_stream_runtime *stream; + struct catpt_dev *cdev = dev_get_drvdata(component->dev); long *ctlvol = (long *)kcontrol->private_value; u32 dspvol; int i; @@ -925,8 +925,8 @@ static int catpt_stream_volume_put(struct snd_kcontrol *kcontrol, { struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); - struct catpt_dev *cdev = dev_get_drvdata(component->dev); struct catpt_stream_runtime *stream; + struct catpt_dev *cdev = dev_get_drvdata(component->dev); long *ctlvol = (long *)kcontrol->private_value; int ret, i; @@ -1001,8 +1001,8 @@ static int catpt_loopback_switch_put(struct snd_kcontrol *kcontrol, { struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); - struct catpt_dev *cdev = dev_get_drvdata(component->dev); struct catpt_stream_runtime *stream; + struct catpt_dev *cdev = dev_get_drvdata(component->dev); bool mute; int ret; From patchwork Thu Dec 16 11:57:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 12680875 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A6A66C433EF for ; Thu, 16 Dec 2021 11:58:49 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E58211EFA; Thu, 16 Dec 2021 12:57:57 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E58211EFA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1639655928; bh=b4fOgYkgfI/QPD5h48SZB39Mp6dXojW/25RhRhJnxuU=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ay41kfG/cpV8kA8DkIK7UkgmQBFu/fynp21xSp7qpajFoVRKdmcLPfMttI/W0ry9a OWz6PWqNYk6jEAi6PtDvyUQwGALMFKEiJzbYll7/KJXN0FSoBQABV+ba3bmf2moVOR hVas6XmnvAqAQNBSFXV3rF1wzbhMgjosuTvR1Nrw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 32DDCF80517; Thu, 16 Dec 2021 12:56:19 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6E982F8050F; Thu, 16 Dec 2021 12:56:17 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 31E25F800B0 for ; Thu, 16 Dec 2021 12:56:09 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 31E25F800B0 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="UpjC6vQZ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1639655770; x=1671191770; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=b4fOgYkgfI/QPD5h48SZB39Mp6dXojW/25RhRhJnxuU=; b=UpjC6vQZhbEFV1p8gJVLQdPBvdA9PT+7+33G2YFJZquJLPKiGsqGjlIS mMtBEy7lOYLvPjv5kELCJM/U1hT2TSW+Lt8BETklizBF9trAh3zOE3DFZ 8BbOsEzpvnOcikq6ydRpup+u7TLOkrqfd4lvSdFwNrc1MwL8NlvB6iEWg J+ZVlYuLtPLso/q0yPhdBSFEC4K1PU4n3bMUqMPm25Z41PkYJRD/VfkAO wgLBkRb0Zh3FCzGVMOIfQvCjMXwwU32cE8HL6IBFkiGvlIWQvpwL69J0L kbR6PzHR7xIpXgwYtD/jabDt9UJMX/nh/8P6GAeTSNymF9rYppLgxfUiY g==; X-IronPort-AV: E=McAfee;i="6200,9189,10199"; a="239692046" X-IronPort-AV: E=Sophos;i="5.88,211,1635231600"; d="scan'208";a="239692046" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Dec 2021 03:56:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,211,1635231600"; d="scan'208";a="506248449" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by orsmga007.jf.intel.com with ESMTP; 16 Dec 2021 03:56:03 -0800 From: Cezary Rojewski To: alsa-devel@alsa-project.org Subject: [PATCH 4/5] ASoC: Intel: catpt: Drop SND_SOC_ACPI_INTEL_MATCH dependency Date: Thu, 16 Dec 2021 12:57:42 +0100 Message-Id: <20211216115743.2130622-5-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211216115743.2130622-1-cezary.rojewski@intel.com> References: <20211216115743.2130622-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , broonie@kernel.org, tiwai@suse.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" catpt-driver does not make use of most of the fields found in the descriptor table and is the sole user of haswell machines list. Move the tables to local directory and clean them up so it's clear what's actually used by the solution. Signed-off-by: Cezary Rojewski --- sound/soc/intel/Kconfig | 2 +- sound/soc/intel/catpt/device.c | 33 ++++++++++++++++++++++++++++++--- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig index f3a4a907b29d..0423009a186e 100644 --- a/sound/soc/intel/Kconfig +++ b/sound/soc/intel/Kconfig @@ -23,7 +23,7 @@ config SND_SOC_INTEL_CATPT depends on ACPI || COMPILE_TEST depends on DMADEVICES && SND_DMA_SGBUF select DW_DMAC_CORE - select SND_SOC_ACPI_INTEL_MATCH + select SND_SOC_ACPI select WANT_DEV_COREDUMP select SND_INTEL_DSP_CONFIG help diff --git a/sound/soc/intel/catpt/device.c b/sound/soc/intel/catpt/device.c index 85a34e37316d..81c7cb94b68b 100644 --- a/sound/soc/intel/catpt/device.c +++ b/sound/soc/intel/catpt/device.c @@ -22,7 +22,6 @@ #include #include #include -#include #include "core.h" #include "registers.h" @@ -313,8 +312,36 @@ static int catpt_acpi_remove(struct platform_device *pdev) return 0; } +struct snd_soc_acpi_mach lpt_machines[] = { + { + .id = "INT33CA", + .drv_name = "haswell-audio", + }, + {} +}; + +struct snd_soc_acpi_mach wpt_machines[] = { + { + .id = "INT343A", + .drv_name = "broadwell-audio", + }, + { + .id = "10EC5650", + .drv_name = "bdw-rt5650", + }, + { + .id = "RT5677CE", + .drv_name = "bdw-rt5677", + }, + { + .id = "INT33CA", + .drv_name = "haswell-audio", + }, + {} +}; + static struct catpt_spec lpt_desc = { - .machines = snd_soc_acpi_intel_haswell_machines, + .machines = lpt_machines, .core_id = 0x01, .host_dram_offset = 0x000000, .host_iram_offset = 0x080000, @@ -329,7 +356,7 @@ static struct catpt_spec lpt_desc = { }; static struct catpt_spec wpt_desc = { - .machines = snd_soc_acpi_intel_broadwell_machines, + .machines = wpt_machines, .core_id = 0x02, .host_dram_offset = 0x000000, .host_iram_offset = 0x0A0000, From patchwork Thu Dec 16 11:57:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cezary Rojewski X-Patchwork-Id: 12680871 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CFC75C433EF for ; Thu, 16 Dec 2021 11:58:11 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 275401B58; Thu, 16 Dec 2021 12:57:20 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 275401B58 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1639655890; bh=QCUlNNClbiodoJD4nyQY/GfOfPcuGL7EpggYFxq6uM0=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Vb1YwJZLwdmvN+Vgm107vz6tIKivAfmq4pc+PIkFfQNjD4JRkkHJaEQGmGgkqQoDs pJJU0HZ/yn7VR5mhVe8Fny4pAch1Q0C6K/XL+hGvS5zLA/MtxiAHMg8u2lCujUYE+u nn6Xy5oBgXluYzfeTp/PUDWx4EqPBDVVEaoULS+w= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 85032F80116; Thu, 16 Dec 2021 12:56:16 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A3850F8047D; Thu, 16 Dec 2021 12:56:14 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A7576F800DE for ; Thu, 16 Dec 2021 12:56:09 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A7576F800DE Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="j3BKnl+m" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1639655770; x=1671191770; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QCUlNNClbiodoJD4nyQY/GfOfPcuGL7EpggYFxq6uM0=; b=j3BKnl+m1V1nqEHqspjYRQ+IsNZ8M0MXq7jiF6jcTLMjQW/roTXQrJCl u8XcNVdleSwpLDHpWgmXGlJ1yzSc7q57/BhIKF9Knzel5ZlTApEUtmaMj EdbwBuk4wopZYDprsIftll3w/G8a9lFMKdSeoYcPP81pVOd+OEkd74yY9 3QycUsHIwzlcAZ9cYowtihXKDXivN3kfCjIzWwdtfATlevI6zAifb2ts2 +zY5NnaZmyiJLN0l67WPjQxJ2rlaLEjO+0oR18ZU47lmwiiahNRKn588V At6BFg0btNQ2pB3/u/xNv9lw7fLQXi7XRDpXwQOTM/g4PjBrTZZrrb60K g==; X-IronPort-AV: E=McAfee;i="6200,9189,10199"; a="239692052" X-IronPort-AV: E=Sophos;i="5.88,211,1635231600"; d="scan'208";a="239692052" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Dec 2021 03:56:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,211,1635231600"; d="scan'208";a="506248461" Received: from crojewsk-ctrl.igk.intel.com ([10.102.9.28]) by orsmga007.jf.intel.com with ESMTP; 16 Dec 2021 03:56:05 -0800 From: Cezary Rojewski To: alsa-devel@alsa-project.org Subject: [PATCH 5/5] ASoC: Intel: Drop legacy HSW/BDW board-match information Date: Thu, 16 Dec 2021 12:57:43 +0100 Message-Id: <20211216115743.2130622-6-cezary.rojewski@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211216115743.2130622-1-cezary.rojewski@intel.com> References: <20211216115743.2130622-1-cezary.rojewski@intel.com> MIME-Version: 1.0 Cc: Cezary Rojewski , broonie@kernel.org, tiwai@suse.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" With board-matching information for legacy solution moved to local directory, there is no need to expose it globally. Signed-off-by: Cezary Rojewski --- include/sound/soc-acpi-intel-match.h | 1 - .../intel/common/soc-acpi-intel-hsw-bdw-match.c | 16 ---------------- 2 files changed, 17 deletions(-) diff --git a/include/sound/soc-acpi-intel-match.h b/include/sound/soc-acpi-intel-match.h index 59551b1f22f3..7b94451ab93a 100644 --- a/include/sound/soc-acpi-intel-match.h +++ b/include/sound/soc-acpi-intel-match.h @@ -14,7 +14,6 @@ * these tables are not constants, some fields can be used for * pdata or machine ops */ -extern struct snd_soc_acpi_mach snd_soc_acpi_intel_haswell_machines[]; extern struct snd_soc_acpi_mach snd_soc_acpi_intel_broadwell_machines[]; extern struct snd_soc_acpi_mach snd_soc_acpi_intel_baytrail_machines[]; extern struct snd_soc_acpi_mach snd_soc_acpi_intel_cherrytrail_machines[]; diff --git a/sound/soc/intel/common/soc-acpi-intel-hsw-bdw-match.c b/sound/soc/intel/common/soc-acpi-intel-hsw-bdw-match.c index fe343a95b5ff..25758c23da17 100644 --- a/sound/soc/intel/common/soc-acpi-intel-hsw-bdw-match.c +++ b/sound/soc/intel/common/soc-acpi-intel-hsw-bdw-match.c @@ -9,44 +9,28 @@ #include #include -struct snd_soc_acpi_mach snd_soc_acpi_intel_haswell_machines[] = { - { - .id = "INT33CA", - .drv_name = "haswell-audio", - .fw_filename = "intel/IntcSST1.bin", - .sof_fw_filename = "sof-hsw.ri", - .sof_tplg_filename = "sof-hsw.tplg", - }, - {} -}; -EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_haswell_machines); - struct snd_soc_acpi_mach snd_soc_acpi_intel_broadwell_machines[] = { { .id = "INT343A", .drv_name = "broadwell-audio", - .fw_filename = "intel/IntcSST2.bin", .sof_fw_filename = "sof-bdw.ri", .sof_tplg_filename = "sof-bdw-rt286.tplg", }, { .id = "10EC5650", .drv_name = "bdw-rt5650", - .fw_filename = "intel/IntcSST2.bin", .sof_fw_filename = "sof-bdw.ri", .sof_tplg_filename = "sof-bdw-rt5650.tplg", }, { .id = "RT5677CE", .drv_name = "bdw-rt5677", - .fw_filename = "intel/IntcSST2.bin", .sof_fw_filename = "sof-bdw.ri", .sof_tplg_filename = "sof-bdw-rt5677.tplg", }, { .id = "INT33CA", .drv_name = "haswell-audio", - .fw_filename = "intel/IntcSST2.bin", .sof_fw_filename = "sof-bdw.ri", .sof_tplg_filename = "sof-bdw-rt5640.tplg", },