From patchwork Tue Oct 3 11:16:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 729604 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 4745EE75450 for ; Tue, 3 Oct 2023 11:17:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239961AbjJCLRU (ORCPT ); Tue, 3 Oct 2023 07:17:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239876AbjJCLRS (ORCPT ); Tue, 3 Oct 2023 07:17:18 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E0CDA1 for ; Tue, 3 Oct 2023 04:17:14 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20231003111713euoutp02d7e148e7c2dc92998879fa8816637bb0~KlNCWqH021082210822euoutp02u for ; Tue, 3 Oct 2023 11:17:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20231003111713euoutp02d7e148e7c2dc92998879fa8816637bb0~KlNCWqH021082210822euoutp02u DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1696331833; bh=wYOgN+xChN8fb2aWq0gBrJakJtJYp/uVLT+nkSF3JUE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eizkfNKFZ1o9eaG2fZd+H1o8TrkjU2rrdZBa/6kxrdjFvwdSI7KV3ud4qXbH2v0Zv XD+KY5OjT7YptY1X+wc956IAlKv0/FZCU4v04BeWVcET72pHiM3EX08iP7mYbB1XuB Wz0ElMWccw7Rpas9+BCb5GY5f90DK0vIcqLHpyPQ= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20231003111712eucas1p142e0b9bb4ef708d18849c80a92cc2f73~KlNB5r8Jq2602126021eucas1p1l; Tue, 3 Oct 2023 11:17:12 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 36.2F.37758.838FB156; Tue, 3 Oct 2023 12:17:12 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20231003111712eucas1p1a089b3aa7e10ae84d8963f89b6bbecd6~KlNBZ5zjG2477724777eucas1p1l; Tue, 3 Oct 2023 11:17:12 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20231003111712eusmtrp1ebfe6d9ab7bf019bb063466d7fa72045~KlNBZRO082246422464eusmtrp1k; Tue, 3 Oct 2023 11:17:12 +0000 (GMT) X-AuditID: cbfec7f5-7ffff7000002937e-e9-651bf838c8b5 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 72.DE.25043.838FB156; Tue, 3 Oct 2023 12:17:12 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231003111711eusmtip2641a272f6e51f817f80b17e7674ad965~KlNAnyci93045530455eusmtip2Y; Tue, 3 Oct 2023 11:17:11 +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 Subject: [PATCH v3 6/8] thermal: exynos: stop using the threshold mechanism on Exynos 4210 Date: Tue, 3 Oct 2023 13:16:32 +0200 Message-ID: <20231003111638.241542-7-m.majewski2@samsung.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231003111638.241542-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrLKsWRmVeSWpSXmKPExsWy7djP87oWP6RTDXbM0rR4MG8bm8Xh+RUW Ux8+YbP4vuU6k8W8z7IWe19vZbf4dqWDyWLT42usFpd3zWGz+Nx7hNFixvl9TBYTj01mtlh7 5C67xdwvU5ktnjzsY3Pg99g56y67x+I9L5k8Nq3qZPO4c20Pm8fmJfUefVtWMXp83iQXwB7F ZZOSmpNZllqkb5fAlXFlaQdTwUr+irsnDjE2ML7j6WLk5JAQMJG42/matYuRi0NIYAWjxOvt T9kgnC+MEhMOL4fKfGaUmNW8hhWm5cqaJhaIxHJGiebdrcwQTiuTxMwdy1lAqtgEDCQevFnG DmKLCLQySsxsUgcpYha4xCxx9+ZasCJhgRiJLT+fA43l4GARUJVY+9cXJMwrYCsx4e8HJoht 8hJ7Fn0HszkF7CRW/lzOBFEjKHFy5hOwMcxANc1bZzND1DdzSjx44gZhu0jc+dfOAmELS7w6 voUdwpaROD25ByqeLzFj83sWkBMkBCok7h70gjCtJT6eYQYxmQU0Jdbv0ocodpToaPgNVcwn ceOtIMR+PolJ26YzQ4R5JTrahCCqVSWO75kEdZa0xJOW21AveUjMuruUfQKj4iwkn8xC8sks hL0LGJlXMYqnlhbnpqcWG+ellusVJ+YWl+al6yXn525iBKaw0/+Of93BuOLVR71DjEwcjIcY JTiYlUR4w45KpQrxpiRWVqUW5ccXleakFh9ilOZgURLn1bY9mSwkkJ5YkpqdmlqQWgS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1YS5/Us6EgUEkhPLEnNTk0tSC2C6WPi4JRqYFp+VGjjSSONEoON2etVuP6w PekwjVt+Jl483G3FuTa5zimPs0/+sBNwuxh97M366Hu97o8Kep4Vedxtqc3brSO573yFh8z3 tEWey2c8+CVS9PGDI+cH7sRvk5doLvf7+d+iYef9a8Kz193l3f2gNWuh7JrcD28Lk/eEVaV9 Z/s0xT/g7J/olZ2nRD/XLfXIWtbOpeDItdDwRP/GYxNX+dY8qmdN/S28OLtS75Cp8jJ3bp+C lo2uh1p16ndn7OsK0Spe4Tcz/92qi3KlCQ/Mjy6Y8cpKYb1Ll7feKvm9EnLfm/5ncgdVrbc4 Kzq33MGiqvrrgcTDS3ML7/qZLOF2cI+Y6G7YsnMXm+Ok3TuO7lJiKc5INNRiLipOBAAtPwL/ QgMAAA== X-CMS-MailID: 20231003111712eucas1p1a089b3aa7e10ae84d8963f89b6bbecd6 X-Msg-Generator: CA X-RootMTR: 20231003111712eucas1p1a089b3aa7e10ae84d8963f89b6bbecd6 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231003111712eucas1p1a089b3aa7e10ae84d8963f89b6bbecd6 References: <20231003111638.241542-1-m.majewski2@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@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 a0a1f7e1e63f..7138e001fa5a 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,