From mboxrd@z Thu Jan 1 00:00:00 1970 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 DDCD3340403; Sat, 1 Aug 2026 05:46:34 +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=1785563196; cv=none; b=NkEYdC0WYuMtEBRjU66ff+d8NVP0lwUJAAYZkICJhM1bWA6C+wxrlw3gqg5aDZC7JxrjhAivzG3BfF7GF2W/CUVoeJ8n+lghta1gkACyMGVGBEOb09XHYL4/SaQFS5T27OhJE8o8BSjPY9S97GsImPXhf2A2pczshyCrUdfdk2I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785563196; c=relaxed/simple; bh=3dKhBmBJw4umTdMWOLeLNJlrY0SVxW92j95f/KicZyQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NvnGu2mle3+sRPv6PZC6PJqLqKh1myrZj/hNtaQa0TnARG+8Jm0WVxSXpFC5L4cAp+2SmwWCjJp0ckwcEuDer/YQ6mNXrclyrzmI7nnLEQXp5BebBrNbCKW0caGu/Bd/q5x0HDN35DemHhJ1vvS95gwOg/I2LcLtWn1KUcfKu8k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=Ddk7gQye; 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=qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="Ddk7gQye" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6713Dfof2065517; Sat, 1 Aug 2026 05:46: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=cFzbgTTdtIa TVeHi7ypxn5pVsN6DBmawxARwxaAZy2E=; b=Ddk7gQyerKhzKTLj8qDLnnObu3E 5AiOXv6eZHRk+pKdndvltLJqwcuYBJYTuNvoYxdPNAlvN/UFxebufK+Nxg3dVdvo JV8Ubru3GDEDTyPsSYq+luJmk95cZbCsz0rX0+WTYJ3DwRHXwIEg1rUuN5qCK1P8 d0+4WZSta5Fumtsv/1DYhPaLsUsp+8ohvHeDF+K6PGiC6MUZnOLSJE7zK0wuA4D8 1ZITblapCitMwS3ebD0hki8lPa9IIDtZkzWRXtHLjHaVCYZq/MyJ7gTI0hgsTtfc iQdffVT0qxZcDWEn3AeWXIQvKSkI5vTseC7lNFdHDeVcDzEMD/+hT0oM/Fg== Received: from apblrppmta02.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.18.19]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fs8q509at-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 01 Aug 2026 05:46:17 +0000 (GMT) Received: from pps.filterd (APBLRPPMTA02.qualcomm.com [127.0.0.1]) by APBLRPPMTA02.qualcomm.com (8.18.1.7/8.18.1.7) with ESMTP id 6715kEnC016947; Sat, 1 Aug 2026 05:46:14 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APBLRPPMTA02.qualcomm.com (PPS) with ESMTPS id 4fs9vh0utq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 01 Aug 2026 05:46:14 +0000 (GMT) Received: from APBLRPPMTA02.qualcomm.com (APBLRPPMTA02.qualcomm.com [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.1.12) with ESMTP id 6715kErI016916; Sat, 1 Aug 2026 05:46:14 GMT Received: from hu-devc-hyd-u22-c.qualcomm.com (hu-pkumpatl-hyd.qualcomm.com [10.147.245.204]) by APBLRPPMTA02.qualcomm.com (PPS) with ESMTPS id 6715kDaU016814 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 01 Aug 2026 05:46:14 +0000 (GMT) Received: by hu-devc-hyd-u22-c.qualcomm.com (Postfix, from userid 3914174) id 082C2C04; Sat, 1 Aug 2026 11:16:13 +0530 (+0530) From: Prasad Kumpatla To: Srinivas Kandagatla , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jaroslav Kysela , Takashi Iwai Cc: linux-arm-msm@vger.kernel.org, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Prasad Kumpatla Subject: [PATCH v5 2/7] ASoC: qcom: q6apm-lpass-dais: add TDM DAI operations Date: Sat, 1 Aug 2026 11:16:05 +0530 Message-Id: <20260801054610.4047089-3-prasad.kumpatla@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260801054610.4047089-1-prasad.kumpatla@oss.qualcomm.com> References: <20260801054610.4047089-1-prasad.kumpatla@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: 8bit X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Spam-Info: AW1haW4tMjYwODAxMDAzNiBTYWx0ZWRfX7ckhmmdiKSu6 jJ38/jFJzVVkYSElxZq+fxVweZwv2irsZxFta3zFh4woo2NXCSo5NiGXep/Nt2YL7D84VniERH8 KE1YvaLLCstS4TY0z7hpLLX/t5k0kco= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODAxMDAzNiBTYWx0ZWRfXx0oGOulvp2L0 4ZyR8TUfVS+oTym1jcZmvV9tJerW6/AVA7f0bJfwUv2TF0LGjVf8kp1yEd8y3VndNhllwrR3l50 ygnWP080ugAi//S1DMvhB9mH/tUTzXSSPBSQJU47k2VNskvWOcU/KwxYzlPKOJ4kxksoOQ+V+Tv MxGDOI9a8MKqTFb44QagVXRaZrOLVNKCEEyM59vDwO/K2Z6mOgJlYLeDyGN9BPRCChPKNlT6/m3 Ln8uNX9JJeWF9IMWvo4aiRr0LN4HONd29SFXjTrjUTv7A8XPvEcTEGEl9R2iCBWK6l42T/wgcMW uFo9ZvPeSh8gshDTOlao9jgTq+L0Optinf9X0EowjCbAd58mnLMqL/zqvc5Z9Pmn7Y/tIdfhWXH 3haONzfhPDnfCO6LBkbUzLa8mxfApvtkDRs3rc/A7q4rpNInA3Lo2TTjHW5KXcvhoW9kx9Rrj8W lWicerzvTVOAkT3C0hg== X-Proofpoint-GUID: HA9akzPStZdDMlkm-f-urhMKMUVIhA-k X-Authority-Analysis: v=2.4 cv=IYC3n2qa c=1 sm=1 tr=0 ts=6a6d8829 cx=c_pps a=Ou0eQOY4+eZoSc0qltEV5Q==:117 a=Ou0eQOY4+eZoSc0qltEV5Q==:17 a=Sv0fKeRqtYgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=3WHJM1ZQz_JShphwDgj5:22 a=EUspDBNiAAAA:8 a=ZMHsmkTgFhVY9WPaUOcA:9 X-Proofpoint-ORIG-GUID: HA9akzPStZdDMlkm-f-urhMKMUVIhA-k X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-31_07,2026-07-30_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 lowpriorityscore=0 impostorscore=0 bulkscore=0 phishscore=0 suspectscore=0 priorityscore=1501 spamscore=0 malwarescore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2608010036 Add TDM DAI operations to q6apm-lpass-dais so AudioReach TDM backends can be configured through the normal ASoC hw_params and DAI setup flow. The TDM set_tdm_slot() callback validates the supported slot width and slot count, stores the active slot mask in the AudioReach module configuration, and leaves existing DMA, I2S and HDMI paths unchanged. Reuse the existing LPASS child-clock handling for TDM nodes as well as MI2S nodes, since TDM backends also request optional backend clocks through the machine driver set_sysclk() path. Signed-off-by: Prasad Kumpatla --- sound/soc/qcom/qdsp6/q6apm-lpass-dais.c | 60 +++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c b/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c index e68e8b000e07..e204fd59e512 100644 --- a/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c +++ b/sound/soc/qcom/qdsp6/q6apm-lpass-dais.c @@ -358,6 +358,53 @@ static int q6i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) return 0; } +static int q6tdm_set_tdm_slot(struct snd_soc_dai *dai, + unsigned int tx_mask, + unsigned int rx_mask, + int slots, int slot_width) +{ + struct q6apm_lpass_dai_data *dai_data = dev_get_drvdata(dai->dev); + struct audioreach_module_config *cfg = &dai_data->module_config[dai->id]; + unsigned int cap_mask, slot_mask; + + if (slot_width != 16 && slot_width != 32) { + dev_err(dai->dev, "%s: invalid slot_width %d\n", __func__, slot_width); + return -EINVAL; + } + + switch (slots) { + case 2: + case 4: + case 8: + case 16: + cap_mask = GENMASK(slots - 1, 0); + break; + default: + dev_err(dai->dev, "%s: invalid slots %d\n", __func__, slots); + return -EINVAL; + } + + switch (dai->id) { + case PRIMARY_TDM_RX_0 ... QUINARY_TDM_TX_7: + slot_mask = (dai->id & 0x1) ? tx_mask : rx_mask; + if (slot_mask & ~cap_mask) { + dev_err(dai->dev, "%s: invalid slot mask 0x%x for %d slots\n", + __func__, slot_mask, slots); + return -EINVAL; + } + + cfg->nslots_per_frame = slots; + cfg->slot_width = slot_width; + cfg->slot_mask = slot_mask; + break; + default: + dev_err(dai->dev, "%s: invalid dai id 0x%x\n", __func__, dai->id); + return -EINVAL; + } + + return 0; +} + static const struct snd_soc_dai_ops q6dma_ops = { .prepare = q6apm_lpass_dai_prepare, .startup = q6apm_lpass_dai_startup, @@ -387,6 +434,17 @@ static const struct snd_soc_dai_ops q6hdmi_ops = { .trigger = q6apm_lpass_dai_trigger, }; +static const struct snd_soc_dai_ops q6tdm_ops = { + .prepare = q6apm_lpass_dai_prepare, + .startup = q6apm_lpass_dai_startup, + .shutdown = q6i2s_lpass_dai_shutdown, + .set_tdm_slot = q6tdm_set_tdm_slot, + .hw_params = q6dma_hw_params, + .set_fmt = q6i2s_set_fmt, + .set_sysclk = q6i2s_set_sysclk, + .trigger = q6apm_lpass_dai_trigger, +}; + static const struct snd_soc_component_driver q6apm_lpass_dai_component = { .name = "q6apm-be-dai-component", .of_xlate_dai_name = q6dsp_audio_ports_of_xlate_dai_name, @@ -415,6 +473,7 @@ static int of_q6apm_parse_dai_data(struct device *dev, case PRIMARY_MI2S_RX ... QUATERNARY_MI2S_TX: case QUINARY_MI2S_RX ... QUINARY_MI2S_TX: case SENARY_MI2S_RX ... SENARY_MI2S_TX: + case PRIMARY_TDM_RX_0 ... QUINARY_TDM_TX_7: priv = &data->priv[id]; priv->mclk = of_clk_get_by_name(node, "mclk"); if (IS_ERR(priv->mclk)) { @@ -479,6 +538,7 @@ static int q6apm_lpass_dai_dev_probe(struct platform_device *pdev) cfg.q6i2s_ops = &q6i2s_ops; cfg.q6dma_ops = &q6dma_ops; cfg.q6hdmi_ops = &q6hdmi_ops; + cfg.q6tdm_ops = &q6tdm_ops; dais = q6dsp_audio_ports_set_config(dev, &cfg, &num_dais); return devm_snd_soc_register_component(dev, &q6apm_lpass_dai_component, dais, num_dais); -- 2.34.1