From patchwork Tue Aug 29 09:18: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: 13368756 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 2A157C83F1C for ; Tue, 29 Aug 2023 09:25:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232079AbjH2JZD (ORCPT ); Tue, 29 Aug 2023 05:25:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234271AbjH2JY3 (ORCPT ); Tue, 29 Aug 2023 05:24:29 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C80F1B7 for ; Tue, 29 Aug 2023 02:24:23 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20230829092422euoutp0234466543655e6373cb20383ab607b40b~-0Fg8X0tU0612506125euoutp02G for ; Tue, 29 Aug 2023 09:24:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20230829092422euoutp0234466543655e6373cb20383ab607b40b~-0Fg8X0tU0612506125euoutp02G DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1693301062; bh=LMqZ4M9gbEgBjK/x+ZePPo+65xbhoSKR9eCICgUWep0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L3LJbhfimGjYfp7ksnG25RJI8NYLC8OwDZViD4rg0IRCeWJulX74W+ql6BS3bkSgg ySBlsep3rlU3WUa2kT0i0nYxepW08ZUkKyLlEfuaHjEuke1x7qSVykbrDE5JtiFUxz 04CEzvMGhYfQ4e1IPJfZPFrzwS71wzAyDIlcjAzE= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230829092421eucas1p2c12f3c95625bdb27f300e97656dc3b02~-0Fgnz1pc2921729217eucas1p24; Tue, 29 Aug 2023 09:24:21 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 8C.27.11320.549BDE46; Tue, 29 Aug 2023 10:24:21 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20230829092421eucas1p1970c3fb42ca622129bf92511893500b1~-0FgPiTP92107821078eucas1p1x; Tue, 29 Aug 2023 09:24:21 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230829092421eusmtrp11d25a978c8781712788f9fcef9732d2f~-0FgOIPBV3248032480eusmtrp1L; Tue, 29 Aug 2023 09:24:21 +0000 (GMT) X-AuditID: cbfec7f4-993ff70000022c38-2e-64edb9458fb1 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 6F.8B.14344.549BDE46; Tue, 29 Aug 2023 10:24:21 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230829092420eusmtip279c0288c8b4887955d720652f40ccf2a~-0FfAyJZY1173411734eusmtip2m; Tue, 29 Aug 2023 09:24:20 +0000 (GMT) From: Mateusz Majewski To: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: Mateusz Majewski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alim Akhtar , Bartlomiej Zolnierkiewicz , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Liam Girdwood , Mark Brown , Marek Szyprowski Subject: [PATCH 08/11] thermal: exynos: stop using the threshold mechanism on Exynos 4210 Date: Tue, 29 Aug 2023 11:18:46 +0200 Message-ID: <20230829091853.626011-9-m.majewski2@samsung.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230829091853.626011-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrLKsWRmVeSWpSXmKPExsWy7djPc7quO9+mGFzdaWLxYN42NovD8yss pj58wmbxfct1Jos1e88xWcz7LGsx/8g5Vou+Fw+ZLb5d6WCy2PT4GqvF5V1z2Cw+9x5htJhx fh+TxcRjk5kt1h65y24x98tUZovWvUfYLZ487GNzEPLYOesuu8fiPS+ZPDat6mTzuHNtD5vH 5iX1Hn1bVjF6fN4kF8AexWWTkpqTWZZapG+XwJXRtXMOc8EzvoqrV5tZGxg38HQxcnJICJhI rNxxk6mLkYtDSGAFo0Tzwj2sEM4XRom/T38wQzifGSXubv3HCtPy6PhpNojEckaJna9+sUM4 rUwSZ5Y9YwGpYhMwkHjwZhlYQkRgMaPE1p2zwLYwC8xlkWhY+ROoioNDWCBaYsreWpAGFgFV icvtnWwgNq+ArcTWqQdZINbJSzy/dYcdxOYUsJOYfr6dCaJGUOLkzCdgNcxANc1bZ4PdKiEw nVOi/9NpZpD5EgIuEqefW0HMEZZ4dXwLO4QtI3F6cg/U/HyJGZvfs0CUV0jcPegFYVpLfDwD NoRZQFNi/S59iGJHia9frzNBVPBJ3HgrCLGfT2LStulQK3klOtqEIKpVJY7vmcQMYUtLPGm5 zQRhe0gsezOLdQKj4iwkn8xC8skshL0LGJlXMYqnlhbnpqcWG+WllusVJ+YWl+al6yXn525i BKa40/+Of9nBuPzVR71DjEwcjIcYJTiYlUR4Lzm+ShHi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ilOBgVhLhveT4KkWINyWxsiq1KD++qDQntfgQoynQ 3ROZpUST84FJIa8k3tDMwNTQxMzSwNTSzFhJnNezoCNRSCA9sSQ1OzW1ILUIpo+Jg1OqgSn1 1ad8jt8/+c03WvKoPJGy6Tf6s5TjvM7VbtGJkjv2X7m3+aT9IluH4yHvWl4VcuY93BX54u26 vM1OG6Vuf5+hduEyj1VIY5FM8/dNWhZLt2RGV6fZdAa9eMR17fVC71yhjculGqdH//q+ec0d PUG9STeOb1wVIKJ/6exnjVkzTx09cyIj7Uj65w3PtTJMohhnZH66w/eO50zuDv1s/km5AuLb 6+5e5F0fG59Tf37u4n/b1E8tWHZC8VuMvP+vlZs/du2s9q+aufWeaGYR9xaGjSxGiyRrFd1j Hkuk2Bb2AWN3o/VP71T+36Hf5melxQUqlTcsvLzWZdWuN2uuddysMZlcxz8/L9/QmXvVg7VK LMUZiYZazEXFiQBOBKtnUgMAAA== X-CMS-MailID: 20230829092421eucas1p1970c3fb42ca622129bf92511893500b1 X-Msg-Generator: CA X-RootMTR: 20230829092421eucas1p1970c3fb42ca622129bf92511893500b1 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230829092421eucas1p1970c3fb42ca622129bf92511893500b1 References: <20230829091853.626011-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). Signed-off-by: Mateusz Majewski Reviewed-by: Krzysztof Kozlowski --- 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 5da44f43715d..6c107fe9fd27 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -336,20 +336,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); } @@ -364,6 +351,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,