From nobody Sun Feb 8 15:37:49 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 3A3662D2391 for ; Mon, 20 Oct 2025 13:12:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760965940; cv=none; b=eugO/21auoalBNDMS+fAdrUQ1Ciydf5dZb5zG0uRFrArRhaX/4JRIyeGXPo+P52YOQPT2tpx8RDjtg/QzlHdWiR5iL/OGNnNUO355FmZiIdV55NTB/1IEahCAtA9UOTX7r+EF93sVXZ0yjNLsPhWXctRKSVpvGiPfwzq79uPL90= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760965940; c=relaxed/simple; bh=cL+lLsNeAu3504P42iTQdxbpOfjV6dphSblHCi2ejPE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=X0RCaAZezWV5ztRM66k1yj9EeyhzBAD+6Y5U7nfdWAkMe2FnAz4Avxc0UdfOzuUdrwNEQE6Y7731F4lVlAkMjT0ZJ4icFRdiHhjgb+dqDaLkjyibDm8kAY1AEJBws/noaxtjHV+gUL3SlkFom8JHrO0XBBpxxfTqgQlyrZGu5Ss= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=ARg4/cqX; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="ARg4/cqX" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 59KBU1Rs016508 for ; Mon, 20 Oct 2025 13:12:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=ANEMhb00kFj 4Hah7g8KhQQL3c2pqAVVvhaWRb8YgqSI=; b=ARg4/cqXywJ/XqU/ow0xVGySGF5 wvGZGYM6P7nVkVB05Rb7xpR+G0Xt0ooSx6VYNO1YSHIcLRV0vPnvB2pSXcTc0Vig P/Cr0WZ9KyRVhi1DZwhSvi9TslmydylVAQv2GaKmmHUVL0SN7XxiP2al+GKwFrXm tWioRzxjKNtKYQslbJD4kxAfZfjzNEdvSPslv99jM/wiF0hft6EuLMPdqvjq5wB0 BgO99cxJDYuJvF4OJPCAbnoPnUBblTjONNYGVLzvo1O48HC316Wx16T+S4yp2cDB 9lTREpMTVUXl0zryy/xxN4P2UlZKRVyewvGPey1IlYDPAdRpL7uzyzx75vA== Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 49v2yv4rw3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 20 Oct 2025 13:12:16 +0000 (GMT) Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-8906059f6b2so2698613485a.2 for ; Mon, 20 Oct 2025 06:12:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760965935; x=1761570735; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ANEMhb00kFj4Hah7g8KhQQL3c2pqAVVvhaWRb8YgqSI=; b=vaKtkb4M9GNVDUL1rsCgqvOLIG6+d8X2wwqMIxaKzClD3R0NVfrSnnOp8FpRplffbn Jp0MMEABw9cgpxC34e5K3fSFbc1FAOvv/IvkQX3CgsU+m3VBa1juEsMoLIlynmNdocnk QlCTxWsTecURfS4jMqf84Dcr3XV56XAN7PtJmeLfrtvdAvYgXe8Ykdy1wn2oqiXkPS3/ UMKB91b52zy2MTLbzTmVW/auYlsedlT9N+FiQbAnN25TQ6NuYFpWF51peVovsZD1TZq5 nPI/QuiiotF2omxQ8zE+Sdq7c2K9HyE3fF89G6COqoZ99H1XWpAX0LaDbXdPcybR2hzm 46vw== X-Forwarded-Encrypted: i=1; AJvYcCVUJFTFBPc5xexq3/2TM8Yvyne+2n0yVSDPvIgFtBTBumUBdKo8jKlIahueLFINzLu/bP+yQqnQBUffmxE=@vger.kernel.org X-Gm-Message-State: AOJu0YzuHb3CELe/QArJVgJMd1Uc7pYOjfQPyZZoYqD77Kgtp+8VdqCR ZjUDb0sLSoZghjao8GvGHp980Yhq+kOaa+hg1PrwT0zAaPpISsX7KcBd7xnyIfUOmk57s2ym+88 bjGfWXYMTOz3mj8MbnuwFEmHx5w6dQ2a6W+VEHKiznn/7GWBlRSwbXeNZ+h7+XMnULfo= X-Gm-Gg: ASbGncvFjphGSaDz/YKFYdg1kxBc5ltIAq2Ps8A5aGV6ZDNm1NQabZWxRyym8IP6svV Xzfx14dUEotBCCsk8WOwZcb1OiqVMPBF4GXLpuDZaHfHfotiro49/oqW5yD2SKPpNuXkBeAh7ep uTO6EA0p5mN9xpYbm4yGQ5MQQy3wXyAMGwXVfeg0kPbctkeDBdX3MRA72bzqyacmx2isXmSziLV Ne9eM/rHTooPeLp2qonc8oQGuZXYtw4W8JqU/MlNk9o1Osv6tBoxGPbYQlcGpsiRS7P10gtihtl MkFT2A3RTqzMoq6dBF0c7WoODRAFwxN9eoVkvpVX5VXD69CDSGmjZzmLcv8NXvhyGmiMSaCLdWj yjhBzzQxYh+RU X-Received: by 2002:a05:622a:1827:b0:4e8:b8f7:299d with SMTP id d75a77b69052e-4e8b8f72eaamr57986421cf.68.1760965934986; Mon, 20 Oct 2025 06:12:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHtkuBs+TSeiwHochXTFUuWHrbLzWe5wwhxMns/ksWwYn9knr90nH1+9yDnFJ67IaCIxKvDgQ== X-Received: by 2002:a05:622a:1827:b0:4e8:b8f7:299d with SMTP id d75a77b69052e-4e8b8f72eaamr57985921cf.68.1760965934527; Mon, 20 Oct 2025 06:12:14 -0700 (PDT) Received: from debian ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4710e8037aasm118165505e9.2.2025.10.20.06.12.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Oct 2025 06:12:14 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org Cc: perex@perex.cz, tiwai@suse.com, srini@kernel.org, alexey.klimov@linaro.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Srinivas Kandagatla , Krzysztof Kozlowski , Stable@vger.kernel.org Subject: [PATCH 1/2] ASoC: qcom: sdw: fix memory leak for sdw_stream_runtime Date: Mon, 20 Oct 2025 14:12:07 +0100 Message-ID: <20251020131208.22734-2-srinivas.kandagatla@oss.qualcomm.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251020131208.22734-1-srinivas.kandagatla@oss.qualcomm.com> References: <20251020131208.22734-1-srinivas.kandagatla@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: aka2sifVbuicDLda3VgTjDSggLi0t7Ci X-Proofpoint-GUID: aka2sifVbuicDLda3VgTjDSggLi0t7Ci X-Authority-Analysis: v=2.4 cv=f+5FxeyM c=1 sm=1 tr=0 ts=68f63530 cx=c_pps a=qKBjSQ1v91RyAK45QCPf5w==:117 a=ZsC4DHZuhs/kKio7QBcDoQ==:17 a=x6icFKpwvdMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=N47DpUgmF8P8R7KZyx8A:9 a=NFOGd7dJGGMPyQGDc5-O:22 a=cvBusfyB2V15izCimMoJ:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMDE4MDAyMyBTYWx0ZWRfX+AOLX4iNtdqt AIEzPsALJn9xRp+ti2FDf3H9EQqOxcZ5FCG4hctlAhqMd2qYnIgnXuk9swy9TzuRZwK6Wy49yet yxerHGyBaoEs/h1UW0/ruble7n+crrt9Zn/CTlaKq73ybueoFB+T5ZFgkDIif3tsyxqxirO/5uc MxRUyB/vcC2DSM07QSEiqEsrewQvwI18EdC4CAI3cNf4xv+g/8EMwgm8lAgOUhBIxflU+W1FY4s HwpZm4jQGjP9T7b7BLubv/TfkojMX+GyInpMMsbg/y/ljGW27hOx/hsXW80oKkjEkAm9c4f9Alf K7PnGso/8dOW9Q9hDay6JaR/GXmGDm8hjmmuivUk6av2EMLFF8+3PPxsy2vq7HSFcUZjmZJru5m PzGKItbkTTxykeJY5576tmvinApz1Q== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-10-20_04,2025-10-13_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 adultscore=0 phishscore=0 bulkscore=0 clxscore=1015 spamscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2510020000 definitions=main-2510180023 Content-Type: text/plain; charset="utf-8" For some reason we endedup allocating sdw_stream_runtime for every cpu dai, this has two issues. 1. we never set snd_soc_dai_set_stream for non soundwire dai, which means there is no way that we can free this, resulting in memory leak 2. startup and shutdown callbacks can be called without hw_params callback called. This combination results in memory leak because machine driver sruntime array pointer is only set in hw_params callback. Fix this by 1. adding a helper function to get sdw_runtime for substream which can be used by shutdown callback to get hold of sruntime to free. 2. only allocate sdw_runtime for soundwire dais. Fixes: d32bac9cb09c ("ASoC: qcom: Add helper for allocating Soundwire strea= m runtime") Cc: Krzysztof Kozlowski Cc: Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/sc7280.c | 2 +- sound/soc/qcom/sc8280xp.c | 2 +- sound/soc/qcom/sdw.c | 104 +++++++++++++++++++++----------------- sound/soc/qcom/sdw.h | 1 + sound/soc/qcom/sm8250.c | 2 +- sound/soc/qcom/x1e80100.c | 2 +- 6 files changed, 63 insertions(+), 50 deletions(-) diff --git a/sound/soc/qcom/sc7280.c b/sound/soc/qcom/sc7280.c index af412bd0c89f..c444dae563c7 100644 --- a/sound/soc/qcom/sc7280.c +++ b/sound/soc/qcom/sc7280.c @@ -317,7 +317,7 @@ static void sc7280_snd_shutdown(struct snd_pcm_substrea= m *substream) struct snd_soc_card *card =3D rtd->card; struct sc7280_snd_data *data =3D snd_soc_card_get_drvdata(card); struct snd_soc_dai *cpu_dai =3D snd_soc_rtd_to_cpu(rtd, 0); - struct sdw_stream_runtime *sruntime =3D data->sruntime[cpu_dai->id]; + struct sdw_stream_runtime *sruntime =3D qcom_snd_sdw_get_stream(substream= ); =20 switch (cpu_dai->id) { case MI2S_PRIMARY: diff --git a/sound/soc/qcom/sc8280xp.c b/sound/soc/qcom/sc8280xp.c index 78e327bc2f07..9ba536dff667 100644 --- a/sound/soc/qcom/sc8280xp.c +++ b/sound/soc/qcom/sc8280xp.c @@ -73,7 +73,7 @@ static void sc8280xp_snd_shutdown(struct snd_pcm_substrea= m *substream) struct snd_soc_pcm_runtime *rtd =3D snd_soc_substream_to_rtd(substream); struct snd_soc_dai *cpu_dai =3D snd_soc_rtd_to_cpu(rtd, 0); struct sc8280xp_snd_data *pdata =3D snd_soc_card_get_drvdata(rtd->card); - struct sdw_stream_runtime *sruntime =3D pdata->sruntime[cpu_dai->id]; + struct sdw_stream_runtime *sruntime =3D qcom_snd_sdw_get_stream(substream= ); =20 pdata->sruntime[cpu_dai->id] =3D NULL; sdw_release_stream(sruntime); diff --git a/sound/soc/qcom/sdw.c b/sound/soc/qcom/sdw.c index 7d7981d4295b..d866fad04131 100644 --- a/sound/soc/qcom/sdw.c +++ b/sound/soc/qcom/sdw.c @@ -7,6 +7,36 @@ #include #include "sdw.h" =20 +static bool qcom_snd_is_sdw_dai(int id) +{ + switch (id) { + case WSA_CODEC_DMA_RX_0: + case WSA_CODEC_DMA_TX_0: + case WSA_CODEC_DMA_RX_1: + case WSA_CODEC_DMA_TX_1: + case WSA_CODEC_DMA_TX_2: + case RX_CODEC_DMA_RX_0: + case TX_CODEC_DMA_TX_0: + case RX_CODEC_DMA_RX_1: + case TX_CODEC_DMA_TX_1: + case RX_CODEC_DMA_RX_2: + case TX_CODEC_DMA_TX_2: + case RX_CODEC_DMA_RX_3: + case TX_CODEC_DMA_TX_3: + case RX_CODEC_DMA_RX_4: + case TX_CODEC_DMA_TX_4: + case RX_CODEC_DMA_RX_5: + case TX_CODEC_DMA_TX_5: + case RX_CODEC_DMA_RX_6: + case RX_CODEC_DMA_RX_7: + return true; + default: + break; + } + + return false; +} + /** * qcom_snd_sdw_startup() - Helper to start Soundwire stream for SoC audio= card * @substream: The PCM substream from audio, as passed to snd_soc_ops->sta= rtup() @@ -29,6 +59,9 @@ int qcom_snd_sdw_startup(struct snd_pcm_substream *substr= eam) u32 rx_ch_cnt =3D 0, tx_ch_cnt =3D 0; int ret, i, j; =20 + if (!qcom_snd_is_sdw_dai(cpu_dai->id)) + return 0; + sruntime =3D sdw_alloc_stream(cpu_dai->name, SDW_STREAM_PCM); if (!sruntime) return -ENOMEM; @@ -89,19 +122,8 @@ int qcom_snd_sdw_prepare(struct snd_pcm_substream *subs= tream, if (!sruntime) return 0; =20 - switch (cpu_dai->id) { - case WSA_CODEC_DMA_RX_0: - case WSA_CODEC_DMA_RX_1: - case RX_CODEC_DMA_RX_0: - case RX_CODEC_DMA_RX_1: - case TX_CODEC_DMA_TX_0: - case TX_CODEC_DMA_TX_1: - case TX_CODEC_DMA_TX_2: - case TX_CODEC_DMA_TX_3: - break; - default: + if (!qcom_snd_is_sdw_dai(cpu_dai->id)) return 0; - } =20 if (*stream_prepared) return 0; @@ -129,9 +151,7 @@ int qcom_snd_sdw_prepare(struct snd_pcm_substream *subs= tream, } EXPORT_SYMBOL_GPL(qcom_snd_sdw_prepare); =20 -int qcom_snd_sdw_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params, - struct sdw_stream_runtime **psruntime) +struct sdw_stream_runtime *qcom_snd_sdw_get_stream(struct snd_pcm_substrea= m *substream) { struct snd_soc_pcm_runtime *rtd =3D snd_soc_substream_to_rtd(substream); struct snd_soc_dai *codec_dai; @@ -139,21 +159,23 @@ int qcom_snd_sdw_hw_params(struct snd_pcm_substream *= substream, struct sdw_stream_runtime *sruntime; int i; =20 - switch (cpu_dai->id) { - case WSA_CODEC_DMA_RX_0: - case RX_CODEC_DMA_RX_0: - case RX_CODEC_DMA_RX_1: - case TX_CODEC_DMA_TX_0: - case TX_CODEC_DMA_TX_1: - case TX_CODEC_DMA_TX_2: - case TX_CODEC_DMA_TX_3: - for_each_rtd_codec_dais(rtd, i, codec_dai) { - sruntime =3D snd_soc_dai_get_stream(codec_dai, substream->stream); - if (sruntime !=3D ERR_PTR(-ENOTSUPP)) - *psruntime =3D sruntime; - } - break; + if (!qcom_snd_is_sdw_dai(cpu_dai->id)) + return NULL; + + for_each_rtd_codec_dais(rtd, i, codec_dai) { + sruntime =3D snd_soc_dai_get_stream(codec_dai, substream->stream); + if (sruntime !=3D ERR_PTR(-ENOTSUPP)) + return sruntime; } + return NULL; +} +EXPORT_SYMBOL_GPL(qcom_snd_sdw_get_stream); + +int qcom_snd_sdw_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params, + struct sdw_stream_runtime **psruntime) +{ + *psruntime =3D qcom_snd_sdw_get_stream(substream); =20 return 0; =20 @@ -166,23 +188,13 @@ int qcom_snd_sdw_hw_free(struct snd_pcm_substream *su= bstream, struct snd_soc_pcm_runtime *rtd =3D snd_soc_substream_to_rtd(substream); struct snd_soc_dai *cpu_dai =3D snd_soc_rtd_to_cpu(rtd, 0); =20 - switch (cpu_dai->id) { - case WSA_CODEC_DMA_RX_0: - case WSA_CODEC_DMA_RX_1: - case RX_CODEC_DMA_RX_0: - case RX_CODEC_DMA_RX_1: - case TX_CODEC_DMA_TX_0: - case TX_CODEC_DMA_TX_1: - case TX_CODEC_DMA_TX_2: - case TX_CODEC_DMA_TX_3: - if (sruntime && *stream_prepared) { - sdw_disable_stream(sruntime); - sdw_deprepare_stream(sruntime); - *stream_prepared =3D false; - } - break; - default: - break; + if (!qcom_snd_is_sdw_dai(cpu_dai->id)) + return 0; + + if (sruntime && *stream_prepared) { + sdw_disable_stream(sruntime); + sdw_deprepare_stream(sruntime); + *stream_prepared =3D false; } =20 return 0; diff --git a/sound/soc/qcom/sdw.h b/sound/soc/qcom/sdw.h index 392e3455f1b1..b8bc5beb0522 100644 --- a/sound/soc/qcom/sdw.h +++ b/sound/soc/qcom/sdw.h @@ -10,6 +10,7 @@ int qcom_snd_sdw_startup(struct snd_pcm_substream *substr= eam); int qcom_snd_sdw_prepare(struct snd_pcm_substream *substream, struct sdw_stream_runtime *runtime, bool *stream_prepared); +struct sdw_stream_runtime *qcom_snd_sdw_get_stream(struct snd_pcm_substrea= m *stream); int qcom_snd_sdw_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct sdw_stream_runtime **psruntime); diff --git a/sound/soc/qcom/sm8250.c b/sound/soc/qcom/sm8250.c index f5b75a06e5bd..ce5b0059207f 100644 --- a/sound/soc/qcom/sm8250.c +++ b/sound/soc/qcom/sm8250.c @@ -117,7 +117,7 @@ static void sm8250_snd_shutdown(struct snd_pcm_substrea= m *substream) struct snd_soc_pcm_runtime *rtd =3D snd_soc_substream_to_rtd(substream); struct snd_soc_dai *cpu_dai =3D snd_soc_rtd_to_cpu(rtd, 0); struct sm8250_snd_data *data =3D snd_soc_card_get_drvdata(rtd->card); - struct sdw_stream_runtime *sruntime =3D data->sruntime[cpu_dai->id]; + struct sdw_stream_runtime *sruntime =3D qcom_snd_sdw_get_stream(substream= ); =20 data->sruntime[cpu_dai->id] =3D NULL; sdw_release_stream(sruntime); diff --git a/sound/soc/qcom/x1e80100.c b/sound/soc/qcom/x1e80100.c index 444f2162889f..2e3599516aa2 100644 --- a/sound/soc/qcom/x1e80100.c +++ b/sound/soc/qcom/x1e80100.c @@ -55,7 +55,7 @@ static void x1e80100_snd_shutdown(struct snd_pcm_substrea= m *substream) struct snd_soc_pcm_runtime *rtd =3D snd_soc_substream_to_rtd(substream); struct snd_soc_dai *cpu_dai =3D snd_soc_rtd_to_cpu(rtd, 0); struct x1e80100_snd_data *data =3D snd_soc_card_get_drvdata(rtd->card); - struct sdw_stream_runtime *sruntime =3D data->sruntime[cpu_dai->id]; + struct sdw_stream_runtime *sruntime =3D qcom_snd_sdw_get_stream(substream= ); =20 data->sruntime[cpu_dai->id] =3D NULL; sdw_release_stream(sruntime); --=20 2.51.0 From nobody Sun Feb 8 15:37:49 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (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 1F05D3164AF for ; Mon, 20 Oct 2025 13:12:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760965941; cv=none; b=lvQmohOJWGcC0PrNcegNEhc8ZxcomsvguYDFWNIgbwTwrdMOP1I0qmXo1Bc5Uwfk+/fY+a28K485lGoLprMU4hXshfxoN+SUaU3uoSef55eFPHRfSDcvz7GEzhzTJkJHzelwClZ4Nm0nONdkwjF9NhxaB4tPlFVou2j3mzaur+s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760965941; c=relaxed/simple; bh=/HFo0chNl4GSV9KBtCBODfpuGIDSCIV2oMLhJt9NfPk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JAhsbl8/DHfoJiJWk8/W2XKKggxiw0foHVQFlSCs1pfzc/ONdP7CS5qGJZiEN6JhPqp7aGFjB/hYHPAXOvYSr6tnA7NXnf2urQxOwbHa8/8oee7oABiZm0OSSJdeJTVOWD3mDH8GyhUyeTlsJgiZiEGUZ7c2hzJHSML46RMz0dA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=oajbwBi6; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="oajbwBi6" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 59KB1H93010027 for ; Mon, 20 Oct 2025 13:12:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=XDzjsbNRreQ M8IINxKudUQBopPbwW7nJ5HkVJNfp380=; b=oajbwBi6Wp2HJbEL7zZ1MPCm4JR b0FadfaqV127SkiwL+6STXy9aSEqCeqosZ9JNMPMhMSHdkbyagvtioUdXQ1EY4SG 1c4IXPuuaC4bevRAgpvpnB3Plh8VKRvhvZd4Ze+bsS9AVZo32JorgfoTwhafPWiQ B2oIrUpwe2FYuV93xzpifdES8HZ0ijqHk9G8GAuaVaSKm+gdW0e6yVnotdA9v4DE vIFZ3+zCLiXNI6PsOVc3tnTu8bgAzrUijus6Aks/kkKpWc0q3Dsc3nrF27uLDapx M3ePZv280JRTHdNdScmpbA4x6uv4Os3A7Po3G2AyQZMIjEzaTE77aIv6h2g== Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 49v0kfd35n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Mon, 20 Oct 2025 13:12:18 +0000 (GMT) Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-87c1f18cbc6so260792846d6.1 for ; Mon, 20 Oct 2025 06:12:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760965937; x=1761570737; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XDzjsbNRreQM8IINxKudUQBopPbwW7nJ5HkVJNfp380=; b=M6k32KpPb6k9/lwd4DCAG31GeG25iG+3W27MNSfNkE5TyUT4fSlD2Pefb1qnX4odQT Rk9mdocYSGDmzC8qxABf0CI9clRLpdHYxI6u0U18HXiF7wYajl1JLrDot/zil9o7UbZ/ hHe3+gqGoRO9HEPtTFv/5UWkspjWzymyjej32EV7apEebRr+mNOgM4gQ1t+DqJxC+b1i cWPuuVAhVtkSino2UOFv+vva2fC2q8/gcxbevk0Vwkw5JBdvQYEqPp7n5BvaG+yYc8D3 LsJvI1Y5sZLBoJl4CY8w6Gs7E6MmgQ5/GWVzBd5kCew9I5uh1FLgL8e+HAJCeAUap/Ex gJCQ== X-Forwarded-Encrypted: i=1; AJvYcCVDO0ITGfmrmtQHxxIHR7QxxlZtjUTawauNsTzUs1x4gWF+rDsfrbTjzEY1+VYXi5z3Zfv41V2EJPwsv+A=@vger.kernel.org X-Gm-Message-State: AOJu0YzZvi0Po2OUveic1aIPLe4l2poU3406MYzu8KGjreuTUQEYnXsJ s6rCsl/bR70Ddwa8eXptBCu3RTJ/5pnf00O4z/scStH6vgBzqhw95upCZuK9GbdZNcRvm0A2VWZ Ss1pJa1RYebyzz1j1ckcLBm7vqudEa7tuKy073WoEUcz1kusQCApw/bxdntam5r+w2IM= X-Gm-Gg: ASbGncsq55CsDEwhuj90S19oAD2F1Y5+ihiSFaIAr5M/BrJ/LHnHTxgNlExR6+5vFTv LxwoR4QZjA8hdv0gRvv1BNBhWuj/izJolZLa0XSZQDF+pfLebnzweO8mhhYcBZjSePcqbjSr7g5 utjPo1g+gFKDR+IfZ4yxcusugRAuhXTY2yfyudWlzgD432appCzuJQmc1ZU9CeIrceOfWTn3cUr uTJ0Nytq63SYqt7TPVncJmuGtURQ29fhYQMzt8+2sI47xk0FMsxDhl7HtrNt25aGhBTNcI2/KIQ rUaYNArCGnJT18o5XfMKWV1ce/M0T3cO6mrffhNwFMdpb61SbpbiTn9myMDo/dSg9gNnGNrvbha DCI6H7+8SC2vr X-Received: by 2002:a05:622a:1182:b0:4e8:9a7d:90fb with SMTP id d75a77b69052e-4e89d335b1amr166530161cf.50.1760965936472; Mon, 20 Oct 2025 06:12:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGVPdUATgyqwUuw9C3MrPllzh7sJzA95U4vgS0PSVpRWvNjeqg+RHAgWUSvgscGhdStT/pqgA== X-Received: by 2002:a05:622a:1182:b0:4e8:9a7d:90fb with SMTP id d75a77b69052e-4e89d335b1amr166529721cf.50.1760965935977; Mon, 20 Oct 2025 06:12:15 -0700 (PDT) Received: from debian ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4710e8037aasm118165505e9.2.2025.10.20.06.12.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Oct 2025 06:12:15 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org Cc: perex@perex.cz, tiwai@suse.com, srini@kernel.org, alexey.klimov@linaro.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH 2/2] ASoC: qcom: sdw: remove redundant code Date: Mon, 20 Oct 2025 14:12:08 +0100 Message-ID: <20251020131208.22734-3-srinivas.kandagatla@oss.qualcomm.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251020131208.22734-1-srinivas.kandagatla@oss.qualcomm.com> References: <20251020131208.22734-1-srinivas.kandagatla@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authority-Analysis: v=2.4 cv=E6LAZKdl c=1 sm=1 tr=0 ts=68f63532 cx=c_pps a=7E5Bxpl4vBhpaufnMqZlrw==:117 a=ZsC4DHZuhs/kKio7QBcDoQ==:17 a=x6icFKpwvdMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=eS8ScSGqROhw0OgIVi4A:9 a=pJ04lnu7RYOZP9TFuWaZ:22 X-Proofpoint-ORIG-GUID: ArmpE5d_sz-YN_oXwHQkMKZnol9p_WSv X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMDE4MDAwMiBTYWx0ZWRfX6f+0S5VDq63/ UTHA3Mp3I3wjE6NaOV6Wovapfkuvcgg4lisKfMtkNGS06qb/jsryDvBYUBenobsY6961wsQwrsc QUEDJRPF3zpdQJeeI3fZ9p97gZzyF3GFRvlgBfyDxrOylBBf4nKFDA7Y7R6iBWF0Trs+XiQoxBu E5Y9XnDeExVwOIzom8iDSOGBYLxJcYdFjXHpeTrRqBXg/UMrzUaZeTDPzj8Bqb2ucqTzBpjJlpF uvs6PsjObaG1fvoK7o2/nfiy2XZ2XQqS0IChw6taXB1AMthZkZcW45z2fTKW9CQVGIZsAs1Gwij iEFp7a8Sg4/wYOdQVXEFA8gagq4c5mQpxbEqYlv8ElyAvU6r78RjpjAyz3IhTyy/YkhpF1TesK3 tqy5OlIm51knS2DnOSvlTi6XlLgrUA== X-Proofpoint-GUID: ArmpE5d_sz-YN_oXwHQkMKZnol9p_WSv X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-10-20_04,2025-10-13_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 bulkscore=0 priorityscore=1501 spamscore=0 phishscore=0 impostorscore=0 malwarescore=0 adultscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2510020000 definitions=main-2510180002 Content-Type: text/plain; charset="utf-8" remove redundant code and pointers to handle sdw_stream_runtime by making use of qcom_snd_sdw_get_stream(). This removes need of machine specific shutdown and hw_params sdw callbacks and also need to store sdw_stream_runtime pointers in machine drivers. Signed-off-by: Srinivas Kandagatla --- sound/soc/qcom/sc8280xp.c | 33 +++------------------------------ sound/soc/qcom/sdw.c | 24 ++++++++++++------------ sound/soc/qcom/sdw.h | 6 +----- sound/soc/qcom/sm8250.c | 33 +++------------------------------ sound/soc/qcom/x1e80100.c | 33 +++------------------------------ 5 files changed, 22 insertions(+), 107 deletions(-) diff --git a/sound/soc/qcom/sc8280xp.c b/sound/soc/qcom/sc8280xp.c index 9ba536dff667..5bd8e8aa1853 100644 --- a/sound/soc/qcom/sc8280xp.c +++ b/sound/soc/qcom/sc8280xp.c @@ -18,7 +18,6 @@ struct sc8280xp_snd_data { bool stream_prepared[AFE_PORT_MAX]; struct snd_soc_card *card; - struct sdw_stream_runtime *sruntime[AFE_PORT_MAX]; struct snd_soc_jack jack; struct snd_soc_jack dp_jack[8]; bool jack_setup; @@ -68,17 +67,6 @@ static int sc8280xp_snd_init(struct snd_soc_pcm_runtime = *rtd) return qcom_snd_wcd_jack_setup(rtd, &data->jack, &data->jack_setup); } =20 -static void sc8280xp_snd_shutdown(struct snd_pcm_substream *substream) -{ - struct snd_soc_pcm_runtime *rtd =3D snd_soc_substream_to_rtd(substream); - struct snd_soc_dai *cpu_dai =3D snd_soc_rtd_to_cpu(rtd, 0); - struct sc8280xp_snd_data *pdata =3D snd_soc_card_get_drvdata(rtd->card); - struct sdw_stream_runtime *sruntime =3D qcom_snd_sdw_get_stream(substream= ); - - pdata->sruntime[cpu_dai->id] =3D NULL; - sdw_release_stream(sruntime); -} - static int sc8280xp_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_params *params) { @@ -108,25 +96,13 @@ static int sc8280xp_be_hw_params_fixup(struct snd_soc_= pcm_runtime *rtd, return 0; } =20 -static int sc8280xp_snd_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params) -{ - struct snd_soc_pcm_runtime *rtd =3D snd_soc_substream_to_rtd(substream); - struct snd_soc_dai *cpu_dai =3D snd_soc_rtd_to_cpu(rtd, 0); - struct sc8280xp_snd_data *pdata =3D snd_soc_card_get_drvdata(rtd->card); - - return qcom_snd_sdw_hw_params(substream, params, &pdata->sruntime[cpu_dai= ->id]); -} - static int sc8280xp_snd_prepare(struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *rtd =3D snd_soc_substream_to_rtd(substream); struct snd_soc_dai *cpu_dai =3D snd_soc_rtd_to_cpu(rtd, 0); struct sc8280xp_snd_data *data =3D snd_soc_card_get_drvdata(rtd->card); - struct sdw_stream_runtime *sruntime =3D data->sruntime[cpu_dai->id]; =20 - return qcom_snd_sdw_prepare(substream, sruntime, - &data->stream_prepared[cpu_dai->id]); + return qcom_snd_sdw_prepare(substream, &data->stream_prepared[cpu_dai->id= ]); } =20 static int sc8280xp_snd_hw_free(struct snd_pcm_substream *substream) @@ -134,16 +110,13 @@ static int sc8280xp_snd_hw_free(struct snd_pcm_substr= eam *substream) struct snd_soc_pcm_runtime *rtd =3D snd_soc_substream_to_rtd(substream); struct sc8280xp_snd_data *data =3D snd_soc_card_get_drvdata(rtd->card); struct snd_soc_dai *cpu_dai =3D snd_soc_rtd_to_cpu(rtd, 0); - struct sdw_stream_runtime *sruntime =3D data->sruntime[cpu_dai->id]; =20 - return qcom_snd_sdw_hw_free(substream, sruntime, - &data->stream_prepared[cpu_dai->id]); + return qcom_snd_sdw_hw_free(substream, &data->stream_prepared[cpu_dai->id= ]); } =20 static const struct snd_soc_ops sc8280xp_be_ops =3D { .startup =3D qcom_snd_sdw_startup, - .shutdown =3D sc8280xp_snd_shutdown, - .hw_params =3D sc8280xp_snd_hw_params, + .shutdown =3D qcom_snd_sdw_shutdown, .hw_free =3D sc8280xp_snd_hw_free, .prepare =3D sc8280xp_snd_prepare, }; diff --git a/sound/soc/qcom/sdw.c b/sound/soc/qcom/sdw.c index d866fad04131..df5cc1dcb96f 100644 --- a/sound/soc/qcom/sdw.c +++ b/sound/soc/qcom/sdw.c @@ -112,19 +112,21 @@ int qcom_snd_sdw_startup(struct snd_pcm_substream *su= bstream) EXPORT_SYMBOL_GPL(qcom_snd_sdw_startup); =20 int qcom_snd_sdw_prepare(struct snd_pcm_substream *substream, - struct sdw_stream_runtime *sruntime, bool *stream_prepared) { struct snd_soc_pcm_runtime *rtd =3D snd_soc_substream_to_rtd(substream); struct snd_soc_dai *cpu_dai =3D snd_soc_rtd_to_cpu(rtd, 0); + struct sdw_stream_runtime *sruntime; int ret; =20 - if (!sruntime) - return 0; =20 if (!qcom_snd_is_sdw_dai(cpu_dai->id)) return 0; =20 + sruntime =3D qcom_snd_sdw_get_stream(substream); + if (!sruntime) + return 0; + if (*stream_prepared) return 0; =20 @@ -171,26 +173,24 @@ struct sdw_stream_runtime *qcom_snd_sdw_get_stream(st= ruct snd_pcm_substream *sub } EXPORT_SYMBOL_GPL(qcom_snd_sdw_get_stream); =20 -int qcom_snd_sdw_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params, - struct sdw_stream_runtime **psruntime) +void qcom_snd_sdw_shutdown(struct snd_pcm_substream *substream) { - *psruntime =3D qcom_snd_sdw_get_stream(substream); - - return 0; + struct sdw_stream_runtime *sruntime =3D qcom_snd_sdw_get_stream(substream= ); =20 + sdw_release_stream(sruntime); } -EXPORT_SYMBOL_GPL(qcom_snd_sdw_hw_params); +EXPORT_SYMBOL_GPL(qcom_snd_sdw_shutdown); =20 -int qcom_snd_sdw_hw_free(struct snd_pcm_substream *substream, - struct sdw_stream_runtime *sruntime, bool *stream_prepared) +int qcom_snd_sdw_hw_free(struct snd_pcm_substream *substream, bool *stream= _prepared) { struct snd_soc_pcm_runtime *rtd =3D snd_soc_substream_to_rtd(substream); struct snd_soc_dai *cpu_dai =3D snd_soc_rtd_to_cpu(rtd, 0); + struct sdw_stream_runtime *sruntime; =20 if (!qcom_snd_is_sdw_dai(cpu_dai->id)) return 0; =20 + sruntime =3D qcom_snd_sdw_get_stream(substream); if (sruntime && *stream_prepared) { sdw_disable_stream(sruntime); sdw_deprepare_stream(sruntime); diff --git a/sound/soc/qcom/sdw.h b/sound/soc/qcom/sdw.h index b8bc5beb0522..061a63f1ac52 100644 --- a/sound/soc/qcom/sdw.h +++ b/sound/soc/qcom/sdw.h @@ -7,14 +7,10 @@ #include =20 int qcom_snd_sdw_startup(struct snd_pcm_substream *substream); +void qcom_snd_sdw_shutdown(struct snd_pcm_substream *substream); int qcom_snd_sdw_prepare(struct snd_pcm_substream *substream, - struct sdw_stream_runtime *runtime, bool *stream_prepared); struct sdw_stream_runtime *qcom_snd_sdw_get_stream(struct snd_pcm_substrea= m *stream); -int qcom_snd_sdw_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params, - struct sdw_stream_runtime **psruntime); int qcom_snd_sdw_hw_free(struct snd_pcm_substream *substream, - struct sdw_stream_runtime *sruntime, bool *stream_prepared); #endif diff --git a/sound/soc/qcom/sm8250.c b/sound/soc/qcom/sm8250.c index ce5b0059207f..203a8705a42f 100644 --- a/sound/soc/qcom/sm8250.c +++ b/sound/soc/qcom/sm8250.c @@ -21,7 +21,6 @@ struct sm8250_snd_data { bool stream_prepared[AFE_PORT_MAX]; struct snd_soc_card *card; - struct sdw_stream_runtime *sruntime[AFE_PORT_MAX]; struct snd_soc_jack jack; struct snd_soc_jack usb_offload_jack; bool usb_offload_jack_setup; @@ -112,36 +111,13 @@ static int sm8250_snd_startup(struct snd_pcm_substrea= m *substream) return qcom_snd_sdw_startup(substream); } =20 -static void sm8250_snd_shutdown(struct snd_pcm_substream *substream) -{ - struct snd_soc_pcm_runtime *rtd =3D snd_soc_substream_to_rtd(substream); - struct snd_soc_dai *cpu_dai =3D snd_soc_rtd_to_cpu(rtd, 0); - struct sm8250_snd_data *data =3D snd_soc_card_get_drvdata(rtd->card); - struct sdw_stream_runtime *sruntime =3D qcom_snd_sdw_get_stream(substream= ); - - data->sruntime[cpu_dai->id] =3D NULL; - sdw_release_stream(sruntime); -} - -static int sm8250_snd_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params) -{ - struct snd_soc_pcm_runtime *rtd =3D snd_soc_substream_to_rtd(substream); - struct snd_soc_dai *cpu_dai =3D snd_soc_rtd_to_cpu(rtd, 0); - struct sm8250_snd_data *pdata =3D snd_soc_card_get_drvdata(rtd->card); - - return qcom_snd_sdw_hw_params(substream, params, &pdata->sruntime[cpu_dai= ->id]); -} - static int sm8250_snd_prepare(struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *rtd =3D snd_soc_substream_to_rtd(substream); struct snd_soc_dai *cpu_dai =3D snd_soc_rtd_to_cpu(rtd, 0); struct sm8250_snd_data *data =3D snd_soc_card_get_drvdata(rtd->card); - struct sdw_stream_runtime *sruntime =3D data->sruntime[cpu_dai->id]; =20 - return qcom_snd_sdw_prepare(substream, sruntime, - &data->stream_prepared[cpu_dai->id]); + return qcom_snd_sdw_prepare(substream, &data->stream_prepared[cpu_dai->id= ]); } =20 static int sm8250_snd_hw_free(struct snd_pcm_substream *substream) @@ -149,16 +125,13 @@ static int sm8250_snd_hw_free(struct snd_pcm_substrea= m *substream) struct snd_soc_pcm_runtime *rtd =3D snd_soc_substream_to_rtd(substream); struct sm8250_snd_data *data =3D snd_soc_card_get_drvdata(rtd->card); struct snd_soc_dai *cpu_dai =3D snd_soc_rtd_to_cpu(rtd, 0); - struct sdw_stream_runtime *sruntime =3D data->sruntime[cpu_dai->id]; =20 - return qcom_snd_sdw_hw_free(substream, sruntime, - &data->stream_prepared[cpu_dai->id]); + return qcom_snd_sdw_hw_free(substream, &data->stream_prepared[cpu_dai->id= ]); } =20 static const struct snd_soc_ops sm8250_be_ops =3D { .startup =3D sm8250_snd_startup, - .shutdown =3D sm8250_snd_shutdown, - .hw_params =3D sm8250_snd_hw_params, + .shutdown =3D qcom_snd_sdw_shutdown, .hw_free =3D sm8250_snd_hw_free, .prepare =3D sm8250_snd_prepare, }; diff --git a/sound/soc/qcom/x1e80100.c b/sound/soc/qcom/x1e80100.c index 2e3599516aa2..a3f4785c4bbe 100644 --- a/sound/soc/qcom/x1e80100.c +++ b/sound/soc/qcom/x1e80100.c @@ -18,7 +18,6 @@ struct x1e80100_snd_data { bool stream_prepared[AFE_PORT_MAX]; struct snd_soc_card *card; - struct sdw_stream_runtime *sruntime[AFE_PORT_MAX]; struct snd_soc_jack jack; struct snd_soc_jack dp_jack[8]; bool jack_setup; @@ -50,17 +49,6 @@ static int x1e80100_snd_init(struct snd_soc_pcm_runtime = *rtd) return qcom_snd_wcd_jack_setup(rtd, &data->jack, &data->jack_setup); } =20 -static void x1e80100_snd_shutdown(struct snd_pcm_substream *substream) -{ - struct snd_soc_pcm_runtime *rtd =3D snd_soc_substream_to_rtd(substream); - struct snd_soc_dai *cpu_dai =3D snd_soc_rtd_to_cpu(rtd, 0); - struct x1e80100_snd_data *data =3D snd_soc_card_get_drvdata(rtd->card); - struct sdw_stream_runtime *sruntime =3D qcom_snd_sdw_get_stream(substream= ); - - data->sruntime[cpu_dai->id] =3D NULL; - sdw_release_stream(sruntime); -} - static int x1e80100_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_params *params) { @@ -85,16 +73,6 @@ static int x1e80100_be_hw_params_fixup(struct snd_soc_pc= m_runtime *rtd, return 0; } =20 -static int x1e80100_snd_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params) -{ - struct snd_soc_pcm_runtime *rtd =3D snd_soc_substream_to_rtd(substream); - struct snd_soc_dai *cpu_dai =3D snd_soc_rtd_to_cpu(rtd, 0); - struct x1e80100_snd_data *data =3D snd_soc_card_get_drvdata(rtd->card); - - return qcom_snd_sdw_hw_params(substream, params, &data->sruntime[cpu_dai-= >id]); -} - static int x1e80100_snd_hw_map_channels(unsigned int *ch_map, int num) { switch (num) { @@ -128,7 +106,6 @@ static int x1e80100_snd_prepare(struct snd_pcm_substrea= m *substream) struct snd_soc_pcm_runtime *rtd =3D snd_soc_substream_to_rtd(substream); struct snd_soc_dai *cpu_dai =3D snd_soc_rtd_to_cpu(rtd, 0); struct x1e80100_snd_data *data =3D snd_soc_card_get_drvdata(rtd->card); - struct sdw_stream_runtime *sruntime =3D data->sruntime[cpu_dai->id]; unsigned int channels =3D substream->runtime->channels; unsigned int rx_slot[4]; int ret; @@ -149,8 +126,7 @@ static int x1e80100_snd_prepare(struct snd_pcm_substrea= m *substream) break; } =20 - return qcom_snd_sdw_prepare(substream, sruntime, - &data->stream_prepared[cpu_dai->id]); + return qcom_snd_sdw_prepare(substream, &data->stream_prepared[cpu_dai->id= ]); } =20 static int x1e80100_snd_hw_free(struct snd_pcm_substream *substream) @@ -158,16 +134,13 @@ static int x1e80100_snd_hw_free(struct snd_pcm_substr= eam *substream) struct snd_soc_pcm_runtime *rtd =3D snd_soc_substream_to_rtd(substream); struct x1e80100_snd_data *data =3D snd_soc_card_get_drvdata(rtd->card); struct snd_soc_dai *cpu_dai =3D snd_soc_rtd_to_cpu(rtd, 0); - struct sdw_stream_runtime *sruntime =3D data->sruntime[cpu_dai->id]; =20 - return qcom_snd_sdw_hw_free(substream, sruntime, - &data->stream_prepared[cpu_dai->id]); + return qcom_snd_sdw_hw_free(substream, &data->stream_prepared[cpu_dai->id= ]); } =20 static const struct snd_soc_ops x1e80100_be_ops =3D { .startup =3D qcom_snd_sdw_startup, - .shutdown =3D x1e80100_snd_shutdown, - .hw_params =3D x1e80100_snd_hw_params, + .shutdown =3D qcom_snd_sdw_shutdown, .hw_free =3D x1e80100_snd_hw_free, .prepare =3D x1e80100_snd_prepare, }; --=20 2.51.0