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 9E8B3282F05 for ; Fri, 8 May 2026 10:07:10 +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=1778234838; cv=none; b=QjMv0KnhPjKRhUVAHVVpzjsHPt7T+ROqeUPflHmbBkohT8UPTZdudCilIa1gtqaoUuVvmhU4hwlv6syhNcF/4J0xruGdlgchbNRojLvoTrN99h+2ImIb5yLUyGrKvJTeuMd3j2sYn+3kBLBnhkacwb+ijBfQraOV+49LowmTUN8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778234838; c=relaxed/simple; bh=y/GfofqIHQANQ5CHSFxmSZ4K6zI+EcLOlo/P5fAMq2M=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=jjQxk5xX6gr1tuPoKTjjl0MO4rlcg+q/ZvEA1X5RqKz/VM49BWULz3aBoV4S0TG0uWeW/pCTb1ng3ylQNYr63BFx59TbTnA8+qqRalh1nC47tgtYeFhxMp59J3+wkjAuwwmFghnCWAPTOE9ZttEy5l5BDNNvAPDjaw9gqy3JNJY= 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=CN3Upoy3; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=dgOmnlFe; 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="CN3Upoy3"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="dgOmnlFe" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6485v9fZ2778221 for ; Fri, 8 May 2026 10:07:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=qcppdkim1; bh=xsznKWdZhGfdpuJiM4vIT0 VCeBhgZXrDmZgPnKnhX6g=; b=CN3Upoy3B5dpTIDfkvKDpPNR2pCrXSzBUxh3pf 931ZnX6lOylU6mm9dpr76YA7sVX7MaSuJ97McOybCXcfH+I5sxPAWhSm8H3GFxmw vs7xRUFvc136KsttmL6buUoQOgrWBFYWVfF84p3ekvwlmn2gHbwQtpDtWowEB3+T U0SeGOfLI5P3fUUmaWgga4hbu6I9pvCCZuLEDNzLcLXsin2dEF6lKsFeeRhqRYmH 53bYbATBel7wH7vkFJNco4SVAPHJndqEvSxipzAEXt68Q22l9uzTjt0rXc8egjah F6RyNC8BRp7BCWAG71DOpn8a9NRx9diAgB0qV1NpAgEiNohw== Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4e1285jhnd-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 08 May 2026 10:07:08 +0000 (GMT) Received: by mail-pg1-f200.google.com with SMTP id 41be03b00d2f7-c7ba03ecdc6so1879049a12.2 for ; Fri, 08 May 2026 03:07:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1778234828; x=1778839628; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=xsznKWdZhGfdpuJiM4vIT0VCeBhgZXrDmZgPnKnhX6g=; b=dgOmnlFeBzdwHYxxvq3HScGG5AmvdWR7BEhoB8n93JNQjITBp0GloaNHGQtWfMT1fP ETKviYFh2wKbw2JemGcV8SSHE1HHwV7bwK5cz2Imt+uLXtw+7P4cmyMuXh7L58bTFdGj aOjpFctrRDUCMZlPxWLrFDQCdDmEAvXspIamGAFIfp66KwZDt2S6k7x8PZVeGKJy45X7 89ZaBAFSmnuzoA0DoCv8oGV0976//S3mPC15MH8Njo/0HlAszDEMan6TTXu1XSkUrCqm vTqgI/cXfI8cyQxy5O3alU6oIoNAE2+zP+rEObW0nhT9Bov7GVKuhAR/BtwohUS5APr2 hSag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778234828; x=1778839628; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=xsznKWdZhGfdpuJiM4vIT0VCeBhgZXrDmZgPnKnhX6g=; b=AYxMIe65VG5eaUIGpaeq3r5guXFwxny/ZsWuLOyPz4X0cmcTwbWWfJ246Se/YlXh36 8Utcw98jcgenm5mwep5+uARRsQmgHzGQuktnIG+lYm3gX3KR4+B3o+8DWa5Ueo0dEYnK +NPJ0iY6hK4lNCvshXkvlme1Uk9ewtFJnp3epKC0iicfVf0NJOJu1TDPYJ2cfVgORxu8 KU3hAVS8f9Ne4ThrvxlY9yTXRA3rtKqNRmdldU9EYUOchaGKphXbBWs0V9RwT14Grys9 Q9L7hdX7C6frdKp1iUOlTlnESbTQMs1gTNfMkzLC/JW2kb3VJr/zz4kac3nWJ5tQYs3r rMgQ== X-Forwarded-Encrypted: i=1; AFNElJ/Ou0wWCRb1leSEpJ9R3NtQ1NzxAGe5JuDX01oKPy8Xg1txfpPe2cYiuWOzeSnxvthpaG4iWyUn2dW2Dfg=@vger.kernel.org X-Gm-Message-State: AOJu0Yx+v9PQQNh12ba6ZrQ6xfzlqR7PPFUQILMduPyWcUvea7Y2SMAm fpu9jPstPC+fEic6/A0Rs6zNVn/2aN729xw7Siicftspj4O8gHmU9uYBKVQwIsFz/ZW2xspsaLQ CAK40KaMNoPHyEbPFUT3g/gfhoN1CWTghu3gfPOrkfc2h94r/uaevIu/sMnwr9SvoK0M= X-Gm-Gg: AeBDieuYSGiBzyAzggJL3ctOLIOI0uFqNFphGoCSap5gDdDwwQXKMxOCKjwF/B7/OPQ FdKcc7sfhyV9Fc8b6dgN5MwcXKJ4Dgk0LnuXX5o//4SejdZEsyHM6KQQ9GNtGOVCxwOeDWD9Wn2 pGFSDqFA1tX7vkB8q4PHgYBk/Sq2bcAzi4p6CfKo22FkiBWe+6H5STqBGWWdXdLmhoI66P6fcDR fyq0n342wHI8xMp0AIR5o9PDpf+kNliYw6DxLJg/aInAuKM39yfg0ll6Ska0Dt1y9iCYRhMZQDA N7UKdhX3jG6LketX1NHS3PrF5VuiyVCE+gTJ0Gppz0i0S/uOFb+IHLGN3KV2Keb7hm/35h5k23m KqiQLABnruwO7hb8jrrvmKsOgBs18xIJnDWYeV3MYbARB/FlRl1SWeSk= X-Received: by 2002:a05:6a00:440c:b0:835:45bf:9659 with SMTP id d2e1a72fcca58-83a5e45319fmr11575605b3a.41.1778234827984; Fri, 08 May 2026 03:07:07 -0700 (PDT) X-Received: by 2002:a05:6a00:440c:b0:835:45bf:9659 with SMTP id d2e1a72fcca58-83a5e45319fmr11575564b3a.41.1778234827418; Fri, 08 May 2026 03:07:07 -0700 (PDT) Received: from hu-priyjain-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-83967dbf7d2sm15876379b3a.49.2026.05.08.03.07.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 May 2026 03:07:06 -0700 (PDT) From: Priyansh Jain To: Amit Kucheria , Thara Gopinath , "Rafael J . Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba Cc: linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, manaf.pallikunhi@oss.qualcomm.com, Priyansh Jain Subject: [PATCH v2 0/2] thermal: qcom: tsens: fix temperature handling Date: Fri, 8 May 2026 15:36:58 +0530 Message-ID: <20260508100700.772985-1-priyansh.jain@oss.qualcomm.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTA4MDEwNCBTYWx0ZWRfX3b8oK6cOFTcb rP96yFArhP/Jpyjw1P2evet96vCfCsFrhtMrIad2zVsZWzBeFd+Le7AA1QS6V4Zl6XoJ4tqr1CY dIEeMDf2P6j8LlZdDZKvFIBsQfrgQ4BlU56RlZI7m2Gl3w/L2xBsnsngAIkv/77ns7u0le7OgeK BNGtNNQ8xFRk+A5YcET1qeA+PmPSMN8qxPvRQA6RsI08U6EZ4wZyDoUj/SNxNWd7Au2WVy9OJm2 IZIxqikM7+tzDlEMQUraSndvt5PKYBEmqUbvSUJuXyiSoLVhQmbpZ15ASXomRBPJXkCQ+108i8a 7j1FgQpLSNVtnmMnOK3FPafhbR7WGPRBYQDlC7wPSy2IgNoEIaI3qVj7GKfOSTENOykXHxA3iMU 8SVhZ63TdyE10PAkLIACathkYdbK1rG8exaN3m7MMpEf9Cckks0NL9shh+/MoTELwKPwiH9FFL0 nTE1bURAvX1SejkC8RA== X-Proofpoint-GUID: 2UVfTWSDz54ueAB4oXXvA9-r1e0eIJi_ X-Proofpoint-ORIG-GUID: 2UVfTWSDz54ueAB4oXXvA9-r1e0eIJi_ X-Authority-Analysis: v=2.4 cv=NKblPU6g c=1 sm=1 tr=0 ts=69fdb5cc cx=c_pps a=oF/VQ+ItUULfLr/lQ2/icg==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=NGcC8JguVDcA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=14Z0-YueNKWrp6JypdoA:9 a=QEXdDO2ut3YA:10 a=3WC7DwWrALyhR5TkjVHa:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-05-07_02,2026-05-06_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 impostorscore=0 spamscore=0 clxscore=1015 malwarescore=0 lowpriorityscore=0 phishscore=0 priorityscore=1501 suspectscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2605080104 This series fixes multiple issues in the Qualcomm TSENS thermal driver related to temperature sampling and trip threshold handling. Patch 1 updates the temperature read path to atomically sample the temperature value along with its valid bit, in accordance with hardware programming guidelines. It also implements the recommended retry and fallback behavior to avoid incorrect readings during transient hardware update windows. Patch 2 widens the software trip temperature limits to match the full hardware-supported range. This prevents repeated threshold reprogramming and interrupt storms when devices operate beyond the previously clamped limits on newer chipsets, while preserving behavior for platforms operating within the original range. v2: - Reverted merging of the valid-bit and LAST_TEMP register field logic to preserve the regmap differences between TSENS versions - Defined valid-bit support and last temperature resolution for all TSENS v1 and v2 feature structures - Defined last temperature resolution for Tsens v0 feature structure - Dropped tsens version checks in favor of valid-bit capability - Computed masks from resolution to keep a single source of truth - Minor code cleanups based on review feedback Priyansh Jain (2): thermal: qcom: tsens: atomic temperature read with hardware-guided retries thermal: qcom: tsens: widen temperature limits to match hardware range drivers/thermal/qcom/tsens-v0_1.c | 1 + drivers/thermal/qcom/tsens-v1.c | 4 ++ drivers/thermal/qcom/tsens-v2.c | 10 ++- drivers/thermal/qcom/tsens.c | 114 ++++++++++++++++++++---------- drivers/thermal/qcom/tsens.h | 7 ++ 5 files changed, 98 insertions(+), 38 deletions(-) -- 2.43.0