From patchwork Tue Aug 29 09:18:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 718504 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 EB626C83F14 for ; Tue, 29 Aug 2023 09:24:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232420AbjH2JY3 (ORCPT ); Tue, 29 Aug 2023 05:24:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234785AbjH2JYX (ORCPT ); Tue, 29 Aug 2023 05:24:23 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18A4C1B6 for ; Tue, 29 Aug 2023 02:24:19 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20230829092406euoutp01337127974b630f0d0cc09316b48be0db~-0FSV93FZ1739317393euoutp01V for ; Tue, 29 Aug 2023 09:24:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20230829092406euoutp01337127974b630f0d0cc09316b48be0db~-0FSV93FZ1739317393euoutp01V DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1693301046; bh=Yg71emI7rkUdONEcXXwkkssF2zl7EmPpwlLXh4qDTeM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bch6VWVrwatFoif+HJy2ySqOXNzxoOhIp/MdTfjgJA024r16aGms8BkL/p94K3kyZ 3Y7tjFmzFgq3tmDpeTwEQ/WlQXZNFJMm13ZH0F7PHpQpRuA8isWaN1y9s8X3/ab97H dBRnqH9vtEs5KGi1mFqHvnkzNifvRTZHpOG7nljU= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20230829092405eucas1p1fc83dded4ba331d6d818eff146d8f59c~-0FRdLMgt2328123281eucas1p1f; Tue, 29 Aug 2023 09:24:05 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id DD.17.11320.539BDE46; Tue, 29 Aug 2023 10:24:05 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20230829092405eucas1p14543d527d81e8714594ebb999ab5fc02~-0FQ_bvLQ2331823318eucas1p1q; Tue, 29 Aug 2023 09:24:05 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230829092405eusmtrp1060d9335f88fe2227d244eed14cf210f~-0FQ9gpQQ3248032480eusmtrp1V; Tue, 29 Aug 2023 09:24:05 +0000 (GMT) X-AuditID: cbfec7f4-993ff70000022c38-ee-64edb935cd4d Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 86.D9.10549.439BDE46; Tue, 29 Aug 2023 10:24:05 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230829092404eusmtip2341d0d647936b47a733e98d3e2a655bb~-0FP-6-gg1072510725eusmtip2i; Tue, 29 Aug 2023 09:24:04 +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 01/11] ARM: dts: exynos: enable polling in Exynos 4210 Date: Tue, 29 Aug 2023 11:18:39 +0200 Message-ID: <20230829091853.626011-2-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+NgFjrDKsWRmVeSWpSXmKPExsWy7djP87qmO9+mGNz8rWDxYN42NovD8yss pj58wmbxfct1Jos1e88xWcz7LGsx/8g5Vou+Fw+ZLb5d6WCy2PT4GqvF5V1z2Cw+9x5htJhx fh+TxcRjk5kt1h65y24x98tUZovWvUfYLZ487GNzEPLYOesuu8fiPS+ZPDat6mTzuHNtD5vH 5iX1Hn1bVjF6fN4kF8AexWWTkpqTWZZapG+XwJXxuDO04BFHxcOLj9kaGBeydzFyckgImEhc WTuPtYuRi0NIYAWjxJzr16CcL4wSP3euY4FwPjNKTH1yFa5lQvsRNojEckaJVY2f2SGcViaJ 53f62UCq2AQMJB68WQaWEBFYzCixdecsJhCHWWAui0TDyp8sIFXCAm4SD168ZO5i5OBgEVCV ePkzDiTMK2ArsXrHMjaIdfISz2/dAVvNKWAnMf18OxNEjaDEyZlPwMYwA9U0b53NDDJfQmA2 p8TRDzeZIZpdJPYdus8IYQtLvDq+BeoHGYnTk3tYIOx8iRmb37OA3CAhUCFx96AXhGkt8fEM 2GXMApoS63fpQ0QdJY7sLoQw+SRuvBWE2M8nMWnbdGaIMK9ER5sQxGRVieN7JkFdIi3xpOU2 E4TtIfHmwEfWCYyKs5B8MgvJJ7MQ1i5gZF7FKJ5aWpybnlpslJdarlecmFtcmpeul5yfu4kR mOBO/zv+ZQfj8lcf9Q4xMnEwHmKU4GBWEuG95PgqRYg3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AezkgjvJcdXKUK8KYmVValF+fFFpTmpxYcY TYHOnsgsJZqcD0wJeSXxhmYGpoYmZpYGppZmxkrivJ4FHYlCAumJJanZqakFqUUwfUwcnFIN TAs+e0lIMGtM0XyiW7N2R1uubtOdizsKq9dFbqv1m6eWuW7m7qANfSuXSsZ462qtmFp5Q/u6 Rfoq+bvzOxfzK5pprf137ILEhryXb4/lHpb6Mf2PxrXHktl3syb8qLK9tCazwzthZmzEuYkL b/BGHnq6pUysbsavmmmH13839+PQPsObe7x5o/YZ+Tzz2SVVvXzqXisXFsye5lP373Vx0nyF 8oc7W7m/f/Qx4hfbKvRWv42BL+Xs9nyLubvPHHm/qXrX1p1VL0TWNzwu6TLJ6J51o3iSh/Lk lbcULLfGGXWfrTifuSOusGrOetunuZ7rfzcyLmCR+/PlRuP+xXd8e45YPkj+zLZZY0qvpqS5 f6kSS3FGoqEWc1FxIgDhwqItUQMAAA== X-CMS-MailID: 20230829092405eucas1p14543d527d81e8714594ebb999ab5fc02 X-Msg-Generator: CA X-RootMTR: 20230829092405eucas1p14543d527d81e8714594ebb999ab5fc02 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230829092405eucas1p14543d527d81e8714594ebb999ab5fc02 References: <20230829091853.626011-1-m.majewski2@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org It seems that thermal in Exynos 4210 is broken without this, as it will never decrease cooling after increasing it. Signed-off-by: Mateusz Majewski --- arch/arm/boot/dts/samsung/exynos4210.dtsi | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/samsung/exynos4210.dtsi b/arch/arm/boot/dts/samsung/exynos4210.dtsi index 0e27c3375e2e..aae185b7f91c 100644 --- a/arch/arm/boot/dts/samsung/exynos4210.dtsi +++ b/arch/arm/boot/dts/samsung/exynos4210.dtsi @@ -391,8 +391,14 @@ &cpu_alert2 { }; &cpu_thermal { - polling-delay-passive = <0>; - polling-delay = <0>; + /* Exynos 4210 supports thermal interrupts, but only for the rising threshold. + * This means that polling is not needed for preventing overheating, but only + * for decreasing cooling when possible. Hence we poll with a high delay. + * Ideally, we would disable polling for the first trip point, but this isn't + * really possible without outrageous hacks. + */ + polling-delay-passive = <5000>; + polling-delay = <5000>; }; &gic { From patchwork Tue Aug 29 09:18:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 719695 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 D878FC83F19 for ; Tue, 29 Aug 2023 09:24:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234695AbjH2JYa (ORCPT ); Tue, 29 Aug 2023 05:24:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234778AbjH2JYX (ORCPT ); Tue, 29 Aug 2023 05:24:23 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3893412F for ; Tue, 29 Aug 2023 02:24:11 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20230829092410euoutp02922d70c1d722b8cd3e4e3f44d7271687~-0FVfWGsp0626806268euoutp02q for ; Tue, 29 Aug 2023 09:24:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20230829092410euoutp02922d70c1d722b8cd3e4e3f44d7271687~-0FVfWGsp0626806268euoutp02q DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1693301050; bh=P34LvyBd3DIzM/01pFsL6osI5wPMYG7QBHPOp6UyW3s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X11MX07hLbBYbNccF7kpbDKdpjaFxkhaRfi7+UAzCFNKfWk4ADgt3iI8piMrF3fna jPU/uCCFaLsXyVIIxjjDtr1dnomc6H/fCaXFasgZ4PwthM9UaCjVSaZCyro2bAh+bG Ren6/o5bimXRrZtrAS5CA3w7uD3ZPXBLcmkvuPfs= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230829092409eucas1p2eb7888fd7a048f0dc432839b8dc5a7c3~-0FU1W7b73169731697eucas1p2n; Tue, 29 Aug 2023 09:24:09 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 42.7F.37758.939BDE46; Tue, 29 Aug 2023 10:24:09 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20230829092408eucas1p24901bbd192db03b69d774f2c5936f5b3~-0FUU3pn52802128021eucas1p2g; Tue, 29 Aug 2023 09:24:08 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230829092408eusmtrp1c398a84095b24b2ab9461cd879135176~-0FUULXbt3248032480eusmtrp1m; Tue, 29 Aug 2023 09:24:08 +0000 (GMT) X-AuditID: cbfec7f5-815ff7000002937e-39-64edb9399b8b Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 09.D9.10549.839BDE46; Tue, 29 Aug 2023 10:24:08 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230829092407eusmtip21454f38562007fa2dbc8ea627f7f64ac~-0FTXL5VJ1173411734eusmtip2c; Tue, 29 Aug 2023 09:24:07 +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 02/11] thermal: exynos: drop id field Date: Tue, 29 Aug 2023 11:18:40 +0200 Message-ID: <20230829091853.626011-3-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+NgFjrDKsWRmVeSWpSXmKPExsWy7djP87qWO9+mGMycxWPxYN42NovD8yss pj58wmbxfct1Jos1e88xWcz7LGsx/8g5Vou+Fw+ZLb5d6WCy2PT4GqvF5V1z2Cw+9x5htJhx fh+TxcRjk5kt1h65y24x98tUZovWvUfYLZ487GNzEPLYOesuu8fiPS+ZPDat6mTzuHNtD5vH 5iX1Hn1bVjF6fN4kF8AexWWTkpqTWZZapG+XwJVxaOY/5oKj3BXbFvxmbWBczdnFyMkhIWAi ceT7OSYQW0hgBaPEjr/cXYxcQPYXRonre2cwQjifGSW+7u5gh+k4tHgCM0RiOaPErceHodpb mSQmHZAEsdkEDCQevFnGDlIkIrCYUWLrzllMIA6zwFwWiYaVP1lAqoQFTCU2rjwINpZFQFVi 9tsvrCA2r4CtxITvu9gg1slLPL91B6yGU8BOYvr5diaIGkGJkzOfgM1hBqpp3job7CQJgdmc EvMuvYNqdpFovPiPGcIWlnh1fAvUDzISpyf3sEDY+RIzNr8HsjmA7AqJuwe9IExriY9nmEFM ZgFNifW79CGKHSXO7PzIBlHBJ3HjrSDEAXwSk7ZNZ4YI80p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s9v3QGr4RSwk5h+vp0J4iRb iTUTzrFB1AtKnJz5BGwzM1B989bZzBMYBWYhSc1CklrAyLSKUSS1tDg3PbfYUK84Mbe4NC9d Lzk/dxMjMCa3Hfu5eQfjvFcf9Q4xMnEwHmKU4GBWEuG95PgqRYg3JbGyKrUoP76oNCe1+BCj KdDdE5mlRJPzgUkhryTe0MzA1NDEzNLA1NLMWEmc17OgI1FIID2xJDU7NbUgtQimj4mDU6qB SZ7vYSqP8bt870e/jk3dXatku3P5mfhTdtufBWe1XDtuL7D4UXfVjg3zhCSyivNuLtK1WzH7 3jLtN0GJUV7t21bE2R9f7xOa/y2kp0L2kxBXqMwM3yPHTun+sjp9/8jO6nefnOa81NRbyH75 lrfg4yzZHdVPXAwOS06/9P3GkkeTb1ZLijn2NNTdfjZtxnrlin4xZmv5Nwe2h8pemJbNn7Pf Lmhlk79KwLKgkPUNk7M6fHmyL8jZdzV//hu8RuTN95wtln8XZEhWxta/YOoR55xdsum2vUDr Xy59i+7X3j/qd1gpTD/3f9708MCcOwoCYtons+tObvr17b/JhcCWy8Hp8w9yffpRcWXR2+vP diixFGckGmoxFxUnAgBNkSLWUgMAAA== X-CMS-MailID: 20230829092408eucas1p24901bbd192db03b69d774f2c5936f5b3 X-Msg-Generator: CA X-RootMTR: 20230829092408eucas1p24901bbd192db03b69d774f2c5936f5b3 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230829092408eucas1p24901bbd192db03b69d774f2c5936f5b3 References: <20230829091853.626011-1-m.majewski2@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org This field is not used in code, and seems to not have any meaning; in my tests, the value was always 0. Signed-off-by: Mateusz Majewski --- drivers/thermal/samsung/exynos_tmu.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 45e5c840d130..70e9c0296ee1 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -138,7 +138,6 @@ enum soc_type { /** * struct exynos_tmu_data : A structure to hold the private data of the TMU * driver - * @id: identifier of the one instance of the TMU controller. * @base: base address of the single instance of the TMU controller. * @base_second: base address of the common registers of the TMU controller. * @irq: irq number of the TMU controller. @@ -173,7 +172,6 @@ enum soc_type { * @tmu_clear_irqs: SoC specific TMU interrupts clearing method */ struct exynos_tmu_data { - int id; void __iomem *base; void __iomem *base_second; int irq; @@ -866,10 +864,6 @@ static int exynos_map_dt_data(struct platform_device *pdev) if (!data || !pdev->dev.of_node) return -ENODEV; - data->id = of_alias_get_id(pdev->dev.of_node, "tmuctrl"); - if (data->id < 0) - data->id = 0; - data->irq = irq_of_parse_and_map(pdev->dev.of_node, 0); if (data->irq <= 0) { dev_err(&pdev->dev, "failed to get IRQ\n"); From patchwork Tue Aug 29 09:18:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 719693 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 B3CA5C83F25 for ; Tue, 29 Aug 2023 09:25:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234612AbjH2JY3 (ORCPT ); Tue, 29 Aug 2023 05:24:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234792AbjH2JYY (ORCPT ); Tue, 29 Aug 2023 05:24:24 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C3CF1BD for ; Tue, 29 Aug 2023 02:24:19 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20230829092411euoutp01890e7a9f84e8c9dba5cb32c9d0c22328~-0FXILLs71739317393euoutp01Z for ; Tue, 29 Aug 2023 09:24:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20230829092411euoutp01890e7a9f84e8c9dba5cb32c9d0c22328~-0FXILLs71739317393euoutp01Z DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1693301051; bh=/YwrTa0ESS+UZ/KcX0BatXOuWIqWi30gs4sg9b7MyU0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VOZNT0Clqy0kIQPUk57NiBnuPrj9+JtU2MpUw3uHtZsVfLPvMYi1mFNN3ngBDd1B5 lDXw8sgZ75wLvF0/g3b/Jza0TjM8Hp/KOtOEaFOvOYuJtQbfpWiHKmCDxPpgaQ7ZGz ruterhyr1WgmrGYwI04n7LYtFcxfN36CHF2fsFcY= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20230829092411eucas1p18948ca3df6f6049f2d055bb275baf85e~-0FWuLK-T2104121041eucas1p1U; Tue, 29 Aug 2023 09:24:11 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 76.D8.42423.B39BDE46; Tue, 29 Aug 2023 10:24:11 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20230829092410eucas1p243a88662e8e64f0c406685931d9a80a3~-0FWVUtuh2471924719eucas1p20; Tue, 29 Aug 2023 09:24:10 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230829092410eusmtrp102d89b4ca0e1ae6ac30c2946642efee9~-0FWUlhyK3248032480eusmtrp1s; Tue, 29 Aug 2023 09:24:10 +0000 (GMT) X-AuditID: cbfec7f2-a3bff7000002a5b7-17-64edb93baa45 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id BA.D9.10549.A39BDE46; Tue, 29 Aug 2023 10:24:10 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230829092409eusmtip2bf7f8cefba59264b42ba325b5b64538f~-0FVRYGrh0986509865eusmtip2Y; Tue, 29 Aug 2023 09:24:09 +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 03/11] thermal: exynos: switch from workqueue-driven interrupt handling to threaded interrupts Date: Tue, 29 Aug 2023 11:18:41 +0200 Message-ID: <20230829091853.626011-4-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+NgFjrJKsWRmVeSWpSXmKPExsWy7djP87rWO9+mGDz7x2fxYN42NovD8yss pj58wmbxfct1Jos1e88xWcz7LGsx/8g5Vou+Fw+ZLb5d6WCy2PT4GqvF5V1z2Cw+9x5htJhx fh+TxcRjk5kt1h65y24x98tUZovWvUfYLZ487GNzEPLYOesuu8fiPS+ZPDat6mTzuHNtD5vH 5iX1Hn1bVjF6fN4kF8AexWWTkpqTWZZapG+XwJVxa91WxoJVEhW/pvxlb2CcJ9LF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htJhx fh+TxcRjk5kt1h65y24x98tUZovWvUfYLZ487GNzEPLYOesuu8fiPS+ZPDat6mTzuHNtD5vH 5iX1Hn1bVjF6fN4kF8AepWdTlF9akqqQkV9cYqsUbWhhpGdoaaFnZGKpZ2hsHmtlZKqkb2eT kpqTWZZapG+XoJdxa91WxoJVEhW/pvxlb2CcJ9LFyMEhIWAicf6ZaBcjF4eQwFJGiRc9v9m6 GDmB4tISh79MYYewhSX+XOtigyhqZpI4umoRE0iCTcBA4sGbZewgCRGB5YwSV+8tZwFxmAWW s0g8X/OBGaRKWCBPom/5KkaQdSwCqhLz9rGBmLwCthJTT1tDLJCXeH7rDtgyTgE7ienn28Hm CwGVrJlwDuwgXgFBiZMzn7CA2MxA9c1bZzNPYBSYhSQ1C0lqASPTKkaR1NLi3PTcYkO94sTc 4tK8dL3k/NxNjMB43Hbs5+YdjPNefdQ7xMjEwXiIUYKDWUmE95LjqxQh3pTEyqrUovz4otKc 1OJDjKZAV09klhJNzgcmhLySeEMzA1NDEzNLA1NLM2MlcV7Pgo5EIYH0xJLU7NTUgtQimD4m Dk6pBibvuAvm16YE3/HS+S+Tdzpc3fmfLUtX9sXKhUyOL39vsWMTu9CXe+bCjP8PpbK9Z3Dt jHf5Ln/+l/jpr2/iFb7sE3Q/kPROccIHraod1t6fd4Szf9ogW79ykli03Pd1O/esONd+ffnf /fIpBlwxrlYzai6/3bfzc8mVM6GdDL6z1Jd47Ja1dpfj3cHG7vJe4GlL20m16uTk+Xxfgs9d WJO3RVZIQoBp7/GKY6+YpBftk1prfzlxumP8A9dAl/rtV5kqLikvmWGtK8p/43ZM5ovFFySv lk56O1VGMm7z7Nd7jm2WCLQ4vvnSA6fe/U13v1tNbHh8XGGu95WfP0skP4Uxxf3zu6xj+1hv gqen8q9KJZbijERDLeai4kQA2g7wF1ADAAA= X-CMS-MailID: 20230829092410eucas1p243a88662e8e64f0c406685931d9a80a3 X-Msg-Generator: CA X-RootMTR: 20230829092410eucas1p243a88662e8e64f0c406685931d9a80a3 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230829092410eucas1p243a88662e8e64f0c406685931d9a80a3 References: <20230829091853.626011-1-m.majewski2@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The workqueue boilerplate is mostly one-to-one what the threaded interrupts do. Signed-off-by: Mateusz Majewski --- drivers/thermal/samsung/exynos_tmu.c | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 70e9c0296ee1..35b0a55017ad 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -142,7 +142,6 @@ enum soc_type { * @base_second: base address of the common registers of the TMU controller. * @irq: irq number of the TMU controller. * @soc: id of the SOC type. - * @irq_work: pointer to the irq work structure. * @lock: lock to implement synchronization. * @clk: pointer to the clock structure. * @clk_sec: pointer to the clock structure for accessing the base_second. @@ -176,7 +175,6 @@ struct exynos_tmu_data { void __iomem *base_second; int irq; enum soc_type soc; - struct work_struct irq_work; struct mutex lock; struct clk *clk, *clk_sec, *sclk; u32 cal_type; @@ -764,10 +762,9 @@ static int exynos7_tmu_read(struct exynos_tmu_data *data) EXYNOS7_TMU_TEMP_MASK; } -static void exynos_tmu_work(struct work_struct *work) +static irqreturn_t exynos_tmu_threaded_irq(int irq, void *id) { - struct exynos_tmu_data *data = container_of(work, - struct exynos_tmu_data, irq_work); + struct exynos_tmu_data *data = id; thermal_zone_device_update(data->tzd, THERMAL_EVENT_UNSPECIFIED); @@ -779,7 +776,8 @@ static void exynos_tmu_work(struct work_struct *work) clk_disable(data->clk); mutex_unlock(&data->lock); - enable_irq(data->irq); + + return IRQ_HANDLED; } static void exynos4210_tmu_clear_irqs(struct exynos_tmu_data *data) @@ -813,16 +811,6 @@ static void exynos4210_tmu_clear_irqs(struct exynos_tmu_data *data) writel(val_irq, data->base + tmu_intclear); } -static irqreturn_t exynos_tmu_irq(int irq, void *id) -{ - struct exynos_tmu_data *data = id; - - disable_irq_nosync(irq); - schedule_work(&data->irq_work); - - return IRQ_HANDLED; -} - static const struct of_device_id exynos_tmu_match[] = { { .compatible = "samsung,exynos3250-tmu", @@ -1024,8 +1012,6 @@ static int exynos_tmu_probe(struct platform_device *pdev) if (ret) goto err_sensor; - INIT_WORK(&data->irq_work, exynos_tmu_work); - data->clk = devm_clk_get(&pdev->dev, "tmu_apbif"); if (IS_ERR(data->clk)) { dev_err(&pdev->dev, "Failed to get clock\n"); @@ -1094,8 +1080,10 @@ static int exynos_tmu_probe(struct platform_device *pdev) goto err_sclk; } - ret = devm_request_irq(&pdev->dev, data->irq, exynos_tmu_irq, - IRQF_TRIGGER_RISING | IRQF_SHARED, dev_name(&pdev->dev), data); + ret = devm_request_threaded_irq( + &pdev->dev, data->irq, NULL, exynos_tmu_threaded_irq, + IRQF_TRIGGER_RISING | IRQF_SHARED | IRQF_ONESHOT, + dev_name(&pdev->dev), data); if (ret) { dev_err(&pdev->dev, "Failed to request irq: %d\n", data->irq); goto err_sclk; From patchwork Tue Aug 29 09:18:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 719694 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 DA6E4C83F14 for ; Tue, 29 Aug 2023 09:25:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234705AbjH2JYb (ORCPT ); Tue, 29 Aug 2023 05:24:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234809AbjH2JY0 (ORCPT ); Tue, 29 Aug 2023 05:24:26 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24C031BF for ; Tue, 29 Aug 2023 02:24:20 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20230829092413euoutp02c00b68f81c2649d44f31bdf91c3318e9~-0FYhdjci0626506265euoutp021 for ; Tue, 29 Aug 2023 09:24:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20230829092413euoutp02c00b68f81c2649d44f31bdf91c3318e9~-0FYhdjci0626506265euoutp021 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1693301053; bh=R1npbRRHIVc5z6cr0/4uwlBlhUhKgoCzpA6deobymMU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KOFpkEUL0x/7wZ6c3789rGGdbcGSzNtU6wTf93x1lVVHYX+lXu5vu6N38rfo6LfI2 sArTPqMPk63e8pYYMcz4yu347pTa5vgo6F9UYAOmT5TUarMLbnwLxee5BvfDym+Dgx WjDFEY0w21t1a7pE+ZV4hbES3gOyR3mWWJCFSUxk= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20230829092412eucas1p1531cee3670a5d7e7fe38d7d7151f2a71~-0FYHCpq31623216232eucas1p1l; Tue, 29 Aug 2023 09:24:12 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id D4.7F.37758.C39BDE46; Tue, 29 Aug 2023 10:24:12 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20230829092412eucas1p2b79a6f90b9077a3a5486845b7e68bbc6~-0FXq7Jdh2939629396eucas1p24; Tue, 29 Aug 2023 09:24:12 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230829092412eusmtrp14cd3da253366871f711c7e1809b20078~-0FXqKtVd3248032480eusmtrp1v; Tue, 29 Aug 2023 09:24:12 +0000 (GMT) X-AuditID: cbfec7f5-815ff7000002937e-43-64edb93cbb05 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id ED.D9.10549.C39BDE46; Tue, 29 Aug 2023 10:24:12 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230829092411eusmtip28a316e30a2b60f07dd72a3c2872f77ed~-0FWvvzIj0629806298eusmtip2i; Tue, 29 Aug 2023 09:24:11 +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 04/11] thermal: exynos: remove fine-grained clk management Date: Tue, 29 Aug 2023 11:18:42 +0200 Message-ID: <20230829091853.626011-5-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+NgFjrHKsWRmVeSWpSXmKPExsWy7djP87o2O9+mGOxu17V4MG8bm8Xh+RUW Ux8+YbP4vuU6k8WaveeYLOZ9lrWYf+Qcq0Xfi4fMFt+udDBZbHp8jdXi8q45bBafe48wWsw4 v4/JYuKxycwWa4/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K5BvUwMAAA== X-CMS-MailID: 20230829092412eucas1p2b79a6f90b9077a3a5486845b7e68bbc6 X-Msg-Generator: CA X-RootMTR: 20230829092412eucas1p2b79a6f90b9077a3a5486845b7e68bbc6 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230829092412eucas1p2b79a6f90b9077a3a5486845b7e68bbc6 References: <20230829091853.626011-1-m.majewski2@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org This clock only controls the register operations. The gain in power efficiency is therefore quite dubious, while there is price of added complexity that is important to get right (as a register operation might outright hang the CPU if the clock is not enabled). Signed-off-by: Mateusz Majewski --- drivers/thermal/samsung/exynos_tmu.c | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 35b0a55017ad..2c5501704911 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -275,7 +275,6 @@ static int exynos_tmu_initialize(struct platform_device *pdev) } mutex_lock(&data->lock); - clk_enable(data->clk); if (!IS_ERR(data->clk_sec)) clk_enable(data->clk_sec); @@ -305,7 +304,6 @@ static int exynos_tmu_initialize(struct platform_device *pdev) data->tmu_clear_irqs(data); } err: - clk_disable(data->clk); mutex_unlock(&data->lock); if (!IS_ERR(data->clk_sec)) clk_disable(data->clk_sec); @@ -336,10 +334,8 @@ static void exynos_tmu_control(struct platform_device *pdev, bool on) struct exynos_tmu_data *data = platform_get_drvdata(pdev); mutex_lock(&data->lock); - clk_enable(data->clk); data->tmu_control(pdev, on); data->enabled = on; - clk_disable(data->clk); mutex_unlock(&data->lock); } @@ -654,7 +650,6 @@ static int exynos_get_temp(struct thermal_zone_device *tz, int *temp) return -EAGAIN; mutex_lock(&data->lock); - clk_enable(data->clk); value = data->tmu_read(data); if (value < 0) @@ -662,7 +657,6 @@ static int exynos_get_temp(struct thermal_zone_device *tz, int *temp) else *temp = code_to_temp(data, value) * MCELSIUS; - clk_disable(data->clk); mutex_unlock(&data->lock); return ret; @@ -729,9 +723,7 @@ static int exynos_tmu_set_emulation(struct thermal_zone_device *tz, int temp) goto out; mutex_lock(&data->lock); - clk_enable(data->clk); data->tmu_set_emulation(data, temp); - clk_disable(data->clk); mutex_unlock(&data->lock); return 0; out: @@ -769,12 +761,10 @@ static irqreturn_t exynos_tmu_threaded_irq(int irq, void *id) thermal_zone_device_update(data->tzd, THERMAL_EVENT_UNSPECIFIED); mutex_lock(&data->lock); - clk_enable(data->clk); /* TODO: take action based on particular interrupt */ data->tmu_clear_irqs(data); - clk_disable(data->clk); mutex_unlock(&data->lock); return IRQ_HANDLED; @@ -1012,7 +1002,7 @@ static int exynos_tmu_probe(struct platform_device *pdev) if (ret) goto err_sensor; - data->clk = devm_clk_get(&pdev->dev, "tmu_apbif"); + data->clk = devm_clk_get_enabled(&pdev->dev, "tmu_apbif"); if (IS_ERR(data->clk)) { dev_err(&pdev->dev, "Failed to get clock\n"); ret = PTR_ERR(data->clk); @@ -1034,12 +1024,6 @@ static int exynos_tmu_probe(struct platform_device *pdev) } } - ret = clk_prepare(data->clk); - if (ret) { - dev_err(&pdev->dev, "Failed to get clock\n"); - goto err_clk_sec; - } - switch (data->soc) { case SOC_ARCH_EXYNOS5433: case SOC_ARCH_EXYNOS7: @@ -1047,12 +1031,12 @@ static int exynos_tmu_probe(struct platform_device *pdev) if (IS_ERR(data->sclk)) { dev_err(&pdev->dev, "Failed to get sclk\n"); ret = PTR_ERR(data->sclk); - goto err_clk; + goto err_clk_sec; } else { ret = clk_prepare_enable(data->sclk); if (ret) { dev_err(&pdev->dev, "Failed to enable sclk\n"); - goto err_clk; + goto err_clk_sec; } } break; @@ -1094,8 +1078,6 @@ static int exynos_tmu_probe(struct platform_device *pdev) err_sclk: clk_disable_unprepare(data->sclk); -err_clk: - clk_unprepare(data->clk); err_clk_sec: if (!IS_ERR(data->clk_sec)) clk_unprepare(data->clk_sec); @@ -1113,7 +1095,6 @@ static int exynos_tmu_remove(struct platform_device *pdev) exynos_tmu_control(pdev, false); clk_disable_unprepare(data->sclk); - clk_unprepare(data->clk); if (!IS_ERR(data->clk_sec)) clk_unprepare(data->clk_sec); From patchwork Tue Aug 29 09:18:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 718503 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 2052EC83F1E for ; Tue, 29 Aug 2023 09:25:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234685AbjH2JYa (ORCPT ); Tue, 29 Aug 2023 05:24:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234827AbjH2JY1 (ORCPT ); Tue, 29 Aug 2023 05:24:27 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB7D8CC9 for ; Tue, 29 Aug 2023 02:24:20 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20230829092416euoutp01a83722c12bfd99d20b6382f18f073603~-0Fb3bl_I1653716537euoutp018 for ; Tue, 29 Aug 2023 09:24:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20230829092416euoutp01a83722c12bfd99d20b6382f18f073603~-0Fb3bl_I1653716537euoutp018 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1693301056; bh=PS2hMZWBxoksmfnyC1o735UN6zy7GfxU5G/igjFuprM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WNcwJBPbkBMBGGhHtOEQviJPWwgs+WgzxuXo+zBa1gjcgBr+UjGtn68ArVRSfkSVn XL9OI+aaUaYoPUBr+q974cgf16dTNKmpl+GWpqi92sgs5YQKBcBB4c0pD/DghVZg1V z7sG/B/jceWJ+GqgiWj3FRFWjUKfYJlkrjw8h0Q4= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20230829092416eucas1p19b7bc837fe4d2a02794541a3b5942096~-0FbdBUCI2064620646eucas1p12; Tue, 29 Aug 2023 09:24:16 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id C8.7F.37758.049BDE46; Tue, 29 Aug 2023 10:24:16 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20230829092415eucas1p1cb4d56f908e7851297b2c4ed59984b2f~-0FbCDVL01818818188eucas1p1t; Tue, 29 Aug 2023 09:24:15 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230829092415eusmtrp1c2a7f49105c3a4b65d53d2f1a07e6816~-0FbBYPNH3248032480eusmtrp17; Tue, 29 Aug 2023 09:24:15 +0000 (GMT) X-AuditID: cbfec7f5-815ff7000002937e-54-64edb940cb7a Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 32.E9.10549.F39BDE46; Tue, 29 Aug 2023 10:24:15 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230829092414eusmtip2660964aafb50caa1e630ce78f05556a2~-0FaHHqt10629806298eusmtip2j; Tue, 29 Aug 2023 09:24:14 +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 05/11] thermal: exynos: simplify sclk (de)initialization Date: Tue, 29 Aug 2023 11:18:43 +0200 Message-ID: <20230829091853.626011-6-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+NgFjrLKsWRmVeSWpSXmKPExsWy7djPc7oOO9+mGMxcLmrxYN42NovD8yss pj58wmbxfct1Jos1e88xWcz7LGsx/8g5Vou+Fw+ZLb5d6WCy2PT4GqvF5V1z2Cw+9x5htJhx fh+TxcRjk5kt1h65y24x98tUZovWvUfYLZ487GNzEPLYOesuu8fiPS+ZPDat6mTzuHNtD5vH 5iX1Hn1bVjF6fN4kF8AexWWTkpqTWZZapG+XwJVxtOkRW8EGwYqFPx6wNDBO5uti5OCQEDCR OHq4sIuRi0NIYAWjxIepi5khnC+MEt2bj0M5nxklZp45zNLFyAnWcWPbCjaIxHJGiWcnJ4Al hARamSQWnk8FsdkEDCQevFnGDlIkIrCYUWLrzllMIA6zwFwWiYaVP8E6hAU8JJ49WMwEYrMI qEq0X5nPDGLzCthKTLu1kAlinbzE81t32EFsTgE7ienn25kgagQlTs58AjaHGaimeetssFsl BKZzSvxvv8gO0ewicXTuJihbWOLV8S1QtozE6ck9UP/kS8zY/J4FEhoVEncPekGY1hIfzzCD mMwCmhLrd+lDFDtK7Ds/iRWigk/ixltBiAP4JCZtm84MEeaV6GgTgqhWlTi+ZxIzhC0t8a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WAnMf18OxPESbYS ayacY4OoF5Q4OfMJC4jNDFTfvHU28wRGgVlIUrOQpBYwMq1iFEktLc5Nzy021CtOzC0uzUvX S87P3cQIjMltx35u3sE479VHvUOMTByMhxglOJiVRHgvOb5KEeJNSaysSi3Kjy8qzUktPsRo CnT3RGYp0eR8YFLIK4k3NDMwNTQxszQwtTQzVhLn9SzoSBQSSE8sSc1OTS1ILYLpY+LglGpg WtXb4xm7cOIaPskfFt/lFn21n6m1qH5VsdP7w19jlKbrlpxZ3zPTb35/imyAeLza/U9Z8z8o rTi5X99NcMq5tSn9PYvNkpNOFe3h6vrKtFFx6ZqdTXsautPdk67MKTh6ZU3UWcbmpy+26/ez dHZ03JL9E3GG753Pni0/9T2mhrx3XzN37eKi47PtpcsrQvTMHfiuebq0/ClN4Dg+3aU0eFFI 7nvtIwmrBSrXbVhb4uwf6993ypjnilvibinrhG7RY0Zq7vMv5m5RtprUqVAuV7suTmj7Kiun oCVXNr75deOiYFDJfdnUOUqJJcKvN+eFq+lOzPA9cTJvx82HqyYuET28pM3wyNQLOtNFan0d lFiKMxINtZiLihMBcVqSklIDAAA= X-CMS-MailID: 20230829092415eucas1p1cb4d56f908e7851297b2c4ed59984b2f X-Msg-Generator: CA X-RootMTR: 20230829092415eucas1p1cb4d56f908e7851297b2c4ed59984b2f X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230829092415eucas1p1cb4d56f908e7851297b2c4ed59984b2f References: <20230829091853.626011-1-m.majewski2@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org There's no need to enable the clock separately, and this also allows us to delegate the deinitialization to devm entirely. Signed-off-by: Mateusz Majewski --- drivers/thermal/samsung/exynos_tmu.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 2c5501704911..49e9157c3dc7 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -1027,17 +1027,11 @@ static int exynos_tmu_probe(struct platform_device *pdev) switch (data->soc) { case SOC_ARCH_EXYNOS5433: case SOC_ARCH_EXYNOS7: - data->sclk = devm_clk_get(&pdev->dev, "tmu_sclk"); + data->sclk = devm_clk_get_enabled(&pdev->dev, "tmu_sclk"); if (IS_ERR(data->sclk)) { dev_err(&pdev->dev, "Failed to get sclk\n"); ret = PTR_ERR(data->sclk); goto err_clk_sec; - } else { - ret = clk_prepare_enable(data->sclk); - if (ret) { - dev_err(&pdev->dev, "Failed to enable sclk\n"); - goto err_clk_sec; - } } break; default: @@ -1055,13 +1049,13 @@ static int exynos_tmu_probe(struct platform_device *pdev) if (ret != -EPROBE_DEFER) dev_err(&pdev->dev, "Failed to register sensor: %d\n", ret); - goto err_sclk; + goto err_clk_sec; } ret = exynos_tmu_initialize(pdev); if (ret) { dev_err(&pdev->dev, "Failed to initialize TMU\n"); - goto err_sclk; + goto err_clk_sec; } ret = devm_request_threaded_irq( @@ -1070,14 +1064,12 @@ static int exynos_tmu_probe(struct platform_device *pdev) dev_name(&pdev->dev), data); if (ret) { dev_err(&pdev->dev, "Failed to request irq: %d\n", data->irq); - goto err_sclk; + goto err_clk_sec; } exynos_tmu_control(pdev, true); return 0; -err_sclk: - clk_disable_unprepare(data->sclk); err_clk_sec: if (!IS_ERR(data->clk_sec)) clk_unprepare(data->clk_sec); @@ -1094,7 +1086,6 @@ static int exynos_tmu_remove(struct platform_device *pdev) exynos_tmu_control(pdev, false); - clk_disable_unprepare(data->sclk); if (!IS_ERR(data->clk_sec)) clk_unprepare(data->clk_sec); From patchwork Tue Aug 29 09:18:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 718501 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 4DF51C6FA8F for ; Tue, 29 Aug 2023 09:25:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234850AbjH2JZB (ORCPT ); Tue, 29 Aug 2023 05:25:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234845AbjH2JY2 (ORCPT ); Tue, 29 Aug 2023 05:24:28 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B469319F for ; Tue, 29 Aug 2023 02:24:22 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20230829092419euoutp011c1b7f713cd6b2a9ddc6c43faaa39196~-0Fd6JZYh1653716537euoutp01_ for ; Tue, 29 Aug 2023 09:24:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20230829092419euoutp011c1b7f713cd6b2a9ddc6c43faaa39196~-0Fd6JZYh1653716537euoutp01_ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1693301059; bh=uxrdo/kD2daqjjmxIH/c4SF+x6XLXkAixdvHbsmRDwk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bXwwCzfDlifzqXFEXRYEdCYDbftyNHThYrxWZUU4EoBeCQzR6po3glpvIvt74Ougl O4zUKKq+SUMTHEYzp59stEhM7UvkdyBinEXg7d0ZQdt9WcbekCL7d/k4OZSfaqvFEU SaY1P+ohiu7PZgG6igfcVFtTd1so0j8mpXQ8+Ou8= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20230829092418eucas1p1262a7d262936a80e888373a78c47803f~-0FdU-MLX2028420284eucas1p1r; Tue, 29 Aug 2023 09:24:18 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 88.27.11320.249BDE46; Tue, 29 Aug 2023 10:24:18 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20230829092417eucas1p187216bed157d5fb8472780688cf746d2~-0Fc7VcCz2327623276eucas1p11; Tue, 29 Aug 2023 09:24:17 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230829092417eusmtrp1eb74272d64882257490272d9adab00eb~-0Fc6jzWT3248032480eusmtrp1C; Tue, 29 Aug 2023 09:24:17 +0000 (GMT) X-AuditID: cbfec7f4-97dff70000022c38-1d-64edb942d3a9 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 27.E9.10549.149BDE46; Tue, 29 Aug 2023 10:24:17 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230829092416eusmtip27357c43634c3501df0df9b98f0422dcb~-0Fb-Yloe0986509865eusmtip2f; Tue, 29 Aug 2023 09:24:16 +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 06/11] thermal: exynos: simplify regulator (de)initialization Date: Tue, 29 Aug 2023 11:18:44 +0200 Message-ID: <20230829091853.626011-7-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+NgFjrDKsWRmVeSWpSXmKPExsWy7djP87pOO9+mGJz7KGTxYN42NovD8yss pj58wmbxfct1Jos1e88xWcz7LGsx/8g5Vou+Fw+ZLb5d6WCy2PT4GqvF5V1z2Cw+9x5htJhx fh+TxcRjk5kt1h65y24x98tUZovWvUfYLZ487GNzEPLYOesuu8fiPS+ZPDat6mTzuHNtD5vH 5iX1Hn1bVjF6fN4kF8AexWWTkpqTWZZapG+XwJUxacJ79oJJkhXd/+6zNzBuFeli5OSQEDCR +PTlIXsXIxeHkMAKRomp3ReYQBJCAl8YJS7uiYOwPzNKbF8pCtNw6uszZoiG5YwS1xcvZYQo amWSmLtOEsRmEzCQePBmGdhUEYHFjBJbd85iAnGYBeaySDSs/MkCUiUs4C/x9dplsG4WAVWJ 9+v2s4HYvAK2EvNbbzJDrJOXeH7rDjuIzSlgJzH9fDsTRI2gxMmZT8DmMAPVNG+dDXaShMBs Tol5ix+wQTS7SLRunsAIYQtLvDq+hR3ClpE4PbmHBcLOl5ix+T2QzQFkV0jcPegFYVpLfDzD DGIyC2hKrN+lD1HsKHF41wcmiAo+iRtvBSEO4JOYtG06M0SYV6KjTQiiWlXi+J5JUH9ISzxp uc0EYXtItGzsYJnAqDgLySuzkLwyC2HvAkbmVYziqaXFuempxUZ5qeV6xYm5xaV56XrJ+bmb GIEJ7vS/4192MC5/9VHvECMTB+MhRgkOZiUR3kuOr1KEeFMSK6tSi/Lji0pzUosPMUpzsCiJ 82rbnkwWEkhPLEnNTk0tSC2CyTJxcEo1MEnfybxeO0vy2V09SbblJk6bdhSuf736sXvpb12B pJBUC43DDbnzpWp1rRe2yap6yKjY15+abpW5YuG7o1uMIrrCp/ZtXhIW+u72VfdIqxe3p3+M uNxwj0O5yHL3zr0O78yWZDr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aY887MWyRcnVAjOOtekYte8BmlrLMz7idZLrst/lTTIeXA9QZB/otxuTmXjRLb4/9PNQ1d Ih1wZ6/2gg8Zj7R1rG7offohKmZ7yVIu8Ok132M730pPav/L82Ja2eUXnCJpLIyrtnpUuzws Uoh0Kr59MV1mm/ynvdOP7tgSunnp33LL2MdBu/uyLffOr2+Xn//84UvDxJP8ZlMqljmuk1PX rmWI7Wq1nvt2qZSF5fKjTklFPxctqHOuKzBnVJopXbmWM1FxmcC2Xffld4hGxDiFT99cOt/7 gK8SS3FGoqEWc1FxIgBvIzS5UgMAAA== X-CMS-MailID: 20230829092417eucas1p187216bed157d5fb8472780688cf746d2 X-Msg-Generator: CA X-RootMTR: 20230829092417eucas1p187216bed157d5fb8472780688cf746d2 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230829092417eucas1p187216bed157d5fb8472780688cf746d2 References: <20230829091853.626011-1-m.majewski2@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org This does reduce the error granularity a bit, but the code simplification seems to be worth it. Signed-off-by: Mateusz Majewski --- drivers/thermal/samsung/exynos_tmu.c | 33 +++++++--------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 49e9157c3dc7..5c08212ff8ac 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -157,7 +157,6 @@ enum soc_type { * @reference_voltage: reference voltage of amplifier * in the positive-TC generator block * 0 < reference_voltage <= 31 - * @regulator: pointer to the TMU regulator structure. * @reg_conf: pointer to structure to register with core thermal. * @tzd: pointer to thermal_zone_device structure * @ntrip: number of supported trip points. @@ -184,7 +183,6 @@ struct exynos_tmu_data { u16 temp_error1, temp_error2; u8 gain; u8 reference_voltage; - struct regulator *regulator; struct thermal_zone_device *tzd; unsigned int ntrip; bool enabled; @@ -985,42 +983,34 @@ static int exynos_tmu_probe(struct platform_device *pdev) * TODO: Add regulator as an SOC feature, so that regulator enable * is a compulsory call. */ - data->regulator = devm_regulator_get_optional(&pdev->dev, "vtmu"); - if (!IS_ERR(data->regulator)) { - ret = regulator_enable(data->regulator); - if (ret) { - dev_err(&pdev->dev, "failed to enable vtmu\n"); - return ret; - } - } else { - if (PTR_ERR(data->regulator) == -EPROBE_DEFER) + ret = devm_regulator_get_enable_optional(&pdev->dev, "vtmu"); + if (ret) { + if (ret == -EPROBE_DEFER) return -EPROBE_DEFER; - dev_info(&pdev->dev, "Regulator node (vtmu) not found\n"); + dev_info(&pdev->dev, "Failed to get regulator node (vtmu)\n"); } ret = exynos_map_dt_data(pdev); if (ret) - goto err_sensor; + return ret; data->clk = devm_clk_get_enabled(&pdev->dev, "tmu_apbif"); if (IS_ERR(data->clk)) { dev_err(&pdev->dev, "Failed to get clock\n"); - ret = PTR_ERR(data->clk); - goto err_sensor; + return PTR_ERR(data->clk); } data->clk_sec = devm_clk_get(&pdev->dev, "tmu_triminfo_apbif"); if (IS_ERR(data->clk_sec)) { if (data->soc == SOC_ARCH_EXYNOS5420_TRIMINFO) { dev_err(&pdev->dev, "Failed to get triminfo clock\n"); - ret = PTR_ERR(data->clk_sec); - goto err_sensor; + return PTR_ERR(data->clk_sec); } } else { ret = clk_prepare(data->clk_sec); if (ret) { dev_err(&pdev->dev, "Failed to get clock\n"); - goto err_sensor; + return ret; } } @@ -1073,10 +1063,6 @@ static int exynos_tmu_probe(struct platform_device *pdev) err_clk_sec: if (!IS_ERR(data->clk_sec)) clk_unprepare(data->clk_sec); -err_sensor: - if (!IS_ERR(data->regulator)) - regulator_disable(data->regulator); - return ret; } @@ -1089,9 +1075,6 @@ static int exynos_tmu_remove(struct platform_device *pdev) if (!IS_ERR(data->clk_sec)) clk_unprepare(data->clk_sec); - if (!IS_ERR(data->regulator)) - regulator_disable(data->regulator); - return 0; } From patchwork Tue Aug 29 09:18:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 718500 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 593A5C83F1E for ; Tue, 29 Aug 2023 09:25:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234746AbjH2JZD (ORCPT ); Tue, 29 Aug 2023 05:25:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230141AbjH2JY3 (ORCPT ); Tue, 29 Aug 2023 05:24:29 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35EC11AA for ; Tue, 29 Aug 2023 02:24:23 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20230829092420euoutp012734863104d593ed44869804dc6e1dda~-0FfQ2Sl81651116511euoutp018 for ; Tue, 29 Aug 2023 09:24:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20230829092420euoutp012734863104d593ed44869804dc6e1dda~-0FfQ2Sl81651116511euoutp018 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1693301060; bh=fAWYlX+RxB8EresjOiGmi5eRZPDuvZsprSSAaoR5vys=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sh17cdzYxNoCCmJb+Q2AKOuBnKYqk11Rx/kxRxtOr6tycOfn44gRExUia07CBHeiu jKUkSRXuS1Ts9bxSZj/SrmtD9Y+/80W7juANfSiTD3VG9okqqnNRG6CyPxbj63RuV0 fIJpri309hi4jcIER/w6eGBWi55Es+ynbZ4keKE0= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20230829092420eucas1p19611b8ff89e109396ed5b59c1b95fa03~-0Fe0s84q2330823308eucas1p1r; Tue, 29 Aug 2023 09:24:20 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 90.E8.42423.349BDE46; Tue, 29 Aug 2023 10:24:19 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20230829092419eucas1p275687d1c34087e8bad4b3194ad4b8973~-0FeaITei2901529015eucas1p2q; Tue, 29 Aug 2023 09:24:19 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230829092419eusmtrp18b3a350707c74a739063c2ab0f32a02a~-0FeZZsoF3270032700eusmtrp1c; Tue, 29 Aug 2023 09:24:19 +0000 (GMT) X-AuditID: cbfec7f2-a3bff7000002a5b7-40-64edb943e032 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 9D.8B.14344.349BDE46; Tue, 29 Aug 2023 10:24:19 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230829092418eusmtip22e91e730285b16a75a1459994fbd299d~-0FdcuXGj1173411734eusmtip2l; Tue, 29 Aug 2023 09:24:18 +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 07/11] thermal: exynos: simplify clk_sec (de)initialization Date: Tue, 29 Aug 2023 11:18:45 +0200 Message-ID: <20230829091853.626011-8-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+NgFjrLKsWRmVeSWpSXmKPExsWy7djPc7rOO9+mGJy9Y2bxYN42NovD8yss pj58wmbxfct1Jos1e88xWcz7LGsx/8g5Vou+Fw+ZLb5d6WCy2PT4GqvF5V1z2Cw+9x5htJhx fh+TxcRjk5kt1h65y24x98tUZovWvUfYLZ487GNzEPLYOesuu8fiPS+ZPDat6mTzuHNtD5vH 5iX1Hn1bVjF6fN4kF8AexWWTkpqTWZZapG+XwJUx7/ts9oKDkhWrPvxha2C8J9LFyMkhIWAi sfb6MXYQW0hgBaPEvbt5XYxcQPYXRonre9+zQTifGSV6m44zdzFygHUc3F8AEV/OKLG57RBU USuTxM2nN1hBRrEJGEg8eLOMHSQhIrCYUWLrzllMIA6zwFwWiYaVP1lAqoQFvCX+zZ7DDGKz CKhKLPj6BOwQXgFbia/9Z1ghDpSXeH7rDlicU8BOYvr5diaIGkGJkzOfgM1hBqpp3jqbGWSB hMB8TomlZ/cwQjS7SGw49p4JwhaWeHV8CzuELSNxenIPC4SdLzFj83sWiN8qJO4e9IIwrSU+ ngH7mFlAU2L9Ln2IYkeJjXO/sENU8EnceCsIcQCfxKRt06HhwyvR0SYEUa0qcXzPJGYIW1ri ScttqFM8JC6/fsM+gVFxFpJXZiF5ZRbC3gWMzKsYxVNLi3PTU4sN81LL9YoTc4tL89L1kvNz NzECU9zpf8c/7WCc++qj3iFGJg7GQ4wSHMxKIryXHF+lCPGmJFZWpRblxxeV5qQWH2KU5mBR EufVtj2ZLCSQnliSmp2aWpBaBJNl4uCUamB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xMzSwNTSzFhJnNezoCNRSCA9sSQ1OzW1ILUIpo+J g1OqgSn+QXqz06GDvd0ztbKmnmnh4di0fGLSw1nVAtMDTzGfFy/I/qO/4dTSInvbKCbugw9O Oa6aVy7q4nSqalHG96Dij8zHFaZcMtn5NUHgV6Kc87OypYYhdx82O2x98YRdw2L2b6OPzfts 9bbusTFUmG2hHcn1Xyq5sZhL8cqnE8Is5lEvdwqkN299w25v/rujaivri/je47c5My5O+/ph l86c1yciDBy6pi/befz8o8afjk807t++/22XQ7GBy9GdK37EJMqeeVC7ZdHM6d/8Etv/yZu6 9nntNl8k9UnWP/WCQUe07c2303jYDLh/b+G8HrV5xtaQ/BoJ4dqUDxsyt/J7cjiZ3L+12p9l sZpK+yIlluKMREMt5qLiRAAfFDHfUQMAAA== X-CMS-MailID: 20230829092419eucas1p275687d1c34087e8bad4b3194ad4b8973 X-Msg-Generator: CA X-RootMTR: 20230829092419eucas1p275687d1c34087e8bad4b3194ad4b8973 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230829092419eucas1p275687d1c34087e8bad4b3194ad4b8973 References: <20230829091853.626011-1-m.majewski2@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org We only now grab the clock where it is actually being used. Additionally, we remove the fine-grained clock management by enabling the clock during initialization. Signed-off-by: Mateusz Majewski --- drivers/thermal/samsung/exynos_tmu.c | 45 ++++++++-------------------- 1 file changed, 12 insertions(+), 33 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 5c08212ff8ac..5da44f43715d 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -273,8 +273,6 @@ static int exynos_tmu_initialize(struct platform_device *pdev) } mutex_lock(&data->lock); - if (!IS_ERR(data->clk_sec)) - clk_enable(data->clk_sec); status = readb(data->base + EXYNOS_TMU_REG_STATUS); if (!status) { @@ -303,8 +301,6 @@ static int exynos_tmu_initialize(struct platform_device *pdev) } err: mutex_unlock(&data->lock); - if (!IS_ERR(data->clk_sec)) - clk_disable(data->clk_sec); out: return ret; } @@ -1000,28 +996,21 @@ static int exynos_tmu_probe(struct platform_device *pdev) return PTR_ERR(data->clk); } - data->clk_sec = devm_clk_get(&pdev->dev, "tmu_triminfo_apbif"); - if (IS_ERR(data->clk_sec)) { - if (data->soc == SOC_ARCH_EXYNOS5420_TRIMINFO) { - dev_err(&pdev->dev, "Failed to get triminfo clock\n"); - return PTR_ERR(data->clk_sec); - } - } else { - ret = clk_prepare(data->clk_sec); - if (ret) { - dev_err(&pdev->dev, "Failed to get clock\n"); - return ret; - } - } - switch (data->soc) { case SOC_ARCH_EXYNOS5433: case SOC_ARCH_EXYNOS7: data->sclk = devm_clk_get_enabled(&pdev->dev, "tmu_sclk"); if (IS_ERR(data->sclk)) { dev_err(&pdev->dev, "Failed to get sclk\n"); - ret = PTR_ERR(data->sclk); - goto err_clk_sec; + return PTR_ERR(data->sclk); + } + break; + case SOC_ARCH_EXYNOS5420_TRIMINFO: + data->clk_sec = + devm_clk_get_enabled(&pdev->dev, "tmu_triminfo_apbif"); + if (IS_ERR(data->clk_sec)) { + dev_err(&pdev->dev, "Failed to get triminfo clock\n"); + return PTR_ERR(data->clk_sec); } break; default: @@ -1039,13 +1028,13 @@ static int exynos_tmu_probe(struct platform_device *pdev) if (ret != -EPROBE_DEFER) dev_err(&pdev->dev, "Failed to register sensor: %d\n", ret); - goto err_clk_sec; + return ret; } ret = exynos_tmu_initialize(pdev); if (ret) { dev_err(&pdev->dev, "Failed to initialize TMU\n"); - goto err_clk_sec; + return ret; } ret = devm_request_threaded_irq( @@ -1054,27 +1043,17 @@ static int exynos_tmu_probe(struct platform_device *pdev) dev_name(&pdev->dev), data); if (ret) { dev_err(&pdev->dev, "Failed to request irq: %d\n", data->irq); - goto err_clk_sec; + return ret; } exynos_tmu_control(pdev, true); return 0; - -err_clk_sec: - if (!IS_ERR(data->clk_sec)) - clk_unprepare(data->clk_sec); - return ret; } static int exynos_tmu_remove(struct platform_device *pdev) { - struct exynos_tmu_data *data = platform_get_drvdata(pdev); - exynos_tmu_control(pdev, false); - if (!IS_ERR(data->clk_sec)) - clk_unprepare(data->clk_sec); - return 0; } 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: 719692 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 0A0EDC83F17 for ; Tue, 29 Aug 2023 09:25:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233205AbjH2JZC (ORCPT ); Tue, 29 Aug 2023 05:25:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232079AbjH2JY3 (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 79AC81AE 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 20230829092422euoutp0256542c55c26ddee8fdce0263d0ecc561~-0Fg8Qynu0788107881euoutp02I for ; Tue, 29 Aug 2023 09:24:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20230829092422euoutp0256542c55c26ddee8fdce0263d0ecc561~-0Fg8Qynu0788107881euoutp02I 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/S59iGJHia9frzNBVPBJ3HgrCLG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CKhKXG7vBFvHK2ArsXXqQRaIFfISz2/dAVvHKWAnMf18OxPESbYS ayacg6oXlDg58wlYPTNQffPW2cwTGAVmIUnNQpJawMi0ilEktbQ4Nz232EivODG3uDQvXS85 P3cTIzAmtx37uWUH48pXH/UOMTJxMB5ilOBgVhLhveT4KkWINyWxsiq1KD++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-pm@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 --- 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, From patchwork Tue Aug 29 09:18:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 719690 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 2858AC83F27 for ; Tue, 29 Aug 2023 09:25:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234737AbjH2JZI (ORCPT ); Tue, 29 Aug 2023 05:25:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234657AbjH2JY3 (ORCPT ); Tue, 29 Aug 2023 05:24:29 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32C1B194 for ; Tue, 29 Aug 2023 02:24:25 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20230829092423euoutp015b2f2bc47b680c0564cfaef16273a561~-0FihU56A1738917389euoutp01l for ; Tue, 29 Aug 2023 09:24:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20230829092423euoutp015b2f2bc47b680c0564cfaef16273a561~-0FihU56A1738917389euoutp01l DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1693301064; bh=MISFxXLRGqBlhsnV74hyg0jBZORCFgJ+ZNkWVkvzueo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X1ALU1ZaQlQfJmmPyq/2vYhFT236PybJ2vQkQNRGDvCVc1h7fOBuHqVXoqGA2EDtM 1ZDWd1vMwvbSBiaF8ySM+GbDOyikTQEmjRjURRNiTDfuOx0gDJ1ob3ko4V1z/dDGFJ /zEEfH2g10uTKFjkDdmye4EzNTT8twkBLUcc0AOU= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20230829092423eucas1p176bd125264a400fcaf3467cbc8649494~-0FiLmy2y1819818198eucas1p1E; Tue, 29 Aug 2023 09:24:23 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 04.E8.42423.749BDE46; Tue, 29 Aug 2023 10:24:23 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20230829092423eucas1p1fc13c188d99482b195e115fd19a1391d~-0FhrCmah2075220752eucas1p1o; Tue, 29 Aug 2023 09:24:23 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230829092423eusmtrp1c33955e9998a3af345772e7d3e831fd7~-0FhqahHc3270032700eusmtrp1l; Tue, 29 Aug 2023 09:24:23 +0000 (GMT) X-AuditID: cbfec7f2-a3bff7000002a5b7-4c-64edb9475ddf Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 41.9B.14344.649BDE46; Tue, 29 Aug 2023 10:24:22 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230829092422eusmtip2ef283c90696bc30860c4f4d372111754~-0FgvxfYQ1320013200eusmtip2F; Tue, 29 Aug 2023 09:24:22 +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 09/11] thermal: exynos: split initialization of TMU and the thermal zone Date: Tue, 29 Aug 2023 11:18:47 +0200 Message-ID: <20230829091853.626011-10-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+NgFjrDKsWRmVeSWpSXmKPExsWy7djPc7ruO9+mGBzrU7B4MG8bm8Xh+RUW Ux8+YbP4vu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fL0ox2P2u/qN Kn+D11399WJyX20o3/zJi1bdOzXPV5qt8O+urcqP5PVfuM6VVn/C3/JCcL/qypZ6N2bJTfMF lViKMxINtZiLihMBfH7+KlIDAAA= X-CMS-MailID: 20230829092423eucas1p1fc13c188d99482b195e115fd19a1391d X-Msg-Generator: CA X-RootMTR: 20230829092423eucas1p1fc13c188d99482b195e115fd19a1391d X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230829092423eucas1p1fc13c188d99482b195e115fd19a1391d References: <20230829091853.626011-1-m.majewski2@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org This will be needed in the future, as the thermal zone subsystem might call our callbacks right after devm_thermal_of_zone_register. Currently we just make get_temp return EAGAIN in such case, but this will not be possible with state-modifying callbacks, for instance set_trips. Signed-off-by: Mateusz Majewski --- drivers/thermal/samsung/exynos_tmu.c | 78 ++++++++++++++++------------ 1 file changed, 45 insertions(+), 33 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 6c107fe9fd27..aa3de367b3c7 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -250,20 +250,43 @@ static void sanitize_temp_error(struct exynos_tmu_data *data, u32 trim_info) } static int exynos_tmu_initialize(struct platform_device *pdev) +{ + struct exynos_tmu_data *data = platform_get_drvdata(pdev); + unsigned int status; + int ret = 0; + + mutex_lock(&data->lock); + + status = readb(data->base + EXYNOS_TMU_REG_STATUS); + if (!status) { + ret = -EBUSY; + } else { + data->tmu_initialize(pdev); + data->tmu_clear_irqs(data); + } + + mutex_unlock(&data->lock); + + return ret; +} + +static int exynos_thermal_zone_configure(struct platform_device *pdev) { struct exynos_tmu_data *data = platform_get_drvdata(pdev); struct thermal_zone_device *tzd = data->tzd; int num_trips = thermal_zone_get_num_trips(tzd); - unsigned int status; int ret = 0, temp; ret = thermal_zone_get_crit_temp(tzd, &temp); + if (ret && data->soc != SOC_ARCH_EXYNOS5433) { /* FIXME */ dev_err(&pdev->dev, "No CRITICAL trip point defined in device tree!\n"); - goto out; + goto err; } + mutex_lock(&data->lock); + if (num_trips > data->ntrip) { dev_info(&pdev->dev, "More trip points than supported by this TMU.\n"); @@ -272,36 +295,23 @@ static int exynos_tmu_initialize(struct platform_device *pdev) num_trips - data->ntrip); } - mutex_lock(&data->lock); + int i, ntrips = min_t(int, num_trips, data->ntrip); - status = readb(data->base + EXYNOS_TMU_REG_STATUS); - if (!status) { - ret = -EBUSY; - } else { - int i, ntrips = - min_t(int, num_trips, data->ntrip); + /* Write temperature code for rising and falling threshold */ + for (i = 0; i < ntrips; i++) { + struct thermal_trip trip; - data->tmu_initialize(pdev); + ret = thermal_zone_get_trip(tzd, i, &trip); + if (ret) + goto err; - /* Write temperature code for rising and falling threshold */ - for (i = 0; i < ntrips; i++) { - - struct thermal_trip trip; - - ret = thermal_zone_get_trip(tzd, i, &trip); - if (ret) - goto err; - - data->tmu_set_trip_temp(data, i, trip.temperature / MCELSIUS); - data->tmu_set_trip_hyst(data, i, trip.temperature / MCELSIUS, - trip.hysteresis / MCELSIUS); - } - - data->tmu_clear_irqs(data); + data->tmu_set_trip_temp(data, i, trip.temperature / MCELSIUS); + data->tmu_set_trip_hyst(data, i, trip.temperature / MCELSIUS, + trip.hysteresis / MCELSIUS); } -err: + mutex_unlock(&data->lock); -out: +err: return ret; } @@ -1006,10 +1016,12 @@ static int exynos_tmu_probe(struct platform_device *pdev) break; } - /* - * data->tzd must be registered before calling exynos_tmu_initialize(), - * requesting irq and calling exynos_tmu_control(). - */ + ret = exynos_tmu_initialize(pdev); + if (ret) { + dev_err(&pdev->dev, "Failed to initialize TMU\n"); + return ret; + } + data->tzd = devm_thermal_of_zone_register(&pdev->dev, 0, data, &exynos_sensor_ops); if (IS_ERR(data->tzd)) { @@ -1020,9 +1032,9 @@ static int exynos_tmu_probe(struct platform_device *pdev) return ret; } - ret = exynos_tmu_initialize(pdev); + ret = exynos_thermal_zone_configure(pdev); if (ret) { - dev_err(&pdev->dev, "Failed to initialize TMU\n"); + dev_err(&pdev->dev, "Failed to configure the thermal zone\n"); return ret; } From patchwork Tue Aug 29 09:18:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 718499 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 AAA02C83F22 for ; Tue, 29 Aug 2023 09:25:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234766AbjH2JZE (ORCPT ); Tue, 29 Aug 2023 05:25:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234712AbjH2JYb (ORCPT ); Tue, 29 Aug 2023 05:24:31 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E53531BE for ; Tue, 29 Aug 2023 02:24:26 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20230829092425euoutp021b96356f716a416a61319c683add6d9b~-0FkI3yZ70626806268euoutp026 for ; Tue, 29 Aug 2023 09:24:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20230829092425euoutp021b96356f716a416a61319c683add6d9b~-0FkI3yZ70626806268euoutp026 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1693301065; bh=BwKvOQg+53QQq68iKWU/gwE5pdkczN9aJgREeUKZy3o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SfD6l3QU+syAq6hhiz/RIj5EX613MAz8gqjC0d8iyssHhY7tN365iX0uT+w2/TZCV qjAJHAhZKxbQkcUgN2klfvxIt9CUrUJ+8n0QnqmJNUXYCtHAgkfYdj6M0G6SXtUv3t HPkkgk5DjMcsXO8QPP6jFwtvdteTreZPg9fJmQjQ= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230829092425eucas1p27150b492d4b03133a011f9f7fdda83f4~-0FjpW5q02661026610eucas1p29; Tue, 29 Aug 2023 09:24:25 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id A2.8F.37758.949BDE46; Tue, 29 Aug 2023 10:24:25 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20230829092424eucas1p269935c8781c84b4c2a83d652f3370bf9~-0FjEnkj02939629396eucas1p27; Tue, 29 Aug 2023 09:24:24 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230829092424eusmtrp127bc77c52ddd7de81e9e2b1f9cf72d37~-0FjD16Sm3270032700eusmtrp1n; Tue, 29 Aug 2023 09:24:24 +0000 (GMT) X-AuditID: cbfec7f5-7ffff7000002937e-75-64edb9490b6b Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 5C.E9.10549.849BDE46; Tue, 29 Aug 2023 10:24:24 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230829092423eusmtip211eded09f968e58fecfd87069fafd2f1~-0FiHdy701173411734eusmtip2o; Tue, 29 Aug 2023 09:24:23 +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 10/11] thermal: exynos: use set_trips Date: Tue, 29 Aug 2023 11:18:48 +0200 Message-ID: <20230829091853.626011-11-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+NgFjrPKsWRmVeSWpSXmKPExsWy7djP87qeO9+mGNx4yG7xYN42NovD8yss pj58wmbxfct1Jos1e88xWcz7LGsx/8g5Vou+Fw+ZLb5d6WCy2PT4GqvF5V1z2Cw+9x5htJhx fh+TxcRjk5kt1h65y24x98tUZovWvUfYLZ487GNzEPLYOesuu8fiPS+ZPDat6mTzuHNtD5vH 5iX1Hn1bVjF6fN4kF8AexWWTkpqTWZZapG+XwJXx9cZeloJPSxkrPrx4z9rA2NnB2MXIySEh YCKx+8wZMFtIYAWjxPuTSV2MXED2F0aJpU+2s0M4nxkljn/ZDtex8PNaqI7ljBL73tpDFLUy Scw63sUOkmATMJB48GYZWLeIwGJGia07ZzGBOMwCc1kkGlb+ZAGpEhYwlejZvQ9sFIuAqsT8 KfPA4rwCdhKXDkyFWicv8fzWHbCpnEDx6efbmSBqBCVOznwCVs8MVNO8dTYzyAIJgdmcEh9e 9rJDNLtI9H5YwQZhC0u8Or4FKi4jcXpyDwuEnS8xY/N7IJsDyK6QuHvQC8K0lvh4hhnEZBbQ lFi/Sx+i2FFiz4kjzBAVfBI33gpCHMAnMWnbdKgwr0RHmxBEtarE8T2TmCFsaYknLbeZIGwP idefZzNNYFScheSVWUhemYWwdwEj8ypG8dTS4tz01GL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CRqZVjCKppcW56bnFhnrFibnFpXnp esn5uZsYgZG57djPzTsY5736qHeIkYmD8RCjBAezkgjvJcdXKUK8KYmVValF+fFFpTmpxYcY TYHunsgsJZqcD0wNeSXxhmYGpoYmZpYGppZmxkrivJ4FHYlCAumJJanZqakFqUUwfUwcnFIN TLs4gw7V/jwhcFU16cXMX1aK+ywjTmzOvDtR72gay8xv7HMt/8hLrNkh36e0eGdJvsDSrKrQ qQLzF7lqSRm0t1kU/V6+4Fmn/8Rul2V39XJinlw4cnr5ObZFTsed+kP9k0oyX66ok5A+oN/W fd2zLT6jsED+9IPlFgW7nnyx+cc6x6yxVObd5Ec3NDNnHJ6oKtHx9+3kToZFfyVfPe0+o+Gy y2zG1Lk5Flv8Lly9J5W9b8er1xafNz4yTFHynXDSb1X1jGwTazvWgvWrfa+empfmFzzhzdSq hTJtn548i5RXEfi/cd63h7d6d0/PbXXyDgg62Ja2v2bbHee61au2KPHbtRxkMrXbnKrYy7bZ vlSJpTgj0VCLuag4EQBji6frVQMAAA== X-CMS-MailID: 20230829092424eucas1p269935c8781c84b4c2a83d652f3370bf9 X-Msg-Generator: CA X-RootMTR: 20230829092424eucas1p269935c8781c84b4c2a83d652f3370bf9 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230829092424eucas1p269935c8781c84b4c2a83d652f3370bf9 References: <20230829091853.626011-1-m.majewski2@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Currently, each trip point defined in the device tree corresponds to a single hardware interrupt. This commit instead switches to using two hardware interrupts, whose values are set dynamically using the set_trips callback. Additionally, the critical temperature threshold is handled specifically. Setting interrupts in this way also fixes a long-standing lockdep warning, which was caused by calling thermal_zone_get_trips with our lock being held. Do note that this requires TMU initialization to be split into two parts, as done by the parent commit: parts of the initialization call into the thermal_zone_device structure and so must be done after its registration, but the initialization is also responsible for setting up calibration, which must be done before thermal_zone_device registration, which will call set_trips for the first time; if the calibration is not done in time, the interrupt values will be silently wrong! Signed-off-by: Mateusz Majewski --- drivers/thermal/samsung/exynos_tmu.c | 390 +++++++++++++++------------ 1 file changed, 217 insertions(+), 173 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index aa3de367b3c7..5b35c51fca79 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -159,7 +159,6 @@ enum soc_type { * 0 < reference_voltage <= 31 * @reg_conf: pointer to structure to register with core thermal. * @tzd: pointer to thermal_zone_device structure - * @ntrip: number of supported trip points. * @enabled: current status of TMU device * @tmu_set_trip_temp: SoC specific method to set trip (rising threshold) * @tmu_set_trip_hyst: SoC specific to set hysteresis (falling threshold) @@ -184,13 +183,13 @@ struct exynos_tmu_data { u8 gain; u8 reference_voltage; struct thermal_zone_device *tzd; - unsigned int ntrip; bool enabled; - void (*tmu_set_trip_temp)(struct exynos_tmu_data *data, int trip, - u8 temp); - void (*tmu_set_trip_hyst)(struct exynos_tmu_data *data, int trip, - u8 temp, u8 hyst); + void (*tmu_set_low_temp)(struct exynos_tmu_data *data, u8 temp); + void (*tmu_set_high_temp)(struct exynos_tmu_data *data, u8 temp); + void (*tmu_set_crit_temp)(struct exynos_tmu_data *data, u8 temp); + void (*tmu_disable_low)(struct exynos_tmu_data *data); + void (*tmu_disable_high)(struct exynos_tmu_data *data); void (*tmu_initialize)(struct platform_device *pdev); void (*tmu_control)(struct platform_device *pdev, bool on); int (*tmu_read)(struct exynos_tmu_data *data); @@ -274,43 +273,24 @@ static int exynos_thermal_zone_configure(struct platform_device *pdev) { struct exynos_tmu_data *data = platform_get_drvdata(pdev); struct thermal_zone_device *tzd = data->tzd; - int num_trips = thermal_zone_get_num_trips(tzd); int ret = 0, temp; ret = thermal_zone_get_crit_temp(tzd, &temp); - - if (ret && data->soc != SOC_ARCH_EXYNOS5433) { /* FIXME */ - dev_err(&pdev->dev, - "No CRITICAL trip point defined in device tree!\n"); - goto err; - } - - mutex_lock(&data->lock); - - if (num_trips > data->ntrip) { - dev_info(&pdev->dev, - "More trip points than supported by this TMU.\n"); - dev_info(&pdev->dev, - "%d trip points should be configured in polling mode.\n", - num_trips - data->ntrip); - } - - int i, ntrips = min_t(int, num_trips, data->ntrip); - - /* Write temperature code for rising and falling threshold */ - for (i = 0; i < ntrips; i++) { - struct thermal_trip trip; - - ret = thermal_zone_get_trip(tzd, i, &trip); - if (ret) + if (ret) { + if (data->soc == + SOC_ARCH_EXYNOS5433) { /* FIXME: Remove this and the check below */ + temp = INT_MAX; + ret = 0; + } else { + dev_err(&pdev->dev, + "No CRITICAL trip point defined in device tree!\n"); goto err; - - data->tmu_set_trip_temp(data, i, trip.temperature / MCELSIUS); - data->tmu_set_trip_hyst(data, i, trip.temperature / MCELSIUS, - trip.hysteresis / MCELSIUS); + } } - mutex_unlock(&data->lock); + if (temp < INT_MAX) + data->tmu_set_crit_temp(data, temp / MCELSIUS); + err: return ret; } @@ -343,17 +323,56 @@ static void exynos_tmu_control(struct platform_device *pdev, bool on) mutex_unlock(&data->lock); } -static void exynos4210_tmu_set_trip_temp(struct exynos_tmu_data *data, - int trip_id, u8 temp) +static void exynos_tmu_update_bit(struct exynos_tmu_data *data, int reg_off, + int bit_off, bool enable) { - temp = temp_to_code(data, temp); - writeb(temp, data->base + EXYNOS4210_TMU_REG_TRIG_LEVEL0 + trip_id * 4); + u32 interrupt_en; + + interrupt_en = readl(data->base + reg_off); + if (enable) + interrupt_en |= 1 << bit_off; + else + interrupt_en &= ~(1 << bit_off); + writel(interrupt_en, data->base + reg_off); } -/* failing thresholds are not supported on Exynos4210 */ -static void exynos4210_tmu_set_trip_hyst(struct exynos_tmu_data *data, - int trip, u8 temp, u8 hyst) +static void exynos4210_tmu_set_low_temp(struct exynos_tmu_data *data, u8 temp) { + /* Failing thresholds are not supported on Exynos 4210. + * We use polling instead. + */ +} + +static void exynos4210_tmu_set_high_temp(struct exynos_tmu_data *data, u8 temp) +{ + temp = temp_to_code(data, temp); + writeb(temp, data->base + EXYNOS4210_TMU_REG_TRIG_LEVEL0 + 4); + exynos_tmu_update_bit(data, EXYNOS_TMU_REG_INTEN, + EXYNOS_TMU_INTEN_RISE0_SHIFT + 4, true); +} + +static void exynos4210_tmu_disable_low(struct exynos_tmu_data *data) +{ + /* Again, this is handled by polling. */ +} + +static void exynos4210_tmu_disable_high(struct exynos_tmu_data *data) +{ + exynos_tmu_update_bit(data, EXYNOS_TMU_REG_INTEN, + EXYNOS_TMU_INTEN_RISE0_SHIFT + 4, false); +} + +static void exynos4210_tmu_set_crit_temp(struct exynos_tmu_data *data, u8 temp) +{ + /* Hardware critical temperature handling is not supported on Exynos 4210. + * We still set the critical temperature threshold, but this is only to + * make sure it is handled as soon as possible. It is just a normal interrupt. + */ + + temp = temp_to_code(data, temp); + writeb(temp, data->base + EXYNOS4210_TMU_REG_TRIG_LEVEL0 + 12); + exynos_tmu_update_bit(data, EXYNOS_TMU_REG_INTEN, + EXYNOS_TMU_INTEN_RISE0_SHIFT + 12, true); } static void exynos4210_tmu_initialize(struct platform_device *pdev) @@ -365,33 +384,49 @@ static void exynos4210_tmu_initialize(struct platform_device *pdev) writeb(0, data->base + EXYNOS4210_TMU_REG_THRESHOLD_TEMP); } -static void exynos4412_tmu_set_trip_temp(struct exynos_tmu_data *data, - int trip, u8 temp) -{ - u32 th, con; - - th = readl(data->base + EXYNOS_THD_TEMP_RISE); - th &= ~(0xff << 8 * trip); - th |= temp_to_code(data, temp) << 8 * trip; - writel(th, data->base + EXYNOS_THD_TEMP_RISE); - - if (trip == 3) { - con = readl(data->base + EXYNOS_TMU_REG_CONTROL); - con |= (1 << EXYNOS_TMU_THERM_TRIP_EN_SHIFT); - writel(con, data->base + EXYNOS_TMU_REG_CONTROL); - } -} - -static void exynos4412_tmu_set_trip_hyst(struct exynos_tmu_data *data, - int trip, u8 temp, u8 hyst) +static void exynos4412_tmu_set_low_temp(struct exynos_tmu_data *data, u8 temp) { u32 th; th = readl(data->base + EXYNOS_THD_TEMP_FALL); - th &= ~(0xff << 8 * trip); - if (hyst) - th |= temp_to_code(data, temp - hyst) << 8 * trip; + th &= ~(0xff << 0); + th |= temp_to_code(data, temp) << 0; writel(th, data->base + EXYNOS_THD_TEMP_FALL); + + exynos_tmu_update_bit(data, EXYNOS_TMU_REG_INTEN, + EXYNOS_TMU_INTEN_FALL0_SHIFT, true); +} + +static void exynos4412_tmu_set_high_temp(struct exynos_tmu_data *data, u8 temp) +{ + u32 th; + + th = readl(data->base + EXYNOS_THD_TEMP_RISE); + th &= ~(0xff << 8); + th |= temp_to_code(data, temp) << 8; + writel(th, data->base + EXYNOS_THD_TEMP_RISE); + + exynos_tmu_update_bit(data, EXYNOS_TMU_REG_INTEN, + EXYNOS_TMU_INTEN_RISE0_SHIFT + 4, true); +} + +static void exynos4412_tmu_disable_low(struct exynos_tmu_data *data) +{ + exynos_tmu_update_bit(data, EXYNOS_TMU_REG_INTEN, + EXYNOS_TMU_INTEN_FALL0_SHIFT, false); +} + +static void exynos4412_tmu_set_crit_temp(struct exynos_tmu_data *data, u8 temp) +{ + u32 th; + + th = readl(data->base + EXYNOS_THD_TEMP_RISE); + th &= ~(0xff << 24); + th |= temp_to_code(data, temp) << 24; + writel(th, data->base + EXYNOS_THD_TEMP_RISE); + + exynos_tmu_update_bit(data, EXYNOS_TMU_REG_CONTROL, + EXYNOS_TMU_THERM_TRIP_EN_SHIFT, true); } static void exynos4412_tmu_initialize(struct platform_device *pdev) @@ -421,44 +456,57 @@ static void exynos4412_tmu_initialize(struct platform_device *pdev) sanitize_temp_error(data, trim_info); } -static void exynos5433_tmu_set_trip_temp(struct exynos_tmu_data *data, - int trip, u8 temp) +static void exynos5433_tmu_set_low_temp(struct exynos_tmu_data *data, u8 temp) { - unsigned int reg_off, j; u32 th; - if (trip > 3) { - reg_off = EXYNOS5433_THD_TEMP_RISE7_4; - j = trip - 4; - } else { - reg_off = EXYNOS5433_THD_TEMP_RISE3_0; - j = trip; - } + th = readl(data->base + EXYNOS5433_THD_TEMP_FALL3_0); + th &= ~(0xff << 0); + th |= temp_to_code(data, temp) << 0; + writel(th, data->base + EXYNOS5433_THD_TEMP_FALL3_0); - th = readl(data->base + reg_off); - th &= ~(0xff << j * 8); - th |= (temp_to_code(data, temp) << j * 8); - writel(th, data->base + reg_off); + exynos_tmu_update_bit(data, EXYNOS5433_TMU_REG_INTEN, + EXYNOS_TMU_INTEN_FALL0_SHIFT, true); } -static void exynos5433_tmu_set_trip_hyst(struct exynos_tmu_data *data, - int trip, u8 temp, u8 hyst) +static void exynos5433_tmu_set_high_temp(struct exynos_tmu_data *data, u8 temp) { - unsigned int reg_off, j; u32 th; - if (trip > 3) { - reg_off = EXYNOS5433_THD_TEMP_FALL7_4; - j = trip - 4; - } else { - reg_off = EXYNOS5433_THD_TEMP_FALL3_0; - j = trip; - } + th = readl(data->base + EXYNOS5433_THD_TEMP_RISE3_0); + th &= ~(0xff << 8); + th |= temp_to_code(data, temp) << 8; + writel(th, data->base + EXYNOS5433_THD_TEMP_RISE3_0); - th = readl(data->base + reg_off); - th &= ~(0xff << j * 8); - th |= (temp_to_code(data, temp - hyst) << j * 8); - writel(th, data->base + reg_off); + exynos_tmu_update_bit(data, EXYNOS5433_TMU_REG_INTEN, + EXYNOS7_TMU_INTEN_RISE0_SHIFT + 1, true); +} + +static void exynos5433_tmu_disable_low(struct exynos_tmu_data *data) +{ + exynos_tmu_update_bit(data, EXYNOS5433_TMU_REG_INTEN, + EXYNOS_TMU_INTEN_FALL0_SHIFT, false); +} + +static void exynos5433_tmu_disable_high(struct exynos_tmu_data *data) +{ + exynos_tmu_update_bit(data, EXYNOS5433_TMU_REG_INTEN, + EXYNOS7_TMU_INTEN_RISE0_SHIFT + 1, false); +} + +static void exynos5433_tmu_set_crit_temp(struct exynos_tmu_data *data, u8 temp) +{ + u32 th; + + th = readl(data->base + EXYNOS5433_THD_TEMP_RISE7_4); + th &= ~(0xff << 24); + th |= temp_to_code(data, temp) << 24; + writel(th, data->base + EXYNOS5433_THD_TEMP_RISE7_4); + + exynos_tmu_update_bit(data, EXYNOS_TMU_REG_CONTROL, + EXYNOS_TMU_THERM_TRIP_EN_SHIFT, true); + exynos_tmu_update_bit(data, EXYNOS5433_TMU_REG_INTEN, + EXYNOS7_TMU_INTEN_RISE0_SHIFT + 7, true); } static void exynos5433_tmu_initialize(struct platform_device *pdev) @@ -494,34 +542,47 @@ static void exynos5433_tmu_initialize(struct platform_device *pdev) cal_type ? 2 : 1); } -static void exynos7_tmu_set_trip_temp(struct exynos_tmu_data *data, - int trip, u8 temp) +static void exynos7_tmu_update_temp(struct exynos_tmu_data *data, u8 temp, + int idx, bool rise) { unsigned int reg_off, bit_off; u32 th; + void __iomem *reg; - reg_off = ((7 - trip) / 2) * 4; - bit_off = ((8 - trip) % 2); + reg_off = ((7 - idx) / 2) * 4; + bit_off = ((8 - idx) % 2); - th = readl(data->base + EXYNOS7_THD_TEMP_RISE7_6 + reg_off); + reg = data->base + + (rise ? EXYNOS7_THD_TEMP_RISE7_6 : EXYNOS7_THD_TEMP_FALL7_6) + + reg_off; + th = readl(reg); th &= ~(EXYNOS7_TMU_TEMP_MASK << (16 * bit_off)); th |= temp_to_code(data, temp) << (16 * bit_off); - writel(th, data->base + EXYNOS7_THD_TEMP_RISE7_6 + reg_off); + writel(th, reg); + + exynos_tmu_update_bit(data, EXYNOS5433_TMU_REG_INTEN, + (rise ? EXYNOS7_TMU_INTEN_RISE0_SHIFT : + EXYNOS_TMU_INTEN_FALL0_SHIFT) + + idx, + true); } -static void exynos7_tmu_set_trip_hyst(struct exynos_tmu_data *data, - int trip, u8 temp, u8 hyst) +static void exynos7_tmu_set_low_temp(struct exynos_tmu_data *data, u8 temp) { - unsigned int reg_off, bit_off; - u32 th; + exynos7_tmu_update_temp(data, temp, 0, false); +} - reg_off = ((7 - trip) / 2) * 4; - bit_off = ((8 - trip) % 2); +static void exynos7_tmu_set_high_temp(struct exynos_tmu_data *data, u8 temp) +{ + exynos7_tmu_update_temp(data, temp, 1, true); +} - th = readl(data->base + EXYNOS7_THD_TEMP_FALL7_6 + reg_off); - th &= ~(EXYNOS7_TMU_TEMP_MASK << (16 * bit_off)); - th |= temp_to_code(data, temp - hyst) << (16 * bit_off); - writel(th, data->base + EXYNOS7_THD_TEMP_FALL7_6 + reg_off); +static void exynos7_tmu_set_crit_temp(struct exynos_tmu_data *data, u8 temp) +{ + /* Like Exynos 4210, Exynos 7 does not seem to support critical temperature + * handling in hardware. Again, we still set a separate interrupt for it. + */ + exynos7_tmu_update_temp(data, temp, 7, true); } static void exynos7_tmu_initialize(struct platform_device *pdev) @@ -536,87 +597,44 @@ static void exynos7_tmu_initialize(struct platform_device *pdev) static void exynos4210_tmu_control(struct platform_device *pdev, bool on) { struct exynos_tmu_data *data = platform_get_drvdata(pdev); - struct thermal_zone_device *tz = data->tzd; - struct thermal_trip trip; - unsigned int con, interrupt_en = 0, i; + unsigned int con; con = get_con_reg(data, readl(data->base + EXYNOS_TMU_REG_CONTROL)); - if (on) { - for (i = 0; i < data->ntrip; i++) { - if (thermal_zone_get_trip(tz, i, &trip)) - continue; - - interrupt_en |= - (1 << (EXYNOS_TMU_INTEN_RISE0_SHIFT + i * 4)); - } - - if (data->soc != SOC_ARCH_EXYNOS4210) - interrupt_en |= - interrupt_en << EXYNOS_TMU_INTEN_FALL0_SHIFT; - + if (on) con |= (1 << EXYNOS_TMU_CORE_EN_SHIFT); - } else { + else con &= ~(1 << EXYNOS_TMU_CORE_EN_SHIFT); - } - writel(interrupt_en, data->base + EXYNOS_TMU_REG_INTEN); writel(con, data->base + EXYNOS_TMU_REG_CONTROL); } static void exynos5433_tmu_control(struct platform_device *pdev, bool on) { struct exynos_tmu_data *data = platform_get_drvdata(pdev); - struct thermal_zone_device *tz = data->tzd; - struct thermal_trip trip; - unsigned int con, interrupt_en = 0, pd_det_en, i; + unsigned int con, pd_det_en; con = get_con_reg(data, readl(data->base + EXYNOS_TMU_REG_CONTROL)); - if (on) { - for (i = 0; i < data->ntrip; i++) { - if (thermal_zone_get_trip(tz, i, &trip)) - continue; - - interrupt_en |= - (1 << (EXYNOS7_TMU_INTEN_RISE0_SHIFT + i)); - } - - interrupt_en |= - interrupt_en << EXYNOS_TMU_INTEN_FALL0_SHIFT; - + if (on) con |= (1 << EXYNOS_TMU_CORE_EN_SHIFT); - } else + else con &= ~(1 << EXYNOS_TMU_CORE_EN_SHIFT); pd_det_en = on ? EXYNOS5433_PD_DET_EN : 0; writel(pd_det_en, data->base + EXYNOS5433_TMU_PD_DET_EN); - writel(interrupt_en, data->base + EXYNOS5433_TMU_REG_INTEN); writel(con, data->base + EXYNOS_TMU_REG_CONTROL); } static void exynos7_tmu_control(struct platform_device *pdev, bool on) { struct exynos_tmu_data *data = platform_get_drvdata(pdev); - struct thermal_zone_device *tz = data->tzd; - struct thermal_trip trip; - unsigned int con, interrupt_en = 0, i; + unsigned int con; con = get_con_reg(data, readl(data->base + EXYNOS_TMU_REG_CONTROL)); if (on) { - for (i = 0; i < data->ntrip; i++) { - if (thermal_zone_get_trip(tz, i, &trip)) - continue; - - interrupt_en |= - (1 << (EXYNOS7_TMU_INTEN_RISE0_SHIFT + i)); - } - - interrupt_en |= - interrupt_en << EXYNOS_TMU_INTEN_FALL0_SHIFT; - con |= (1 << EXYNOS_TMU_CORE_EN_SHIFT); con |= (1 << EXYNOS7_PD_DET_EN_SHIFT); } else { @@ -624,7 +642,6 @@ static void exynos7_tmu_control(struct platform_device *pdev, bool on) con &= ~(1 << EXYNOS7_PD_DET_EN_SHIFT); } - writel(interrupt_en, data->base + EXYNOS7_TMU_REG_INTEN); writel(con, data->base + EXYNOS_TMU_REG_CONTROL); } @@ -856,13 +873,15 @@ static int exynos_map_dt_data(struct platform_device *pdev) switch (data->soc) { case SOC_ARCH_EXYNOS4210: - data->tmu_set_trip_temp = exynos4210_tmu_set_trip_temp; - data->tmu_set_trip_hyst = exynos4210_tmu_set_trip_hyst; + data->tmu_set_low_temp = exynos4210_tmu_set_low_temp; + data->tmu_set_high_temp = exynos4210_tmu_set_high_temp; + data->tmu_disable_low = exynos4210_tmu_disable_low; + data->tmu_disable_high = exynos4210_tmu_disable_high; + data->tmu_set_crit_temp = exynos4210_tmu_set_crit_temp; data->tmu_initialize = exynos4210_tmu_initialize; data->tmu_control = exynos4210_tmu_control; data->tmu_read = exynos4210_tmu_read; data->tmu_clear_irqs = exynos4210_tmu_clear_irqs; - data->ntrip = 4; data->gain = 15; data->reference_voltage = 7; data->efuse_value = 55; @@ -875,14 +894,16 @@ static int exynos_map_dt_data(struct platform_device *pdev) case SOC_ARCH_EXYNOS5260: case SOC_ARCH_EXYNOS5420: case SOC_ARCH_EXYNOS5420_TRIMINFO: - data->tmu_set_trip_temp = exynos4412_tmu_set_trip_temp; - data->tmu_set_trip_hyst = exynos4412_tmu_set_trip_hyst; + data->tmu_set_low_temp = exynos4412_tmu_set_low_temp; + data->tmu_set_high_temp = exynos4412_tmu_set_high_temp; + data->tmu_disable_low = exynos4412_tmu_disable_low; + data->tmu_disable_high = exynos4210_tmu_disable_high; + data->tmu_set_crit_temp = exynos4412_tmu_set_crit_temp; data->tmu_initialize = exynos4412_tmu_initialize; data->tmu_control = exynos4210_tmu_control; data->tmu_read = exynos4412_tmu_read; data->tmu_set_emulation = exynos4412_tmu_set_emulation; data->tmu_clear_irqs = exynos4210_tmu_clear_irqs; - data->ntrip = 4; data->gain = 8; data->reference_voltage = 16; data->efuse_value = 55; @@ -894,14 +915,16 @@ static int exynos_map_dt_data(struct platform_device *pdev) data->max_efuse_value = 100; break; case SOC_ARCH_EXYNOS5433: - data->tmu_set_trip_temp = exynos5433_tmu_set_trip_temp; - data->tmu_set_trip_hyst = exynos5433_tmu_set_trip_hyst; + data->tmu_set_low_temp = exynos5433_tmu_set_low_temp; + data->tmu_set_high_temp = exynos5433_tmu_set_high_temp; + data->tmu_disable_low = exynos5433_tmu_disable_low; + data->tmu_disable_high = exynos5433_tmu_disable_high; + data->tmu_set_crit_temp = exynos5433_tmu_set_crit_temp; data->tmu_initialize = exynos5433_tmu_initialize; data->tmu_control = exynos5433_tmu_control; data->tmu_read = exynos4412_tmu_read; data->tmu_set_emulation = exynos4412_tmu_set_emulation; data->tmu_clear_irqs = exynos4210_tmu_clear_irqs; - data->ntrip = 8; data->gain = 8; if (res.start == EXYNOS5433_G3D_BASE) data->reference_voltage = 23; @@ -912,14 +935,16 @@ static int exynos_map_dt_data(struct platform_device *pdev) data->max_efuse_value = 150; break; case SOC_ARCH_EXYNOS7: - data->tmu_set_trip_temp = exynos7_tmu_set_trip_temp; - data->tmu_set_trip_hyst = exynos7_tmu_set_trip_hyst; + data->tmu_set_low_temp = exynos7_tmu_set_low_temp; + data->tmu_set_high_temp = exynos7_tmu_set_high_temp; + data->tmu_disable_low = exynos5433_tmu_disable_low; + data->tmu_disable_high = exynos5433_tmu_disable_high; + data->tmu_set_crit_temp = exynos7_tmu_set_crit_temp; data->tmu_initialize = exynos7_tmu_initialize; data->tmu_control = exynos7_tmu_control; data->tmu_read = exynos7_tmu_read; data->tmu_set_emulation = exynos4412_tmu_set_emulation; data->tmu_clear_irqs = exynos4210_tmu_clear_irqs; - data->ntrip = 8; data->gain = 9; data->reference_voltage = 17; data->efuse_value = 75; @@ -955,9 +980,28 @@ static int exynos_map_dt_data(struct platform_device *pdev) return 0; } +static int exynos_set_trips(struct thermal_zone_device *tz, int low, int high) +{ + struct exynos_tmu_data *data = thermal_zone_device_priv(tz); + + mutex_lock(&data->lock); + if (low > INT_MIN) + data->tmu_set_low_temp(data, low / MCELSIUS); + else + data->tmu_disable_low(data); + if (high < INT_MAX) + data->tmu_set_high_temp(data, high / MCELSIUS); + else + data->tmu_disable_high(data); + mutex_unlock(&data->lock); + + return 0; +} + static const struct thermal_zone_device_ops exynos_sensor_ops = { .get_temp = exynos_get_temp, .set_emul_temp = exynos_tmu_set_emulation, + .set_trips = exynos_set_trips, }; static int exynos_tmu_probe(struct platform_device *pdev) From patchwork Tue Aug 29 09:18:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 719691 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 EE36EC83F26 for ; Tue, 29 Aug 2023 09:25:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234728AbjH2JZG (ORCPT ); Tue, 29 Aug 2023 05:25:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234737AbjH2JYd (ORCPT ); Tue, 29 Aug 2023 05:24:33 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8545919A for ; Tue, 29 Aug 2023 02:24:28 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20230829092427euoutp0178100adb059d74857923bbc2396331db~-0FloYI8v1739117391euoutp01e for ; Tue, 29 Aug 2023 09:24:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20230829092427euoutp0178100adb059d74857923bbc2396331db~-0FloYI8v1739117391euoutp01e DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1693301067; bh=C5FbbJybvkzNZK0Gyfa1Nr5aayYuC3Mc7brz6IA0CMs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XVkjLOvj3Z31jVU0WNO4Oh6iftr4rtmAGsRhgRDc50KAQUk3VREsqs9WV6mFAT/1k QYS+eKvVaCWSlQbtkIZhlhNfDdv4fY5K86GMw2LhPcszKH67c4VarN8VNOrKaIrjt3 xdvDLwxUggKHeELLNT5tqBcSDQMeUzjjfv3q2FFk= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230829092426eucas1p2d03704c98d91b12179f2b29af682988e~-0FlSALwA2824228242eucas1p2a; Tue, 29 Aug 2023 09:24:26 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id F4.8F.37758.A49BDE46; Tue, 29 Aug 2023 10:24:26 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20230829092426eucas1p222c2a1c2013f4eb9ee739f03761e5236~-0FkfWmzM2729627296eucas1p2j; Tue, 29 Aug 2023 09:24:26 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230829092426eusmtrp171367fb1384d1ee8b77399c5b6dc0598~-0FketUkS3248032480eusmtrp1V; Tue, 29 Aug 2023 09:24:26 +0000 (GMT) X-AuditID: cbfec7f5-815ff7000002937e-7c-64edb94aa42a Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 6F.E9.10549.949BDE46; Tue, 29 Aug 2023 10:24:26 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230829092425eusmtip286b9ff2658d36cd4f3a82c6ae94a37bf~-0FjjIsYn1321813218eusmtip2F; Tue, 29 Aug 2023 09:24:25 +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 11/11] ARM: dts: exynos: disable polling in Odroid XU3-related devices Date: Tue, 29 Aug 2023 11:18:49 +0200 Message-ID: <20230829091853.626011-12-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+NgFjrHKsWRmVeSWpSXmKPExsWy7djPc7peO9+mGLS1GVs8mLeNzeLw/AqL qQ+fsFl833KdyWLN3nNMFvM+y1rMP3KO1aLvxUNmi29XOpgsNj2+xmpxedccNovPvUcYLWac 38dkMfHYZGaLtUfuslvM/TKV2aJ17xF2iycP+9gchDx2zrrL7rF4z0smj02rOtk87lzbw+ax eUm9R9+WVYwenzfJBbBHcdmkpOZklqUW6dslcGUs/rGKpWCmcMWrluXsDYw/+LoYOTkkBEwk jh6bxdzFyMUhJLCCUeLr6VssEM4XRok/D99COZ8ZJdYsmsAE03KhdwkrRGI5UNW15ywgCSGB ViaJD3/8QGw2AQOJB2+WsYMUiQgsZpTYunMWE4jDLDCXRaJh5U+wDmGBCIn5F7cyg9gsAqoS n49OBFvBK2An8fnuITaIdfISz2/dYQexOYHi08+3Q9UISpyc+QRsDjNQTfPW2WBfSAhM55SY 8OEQI0Szi8Tq9Y+gbGGJV8e3sEPYMhKnJ/ewQNj5EjM2vweyOYDsCom7B70gTGuJj2eYQUxm AU2J9bv0IYodJS6+fAVVzCdx460gxAF8EpO2TWeGCPNKdLQJQVSrShzfM4kZwpaWeNJyGxqE HhJHGxeyT2BUnIXklVlIXpmFsHcBI/MqRvHU0uLc9NRi47zUcr3ixNzi0rx0veT83E2MwCR3 +t/xrzsYV7z6qHeIkYmD8RCjBAezkgjvJcdXKUK8KYmVValF+fFFpTmpxYcYpTlYlMR5tW1P JgsJpCeWpGanphakFsF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5q8SFG U6C7JzJLiSbnA9NCXkm8oZmBqaGJmaWBqaWZsZI4r2dBR6KQQHpiSWp2ampBahFMHxMHp1QD k3Be8HQ7fv9tQp5bn8frJ/2fssXAn3vLpbqLhfJ5i7fZe8hO9b0tMGHtGhNj6Q0STUbahSxr 769WCS/6/Mfe6GR2YdJdy5yb8ZIf181OKvRJn6i7+fOmOhsmnnMc3bPz0926nTW3bNsyr9v1 45lezQd1Ec+dfV7deXh6Vkzvnh0rdG8qO233TtnKpDHT8Av/1YLc71XqtcuXSc8Vv6Tzo/Fm m7/PadaCu798u5etuLfy2Ic/eeHLnM/cKewOly8+kbHi/PfMrCWG++8UFCxaL9rGZS3dzT5X etH8lPzaB4pPwtje9kcUztf58ONcl6VFy+cNvyrtzBkmqv5/s/2Fj37gxm9203myf3AcvKbV rsRSnJFoqMVcVJwIAJuplj5TAwAA X-CMS-MailID: 20230829092426eucas1p222c2a1c2013f4eb9ee739f03761e5236 X-Msg-Generator: CA X-RootMTR: 20230829092426eucas1p222c2a1c2013f4eb9ee739f03761e5236 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230829092426eucas1p222c2a1c2013f4eb9ee739f03761e5236 References: <20230829091853.626011-1-m.majewski2@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org After having switched to dynamic trip points, we no longer have a hardware limit for trip point count and can support as many as we want without polling. Signed-off-by: Mateusz Majewski --- .../dts/samsung/exynos5422-odroidxu3-common.dtsi | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/arch/arm/boot/dts/samsung/exynos5422-odroidxu3-common.dtsi b/arch/arm/boot/dts/samsung/exynos5422-odroidxu3-common.dtsi index b4a851aa8881..4a4c55a4beb3 100644 --- a/arch/arm/boot/dts/samsung/exynos5422-odroidxu3-common.dtsi +++ b/arch/arm/boot/dts/samsung/exynos5422-odroidxu3-common.dtsi @@ -55,7 +55,7 @@ fan0: pwm-fan { thermal-zones { cpu0_thermal: cpu0-thermal { thermal-sensors = <&tmu_cpu0>; - polling-delay-passive = <250>; + polling-delay-passive = <0>; polling-delay = <0>; trips { cpu0_alert0: cpu-alert-0 { @@ -78,12 +78,6 @@ cpu0_crit0: cpu-crit-0 { hysteresis = <0>; /* millicelsius */ type = "critical"; }; - /* - * Exynos542x supports only 4 trip-points - * so for these polling mode is required. - * Start polling at temperature level of last - * interrupt-driven trip: cpu0_alert2 - */ cpu0_alert3: cpu-alert-3 { temperature = <70000>; /* millicelsius */ hysteresis = <10000>; /* millicelsius */ @@ -144,7 +138,7 @@ cpu0_cooling_map4: map4 { }; cpu1_thermal: cpu1-thermal { thermal-sensors = <&tmu_cpu1>; - polling-delay-passive = <250>; + polling-delay-passive = <0>; polling-delay = <0>; trips { cpu1_alert0: cpu-alert-0 { @@ -217,7 +211,7 @@ cpu1_cooling_map4: map4 { }; cpu2_thermal: cpu2-thermal { thermal-sensors = <&tmu_cpu2>; - polling-delay-passive = <250>; + polling-delay-passive = <0>; polling-delay = <0>; trips { cpu2_alert0: cpu-alert-0 { @@ -290,7 +284,7 @@ cpu2_cooling_map4: map4 { }; cpu3_thermal: cpu3-thermal { thermal-sensors = <&tmu_cpu3>; - polling-delay-passive = <250>; + polling-delay-passive = <0>; polling-delay = <0>; trips { cpu3_alert0: cpu-alert-0 { @@ -363,7 +357,7 @@ cpu3_cooling_map4: map4 { }; gpu_thermal: gpu-thermal { thermal-sensors = <&tmu_gpu>; - polling-delay-passive = <250>; + polling-delay-passive = <0>; polling-delay = <0>; trips { gpu_alert0: gpu-alert-0 {