From mboxrd@z Thu Jan 1 00:00:00 1970 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 B50F940098C for ; Mon, 27 Jul 2026 12:42:49 +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=1785156171; cv=none; b=dNrQVj6OHcdTMHTKhOUX+g1NQX36KDkRV/XrEp3/PJcf/uFY61VWdE38Kzd81bvCfQ7hjS/gZdP9z0hvpdPAMG5t3NbjyMozZjigomR/OK3iMz6/MszWYJIHhjeJfj6iMNgV43Cf4Zob1dphjsn1xgboZxtgwhWkesV8b90nCPw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785156171; c=relaxed/simple; bh=P3bcNk2ItdYNy9fv7D3XFoVJLhJ9Kx2btxWKnvnZJDQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=as3MutLMzuq8oqXvlI8pYOEQ0AitHQkiyblY0ahayGTsvweohxXniTDokgz231oBtidI6BeI5zqbbnzsk/z/6P0mMqiW99E5xBxDiTarGMKf3kXRnrz9UGJTpU22eU/0Kd5zFhdSFyioPJhd2yFUFd80oyaGUfc7bDdDlQhNgUw= 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=LKIeD0Y5; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=IZ5yqK96; 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="LKIeD0Y5"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="IZ5yqK96" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66RAMDuC3604276 for ; Mon, 27 Jul 2026 12:42:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= B126ndC369ZSKqzxhDuIkJaY7WNwhTlD7hGGb6MU6/E=; b=LKIeD0Y5IeHRemRK ZiYPOwbZZj6nhF5smsr8WBzz6opMQrtw7NHCk9XjlN8tc7BAyvhNU+i0vfy5nLT8 S6cEoVnY4e03FbH8tc8gHstdNjh9jJRYTm3Yy0uvZSHATNT5wvnEZd7ttTI/eH2H Oy4b7F3pxgLqZUZ04Lf3QGKii6xdTKx/TB7aqYpDiCLLpozdBIjcmFWWL3yoGIPH 7bkuylVJuWhpt5YBh2SFY1PEXe64Vd7kEov0PC2CMuSWIxLjlraMJHiOXSuT0tSa BpIYu+rZhc/vcMQJ6YDSvDJgFl8lZn57mjf6pzU/rItjGM/hHL9JdTEGdl+MVcrI eZM+sA== Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fngysuftu-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 27 Jul 2026 12:42:48 +0000 (GMT) Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-51c1a97644aso34363561cf.2 for ; Mon, 27 Jul 2026 05:42:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1785156168; x=1785760968; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=B126ndC369ZSKqzxhDuIkJaY7WNwhTlD7hGGb6MU6/E=; b=IZ5yqK96U0aBLHyBmHig4XCr6mCRgmCP+zJqC3d23n+5CgA0hd3vQPahxcsUDex7Fk 4Lcl8wbxExkvIU/ldV0VA+w0rcQMDnMeoRtJj8OSCU/OCwrK4alsRywbJNp5lpF3dzBv EBvyseTppivhs6v5HdENU59orKOfJZN8PQK35qeIm+XTMkTKemLzHiRWCR+jxlTg1hmc eU1LMqkrmeal6n7C9ltybrZqfq6ODYLt5616KiGmNKigr5Pgs4yO4tr3Uxj7sS9JWKSU LhPcMuUoZ8NFhk7zR8sTfUbfBA4vGpzMOD8KPzANnixhMXB7GebZjdGzzDHNxFVbG18m fW4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785156168; x=1785760968; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=B126ndC369ZSKqzxhDuIkJaY7WNwhTlD7hGGb6MU6/E=; b=ffu4VnWjyTvxDkDM37omronnwIi6T9fuX/00mG2a7dT++5Hmi0vIBdNcqUot/DdzoA Xl/vGTV4odDI1UQLbFRTNwvtdU/wwnlk5y7WOjeOnESz8+lzSV66N9b6u6vgTETt9wJR RVhj/50TV2Q9FGhnVmZKkKfF5aIAH8PiPpEXimKCZsJIxAyx21ZQDK7ZzugTcn89R6jm +k+a9w0+4i+DRHA8hJmMxnQogqW5GlMlINyz0m7LHbiJsVy6qKPTQ9uIOMGIcho+IQGM th6dV1a1MZzhoORxP4jjT8crxl4rOYM/hLZiPL5TAptG4q8FnX+A/JOPZIbFdsQNNWp7 u1BQ== X-Forwarded-Encrypted: i=1; AHgh+RrVp4eWVQ+ofLKBoC7iaDDCt8FCkTlLKXZjOOLqeJvhaQZAS1jFvi222FZZJJG5W4j/A77SfgHHPM+oCi4=@vger.kernel.org X-Gm-Message-State: AOJu0YxJ0ZLCbQAC6MtdylM7QK74sDZkwpjxgNCk/4Yi/MU4JOZAImz0 994QuRgm/XQp3uiwJr/b7d9rF9eDJLyaKnUSSZv5Yh/VQNyyLCbb3pyfZ9iw3gilcvo9ZPTW5Ai jHVqOqoIZmw987ARiuWjpvSYfvJDN9gSpgUC9cCwaR+TfUjp7r7KOCcfa/9pXqS7Wcsk= X-Gm-Gg: AR+sD10nXj5yCJ7GtOv7VJmEXAWRKKFfH502HZgUrp1ljglXZHHABWDQ+3JjnU+kujK ywVvWwX1Y+o/xxcsyYhUnkGbkj1/xt66tVN+/Aj5x/MNm1Q6nresEQg3/CwFoY3z7avQyU4+w1V iEh3fhM+yGEGA7obzl5BSZlVGHe66lbI25VGobGMMWTSba57CgqrdFxp7wMMLCoDegankiQgH9A PbEFAxd0K4mL3vH8S/i2RYw+viraWNjtjED4laNK9bJNwhT6myNQebTuHapwVrfgXY9QDmOX6zR yUx0sX2KFbmYegalPjR90BijZrG+PF8So7Wu7jgiYiTCEaibNeliE3aYs5HGOIt1tl9UeQpiwV6 cInoL92BLXGyEeTDzW9d29q9XE0o= X-Received: by 2002:a05:622a:550:b0:51c:7b11:41b5 with SMTP id d75a77b69052e-529a887fdddmr84157471cf.81.1785156167933; Mon, 27 Jul 2026 05:42:47 -0700 (PDT) X-Received: by 2002:a05:622a:550:b0:51c:7b11:41b5 with SMTP id d75a77b69052e-529a887fdddmr84157101cf.81.1785156167408; Mon, 27 Jul 2026 05:42:47 -0700 (PDT) Received: from [192.168.68.105] ([5.133.47.210]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-496b4ee0e91sm222355475e9.4.2026.07.27.05.42.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Jul 2026 05:42:46 -0700 (PDT) Message-ID: <53bf0259-d7f3-48b7-bf6c-ae3d58856b49@oss.qualcomm.com> Date: Mon, 27 Jul 2026 13:42:44 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH 1/8] ASoC: SDCA: hw_params: program upstream Input Terminals for OT DAI To: Charles Keepax Cc: Mark Brown , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Maciej Strozek , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Srinivas Kandagatla , Bard Liao , Pierre-Louis Bossart , Richard Fitzgerald , Jorijn van der Graaf , linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, patches@opensource.cirrus.com, linux-kernel@vger.kernel.org References: <20260722234221.884765-1-srinivas.kandagatla@oss.qualcomm.com> <20260722234221.884765-2-srinivas.kandagatla@oss.qualcomm.com> Content-Language: en-US From: Srinivas Kandagatla In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzI3MDEyNCBTYWx0ZWRfX896SmPscFOBf fE4M/qykNYvdvV8PtaHsy1gcSJwqIPRXCJotNzUOIL5/xU1jatDve3AO76IJvELexz+gRyFkZ+D eb3eM0WfmB5Bcb9RsnGOnHPWGyMUjOa78vFTD2kLZrOAqsdY5ou7Dm/Jrq6+fnXwZnLwK5z3zGM 4VVi3KuTnKu3LnZ4ulcddaE+JNKlgzVnF6MlAHS4EcKNRvkSH8aTRF/9dDQxlkTitru98EQWgFO /6r0SPeyPBI0ImazgwGRpiy2RVCFMiNoRtFRHtbsDj5Di9byKhN+56ANOGqGmhaCxvfw75y1paT 3/pkjexSL2kd9pAxSziWQVxFVKoTfwpzx4mF1+P5uFoIK2wLt8tj/bxyzTu4afp+fNN7pwxwqVD 3n5Oc40wsCd/r4+YYIsHWzbNBzzTiIH0o/fDCvFkvuH6uXz8x9BXgfwsHPBuk3SuIozIpA1vJk7 qgcBcAhQocgUhu/9npA== X-Proofpoint-GUID: MElz-y7jOrZzKeExwPDr3paCyRUADMHG X-Authority-Analysis: v=2.4 cv=DNG/JSNb c=1 sm=1 tr=0 ts=6a675248 cx=c_pps a=mPf7EqFMSY9/WdsSgAYMbA==:117 a=ZsC4DHZuhs/kKio7QBcDoQ==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=orBqx6od7Nat40pafO0A:9 a=QEXdDO2ut3YA:10 a=dawVfQjAaf238kedN5IG:22 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzI3MDEyNCBTYWx0ZWRfX+KK1e+MQhvge eLMuTDSrYPM1H+Yed/E24999NS2sJ1CTqLToJkvitjjDanO6MUupAY+cIGUXXNMTW3P7nsndCmT 3g3jt5SUD5fdRQhzfTuQGhznrW706rM= X-Proofpoint-ORIG-GUID: MElz-y7jOrZzKeExwPDr3paCyRUADMHG 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-27_03,2026-07-24_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 clxscore=1015 malwarescore=0 bulkscore=0 adultscore=0 suspectscore=0 impostorscore=0 lowpriorityscore=0 phishscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607270124 On 7/27/26 9:33 AM, Charles Keepax wrote: > On Fri, Jul 24, 2026 at 05:35:36PM +0100, Srinivas Kandagatla wrote: >> On 7/24/26 2:14 PM, Charles Keepax wrote: >>> On Thu, Jul 23, 2026 at 12:42:11AM +0100, Srinivas Kandagatla wrote: >>>> For a capture stream the DAI is the Output Terminal so >>>> sdca_asoc_hw_params() only programs the OT itself: cluster, clock >>>> and Usage. The upstream Input Terminals that actually source the >>>> audio never get their Usage, ClusterIndex or clock programmed, so >>>> the power domain comes up but no samples are produced. >>>> >>>> Walk the source graph from the OT and program every Input Terminal >>>> reachable through it. >>> >>> What was the thinking with respect to the units in the middle? >> >> As per $6.3.2.1 and 6.3.2.2 >> FUs does not modify the cluster, its transparent to cluster, Output Pin >> uses same cluster as input pin > > But that section is specific to FUs, all the other units I > listed below do appear to allow cluster changes: > Yes, other units will not preserve the wire format, this is what I was planning to send as v2 which will stop traversing at any other units that do not preserve the wire format. +/* + * For a capture stream the ASoC DAI is the Output Terminal, so + * hw_params only programs the OT itself. The upstream Input + * Terminal(s) that actually source the audio (e.g. a mic input + * behind a power-domain entity) never get their Usage / + * ClusterIndex / clock programmed and stay inactive, so the + * power domain comes up but no samples are produced. Walk the + * source graph from the OT and program every Input Terminal we + * reach. + * + * The walk propagates the OT's channels/rate/width to the IT, + * so it is only safe to descend through entities that preserve + * the wire format on their upstream path (PDE / FU). Stop at + * any other entity type: source-selecting or format-transforming + * units (SU, MU, CRU, UDMPU, MFPU, PPU, XU) would either clobber + * an inactive branch or program mismatched parameters, and a + * codec with such topology needs a smarter walk than this one. + * + * Depth is bounded by the number of entities to defend against + * a malformed graph with a cycle. + */ +static int +set_input_terminal_sources(struct device *dev, struct regmap *regmap, + struct sdca_function_data *function, + struct sdca_entity *entity, + int channels, int rate, int width, + unsigned int depth) +{ + int i, ret; + + if (depth > function->num_entities) { + dev_err(dev, + "%s: source graph too deep, possible cycle\n", + entity->label); + return -ELOOP; + } + + for (i = 0; i < entity->num_sources; i++) { + struct sdca_entity *src = entity->sources[i]; + + switch (src->type) { + case SDCA_ENTITY_TYPE_IT: + ret = set_cluster(dev, regmap, function, + src, channels); + if (ret) + return ret; + + if (src->iot.clock) { + ret = set_clock(dev, regmap, function, + src->iot.clock, rate); + if (ret) + return ret; + } + + ret = set_usage(dev, regmap, function, src, + SDCA_CTL_IT_USAGE, rate, width); + if (ret) + return ret; + continue; + case SDCA_ENTITY_TYPE_PDE: + case SDCA_ENTITY_TYPE_FU: + ret = set_input_terminal_sources(dev, regmap, + function, src, + channels, rate, + width, depth + 1); + if (ret) + return ret; + break; + default: + dev_dbg(dev, + "%s: not walking past %s (type %#x)\n", + entity->label, src->label, src->type); + break; + } + } + + return 0; +} + >> entities in the middle could change the cluster, such as CRUs, >>> MPFUs, UDMPUs. Also possibly SUs to consider too, since they > > Thanks, > Charles