Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp508333ybl; Fri, 10 Jan 2020 02:17:55 -0800 (PST) X-Google-Smtp-Source: APXvYqwPZS6u5KMOK2xD2KazfcQNKNpelbXWhEXrmzDJEnfq2yCE6ceWFEAQQl5JSssAKOpGuL92 X-Received: by 2002:a9d:53c4:: with SMTP id i4mr2073505oth.48.1578651475759; Fri, 10 Jan 2020 02:17:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578651475; cv=none; d=google.com; s=arc-20160816; b=CfzXESZP/WxaXzhommB3CeGAOyx00d3bGbAL6wfuxX16x+3r2Y0ab3qGsaByj7ypsc lm5WrlnDiiAzfBhicvtml4OmyoQtsA2/YI4Y+LtyxhHF6XBfgvEQwqRY6bUmaAA1W/wi Acpz/Rf8pxhYTU0k9Wl/4HvINun58YPebQQM/mv1NweBXdUerVaY0ocdInI3/jHUSa8o lK+RBSYoyUjmm6N1qwJ39PQmutLyvFOG8z3JF8jMTvZ5SPXGBpzClPm0aYbaomZ2G8J1 PNQQxn8aaysGqXX6SkIbW5Ng0O1Xm52OxIs0iBpjLm6Fe93ataB1EoYcLtHZIrDjLR1c T3dQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=AAD/GToJl17SoA/ncPjv8bRydogH2ZBtCfUpPZ40ub0=; b=lcvOFRCPHVm/wFJdwO1AQr8/2pYAiF884kaXez0DzrTMpcqhwl1CIB96Cv3vZlA8w8 zz5fiqakz2ix64PHlsAEPBfIzkrARhsV8M89CYqYmO60dtkHSfiH9/7RFm9o2tsKgBPl EaUDHPy2NBZVY7Zhu4vWtOfPaKZ+ehHd/frWNm9IWSiex3J6HtopPwiKqNS5y3zYh7QO FWqeZD730FnnwC8ZaXKGwo86VGGoRqq+PPPLDBJP42r1+f+As+zWM3LO/P4jaOpRNAh3 /0aN2PHU8gpxo2rrKfvgb60AysC1nSKoDiXh/oC6VyHnPUfQNvw3mjCyaZOUcjmfzVNA kT5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=zpzL2mKR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=st.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v18si968781otn.202.2020.01.10.02.17.44; Fri, 10 Jan 2020 02:17:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=zpzL2mKR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727605AbgAJKQk (ORCPT + 99 others); Fri, 10 Jan 2020 05:16:40 -0500 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:23052 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727452AbgAJKQg (ORCPT ); Fri, 10 Jan 2020 05:16:36 -0500 Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 00AAE3Yq031197; Fri, 10 Jan 2020 11:16:18 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=AAD/GToJl17SoA/ncPjv8bRydogH2ZBtCfUpPZ40ub0=; b=zpzL2mKRX3XGn9bOo1I7gmQD4k8aW36S5+loLQuhg/U2FX8Zy9tx3LU9PvGDkccAfS3L nMQyx8AO/LbrSHjrFvlp8s5SWocc15VluEjiN6j9OZM5WHGW81paA0Qtd4pUuiCn188w ZPsF7j0IWLJgh3SYnzlfDisKc0MG/+p6WSOnaHQNUpn0w+iEA2fiSm9dkvQowp1/1rMs GG6k3bPmUujVOdYPXcrvMOJhCC9cxc1lehVrKdV1k/GqRSZ7Krj9aCTtpBXy5kGcMs5t iSZR1hTQRBc1OphTho7YI3NKeg8ouiv6/FYHeH+pDuu/ky3AtbrGiWWtD47VNKC6eXoA 7g== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2xepyt83ft-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 10 Jan 2020 11:16:18 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id BFA92100038; Fri, 10 Jan 2020 11:16:12 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag6node2.st.com [10.75.127.17]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id B1AFE2A7907; Fri, 10 Jan 2020 11:16:12 +0100 (CET) Received: from localhost (10.75.127.45) by SFHDAG6NODE2.st.com (10.75.127.17) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Fri, 10 Jan 2020 11:16:12 +0100 From: Pascal Paillet To: , , , , , , , , , , , , , Subject: [PATCH_V3 6/6] thermal: stm32: fix low threshold interrupt flood Date: Fri, 10 Jan 2020 11:16:05 +0100 Message-ID: <20200110101605.24984-7-p.paillet@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200110101605.24984-1-p.paillet@st.com> References: <20200110101605.24984-1-p.paillet@st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.75.127.45] X-ClientProxiedBy: SFHDAG5NODE1.st.com (10.75.127.13) To SFHDAG6NODE2.st.com (10.75.127.17) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-01-10_01:2020-01-10,2020-01-09 signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With the STM32 thermal peripheral, it is not possible to dump the temperature that has caused the interrupt. When the temperature reaches the low threshold, we generally read a temperature that is a little bit higher than the low threshold. This maybe due to sampling precision, and also because the CPU becomes hotter when it quits WFI mode. In that case, the framework does not change the trip points. This leads to a lot of low threshold interrupts. The fix is to set the low threshold value 0.5 degrees Celsius below the actual request. The problem is not so frequent with the high threshold and it would no be a good idea to set the threshold value higher than the request. Signed-off-by: Pascal Paillet --- drivers/thermal/st/stm_thermal.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/thermal/st/stm_thermal.c b/drivers/thermal/st/stm_thermal.c index aaf25ca2f118..1cc5e6c5709e 100644 --- a/drivers/thermal/st/stm_thermal.c +++ b/drivers/thermal/st/stm_thermal.c @@ -321,7 +321,8 @@ static int stm_thermal_set_trips(void *data, int low, int high) if (low > -INT_MAX) { sensor->low_temp_enabled = 1; - ret = stm_thermal_calculate_threshold(sensor, low, &th); + /* add 0.5 of hysteresis due to measurement error */ + ret = stm_thermal_calculate_threshold(sensor, low - 500, &th); if (ret) return ret; -- 2.17.1