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: 13407472 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 4EC08E7544A for ; Tue, 3 Oct 2023 11:17:49 +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=wwan0ynyf4xe8omyHGkvkyEBdslfYbmxqIYWsXAOxf4=; b=uq1FqpzYIVA81e QYwvuquTkPAIP50syRGdBYAyxrtAJzqVx0TCoWYywSfcadiLMg47NvndF0skFr4rlu+6nPuEGaAF9 0XUYf8wDOpSVZtsI12UVulSnTE7Mp0ifrv9AETzRyT7xfSeJY0mYzy8o+ayatOoUCS0Zu80+XCmBH L03nvgkHGt8YyCnjOhumZXXowp3yMOW8AM+FFA8oMLhpErf5b/M7Vnlr7QenVDNzTAQvQ1UjW+E3t 637vccikSeXeguCgULJ1cNgSx1+qTNyxx6pBqZUHuHVZc0zv9B8fsuCT/hkY4HFOSS37rs/vhTtES zaQWziZoJAXDIZaO6qEQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qndOx-00EVtV-2M; Tue, 03 Oct 2023 11:17:19 +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 1qndOs-00EVpi-1Q for linux-arm-kernel@lists.infradead.org; Tue, 03 Oct 2023 11:17:15 +0000 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20231003111713euoutp01f2f758a3c18c1e25afbeccb30e5a38c4~KlNCV402r1147311473euoutp01u for ; Tue, 3 Oct 2023 11:17:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20231003111713euoutp01f2f758a3c18c1e25afbeccb30e5a38c4~KlNCV402r1147311473euoutp01u 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 5C67xdwvU5ktnj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eucas1p1a089b3aa7e10ae84d8963f89b6bbecd6 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231003_041714_748029_6E78BE70 X-CRM114-Status: GOOD ( 18.73 ) 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 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,