From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=205.220.168.131 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796073806; b=NhNgiJ6yLkpnKErtiZs0N+AoIUwJoLP0YiuVRnD0IkqoR5E2QZPhRKlJ5M3jAriu0+ZK 7zZWWN+VMq3APTenmNHqVsv11l7TJ/2CdG441jD9D9JWoSCbn0iKSmtNfi/j/DW9K4QMo UEIvHXLAeciEU386Q2eUOokMLOiZktRnnmVughkcWXRFya1jIbmd7V86w7YW/dlZZu825 s27dnIldF23ue7/RqocbBhoJ+P2pds/TAqySIVa1DZdwBHxZs3QJkbDO5csHBZr1DPkBL tWUx9Ip+ZTL3/AQQ+ZzYyKDv7KtlqRkSUXR/UEEpqoYnT5gsoAtGXw/b1BWW0fVOwZA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796073806; h=DMARC-Filter:Received:DKIM-Signature:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:X-Received:Received:From:To:Cc: Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-Proofpoint-Spam-Info:X-Authority-Analysis: X-Proofpoint-Spam-Details-Enc:X-Proofpoint-GUID: X-Proofpoint-ORIG-GUID:X-Proofpoint-Virus-Version: X-Proofpoint-Spam-Details; bh=sHkeIm4RalRpZ4n87opkytrHR25vWnrE4cHamlKiGxU=; b=DgEoLe2a5AIUTH7CuucJ+n2NMOFaYTYqMbn3mEKfaUuXH0sDl+oaQ/H+oXw25FK0BMfh /FrIZg+DUZeK3doiuCFH9RUHboD7p0YhgotKMykZa0pbfcpddJ/5G9XVIAeRy7zVEtXjG KSuY9SVGaGEHvxs9Fq7AfFSo1nUb16r+kW0leGKQnnWT1Csn5mhHluLE52tSJUKgkgzX5 AV96G3Ipoq8xIbJyGvBsufpmT871AZk22VYulPM+lQFRvM2I3QYkwX3TichQ4UNK7Roxc 1ghsSb6zYmckWjHY6q8WclRkx0Rgi5vgoFZiNDqQscXywe50lpB4zfVmLamPkOIUPRQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b="awZfuDr/"; dkim=pass header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=GixKeDAu; arc=none smtp.remote-ip=205.220.168.131 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 08292606A32E for ; Mon, 30 Nov 2026 21:23:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 08292606A32E Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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.a=rsa-sha256 header.s=qcppdkim1 header.b=awZfuDr/; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=GixKeDAu Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AUKQBSw4082930 for ; Mon, 30 Nov 2026 21:23:25 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=sHkeIm4RalR pZ4n87opkytrHR25vWnrE4cHamlKiGxU=; b=awZfuDr/l6rhnL/HiqbnshdxaTR 5xJTUuSbZqDubEKkbxuq1CPwmgIa4ustiwKFquPZuIVDYYkK+FJ5C9XhKzQNBVvY hHH0sf00uLC1U9BE9bRw+QcbF7uEBP0CT3EoHRRG47k5tth/2q3dhuCbhaMuDUXW 6hDNYADxadcHCd/r9s8DilB1vaL22QBCXGsjBBWwiUiCSa/TVjJb/V8YoCfV5TgN a4STzB3VACHkrRHtFwcoYB3L80hLfKBBoCILVnpgbtmItF3Mwh8lRgGtIhbl7z0I XBswv3KSCVrlVl0KjJbxA6eSMfYL6pKqY1hYmKDRAnpQr4Z33rsJ/1T26kA== Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j98uda8hu-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 30 Nov 2026 21:23:25 +0000 (GMT) Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-93f5844cb60so1775219285a.0 for ; Mon, 30 Nov 2026 13:23:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1796073804; x=1796678604; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=sHkeIm4RalRpZ4n87opkytrHR25vWnrE4cHamlKiGxU=; b=GixKeDAuWjrTCevzGi+IQgjAbpR/fGdYmektoIlKP1qf54+fJiCDBfgMpKo9MRwC++ TG8nOi52sKUHA/bCenkHUDcLdVJGT3XgwFGGijGPVCbXuKh2CvEsOoeqEyQMiL2DVfYz gPxUEQwOvVfODHSAVHxpRs/c90w48egdVuLPWUqiwl3k/15kmXLdMf2dS8meEA1beKX+ cOOGPCAD5QKqYJOvdq0toS4vIna7TCZ7PLJuP9QzWvumpDZoKnwlr1Zllvt/s0jdyQ43 Xi6WkEUqgWX2z3mkV9iE/9UGHOiZz/7iRaQQUg+PXFK019d7V6kYCnOIgSg7CmT2RsKh K27w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796073804; x=1796678604; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=sHkeIm4RalRpZ4n87opkytrHR25vWnrE4cHamlKiGxU=; b=tNH/BhEUUc/oQMmepNyqr24G+H+ET0ZAFu0XX7ank7LBmgdOI+Bvdhjg5Mts0khXUn EFs0WCFLkfCi79pCx/4+1F6iinocReVicj9NGXbcRHPPN7JCrffvaoC30JLu7vbNGvAh GJ0l4zPHySfEi80czDtE2Xg947y3Gb0hzuAUfJNcdWf3l9nlJyF25h3+VWrFDhS42jKp RQ6ePhDQyEjc8RBkB+aOK7pw0pViZGXAv7Eq9TWZShLYkhe5piRpcXOYJMSSKXdFL0PW EbbOZX1+MnZsnohje74ByJPGTyipgjcZAz6u6Xjazsv2kEb0kYZ+ryI2kFRZtm/N3eCe u2Pw== X-Forwarded-Encrypted: i=1; AL+hErFJEXmghUwFxVOr/4W8Hmt97PMyyfnbD3QIUTw1TfdduwyUj6oDpzXssSbqHPjEEzdyjFUFtXXus45CZ/A=@vger.kernel.org X-Gm-Message-State: APuU4Z/j2BVF/iRcrO9P7Bjdi5B3+azV37TLLQuz8J7NFbzaCLhV/10R 5WGvvHLqUYiWYEtBf5uF/gupjKGrN6NQudPOa5+xiKMVjFkBCLi7RjTc6lQj953/OrXI/5KSrcV RtWXd8kv+Ap+NXYr7AdScCIE9snXAQclZoA1XL1S+BNOFjNgcMoC131vp+m+whNKjtjw= X-Gm-Gg: AZFdTZcJz5ZJIMVySu2zXb0/W7pKJfV8pdbttVyFltqfGYALWjjYZQdPrLaToBqGp1N lrwXdREfllE4T9R4tGtunQb+QhtQ+E9m/iAx6ljPkyY7yxoA4cZtj1fA+hX/zx02Vd437YnLY9z TwXymBqO9dGv4xK3WBSDvnIe6oWhpEFqITjW2oKwPuKPTWUSOTs4VhZImua4pSfGXvZrSXmIsQD w3ecSPj0SgG99fHw3Q5Qjc2VDbf2r0Pb8TF39aCzYK1JpMdah/jghqxnM93WNcYazT6aw4EEf// yfdT210GTVZpgLtQy4qBpXvLJt2SRDur3S1cBYlwcaOsnWD62/yg8WNiT5VOlxcO9XWhA89B8yO fm+WwjNxzet4npOp0CJXri4ydq71r3uUaIhU2otburLrqNMn3Pt0r8Sf4IDAo5sYu X-Received: by 2002:a05:620a:4610:b0:949:6b5e:33ee with SMTP id af79cd13be357-949b360efedmr6898420985a.31.1796073804369; Mon, 30 Nov 2026 13:23:24 -0800 (PST) X-Received: by 2002:a05:620a:4610:b0:949:6b5e:33ee with SMTP id af79cd13be357-949b360efedmr6898414285a.31.1796073803866; Mon, 30 Nov 2026 13:23:23 -0800 (PST) Received: from debian ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb88402ce9sm792580515e9.0.2026.11.30.13.23.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 13:23:22 -0800 (PST) From: Srinivas Kandagatla To: Mark Brown Cc: Srinivas Kandagatla , Ravi Hothi , Jaroslav Kysela , Liam Girdwood , Takashi Iwai , Pierre-Louis Bossart , Kuninori Morimoto , Bjorn Andersson , Konrad Dybcio , Abel Vesa , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, kernel test robot Subject: [PATCH v3 08/24] ASoC: codecs: wsa884x: register the die temperature as a thermal zone Date: Mon, 30 Nov 2026 21:22:42 +0000 Message-ID: <20261130212258.7376-9-srinivas.kandagatla@oss.qualcomm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261130212258.7376-1-srinivas.kandagatla@oss.qualcomm.com> References: <20261130212258.7376-1-srinivas.kandagatla@oss.qualcomm.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-Spam-Info: AW1haW4tMjYxMTMwMDA4NiBTYWx0ZWRfXwHRX6pTGlx3u nAPJqx4vo16lVkf7ks0ezFfESM8YSk3mKHNL6BSrRelS1zGjh0Cte1vUGBfNUV+k2EfIob27/+P cijeILFpLVaglBNyyWeCHK7M0MT0b9o= X-Authority-Analysis: v=2.4 cv=edqo7LEH c=1 sm=1 tr=0 ts=6b0de94d cx=c_pps a=50t2pK5VMbmlHzFWWp8p/g==:117 a=ZsC4DHZuhs/kKio7QBcDoQ==:17 a=zJRp6_cAMcgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=Um2Pa8k9VHT-vaBCBUpS:22 a=VwQbUJbxAAAA:8 a=QyXUC8HyAAAA:8 a=EUspDBNiAAAA:8 a=51jdShTR6rvD-JhUMxgA:9 a=IoWCM6iH3mJn3m4BftBB:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTMwMDA4NiBTYWx0ZWRfXxpbLopBfqnoo 6ppN5JhbbS+rYbUT4emNMlXkDBueVNSvgZGL/waBfgQUbCxcii812gIdZSWrBVGLTuqLtqYuwuP pPJ4uqlPgoc9NcoIkcz3AeEimLsjHuwJXJIlAR3Xn+pOXcZUi0on36BK2yTSPG8gBR2YcQGoAcY q8XPRubcJ3aT5XDzavnEyUzQBiEl0BuAtLmRp41nhcQj07oBUTu73mfC1FTyOhF/EOeWhIMEY3b lYSD0fW5rvq/s3xERi7kolN+89k7wyeODcriEgtG+QMfBJDHUQrmo6oJnuM1x+qmZmkeTErsmZY 72cQmufbX10ZPWesSFEqVniWxoUZIJnR8wWLUxW9V4+MhO5vZh/LH201DNdZ0LElBRrNzJWbVO0 cUL4yq64tUwrL+N1zjduhv+v3MxR/tYP5PGTxxh/mYyhwrenDN9b8bJunq++Q5rXdENA9xH9l8b mFjErz0GQQs2I5Z3dCA== X-Proofpoint-GUID: eMfsRjcCu0USZNA6Nn5Ztp8k-BO0ijyy X-Proofpoint-ORIG-GUID: eMfsRjcCu0USZNA6Nn5Ztp8k-BO0ijyy X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-30_05,2026-11-30_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 bulkscore=0 lowpriorityscore=0 malwarescore=0 phishscore=0 spamscore=0 adultscore=0 suspectscore=0 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611300086 Speaker protection pairs each speaker's calibrated resistance with the amplifier die temperature (T0) at the time, but an in-kernel user has no way to read that temperature. Register a tripless thermal zone over the existing temperature read, named "wsa--" so a user holding the codec's device can find it with thermal_zone_get_zone_by_name(). Until the codec is initialised, and while the PA is on with nothing cached yet, return -EAGAIN to hwmon and no valid temperature to the thermal zone, instead of a plausible looking zero. -EAGAIN would make the thermal core re-read the zone every 250 ms and keep the codec awake. Signed-off-by: Srinivas Kandagatla Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/20261124071812.oiRgQnHg-lkp@intel.com/ --- sound/soc/codecs/wsa884x.c | 70 +++++++++++++++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/wsa884x.c b/sound/soc/codecs/wsa884x.c index 91aa004d7137..d0a00aced220 100644 --- a/sound/soc/codecs/wsa884x.c +++ b/sound/soc/codecs/wsa884x.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -1935,8 +1936,10 @@ static int wsa884x_get_temp(struct wsa884x_priv *wsa884x, long *temp) if (wsa884x->pa_on) { /* * Reading temperature is possible only when Power Amplifier is - * off. Report last cached data. + * off. Report last cached data if we have one, -EAGAIN otherwise. */ + if (!wsa884x->temperature) + return -EAGAIN; *temp = wsa884x->temperature * 1000; return 0; } @@ -2058,6 +2061,42 @@ static const struct hwmon_chip_info wsa884x_hwmon_chip_info = { .info = wsa884x_hwmon_info, }; +static int wsa884x_tz_get_temp(struct thermal_zone_device *tz, int *temp_mdeg) +{ + struct wsa884x_priv *wsa884x = thermal_zone_device_priv(tz); + long mdeg; + int ret; + + /* + * OTP trims read back as zero until the codec is initialised. Report + * no reading rather than -EAGAIN, which makes the core poll the zone. + */ + if (!wsa884x->hw_init) { + *temp_mdeg = THERMAL_TEMP_INVALID; + return 0; + } + + ret = wsa884x_get_temp(wsa884x, &mdeg); + if (ret == -EAGAIN) { + *temp_mdeg = THERMAL_TEMP_INVALID; + return 0; + } + if (ret) + return ret; + + *temp_mdeg = (int)mdeg; + return 0; +} + +static struct thermal_zone_device_ops wsa884x_tz_ops = { + .get_temp = wsa884x_tz_get_temp, +}; + +static void wsa884x_tz_unregister(void *data) +{ + thermal_zone_device_unregister(data); +} + static void wsa884x_reset_powerdown(void *data) { struct wsa884x_priv *wsa884x = data; @@ -2194,6 +2233,35 @@ static int wsa884x_probe(struct sdw_slave *pdev, if (ret) return ret; + if (IS_REACHABLE(CONFIG_THERMAL)) { + char tz_name[THERMAL_NAME_LENGTH]; + struct thermal_zone_device *tz; + + /* + * Register after runtime PM is enabled, as the zone is read + * right away. dev_name() is too long for a zone name. + */ + scnprintf(tz_name, sizeof(tz_name), "wsa-%d-%u", + pdev->bus->id, pdev->id.unique_id); + tz = thermal_tripless_zone_device_register(tz_name, + wsa884x, + &wsa884x_tz_ops, + NULL); + if (IS_ERR(tz)) { + dev_warn(dev, + "thermal zone '%s' registration failed (%ld); SP T0 kcontrol will read 0 for this codec\n", + tz_name, PTR_ERR(tz)); + } else { + ret = devm_add_action_or_reset(dev, + wsa884x_tz_unregister, + tz); + if (ret) + return ret; + + thermal_zone_device_enable(tz); + } + } + return devm_snd_soc_register_component(dev, &wsa884x_component_drv, wsa884x_dais, -- 2.53.0