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 2673A3803F7 for ; Fri, 19 Jun 2026 12:14:38 +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=1781871284; cv=none; b=tz3OQFML1I2chPZzKj0iI3E2SrdZINhzNPcJ8VgE2rR5SRLrtT0GiR0bBDM7gFhOYfxWtSkHZyZ/cCaHHFihopzqu7eUniI6K1muiEj0UhFh/SoUIukF1ukQiBJOPYo0NPYDHzEnuNP8ufRETMq3/ZbNBcQW1Yhdn9j3AN1gHKc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781871284; c=relaxed/simple; bh=gmlc2x3Sx9TTXS2SnEsXIeKsBRFp3YpvrWD1xNAK2HY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=SmeHq4XMHyJW5/gv/g7tCBCuuqY7FNIWCz0L9kTnlfT/1V9+EKMvr7917xIUKIggHam5Qbaw1TyDZ8+Bix0NcaeHFW/cVp7xdca+Q05+1Rgnk2ZN4ktPf76LGaFuGjfrkCsSVy+nGRR7zyS6yaPoY7kfLhNlNx/5dzuhCOty+zY= 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=n2+p+fQ4; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=TkC0SvdX; 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="n2+p+fQ4"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="TkC0SvdX" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 65J7Q4wP4033733 for ; Fri, 19 Jun 2026 12:14:38 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= YB5TdQQBRKdo3NZtG8wlUHn81r0WZQz2AuX2RuLMVLU=; b=n2+p+fQ4wCRjumLr 9veJ7nFFJGeEtOdWgOFs1ybRBss+PDVGhQEGMHlenqzHC7hEbextHucdEabVTKPO UOtTPWPbi8QjLPE501VmZkFaTl2Q75ETZrOeKQdZM0z+YDRG0p6qRc1ICku8bEXd PvIxR6mt1kAiFrA2poopOGmsCvcn0Uzt8gjd3SzeGVsXgCsDgmbUgdMzKBi1PVne LtXdnX00ovAhka7v5I+VbhEbQfaLeUimLF4RoP0o0sNnHhfS8HoQj6pnpt23f/o5 GTiLs61/miBQehGAdMak3r/Zw6Co1CEX41JdKufLNRgMkPQSvidbyCCyVOHRdnpr F9LEpw== Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4evp6sb503-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 19 Jun 2026 12:14:37 +0000 (GMT) Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-5178a632a12so4847531cf.3 for ; Fri, 19 Jun 2026 05:14:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1781871277; x=1782476077; darn=vger.kernel.org; h=content-transfer-encoding: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; bh=YB5TdQQBRKdo3NZtG8wlUHn81r0WZQz2AuX2RuLMVLU=; b=TkC0SvdXMnxdbJ7qh05Ekxyl99PsAU1gkNU54/1uBRpDtcA0R622RyEy16xgoJTToi yuGiZmTg+9zExR6YMYfJzFIG9MEgt5muZnHiy8ORukw51uhLWVMpb+NANPM9STdY224Z ZWsYeBLbMOnpBI6ztwNvk2ealERPtpi9nHMXgeY6lKfbeEBDcpX3PzuZQPFm7rgmRv5d fTedEnXAj2X9mVgDmp2snoFa2QnoBmwuAollcrvKlT7bXP5zqCxF4UzV50hclZIT1MUx C9AIV3va97s1SVtdNrLIhH3NmesRvwgGcmakP3NhsINxjYAnXGJGBQIaoDkF2d7RP3LM uA7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781871277; x=1782476077; h=content-transfer-encoding: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; bh=YB5TdQQBRKdo3NZtG8wlUHn81r0WZQz2AuX2RuLMVLU=; b=R1Pj74BVPSsalMTBnsFt9S6FYWEwypI3xzS7H8f00fJRTRzm0hRQau33LJDSCFTIJT Sa9d2dVEipWbhWhhImYPdMk83Rq3fKUtSbBZqanVp5wwOgY7mdEY8HpRTqriLDBovYhP RwbH8QXCmFVkQT17hMEk0ECAxAa0YDFWPueCvuurZCugToh2u3nhU639a28SdhcMI48B xcsH2cpBB3AEQUig2Rnc4T78MDH1dQllH+bI5GD+KdLKqoPquC2oLKmRJDBbMULy0F1Z XojMZvIny/1DsI+WDs2OWaZe5BmLN8dQrRM3r7jCNBqUBxzHlpHHAbtUd4PjycCzLfMx 6qIQ== X-Forwarded-Encrypted: i=1; AFNElJ9hLPPM3PYVHPquN0rbvJr8ekHCO3ylNuInH9RYkzkYbl2hBz9gQK9YvquyVhh55yoycQA1tNUu96j506Y=@vger.kernel.org X-Gm-Message-State: AOJu0Yx5K9emMk1JY70qYcFFEA2l0PibGDSnbY05PEVGQV3L99CKZXht SjkAEhEZ49wR0NOeDZ7DuMc3T90NTnkohzt6K3oSpDPAmW4nwIeZtrollzTIwau0UV8uyDa2r1A IqSSs7IXgyBZOrjRy4P4SvgsPQub/RYae3Uqfadt/lxhr2R24WU+RvBI4Mk4kxRWRsBk= X-Gm-Gg: AfdE7ckMRvXBH5HcKN7wxUDlOS3+h7CCIg1UkTe3q15ZBSsyqn53JTyGWwrgNLn9A5F iFpdFyW0c7XjnqpWEsUHZsdc+W15sEvsGF6lp2tLoxwWQvmqUEIbDI7CDdUwAIPNWyA5n8woi5R pWxeVJGNa4DEiijCNvJ6g9ZfIcO+PcjBESvbQrY8eiAGuOiXE26IPfGKn0P8TwAHSCVNlcC9jtr VPhs/ymV0ddicQ/oSxkZnVLI5izx7KO85GkksV3nQtuFwydioeMMWGRuFxgBErD1MCmOn2NN9DE 5I/iUqjasdwK8FiU0mKcbkCaAVsiK3LGJlrthNNpjtuItMhNf30X9Pe3rFBI4akrSYJfd2iKggA bND8G/hybb/R0om91R5Jk2mHR+QWPyB3t35A= X-Received: by 2002:a05:622a:41:b0:517:8999:6c50 with SMTP id d75a77b69052e-519fef5752amr3187581cf.8.1781871276942; Fri, 19 Jun 2026 05:14:36 -0700 (PDT) X-Received: by 2002:a05:622a:41:b0:517:8999:6c50 with SMTP id d75a77b69052e-519fef5752amr3186881cf.8.1781871276235; Fri, 19 Jun 2026 05:14:36 -0700 (PDT) Received: from [192.168.120.170] ([178.235.128.140]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-696edc880cesm855827a12.8.2026.06.19.05.14.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 19 Jun 2026 05:14:34 -0700 (PDT) Message-ID: <5ad33cf2-3168-44f2-89fe-a7fe1420f8f4@oss.qualcomm.com> Date: Fri, 19 Jun 2026 14:14:32 +0200 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: [PATCH 2/2] thermal: qcom: Add support for Qualcomm MBG thermal monitoring To: Sachin Gupta , Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Stephen Boyd , Jishnu Prakash , Kamal Wadhwa , Amit Kucheria , Thara Gopinath Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Satya Priya Kakitapalli , Ajit Pandey , Imran Shaik , Taniya Das , Jagadeesh Kona References: <20260601-spmi-mbg-driver-v1-0-b4892b55a17f@oss.qualcomm.com> <20260601-spmi-mbg-driver-v1-2-b4892b55a17f@oss.qualcomm.com> <7478c540-a5fc-4238-bba0-5b04547f57c7@oss.qualcomm.com> <487f0ed1-dfc2-4f7b-94ce-60045017a663@oss.qualcomm.com> Content-Language: en-US From: Konrad Dybcio In-Reply-To: <487f0ed1-dfc2-4f7b-94ce-60045017a663@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Proofpoint-GUID: F2pm2UqMwp18ghqNQHq-JZufyh0O48zh X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjE5MDExNCBTYWx0ZWRfX/IzYoRco55iL qptVCp/lcwrENibZlOZDqLC6h+C8wd1ipDt6RyviBdYqmCKQ+mqduTyoe4POHkKwNMc63O3wVVN ZYSj6ndtVQnVq6kWEANp/MyMHQFYX11LUSvhgdVvkth1qoLCk8BmwpFzyVwhmTT1Q55atiaErDh jW0a9zbSH7XZ/1jj/vzkp9cKp4o/NfqGBzKjj4S5JxqNPqaoRrzYLjmfhjItxm6BjaYTsnk3i8H /i92HmXtaOSe7LN3wKLQC5Z3WtjlcZRAmvkDQ/iestY5tLyJ0DL1TeorWD9pC3f2VspZTrpKqMf AzZULWXo3/ktaBz9FD6alpFd/6goHqXgtI99URjT9xVmeSuZemSFo5AosQH4lRVBA/NFSIrh4zQ eNgjjOG/k+LQiaeSTb5wXeIOd5qgkgKH9Ga7QKpkEN+lrkEF9kInS9A2udUAsgwDKgstztHdP/5 u+EpzAOeyZWsV1rAsJg== X-Proofpoint-Spam-Info: AW1haW4tMjYwNjE5MDExNCBTYWx0ZWRfX69K7s/qSG/kL CW3K/saCAMASgnaPUEMU+WFe1duO2JuS0R17NUwEAoGTL0dINhCGMWZKCOzIBYTZsxykZgsgkSX StO0Oz1/tI2H/XFNseOrz8x9VGUL/YQ= X-Proofpoint-ORIG-GUID: F2pm2UqMwp18ghqNQHq-JZufyh0O48zh X-Authority-Analysis: v=2.4 cv=KbzidwYD c=1 sm=1 tr=0 ts=6a3532ad cx=c_pps a=EVbN6Ke/fEF3bsl7X48z0g==:117 a=PRfkaYvzSr8QmIIGAkY2Sg==:17 a=IkcTkHD0fZMA:10 a=FelO9ux0wxsA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=ZpdpYltYx_vBUK5n70dp:22 a=COk6AnOGAAAA:8 a=EUspDBNiAAAA:8 a=JThlKoFKImu4mk-f7WUA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=a_PwQJl-kcHnX1M80qC6:22 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-06-19_02,2026-06-18_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 suspectscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 spamscore=0 impostorscore=0 adultscore=0 phishscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2606190114 On 6/19/26 8:45 AM, Sachin Gupta wrote: > > > On 6/16/2026 3:40 PM, Konrad Dybcio wrote: >> On 6/1/26 1:01 PM, Sachin Gupta wrote: >>> From: Satya Priya Kakitapalli >>> >>> Add driver for the Qualcomm MBG thermal monitoring device. It monitors >>> the die temperature, and when there is a level 1 upper threshold >>> violation, it receives an interrupt over spmi. The driver reads >>> the fault status register and notifies thermal accordingly. >>> >>> Signed-off-by: Satya Priya Kakitapalli >>> Co-developed-by: Sachin Gupta >>> Signed-off-by: Sachin Gupta >>> --- [...] >>> +    /* >>> +     * Configure the last_temp one degree higher, to ensure the >>> +     * violated temp is returned to thermal framework when it reads >>> +     * temperature for the first time after the violation happens. >>> +     * This is needed to account for the inaccuracy in the conversion >>> +     * formula used which leads to the thermal framework setting back >>> +     * the same thresholds in case the temperature it reads does not >>> +     * show violation. >>> +     */ >>> +    chip->last_temp = temp + MBG_TEMP_CONSTANT; >> >> Will this work fine if the user tries to set the max temp supported >> by the hardware (i.e. is there headroom for max+1)? >> > > In the current implementation, temp == MBG_MAX_SUPPORTED_TEMP is not accepted (temp < MBG_MAX_SUPPORTED_TEMP), so the last_temp = temp + MBG_TEMP_CONSTANT path is never taken at absolute max. For accepted trips (strictly below max), there is headroom for the +1C adjustment. You check for `temp < MBG_MAX_SUPPORTED_TEMP` and there's: #define MBG_MAX_SUPPORTED_TEMP 160000, so passing temp=159999 is "valid" and after the addition it becomes 160999, which in my understanding is outside the range Konrad