From patchwork Fri Dec 1 09:56:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 13475610 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="sHcYRry+" Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E40E21718 for ; Fri, 1 Dec 2023 01:56:47 -0800 (PST) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20231201095646euoutp029574efaf77ada35ec817a2c5da745c7b~crKpR5Aos0720007200euoutp02r for ; Fri, 1 Dec 2023 09:56:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20231201095646euoutp029574efaf77ada35ec817a2c5da745c7b~crKpR5Aos0720007200euoutp02r DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1701424606; bh=dXf9wUUf5w5y7OBV4KeN+1ChCSvq94K/h1PmwKd1DP4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sHcYRry+brrCuAAtjl66Uf683HSsLz/s9LocpmtVvanQklbKQhxMkaSHwemQi+qYr O2i97//VaUQdau7I3ytHcciJsSICNPFt0Ox+rRWe/uKZB+3AN3QOeW+wqDXjXWFoke 4C/tK1HggFeECQgI09AHlO8cwhn8vk7RtFVpGSa0= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20231201095646eucas1p28e2e345ff39006fbd3e1a9f94ee3172b~crKo02P5x1611916119eucas1p2I; Fri, 1 Dec 2023 09:56:46 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id D8.FF.09552.EDDA9656; Fri, 1 Dec 2023 09:56:46 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20231201095645eucas1p2fa7ecbd8c5ea09908c304a395f0672cc~crKoTef9f3114831148eucas1p2K; Fri, 1 Dec 2023 09:56:45 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20231201095645eusmtrp154ad233b70b9931a7616d6e36bd2e33f~crKoSyjrV0759907599eusmtrp1C; Fri, 1 Dec 2023 09:56:45 +0000 (GMT) X-AuditID: cbfec7f5-853ff70000002550-8f-6569adde859a Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 6E.20.09146.DDDA9656; Fri, 1 Dec 2023 09:56:45 +0000 (GMT) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231201095644eusmtip2e54bf6dd0a189b17138a3bb6282d2918~crKnZL3GY1179711797eusmtip2A; Fri, 1 Dec 2023 09:56:44 +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 , Dan Carpenter Subject: [PATCH v6 6/9] thermal: exynos: stop using the threshold mechanism on Exynos 4210 Date: Fri, 1 Dec 2023 10:56:22 +0100 Message-ID: <20231201095625.301884-7-m.majewski2@samsung.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231201095625.301884-1-m.majewski2@samsung.com> Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe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kFP+/5InGVxmDdH9HnWLcxrq4Njd/w27Lpi4F1m/bonurNyybqvb3 8yV362ctZWznti/8yO3Ffm7q9GzPVY49i0/9EbTf+ymZbwq37NPr7IZn91eLr/2wrOh5pR/L q+5d69KuXQ7WcZ7cu2ramd8nYxZahkutFPnx6WDajMceQcn8z3amsf1Njdm/KYgx93JcRN4R 1Ttz/ZRYijMSDbWYi4oTAQb1MbZSAwAA X-CMS-MailID: 20231201095645eucas1p2fa7ecbd8c5ea09908c304a395f0672cc X-Msg-Generator: CA X-RootMTR: 20231201095645eucas1p2fa7ecbd8c5ea09908c304a395f0672cc X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231201095645eucas1p2fa7ecbd8c5ea09908c304a395f0672cc References: <20231201095625.301884-1-m.majewski2@samsung.com> 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,