From patchwork Wed Oct 25 13:30:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 13436136 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F062C25B47 for ; Wed, 25 Oct 2023 13:31:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235007AbjJYNbb (ORCPT ); Wed, 25 Oct 2023 09:31:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344598AbjJYNbB (ORCPT ); Wed, 25 Oct 2023 09:31:01 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E46E218C for ; Wed, 25 Oct 2023 06:30:57 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20231025133056euoutp0276fbf06fbb59777b5dfdae87615a8b5d~RXOEuP2MM1108811088euoutp027 for ; Wed, 25 Oct 2023 13:30:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20231025133056euoutp0276fbf06fbb59777b5dfdae87615a8b5d~RXOEuP2MM1108811088euoutp027 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1698240656; bh=dXf9wUUf5w5y7OBV4KeN+1ChCSvq94K/h1PmwKd1DP4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W1xZYTZLCJE9PX4xThAgbQjNA4E4u5wbvXzcojQ+zPPDgRAcDh5vHAvQ9aIjDkf9u DmQny275+1MaGNyTRpeWT6P1g8j8GHtBoi4Mh4NhHHkYsR9Ct+34CucxDT13PTHtdM mRRFsK26CRBf0fL0di+1qBWqgcSuDnzmJ74xXtWI= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20231025133056eucas1p1a2adf2d26aadcbaf08cef52eeb4cec47~RXOEKnNpU1622416224eucas1p1c; Wed, 25 Oct 2023 13:30:56 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id BE.0B.37758.F8819356; Wed, 25 Oct 2023 14:30:56 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20231025133055eucas1p13779e9c86720bf460c12b28c6d830f2a~RXODnVXLp1383513835eucas1p1n; Wed, 25 Oct 2023 13:30:55 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20231025133055eusmtrp118dc2d78f39781360c357af53597bfe6~RXODmrwpP0869708697eusmtrp1_; Wed, 25 Oct 2023 13:30:55 +0000 (GMT) X-AuditID: cbfec7f5-815ff7000002937e-68-6539188f47c1 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 35.A8.10549.F8819356; Wed, 25 Oct 2023 14:30:55 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231025133054eusmtip20ca3122846fae9c23e3274de6df353cb~RXOCxF0RM1587515875eusmtip2C; Wed, 25 Oct 2023 13:30:54 +0000 (GMT) From: Mateusz Majewski To: linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Mateusz Majewski , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Alim Akhtar , Liam Girdwood , Mark Brown , Marek Szyprowski , Lukasz Luba Subject: [PATCH v4 6/8] thermal: exynos: stop using the threshold mechanism on Exynos 4210 Date: Wed, 25 Oct 2023 15:30:25 +0200 Message-ID: <20231025133027.524152-7-m.majewski2@samsung.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231025133027.524152-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrBKsWRmVeSWpSXmKPExsWy7djPc7oTJCxTDV4tYbR4MG8bm8Xh+RUW Ux8+YbP4vuU6k8W8z7IWe19vZbf4dqWDyWLT42usFpd3zWGz+Nx7hNFixvl9TBYLm1rYLSYe m8xssfbIXXaLuV+mMls8edjH5iDgsWbeGkaPnbPusnss3vOSyWPTqk42jzvX9rB5bF5S79G3 ZRWjx+dNcgEcUVw2Kak5mWWpRfp2CVwZf858YytYyV8x8eVktgbGdzxdjJwcEgImEofnv2Lu YuTiEBJYwShx88pTNgjnC6PEtYn7GCGcz4wSf1+/ZYJpufL7JTtEYjmjxMt1u6FaWpkkVq5s ZASpYhMwkHjwZhk7iC0i0MooMbNJHaSIWeArs8TV1/OZQRLCAjES5+/NB2tgEVCV2NmxFKyB V8BWYv6ppVDr5CX2LPoOZnMK2En0Hr/OBlEjKHFy5hMWEJsZqKZ562ywLyQEujklljesZYVo dpE4e/Y2C4QtLPHq+BZ2CFtG4vTkHqh4vsSMze+BbA4gu0Li7kEvCNNa4uMZZhCTWUBTYv0u fYhiR4nHn5qgivkkbrwVhDiAT2LStunMEGFeiY42IYhqVYnjeyYxQ9jSEk9abjNBlHhIPGxl ncCoOAvJJ7OQfDILYe0CRuZVjOKppcW56anFxnmp5XrFibnFpXnpesn5uZsYgYnt9L/jX3cw rnj1Ue8QIxMH4yFGCQ5mJRHeSB+LVCHelMTKqtSi/Pii0pzU4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cBEkFcSb2hmYGpoYmZpYGppZqwkzutZ0JEoJJCeWJKanZpakFoE08fEwSnVwFT/6cfkxifr Nq5nXFjw5bKlUYmUUYTcN6uupoW27P15JxbuW/dP/PzqeKUFYpMUri3Za/3puxt/6k2TZQ+D 1kSluTy3PdHkbNPh+1/8Wt/cCbMfNaX2/PpTelRKeIqhh+Vxnz095TtePfxXnhnXZn8o9eGb X4IXyos3izw2EYqeoR0qIRnmO+dPvUFUzxRzt7BnP/6tq9JimVZwuP9acfmcTVNZjh33fi1m WTmvIYMx+fajrgI5iUzr7MWJzBmP2tn/Bt6QyF7veb/b1cxDS+vjAdVrC9/F3C6qyijw27N6 bWie9/Kd98rFQrexN+ydaPVu8tpvbpIzKsV8i2cqau3UkwibUzLv2VHLJ8WRd5VYijMSDbWY i4oTAdmYmvpMAwAA X-CMS-MailID: 20231025133055eucas1p13779e9c86720bf460c12b28c6d830f2a X-Msg-Generator: CA X-RootMTR: 20231025133055eucas1p13779e9c86720bf460c12b28c6d830f2a X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231025133055eucas1p13779e9c86720bf460c12b28c6d830f2a References: <20231025133027.524152-1-m.majewski2@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.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). Reviewed-by: Krzysztof Kozlowski Signed-off-by: Mateusz Majewski --- 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 3bdcbab7466f..d918bf6d5359 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -343,20 +343,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); } @@ -371,6 +358,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,