From patchwork Mon Nov 20 14:50: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: 13461423 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 B194AC5AD4C for ; Mon, 20 Nov 2023 14:51:53 +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=WLZTTrbjBVQwwPqJRNaCTmmK2slv/QZBFdMOsVnjT7g=; b=ZnVyvBWvtM3wR8 vR1hkH2bobzw0h8D1jqF8o+2SWIpaNhy0lIpW8XIb1oOgh13TqxO0bmUlcUuEkGshQleYQpjcwiU5 dWSZxAlt90uqE5wqV6t7qFBv+fV0H1XQp1dc1itdgHPYEdZ7mzugJbaN4N8qkG2KRCs2lSLkx+cvY EB0Ux1MNLhDoMp4SkfuGKcx/yyFwf6QCU3zdMvrx/aTGsPTF9FSHsgdRFInd7L4/6THUKmg27GlpN lNuNoxccEY0wShOLToYCdPBT23yt8Ri0MTdkk8E5MpvGvVQnb2bX3kGtbwI5z4YyN+NWGJDdhC9dL GnFK+axd0hUwUieD8Yug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r55cS-00CO6l-0G; Mon, 20 Nov 2023 14:51:24 +0000 Received: from mailout1.w1.samsung.com ([210.118.77.11]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r55cB-00CNx9-1t for linux-arm-kernel@lists.infradead.org; Mon, 20 Nov 2023 14:51:11 +0000 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20231120145106euoutp01d5b757357f2738525e3c2210ce6fa558~ZXFfFMXp52424024240euoutp01E for ; Mon, 20 Nov 2023 14:51:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20231120145106euoutp01d5b757357f2738525e3c2210ce6fa558~ZXFfFMXp52424024240euoutp01E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1700491866; bh=dXf9wUUf5w5y7OBV4KeN+1ChCSvq94K/h1PmwKd1DP4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sg1ctm0TcDobA3Deail7KDDXaBKJsVxrbQ26TqUFptfYTLdh5YLMhO+0kXmqD4gtB AFJ12yitWvdNe0naMBVZgCoawA2X8z8eK5fcqx7grJGPGFgo5eufLyl6CbQL3jrJtg ZMvy85VxwkBHkHC+uqa7KHUuW9lk2ho1MjKID3fU= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20231120145105eucas1p218e1b31a4ae803118eaff8055d5e51b6~ZXFep0Se22568025680eucas1p2o; Mon, 20 Nov 2023 14:51:05 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 57.A8.09552.9527B556; Mon, 20 Nov 2023 14:51:05 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20231120145105eucas1p11844e768db69eefb84934ec307ec528d~ZXFeURYml1856818568eucas1p1U; Mon, 20 Nov 2023 14:51:05 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20231120145105eusmtrp228fa7a6f822ba82d3365738906a96dd3~ZXFeTmJ4j0691806918eusmtrp2N; Mon, 20 Nov 2023 14:51:05 +0000 (GMT) X-AuditID: cbfec7f5-853ff70000002550-8b-655b7259b032 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 8E.64.09274.9527B556; Mon, 20 Nov 2023 14:51:05 +0000 (GMT) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231120145104eusmtip2f3c189249c7d49f9c63a1640b08ffbcc~ZXFdfd68j0740707407eusmtip2a; Mon, 20 Nov 2023 14:51:04 +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 v5 6/9] thermal: exynos: stop using the threshold mechanism on Exynos 4210 Date: Mon, 20 Nov 2023 15:50:46 +0100 Message-ID: <20231120145049.310509-7-m.majewski2@samsung.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231120145049.310509-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrBKsWRmVeSWpSXmKPExsWy7djP87qRRdGpBldfGVk8mLeNzeLw/AqL qQ+fsFl833KdyWLeZ1mLva+3slt8u9LBZLHp8TVWi8u75rBZfO49wmgx4/w+JouFTS3sFhOP TWa2WHvkLrvF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ArFDd30oDAAA= X-CMS-MailID: 20231120145105eucas1p11844e768db69eefb84934ec307ec528d X-Msg-Generator: CA X-RootMTR: 20231120145105eucas1p11844e768db69eefb84934ec307ec528d X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231120145105eucas1p11844e768db69eefb84934ec307ec528d References: <20231120145049.310509-1-m.majewski2@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231120_065107_896682_21FBC6F1 X-CRM114-Status: GOOD ( 18.36 ) 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). 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,