From patchwork Tue Aug 29 09:18:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 13368733 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4BB23C6FA8F for ; Tue, 29 Aug 2023 09:25:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:References:MIME-Version:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4smm/enVNSFFhUWVZlhG7lnQFlkalE9sd+oqoBjuq8o=; b=EgbhObKRtiojlv D+d6f9+NGZOcA21ururiDRMP3DMnAs05/58SfOhGVZADf4LbFX/73HhKZKTfe20CrQo2aBMHOqiBf wf7Xl3sikZnF3oCcTAuR0C2EKGwZIx4oCAu69lXt2VhSgwgjLexjNVlyQ0lHVJUe8nVWze/rJXjPz BFocaKdwM/8do2gehViLYlg6nTMWfMCcHQsg4qqAhmIFpvXCKCjQcZcMPc5rhdykWatvG8sQmCBBE 3SUwd7q4Js61lnPF8gagXnHu/X6FgOVTiyKXHog8fgxg1pPBZ1LX2dW9LUCNqgLc+ZA9ojz8uZ2rD JOToNbKxeR7nouUEd1+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qauxq-00B7nx-0A; Tue, 29 Aug 2023 09:24:46 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qauxT-00B7gb-1V for linux-arm-kernel@lists.infradead.org; Tue, 29 Aug 2023 09:24:25 +0000 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20230829092422euoutp024a3d707e3c6b3309fe0f527d9a6ca80e~-0Fg3QSIu0809608096euoutp02B for ; Tue, 29 Aug 2023 09:24:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20230829092422euoutp024a3d707e3c6b3309fe0f527d9a6ca80e~-0Fg3QSIu0809608096euoutp02B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1693301062; bh=LMqZ4M9gbEgBjK/x+ZePPo+65xbhoSKR9eCICgUWep0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L3LJbhfimGjYfp7ksnG25RJI8NYLC8OwDZViD4rg0IRCeWJulX74W+ql6BS3bkSgg ySBlsep3rlU3WUa2kT0i0nYxepW08ZUkKyLlEfuaHjEuke1x7qSVykbrDE5JtiFUxz 04CEzvMGhYfQ4e1IPJfZPFrzwS71wzAyDIlcjAzE= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230829092421eucas1p2c12f3c95625bdb27f300e97656dc3b02~-0Fgnz1pc2921729217eucas1p24; Tue, 29 Aug 2023 09:24:21 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 8C.27.11320.549BDE46; Tue, 29 Aug 2023 10:24:21 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20230829092421eucas1p1970c3fb42ca622129bf92511893500b1~-0FgPiTP92107821078eucas1p1x; Tue, 29 Aug 2023 09:24:21 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230829092421eusmtrp11d25a978c8781712788f9fcef9732d2f~-0FgOIPBV3248032480eusmtrp1L; Tue, 29 Aug 2023 09:24:21 +0000 (GMT) X-AuditID: cbfec7f4-993ff70000022c38-2e-64edb9458fb1 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 6F.8B.14344.549BDE46; Tue, 29 Aug 2023 10:24:21 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230829092420eusmtip279c0288c8b4887955d720652f40ccf2a~-0FfAyJZY1173411734eusmtip2m; Tue, 29 Aug 2023 09:24:20 +0000 (GMT) From: Mateusz Majewski To: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: Mateusz Majewski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alim Akhtar , Bartlomiej Zolnierkiewicz , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Liam Girdwood , Mark Brown , Marek Szyprowski Subject: [PATCH 08/11] thermal: exynos: stop using the threshold mechanism on Exynos 4210 Date: Tue, 29 Aug 2023 11:18:46 +0200 Message-ID: <20230829091853.626011-9-m.majewski2@samsung.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230829091853.626011-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrLKsWRmVeSWpSXmKPExsWy7djPc7quO9+mGFzdaWLxYN42NovD8yss pj58wmbxfct1Jos1e88xWcz7LGsx/8g5Vou+Fw+ZLb5d6WCy2PT4GqvF5V1z2Cw+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N2uuddysMZlcxz8/L9/QmXvVg7VK LMUZiYZazEXFiQBOBKtnUgMAAA== X-CMS-MailID: 20230829092421eucas1p1970c3fb42ca622129bf92511893500b1 X-Msg-Generator: CA X-RootMTR: 20230829092421eucas1p1970c3fb42ca622129bf92511893500b1 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230829092421eucas1p1970c3fb42ca622129bf92511893500b1 References: <20230829091853.626011-1-m.majewski2@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230829_022423_785558_D284C9BC X-CRM114-Status: GOOD ( 18.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Exynos 4210 supports setting a base threshold value, which is added to all trip points. This might be useful, but is not really necessary in our usecase, so we always set it to 0 to simplify the code a bit. Additionally, this change makes it so that we convert the value to the calibrated one in a slightly different place. This is more correct morally, though it does not make any change when single-point calibration is being used (which is the case currently). Signed-off-by: Mateusz Majewski Reviewed-by: Krzysztof Kozlowski --- drivers/thermal/samsung/exynos_tmu.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 5da44f43715d..6c107fe9fd27 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -336,20 +336,7 @@ static void exynos_tmu_control(struct platform_device *pdev, bool on) static void exynos4210_tmu_set_trip_temp(struct exynos_tmu_data *data, int trip_id, u8 temp) { - struct thermal_trip trip; - u8 ref, th_code; - - if (thermal_zone_get_trip(data->tzd, 0, &trip)) - return; - - ref = trip.temperature / MCELSIUS; - - if (trip_id == 0) { - th_code = temp_to_code(data, ref); - writeb(th_code, data->base + EXYNOS4210_TMU_REG_THRESHOLD_TEMP); - } - - temp -= ref; + temp = temp_to_code(data, temp); writeb(temp, data->base + EXYNOS4210_TMU_REG_TRIG_LEVEL0 + trip_id * 4); } @@ -364,6 +351,8 @@ static void exynos4210_tmu_initialize(struct platform_device *pdev) struct exynos_tmu_data *data = platform_get_drvdata(pdev); sanitize_temp_error(data, readl(data->base + EXYNOS_TMU_REG_TRIMINFO)); + + writeb(0, data->base + EXYNOS4210_TMU_REG_THRESHOLD_TEMP); } static void exynos4412_tmu_set_trip_temp(struct exynos_tmu_data *data,