From patchwork Tue Oct 3 11:16:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 729196 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 703D0E7544F for ; Tue, 3 Oct 2023 11:17:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239906AbjJCLRO (ORCPT ); Tue, 3 Oct 2023 07:17:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239903AbjJCLRN (ORCPT ); Tue, 3 Oct 2023 07:17:13 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A91DEAF for ; Tue, 3 Oct 2023 04:17:07 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20231003111706euoutp02944c99eed715ac44a539479793e3ddd8~KlM8FBn3u0869508695euoutp02h for ; Tue, 3 Oct 2023 11:17:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20231003111706euoutp02944c99eed715ac44a539479793e3ddd8~KlM8FBn3u0869508695euoutp02h DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1696331826; bh=/ca++/KHRk6o53rF+DzbG9/VMb831UCbsayQlJT1j9U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VCFMF3iKQ7alTsayspALx/I9chVxIadsjjVjRlJCNqFR9a7t4fv4GPfOq4oOkimZi lXSPAZ4hGs4Du6Q+ZrVqxZ2Tmkmd7hMrn1yMQZN4/4LcILNcpjHWPAlQ9oa6VHBX0Z lcUObG+EEjvA7OU8xVJAaM9N9uOVt8yzvS9mQtbA= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20231003111706eucas1p1898517e6f35ba51c43e91baa3a3d879b~KlM7uOk_42602126021eucas1p1g; Tue, 3 Oct 2023 11:17:06 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 00.2F.37758.238FB156; Tue, 3 Oct 2023 12:17:06 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20231003111705eucas1p2f47a85d9c53d608654c5957cae88cf60~KlM7RmT7Q2468224682eucas1p2s; Tue, 3 Oct 2023 11:17:05 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20231003111705eusmtrp1ce6d8e66ac6dd31a3c945b2745107f4e~KlM7Q2Qux2246422464eusmtrp1S; Tue, 3 Oct 2023 11:17:05 +0000 (GMT) X-AuditID: cbfec7f5-7ffff7000002937e-d7-651bf832c6af Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id D6.D1.10549.138FB156; Tue, 3 Oct 2023 12:17:05 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231003111704eusmtip22bf7e326c87e75be0083e005f8032a34~KlM6fh-e52844228442eusmtip2B; Tue, 3 Oct 2023 11:17:04 +0000 (GMT) From: Mateusz Majewski To: linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Mateusz Majewski , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Alim Akhtar , Liam Girdwood , Mark Brown , Marek Szyprowski Subject: [PATCH v3 1/8] thermal: exynos: remove an unnecessary field description Date: Tue, 3 Oct 2023 13:16:27 +0200 Message-ID: <20231003111638.241542-2-m.majewski2@samsung.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231003111638.241542-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrNKsWRmVeSWpSXmKPExsWy7djPc7pGP6RTDU4/Z7F4MG8bm8Xh+RUW Ux8+YbP4vuU6k8W8z7IWe19vZbf4dqWDyWLT42usFpd3zWGz+Nx7hNFixvl9TBYTj01mtlh7 5C67xdwvU5ktnjzsY3Pg99g56y67x+I9L5k8Nq3qZPO4c20Pm8fmJfUefVtWMXp83iQXwB7F ZZOSmpNZllqkb5fAldG0jLtgFXvFiu+bGBsYJ7N1MXJySAiYSExe+4ipi5GLQ0hgBaPE48s7 2SCcL4wS0x5tZQapEhL4zCixc5cqTMfW/9cZIYqWM0q0rznMDOG0Mklc+dXFDlLFJmAg8eDN MjBbRKCVUWJmkzpIEbPAJWaJuzfXsoAkhAWCJGac/wR2CIuAqsTnhkesIDavgK3Eq/fLWCDW yUvsWfSdCcTmFLCTWPlzORNEjaDEyZlPwGqYgWqat84Gu0JCoJlT4sjctUCbOYAcF4lVTQEQ c4QlXh3fwg5hy0icntwDNT9fYsbm9ywQ5RUSdw96QZjWEh/PMIOYzAKaEut36UNEHSXad6tA mHwSN94KQqznk5i0bTozRJhXoqNNCGKyqsTxPZOYIWxpiSctt5kgbA+JJfd72CcwKs5C8sgs JI/MQli7gJF5FaN4amlxbnpqsXFearlecWJucWleul5yfu4mRmD6Ov3v+NcdjCtefdQ7xMjE wXiIUYKDWUmEN+yoVKoQb0piZVVqUX58UWlOavEhRmkOFiVxXm3bk8lCAumJJanZqakFqUUw WSYOTq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SzNjJXFez4KORCGB9MSS1OzU1ILUIpg+Jg5OqQamas4N/tbfVx6ZttKjXa8mJ2ii 7msLWa41m+Qneqr3C+jtm1s439L3teF6iyefb3tNe/HiR+bzXZO28V6NONR+y9Mo89ye7sXx vh93ZrfWcW818jYKzOpS51Ft/y6XtGDf9zbDXRf/LrhwRS8nTUTpwaVz4i2N33+VXuG9fVnL /2ow55r+vlBBpuu3Mo70frlTOs9a+9JJPq3oldckyo7e2cgaYvFnfkLHmqPLgk/Xd6yOfLiw 1GuN8/RztVNuLn/ydN0Cd8YDGVJat7+/Orpo+pbWXwGr5eb1zBNzMI49rGu2pGbrrCuL15Y/ 85tn17vsKNOemlevF5xxPabdqDDr2bwznQ1mQW2NnEdep9nM26nEUpyRaKjFXFScCAAqOo69 QgMAAA== X-CMS-MailID: 20231003111705eucas1p2f47a85d9c53d608654c5957cae88cf60 X-Msg-Generator: CA X-RootMTR: 20231003111705eucas1p2f47a85d9c53d608654c5957cae88cf60 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231003111705eucas1p2f47a85d9c53d608654c5957cae88cf60 References: <20231003111638.241542-1-m.majewski2@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org It seems that the field has been removed in one of the previous commits, but the description has been forgotten. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Mateusz Majewski --- drivers/thermal/samsung/exynos_tmu.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index e5bc2c82010f..2c1cfb8c4b33 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -160,7 +160,6 @@ enum soc_type { * 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. * @enabled: current status of TMU device From patchwork Tue Oct 3 11:16:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 729606 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 299F3E75450 for ; Tue, 3 Oct 2023 11:17:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240030AbjJCLRR (ORCPT ); Tue, 3 Oct 2023 07:17:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239912AbjJCLRO (ORCPT ); Tue, 3 Oct 2023 07:17:14 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D614B4 for ; Tue, 3 Oct 2023 04:17:09 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20231003111708euoutp017a2d115fffce83cbf67821b38dfe59f7~KlM9fOxAj0934309343euoutp01i for ; Tue, 3 Oct 2023 11:17:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20231003111708euoutp017a2d115fffce83cbf67821b38dfe59f7~KlM9fOxAj0934309343euoutp01i DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1696331828; bh=kSlZRZZZYwokLKnnMzMRsCX62Vw++ZxZSxihVjzwQk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e9nTjyjEsWcfq5YU3eeOaRkq/emOlob2QHSE7dfzeXHh0Fpb6y1gZKaOXsGKSdaW7 zkE7Jv/43KniY/sl5mMZoVhOteBXADxfkBxXVKGJj0pgCN3a5jU4INwsz/3exgFifI GwPNOvGckgisoITeW6ANTTQdlvDdoKlVSRCn5S94= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20231003111707eucas1p23d6471359956640c696157b700f7a153~KlM88kgCg2468224682eucas1p2x; Tue, 3 Oct 2023 11:17:07 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 33.14.11320.338FB156; Tue, 3 Oct 2023 12:17:07 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20231003111707eucas1p2ec2e5eacf68ecb0610f74ca1105c9da4~KlM8ipCRZ2873428734eucas1p2H; Tue, 3 Oct 2023 11:17:07 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20231003111707eusmtrp196e15560308b447fc108fda720121c06~KlM8iBcL52239722397eusmtrp13; Tue, 3 Oct 2023 11:17:07 +0000 (GMT) X-AuditID: cbfec7f4-993ff70000022c38-32-651bf833bedd Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 5A.CE.25043.238FB156; Tue, 3 Oct 2023 12:17:06 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231003111706eusmtip21caa2dee1934b1182cdd7a7e8413b514~KlM7vX00_2730527305eusmtip2c; Tue, 3 Oct 2023 11:17:06 +0000 (GMT) From: Mateusz Majewski To: linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Mateusz Majewski , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Alim Akhtar , Liam Girdwood , Mark Brown , Marek Szyprowski Subject: [PATCH v3 2/8] thermal: exynos: drop id field Date: Tue, 3 Oct 2023 13:16:28 +0200 Message-ID: <20231003111638.241542-3-m.majewski2@samsung.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231003111638.241542-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDKsWRmVeSWpSXmKPExsWy7djPc7rGP6RTDQ5ek7B4MG8bm8Xh+RUW Ux8+YbP4vuU6k8W8z7IWe19vZbf4dqWDyWLT42usFpd3zWGz+Nx7hNFixvl9TBYTj01mtlh7 5C67xdwvU5ktnjzsY3Pg99g56y67x+I9L5k8Nq3qZPO4c20Pm8fmJfUefVtWMXp83iQXwB7F ZZOSmpNZllqkb5fAlbHv1knmgkk8FS/WyDYwfuLsYuTkkBAwkTgy/z1zFyMXh5DACkaJFf8O s0A4XxglTn2/xwbhfGaUmHv3MztMy4OW6VBVyxkldi9+xAaSEBJoZZJY+aIIxGYTMJB48GYZ WIOIQCujxMwmdZAGZoFLzBJ3b64F6ubgEBYwk1g6Xx2khkVAVeLyq1lg9bwCthL9P86yQCyT l9iz6DsTiM0pYCex8udyJogaQYmTM5+A1TAD1TRvnQ32g4RAM6fEhduboZpdJOZNvsoKYQtL vDq+BeoDGYnTk3ugavIlZmx+D3aPhECFxN2DXhCmtcTHM8wgJrOApsT6XfoQxY4STyZtYIeo 4JO48VYQ4gA+iUnbpjNDhHklOtqEIKpVJY7vmcQMYUtLPGm5zQRhe0g8Xz2JfQKj4iwkr8xC 8soshL0LGJlXMYqnlhbnpqcWG+WllusVJ+YWl+al6yXn525iBCaw0/+Of9nBuPzVR71DjEwc jIcYJTiYlUR4w45KpQrxpiRWVqUW5ccXleakFh9ilOZgURLn1bY9mSwkkJ5YkpqdmlqQWgST ZeLglGpgKrt46Vts3mH5OLc+3tt3T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08fEwSnVwJT0Ni/jx5FfkQt7Ewyc1Z0f Rl6UNJQI3hDGt2fL3a/nCy8cC6loSTgtO4ExiVHvTF7mcp04rQ/Trl7oC1/AyyLg5GF1YI/M tX3pM8982aa9gq1599utCyaVb5jilRLvUzN5rkO1Vd36P4n3Zpiw3hWZbbLxZbKe45RNqk/m xdutnrCzOO9+6rXu4++q3k3Rv7+g58s6TcbIj/KbF22UK18559pUV7FLO/x2Lrz3IsV+5l1H juLrob0vPbcam5s8P+IS/n3h7vdpAf8zl2xXn1/rUDvn4qSsHbNEi4Ra1n8pabr5e1JGxRrb ly++Vlt4rjtg0DdBw3rl9biUZye2vqz4IqExZ96jnprcxSy/SidfUmIpzkg01GIuKk4EAB8K PHZBAwAA X-CMS-MailID: 20231003111707eucas1p2ec2e5eacf68ecb0610f74ca1105c9da4 X-Msg-Generator: CA X-RootMTR: 20231003111707eucas1p2ec2e5eacf68ecb0610f74ca1105c9da4 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231003111707eucas1p2ec2e5eacf68ecb0610f74ca1105c9da4 References: <20231003111638.241542-1-m.majewski2@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org We do not use the value, and only Exynos 7 defines this alias anyway. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Mateusz Majewski --- v1 -> v2: minor commit message rewording. 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 2c1cfb8c4b33..90c33e8017af 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. @@ -172,7 +171,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; @@ -865,10 +863,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 Oct 3 11:16:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 729195 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 C27A4E7544D for ; Tue, 3 Oct 2023 11:17:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239977AbjJCLRS (ORCPT ); Tue, 3 Oct 2023 07:17:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239921AbjJCLRO (ORCPT ); Tue, 3 Oct 2023 07:17:14 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BA4FBD for ; Tue, 3 Oct 2023 04:17:10 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20231003111709euoutp0114bf4bcbadb1f236f8fa9bf8d060b24d~KlM_lJ_Dj1220312203euoutp01e for ; Tue, 3 Oct 2023 11:17:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20231003111709euoutp0114bf4bcbadb1f236f8fa9bf8d060b24d~KlM_lJ_Dj1220312203euoutp01e DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1696331829; bh=CCUmjPvJE2taTRrp0O0mccb79s4/56wbyFNyGnHqHRc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hdgk0t288TFpR1FJtTet88IP1k8jyy4ZmQZvIR0sdSwoOqvfVz9slUUpdymDO12bM 3wANaMwqSF9btZm4RMG0rV2c3GOiqz8pbGLda7AO57/N0P5Omv3osJEymEfJJuu2na Q6WyQb7WIHGLl0/G4+IGSZeeafUHIy7LPwkfNrZY= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20231003111708eucas1p220d81655676ed79d728ea5a48ab2000a~KlM_I96U70665806658eucas1p2K; Tue, 3 Oct 2023 11:17:08 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 75.14.11320.438FB156; Tue, 3 Oct 2023 12:17:08 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20231003111708eucas1p29eebdad45a2eae16148c9a5dbbcd47eb~KlM9ueQt_2873428734eucas1p2J; Tue, 3 Oct 2023 11:17:08 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20231003111708eusmtrp1557c1b9222630af8ae63b55e44a6e735~KlM9ttFgI2246422464eusmtrp1Z; Tue, 3 Oct 2023 11:17:08 +0000 (GMT) X-AuditID: cbfec7f4-97dff70000022c38-37-651bf8347486 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 3A.D1.10549.438FB156; Tue, 3 Oct 2023 12:17:08 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231003111707eusmtip27cb19697124906ee428f70d4b9f2ccf5~KlM874NuU2773227732eusmtip2e; Tue, 3 Oct 2023 11:17:07 +0000 (GMT) From: Mateusz Majewski To: linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Mateusz Majewski , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Alim Akhtar , Liam Girdwood , Mark Brown , Marek Szyprowski Subject: [PATCH v3 3/8] thermal: exynos: switch from workqueue-driven interrupt handling to threaded interrupts Date: Tue, 3 Oct 2023 13:16:29 +0200 Message-ID: <20231003111638.241542-4-m.majewski2@samsung.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231003111638.241542-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrHKsWRmVeSWpSXmKPExsWy7djPc7omP6RTDd5f1LB4MG8bm8Xh+RUW Ux8+YbP4vuU6k8W8z7IWe19vZbf4dqWDyWLT42usFpd3zWGz+Nx7hNFixvl9TBYTj01mtlh7 5C67xdwvU5ktnjzsY3Pg99g56y67x+I9L5k8Nq3qZPO4c20Pm8fmJfUefVtWMXp83iQXwB7F ZZOSmpNZllqkb5fAlfHkXCNjwR7Jil1H29kbGCeJdjFyckgImEjMOtLA0sXIxSEksIJRYsuq dkYI5wujRHv/FmYI5zOjxJHOvWwwLbuO/mGDSCxnlHjc84cVwmllkvi3dh8rSBWbgIHEgzfL 2EFsEYFWRomZTeogRcwCl5gl7t5cywKSEBYolJj8ZivYWBYBVYmWFRfBGngFbCXajnSxQqyT l9iz6DsTiM0pYCex8udyJogaQYmTM5+AzWEGqmneOhvsVgmB/xwSG77MgLrVRWLenoNMELaw xKvjW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1+RxYglngFrPE/ddaXYwcHMIC+RL/LqmChFkE VCVaVlwEG8orYCvRdqQLapm8xJ5F38FaOQXsJFb+XA5mCwHV3Fq+jwWiXlDi5MwnLBDj5SWa t85mnsAoMAtJahaS1AJGplWMIqmlxbnpucWGesWJucWleel6yfm5mxiBMbft2M/NOxjnvfqo d4iRiYPxEKMEB7OSCG/YUalUId6UxMqq1KL8+KLSnNTiQ4ymQHdPZJYSTc4HRn1eSbyhmYGp oYmZpYGppZmxkjivZ0FHopBAemJJanZqakFqEUwfEwenVAPTVLed7NcCbkqWTphyKNlkuku3 l+TM++8ESsRb8378VCxS/3rxzmyBtLRPU7e88lheksMqy237dtK7F8/N7t5q9/8aaFxe+enN Lv1bHKcLHm6e+XquVg7zrWLvmE0bb00WilvxZxFLm+OilwKXc9bnlGwOOFHzKUUl5eEnoTt7 FVl7LP07V7b3VhnaL3v54FukxrqzzeXhx5JXca4QFDt2+GPN4/2BKx/39Gxdo5PNdqvU7c+7 vlf/I+tqb/uqzchL0pRo/uhv7HvyyTXOjTn/jixvKNSc+HZVyeyK0//MuJr69P95rFwR9POn GpOPafj9kC37tnTm6WccuPr5TMl/D2HPyQWmqz4yFLXdTph9U4mlOCPRUIu5qDgRANVJxE5C AwAA X-CMS-MailID: 20231003111708eucas1p29eebdad45a2eae16148c9a5dbbcd47eb X-Msg-Generator: CA X-RootMTR: 20231003111708eucas1p29eebdad45a2eae16148c9a5dbbcd47eb X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231003111708eucas1p29eebdad45a2eae16148c9a5dbbcd47eb References: <20231003111638.241542-1-m.majewski2@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org The workqueue boilerplate is mostly one-to-one what the threaded interrupts do. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Mateusz Majewski --- v1 -> v2: devm_request_threaded_irq call formatting change. drivers/thermal/samsung/exynos_tmu.c | 29 +++++++++------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 90c33e8017af..0e970638193d 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. @@ -175,7 +174,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; @@ -763,10 +761,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); @@ -778,7 +775,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) @@ -812,16 +810,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", @@ -1023,8 +1011,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"); @@ -1093,8 +1079,11 @@ 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 Oct 3 11:16:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 729605 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 299B1E7544F for ; Tue, 3 Oct 2023 11:17:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239921AbjJCLRT (ORCPT ); Tue, 3 Oct 2023 07:17:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239963AbjJCLRQ (ORCPT ); Tue, 3 Oct 2023 07:17:16 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA027BF for ; Tue, 3 Oct 2023 04:17:11 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20231003111710euoutp014a8e1e8fe136786f6373380bcb1c24fc~KlM-yizpS1147311473euoutp01s for ; Tue, 3 Oct 2023 11:17:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20231003111710euoutp014a8e1e8fe136786f6373380bcb1c24fc~KlM-yizpS1147311473euoutp01s DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1696331830; bh=Vg9DFf70aoyV0Kmb3Cb2AWmwbCE2SJj9B9sBvA2HuYg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C5tlqEjBZmPORQTzCLzRx8C7titOhRX8qDeSxK+s75TC7O4X0m8x4n1GxwTeiKOW5 IiBlFnY6+jHSs0cFHYN8JSFLwgX71YVRMc22yKAeoWfx6IYG85Ar28CIr40ZRtq30i s3McVxgfork35cUAEDHLmdUQneCWy/AXuvEFNuKs= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20231003111710eucas1p204e1d3274a5bbb029e30898acee06042~KlM-djcw23094430944eucas1p2t; Tue, 3 Oct 2023 11:17:10 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 6B.F7.42423.638FB156; Tue, 3 Oct 2023 12:17:10 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20231003111709eucas1p21f2d28615faab2f4aa4d9a264cf7f54f~KlM-AFzO62873528735eucas1p2v; Tue, 3 Oct 2023 11:17:09 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20231003111709eusmtrp14a69c0266cc53ac9a752ddb9f6a8a128~KlM_-KruD2246422464eusmtrp1c; Tue, 3 Oct 2023 11:17:09 +0000 (GMT) X-AuditID: cbfec7f2-a51ff7000002a5b7-c6-651bf835d994 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id CC.CE.25043.538FB156; Tue, 3 Oct 2023 12:17:09 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231003111708eusmtip29d07bb5541e22c576b800fd54121b136~KlM_LA_L-2772927729eusmtip2I; Tue, 3 Oct 2023 11:17:08 +0000 (GMT) From: Mateusz Majewski To: linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Mateusz Majewski , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Alim Akhtar , Liam Girdwood , Mark Brown , Marek Szyprowski Subject: [PATCH v3 4/8] thermal: exynos: handle devm_regulator_get_optional return value correctly Date: Tue, 3 Oct 2023 13:16:30 +0200 Message-ID: <20231003111638.241542-5-m.majewski2@samsung.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231003111638.241542-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrPKsWRmVeSWpSXmKPExsWy7djPc7pmP6RTDV78YrJ4MG8bm8Xh+RUW Ux8+YbP4vuU6k8W8z7IWe19vZbf4dqWDyWLT42usFpd3zWGz+Nx7hNFixvl9TBYTj01mtlh7 5C67xdwvU5ktnjzsY3Pg99g56y67x+I9L5k8Nq3qZPO4c20Pm8fmJfUefVtWMXp83iQXwB7F ZZOSmpNZllqkb5fAlbHw0kymgmMcFVda9rI1MLawdzFyckgImEgsnvqLrYuRi0NIYAWjxKNN XewQzhdGibVfvrNAOJ8ZJc7+Pc4K0/L4yjyoxHJGia7Hd1ghnFYmibmrlrKAVLEJGEg8eLMM bImIQCujxMwmdZAiZoFLzBJ3b64FKxIWSJF4vW4+WBGLgKrEtF+NjCA2r4CtxMPLL9gg1slL 7Fn0nQn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dzFyckgImEg8vjKPpYuRi0NIYCmjxIpvO5ggEtISh79MgSoSlvhzrYsN oqiZSWLd9m1gRWwCBhIP3ixjB0mICHQySnRtPgeWYBa4xSxx/7UWiC0skCTxeeV9FhCbRUBV YtqvRkYQm1fAVuLh5RdsEBvkJfYs+g7WyylgJ7Hy53IwWwio5tbyfSwQ9YISJ2c+YYGYLy/R vHU28wRGgVlIUrOQpBYwMq1iFEktLc5Nzy020itOzC0uzUvXS87P3cQIjLptx35u2cG48tVH vUOMTByMhxglOJiVRHjDjkqlCvGmJFZWpRblxxeV5qQWH2I0Bbp7IrOUaHI+MO7zSuINzQxM DU3MLA1MLc2MlcR5PQs6EoUE0hNLUrNTUwtSi2D6mDg4pRqY7GSLtD6tSc/a9GjFxwCnU7y3 Tz3VnpL831f+1olbpyS2zyncFiTrvo7/eFHuUbY3ITuumripVKmtuHt94oZHlj5WTzYGT320 pXbmAvX58vf3bMxiDfLzYLn1QElp6WMBzzrpaK+qjXdWfRA2c9A9uFy4zON75TkB4aU1zUuW bLO9UROsKnxU1+jmYU7/5Ph1inE6jN0CXtkSz6yYmOxT2GTO866SuMxc6sX9bfPygPgZ5v43 tIvWfOCYOyXmhaBZYqLiN4E/D9fKfua4uK7A32V2e1lh2QvzVLnafO+Wgz/7p5w9Efl23fKs +I7qVypML0Mbdmd6dq0WYeLm7xX9EXm497vq7tiNS6S2te9WYinOSDTUYi4qTgQAKeRGI0MD AAA= X-CMS-MailID: 20231003111709eucas1p21f2d28615faab2f4aa4d9a264cf7f54f X-Msg-Generator: CA X-RootMTR: 20231003111709eucas1p21f2d28615faab2f4aa4d9a264cf7f54f X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231003111709eucas1p21f2d28615faab2f4aa4d9a264cf7f54f References: <20231003111638.241542-1-m.majewski2@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Currently, if regulator is required in the SoC, but devm_regulator_get_optional fails for whatever reason, the execution will proceed without propagating the error. Signed-off-by: Mateusz Majewski Reviewed-by: Krzysztof Kozlowski --- drivers/thermal/samsung/exynos_tmu.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 0e970638193d..6070b03cff9d 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -1002,9 +1002,17 @@ static int exynos_tmu_probe(struct platform_device *pdev) return ret; } } else { - if (PTR_ERR(data->regulator) == -EPROBE_DEFER) + ret = PTR_ERR(data->regulator); + switch (ret) { + case -ENODEV: + break; + case -EPROBE_DEFER: return -EPROBE_DEFER; - dev_info(&pdev->dev, "Regulator node (vtmu) not found\n"); + default: + dev_err(&pdev->dev, "Failed to get regulator: %d\n", + ret); + return ret; + } } ret = exynos_map_dt_data(pdev); From patchwork Tue Oct 3 11:16:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 729194 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 D69DCE75453 for ; Tue, 3 Oct 2023 11:17:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239929AbjJCLRU (ORCPT ); Tue, 3 Oct 2023 07:17:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231723AbjJCLRR (ORCPT ); Tue, 3 Oct 2023 07:17:17 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45BB0AF for ; Tue, 3 Oct 2023 04:17:13 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20231003111712euoutp01e77de54b2a67ae9c9f8fbcf6bcbb4af4~KlNBSnKS40934109341euoutp01h for ; Tue, 3 Oct 2023 11:17:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20231003111712euoutp01e77de54b2a67ae9c9f8fbcf6bcbb4af4~KlNBSnKS40934109341euoutp01h DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1696331832; bh=V2/Mzb3I7DEQaqQIC0PslVbUjHF4j1Sq8nv+9t2b3y0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ID8Z0dMgZk+xiF2qNL2+N6JaBTVz382TOqb5TM/xLHmD7qDMPhtEm3fGceNm90zfS FsVx34UX8I+7D5i4c5fN5mnl4p1i7Ee5PHyqX4RcgCx/HCuhKK3rNo5qOdPzPa2vLg H9QUV2HqJNoIEujnW73FVqm8EsS9Jbpj/nW4m80o= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20231003111711eucas1p1628e726b548802c3befcd088761ae329~KlNA48lQA2460224602eucas1p1x; Tue, 3 Oct 2023 11:17:11 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id D4.2F.37758.738FB156; Tue, 3 Oct 2023 12:17:11 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20231003111711eucas1p2646dcfd2d7d473b78b012153bca06cc7~KlNASNH_30433204332eucas1p2N; Tue, 3 Oct 2023 11:17:11 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20231003111711eusmtrp1323c66d180ae07f5752a597299e8ac54~KlNARkQSH2239722397eusmtrp1B; Tue, 3 Oct 2023 11:17:11 +0000 (GMT) X-AuditID: cbfec7f5-7ffff7000002937e-e5-651bf837e354 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 80.DE.25043.638FB156; Tue, 3 Oct 2023 12:17:10 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231003111710eusmtip2f6c814e4b6d39c4deec3ca73aa73b069~KlM-ax1nA2844228442eusmtip2E; Tue, 3 Oct 2023 11:17:10 +0000 (GMT) From: Mateusz Majewski To: linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Mateusz Majewski , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Alim Akhtar , Liam Girdwood , Mark Brown , Marek Szyprowski Subject: [PATCH v3 5/8] thermal: exynos: simplify regulator (de)initialization Date: Tue, 3 Oct 2023 13:16:31 +0200 Message-ID: <20231003111638.241542-6-m.majewski2@samsung.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231003111638.241542-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrLKsWRmVeSWpSXmKPExsWy7djP87rmP6RTDT5sULZ4MG8bm8Xh+RUW Ux8+YbP4vuU6k8W8z7IWe19vZbf4dqWDyWLT42usFpd3zWGz+Nx7hNFixvl9TBYTj01mtlh7 5C67xdwvU5ktnjzsY3Pg99g56y67x+I9L5k8Nq3qZPO4c20Pm8fmJfUefVtWMXp83iQXwB7F ZZOSmpNZllqkb5fAlXH3xTGWgu2yFUvX32JvYLwk3sXIwSEhYCKxY1VuFyMXh5DACkaJ768X MEM4Xxgl5k14z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99g56y67x+I9L5k8Nq3qZPO4c20Pm8fmJfUefVtWMXp83iQXwB6l Z1OUX1qSqpCRX1xiqxRtaGGkZ2hpoWdkYqlnaGwea2VkqqRvZ5OSmpNZllqkb5egl3H3xTGW gu2yFUvX32JvYLwk3sXIySEhYCIxq6+JGcQWEljKKLG5Kw0iLi1x+MsUdghbWOLPtS62LkYu oJpmJombLzoYQRJsAgYSD94sYwdJiAh0Mkp0bT7HBJJgFrjFLHH/tRaILSzgJ3FiwnRWEJtF QFXi498/bCA2r4CtxLul26E2yEvsWfQdrJdTwE5i5c/lTBAX2UrcWr6PBaJeUOLkzCcsEPPl JZq3zmaewCgwC0lqFpLUAkamVYwiqaXFuem5xUZ6xYm5xaV56XrJ+bmbGIExt+3Yzy07GFe+ +qh3iJGJg/EQowQHs5IIb9hRqVQh3pTEyqrUovz4otKc1OJDjKZAd09klhJNzgdGfV5JvKGZ gamhiZmlgamlmbGSOK9nQUeikEB6YklqdmpqQWoRTB8TB6dUA1NBnW/gW1bl+E6XnT+rq7bv WFyZI2sc8lKDdd7p+w78wb9vCHjLH8h5WLTEpT3jh1vucc0z0zRDn+k72fdJMm53Pbr/1nmL j8e+6Fxpmc75obiZN2it0dNlZ9TaVZfkWm8oMPkbdsLVJfVsTOXvjUfS1CeWVx4rurbg8r2l s468NmjbuNlsfaPJc6He1zx56qLdVTXeiY+Up13hfb5CfcKK+6bfj6t+L/+TlL/Zm3vl41Wx 7ItOiswRWxC40OPiis8N/xfMn5Cuq3u25urlG40rEm9HKnpJp531OHZijlZK+vsfX790zDpZ Zvj33PF+o1Tj+/Y1Dfo5vL61K3dKLlJmdQhNOrvKaVXqbavAvE9KLMUZiYZazEXFiQCZM+zK QgMAAA== X-CMS-MailID: 20231003111711eucas1p2646dcfd2d7d473b78b012153bca06cc7 X-Msg-Generator: CA X-RootMTR: 20231003111711eucas1p2646dcfd2d7d473b78b012153bca06cc7 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231003111711eucas1p2646dcfd2d7d473b78b012153bca06cc7 References: <20231003111638.241542-1-m.majewski2@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org We rewrite the initialization to enable the regulator as part of devm, which allows us to not handle the struct instance manually. We also remove the error message in case the regulator is unavailable, as this is expected behaviour. Signed-off-by: Mateusz Majewski Reviewed-by: Krzysztof Kozlowski --- v2 -> v3: fixed error handling of devm_regulator_get_optional to handle the case in which the regulator is available, but enabling it fails. Also removed the error message, split into two commits and reworded the commit message. drivers/thermal/samsung/exynos_tmu.c | 49 +++++++++------------------- 1 file changed, 15 insertions(+), 34 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 6070b03cff9d..a0a1f7e1e63f 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. * @tzd: pointer to thermal_zone_device structure * @ntrip: number of supported trip points. * @enabled: current status of TMU device @@ -183,7 +182,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; @@ -994,50 +992,40 @@ 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 { - ret = PTR_ERR(data->regulator); - switch (ret) { - case -ENODEV: - break; - case -EPROBE_DEFER: - return -EPROBE_DEFER; - default: - dev_err(&pdev->dev, "Failed to get regulator: %d\n", - ret); - return ret; - } + ret = devm_regulator_get_enable_optional(&pdev->dev, "vtmu"); + switch (ret) { + case 0: + case -ENODEV: + break; + case -EPROBE_DEFER: + return -EPROBE_DEFER; + default: + dev_err(&pdev->dev, "Failed to get enabled regulator: %d\n", + ret); + return ret; } ret = exynos_map_dt_data(pdev); if (ret) - goto err_sensor; + return ret; data->clk = devm_clk_get(&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; } } @@ -1107,10 +1095,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; } @@ -1125,9 +1109,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 Oct 3 11:16:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 729604 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4745EE75450 for ; Tue, 3 Oct 2023 11:17:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239961AbjJCLRU (ORCPT ); Tue, 3 Oct 2023 07:17:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239876AbjJCLRS (ORCPT ); Tue, 3 Oct 2023 07:17:18 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E0CDA1 for ; Tue, 3 Oct 2023 04:17:14 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20231003111713euoutp02d7e148e7c2dc92998879fa8816637bb0~KlNCWqH021082210822euoutp02u for ; Tue, 3 Oct 2023 11:17:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20231003111713euoutp02d7e148e7c2dc92998879fa8816637bb0~KlNCWqH021082210822euoutp02u DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1696331833; bh=wYOgN+xChN8fb2aWq0gBrJakJtJYp/uVLT+nkSF3JUE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eizkfNKFZ1o9eaG2fZd+H1o8TrkjU2rrdZBa/6kxrdjFvwdSI7KV3ud4qXbH2v0Zv XD+KY5OjT7YptY1X+wc956IAlKv0/FZCU4v04BeWVcET72pHiM3EX08iP7mYbB1XuB Wz0ElMWccw7Rpas9+BCb5GY5f90DK0vIcqLHpyPQ= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20231003111712eucas1p142e0b9bb4ef708d18849c80a92cc2f73~KlNB5r8Jq2602126021eucas1p1l; Tue, 3 Oct 2023 11:17:12 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 36.2F.37758.838FB156; Tue, 3 Oct 2023 12:17:12 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20231003111712eucas1p1a089b3aa7e10ae84d8963f89b6bbecd6~KlNBZ5zjG2477724777eucas1p1l; Tue, 3 Oct 2023 11:17:12 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20231003111712eusmtrp1ebfe6d9ab7bf019bb063466d7fa72045~KlNBZRO082246422464eusmtrp1k; Tue, 3 Oct 2023 11:17:12 +0000 (GMT) X-AuditID: cbfec7f5-7ffff7000002937e-e9-651bf838c8b5 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 72.DE.25043.838FB156; Tue, 3 Oct 2023 12:17:12 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231003111711eusmtip2641a272f6e51f817f80b17e7674ad965~KlNAnyci93045530455eusmtip2Y; Tue, 3 Oct 2023 11:17:11 +0000 (GMT) From: Mateusz Majewski To: linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Mateusz Majewski , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Alim Akhtar , Liam Girdwood , Mark Brown , Marek Szyprowski Subject: [PATCH v3 6/8] thermal: exynos: stop using the threshold mechanism on Exynos 4210 Date: Tue, 3 Oct 2023 13:16:32 +0200 Message-ID: <20231003111638.241542-7-m.majewski2@samsung.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231003111638.241542-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAA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KlCQ/Mjy6Y8cpKYb1Ll7feKvm9EnLfm/5ncgdVrbc4 Kzq33MGiqvrrgcTDS3ML7/qZLOF2cI+Y6G7YsnMXm+Ok3TuO7lJiKc5INNRiLipOBAAtPwL/ QgMAAA== X-CMS-MailID: 20231003111712eucas1p1a089b3aa7e10ae84d8963f89b6bbecd6 X-Msg-Generator: CA X-RootMTR: 20231003111712eucas1p1a089b3aa7e10ae84d8963f89b6bbecd6 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231003111712eucas1p1a089b3aa7e10ae84d8963f89b6bbecd6 References: <20231003111638.241542-1-m.majewski2@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Exynos 4210 supports setting a base threshold value, which is added to all trip points. This might be useful, but is not really necessary in our usecase, so we always set it to 0 to simplify the code a bit. Additionally, this change makes it so that we convert the value to the calibrated one in a slightly different place. This is more correct morally, though it does not make any change when single-point calibration is being used (which is the case currently). Reviewed-by: Krzysztof Kozlowski Signed-off-by: Mateusz Majewski --- drivers/thermal/samsung/exynos_tmu.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index a0a1f7e1e63f..7138e001fa5a 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -343,20 +343,7 @@ static void exynos_tmu_control(struct platform_device *pdev, bool on) static void exynos4210_tmu_set_trip_temp(struct exynos_tmu_data *data, int trip_id, u8 temp) { - struct thermal_trip trip; - u8 ref, th_code; - - if (thermal_zone_get_trip(data->tzd, 0, &trip)) - return; - - ref = trip.temperature / MCELSIUS; - - if (trip_id == 0) { - th_code = temp_to_code(data, ref); - writeb(th_code, data->base + EXYNOS4210_TMU_REG_THRESHOLD_TEMP); - } - - temp -= ref; + temp = temp_to_code(data, temp); writeb(temp, data->base + EXYNOS4210_TMU_REG_TRIG_LEVEL0 + trip_id * 4); } @@ -371,6 +358,8 @@ static void exynos4210_tmu_initialize(struct platform_device *pdev) struct exynos_tmu_data *data = platform_get_drvdata(pdev); sanitize_temp_error(data, readl(data->base + EXYNOS_TMU_REG_TRIMINFO)); + + writeb(0, data->base + EXYNOS4210_TMU_REG_THRESHOLD_TEMP); } static void exynos4412_tmu_set_trip_temp(struct exynos_tmu_data *data, From patchwork Tue Oct 3 11:16:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 729193 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 EA780E7544B for ; Tue, 3 Oct 2023 11:17:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240501AbjJCLRd (ORCPT ); Tue, 3 Oct 2023 07:17:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239914AbjJCLRV (ORCPT ); Tue, 3 Oct 2023 07:17:21 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C953CB0 for ; Tue, 3 Oct 2023 04:17:16 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20231003111715euoutp0263c3fbe795464b483de6a0dcb7c04b8d~KlNEi-tyF1157011570euoutp02X for ; Tue, 3 Oct 2023 11:17:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20231003111715euoutp0263c3fbe795464b483de6a0dcb7c04b8d~KlNEi-tyF1157011570euoutp02X DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1696331835; bh=KJozKF3tDwxVWSXlQ/ef+TTDcYyB/rkSZst7Qpw6Axc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lsRLzs8ubE9rRu4UegkLic+WqWUd/t5uC36VuDjypDdtCEAadfFrxSyYAsMETyYHC 4wECbnnod1oPyzNfxsFWZEhughdNeSYVTrnNgBIej3BN0+u6v/WmvPE5L3UTa9M9fI hH5ppIID2uTHCbNVjLwwbEdnomzUJ2zRg2Ija3Rk= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20231003111714eucas1p29e6ebbdefd687adbd93ea166433e7ed9~KlNDLbY_v2468224682eucas1p2A; Tue, 3 Oct 2023 11:17:14 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 8A.14.11320.A38FB156; Tue, 3 Oct 2023 12:17:14 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20231003111713eucas1p27fcc64df0091b6097461f28b05bf772a~KlNCtkiRc2872628726eucas1p2a; Tue, 3 Oct 2023 11:17:13 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20231003111713eusmtrp167ee5936eac0aed120e54207fe9c946c~KlNCqkHN42246422464eusmtrp1o; Tue, 3 Oct 2023 11:17:13 +0000 (GMT) X-AuditID: cbfec7f4-97dff70000022c38-4c-651bf83a4dc0 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 20.E1.10549.938FB156; Tue, 3 Oct 2023 12:17:13 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231003111712eusmtip272573f24002e37035f6c8fd926410db5~KlNB1KmUM2844228442eusmtip2F; Tue, 3 Oct 2023 11:17:12 +0000 (GMT) From: Mateusz Majewski To: linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Mateusz Majewski , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Alim Akhtar , Liam Girdwood , Mark Brown , Marek Szyprowski Subject: [PATCH v3 7/8] thermal: exynos: split initialization of TMU and the thermal zone Date: Tue, 3 Oct 2023 13:16:33 +0200 Message-ID: <20231003111638.241542-8-m.majewski2@samsung.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231003111638.241542-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrLKsWRmVeSWpSXmKPExsWy7djP87pWP6RTDRa2s1o8mLeNzeLw/AqL qQ+fsFl833KdyWLeZ1mLva+3slt8u9LBZLHp8TVWi8u75rBZfO49wmgx4/w+JouJxyYzW6w9 cpfdYu6XqcwWTx72sTnwe+ycdZfdY/Gel0wem1Z1snncubaHzWPzknqPvi2rGD0+b5ILYI/i sklJzcksSy3St0vgyni1dytzwUS1ii8HrjI2MP6Q62Lk5JAQMJHY1XODsYuRi0NIYAWjxOZN E5lBEkICXxglrt/ygUh8ZpRYf2gdC0zH69MnWCESyxklFt06zwTR0cokseScNojNJmAg8eDN MnYQW0SglVFiZpM6SAOzwCVmibs314JNEhaIlvj5dh1YEYuAqsS+PefABvEK2ErM/P6dCWKb vMSeRRA2p4CdxMqfy6FqBCVOznwCNocZqKZ562xmkAUSAv85JF483c4G0ewiMXVdBzuELSzx 6vgWKFtG4vTkHqh38iVmbH4PZHMA2RUSdw96QZjWEh/PMIOYzAKaEut36UMUO0qsOz2DCaKC T+LGW0GIA/gkJm2bzgwR5pXoa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v5cDmYLAdXcWr6PBaJeUOLkzCcsEPPlJZq3 zmaewCgwC0lqFpLUAkamVYwiqaXFuem5xYZ6xYm5xaV56XrJ+bmbGIFRt+3Yz807GOe9+qh3 iJGJg/EQowQHs5IIb9hRqVQh3pTEyqrUovz4otKc1OJDjKZAd09klhJNzgfGfV5JvKGZgamh iZmlgamlmbGSOK9nQUeikEB6YklqdmpqQWoRTB8TB6dUA5OBU+oJXa2dJrcY/HMtefLTX/rX FWobuM4uM054G7DSZLvc2j2P90dly7GFKfXtiL9wkr3TXji5hVti6l6f+GUhj1ufnlbiWp3v U/nVdELVhbkLSuem3zx/onSK5cpDmxddOTDpr++OolN7WWN/LD11eU565Und9cx/VWZrLJro bhR7QcuTt0DL0iRR+Evq7jvu9T0z3+5eYHjXYefnNFbd5Uuzrt5gmmxo9nrKict9MyxahCIs b7ZuzZ/TfLCueH5w5ETzqUJVfTuumX5JN+OZ8Hylr8Q3xglX9z3aZCjBVLvzccqH9+s5j5u7 Pi/JyfkcpXj1dvJzRzPea2/Xna1qUt/z7K3LxF7p3eWxaz2VWIozEg21mIuKEwEWHvKgQwMA AA== X-CMS-MailID: 20231003111713eucas1p27fcc64df0091b6097461f28b05bf772a X-Msg-Generator: CA X-RootMTR: 20231003111713eucas1p27fcc64df0091b6097461f28b05bf772a X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231003111713eucas1p27fcc64df0091b6097461f28b05bf772a References: <20231003111638.241542-1-m.majewski2@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@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 Reviewed-by: Krzysztof Kozlowski --- v1 -> v2: We take clocks into account; exynos_tmu_initialize needs both clocks, as tmu_initialize might use the base_second registers. However, exynos_thermal_zone_configure only needs clk. drivers/thermal/samsung/exynos_tmu.c | 104 +++++++++++++++------------ 1 file changed, 60 insertions(+), 44 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 7138e001fa5a..343e27c61528 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -251,25 +251,8 @@ 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); - 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; - } - - 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 ret = 0; mutex_lock(&data->lock); clk_enable(data->clk); @@ -280,32 +263,63 @@ static int exynos_tmu_initialize(struct platform_device *pdev) if (!status) { ret = -EBUSY; } else { - int i, ntrips = - min_t(int, num_trips, data->ntrip); - data->tmu_initialize(pdev); - - /* 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); } + + mutex_unlock(&data->lock); + clk_disable(data->clk); + if (!IS_ERR(data->clk_sec)) + clk_disable(data->clk_sec); + + 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 i, 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 out; + } + + 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); + } + + clk_enable(data->clk); + + num_trips = min_t(int, num_trips, data->ntrip); + + /* Write temperature code for rising and falling threshold */ + for (i = 0; i < num_trips; 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); + } + err: clk_disable(data->clk); mutex_unlock(&data->lock); - if (!IS_ERR(data->clk_sec)) - clk_disable(data->clk_sec); out: return ret; } @@ -1044,10 +1058,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)) { @@ -1058,9 +1074,9 @@ static int exynos_tmu_probe(struct platform_device *pdev) goto err_sclk; } - 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"); goto err_sclk; } From patchwork Tue Oct 3 11:16:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 729603 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 31C30E7544E for ; Tue, 3 Oct 2023 11:17:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240491AbjJCLRm (ORCPT ); Tue, 3 Oct 2023 07:17:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240500AbjJCLRd (ORCPT ); Tue, 3 Oct 2023 07:17:33 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 508A5BF for ; Tue, 3 Oct 2023 04:17:17 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20231003111715euoutp0127eaae31454ca5f98517236988be3504~KlNEzlW6h1141711417euoutp011 for ; Tue, 3 Oct 2023 11:17:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20231003111715euoutp0127eaae31454ca5f98517236988be3504~KlNEzlW6h1141711417euoutp011 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1696331835; bh=6pQq2j4oWPpU1K39ZQsmq/adTTse3sbmpHJoM81es1Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Eraxu/fb5ZCo7H93DbwzRK1XUr6AQd5WDulayTDlMJuqYaYkLjqQSne4eLt0dgLWe d778B/UCUZl4TEl9mejlZpRVUStjnO7wdGV41F61DsXopgGXmgKF77OjafjXWI+SZh QADKQ3p5yQb0jUvE0z5NoHLhrQ8nnyNcC77uzRbw= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20231003111715eucas1p242320a38764f9c2111fc0e73770a1ead~KlNEWfVLt2870828708eucas1p2D; Tue, 3 Oct 2023 11:17:15 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id B3.08.42423.B38FB156; Tue, 3 Oct 2023 12:17:15 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20231003111714eucas1p19c2351845d47b4ed1da8bc1b866e3353~KlND5H1Q02462224622eucas1p1a; Tue, 3 Oct 2023 11:17:14 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20231003111714eusmtrp13d62977ea24e73fb37e09beb164436cc~KlND4NY732239722397eusmtrp1M; Tue, 3 Oct 2023 11:17:14 +0000 (GMT) X-AuditID: cbfec7f2-a51ff7000002a5b7-d9-651bf83b66af Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id C1.E1.10549.A38FB156; Tue, 3 Oct 2023 12:17:14 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231003111714eusmtip2b5a0ce422071b88639a4df98a7cd2e3d~KlNDFMiJz3116931169eusmtip2e; Tue, 3 Oct 2023 11:17:13 +0000 (GMT) From: Mateusz Majewski To: linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Mateusz Majewski , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Alim Akhtar , Liam Girdwood , Mark Brown , Marek Szyprowski Subject: [PATCH v3 8/8] thermal: exynos: use set_trips Date: Tue, 3 Oct 2023 13:16:34 +0200 Message-ID: <20231003111638.241542-9-m.majewski2@samsung.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231003111638.241542-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrPKsWRmVeSWpSXmKPExsWy7djP87rWP6RTDZ4cE7J4MG8bm8Xh+RUW Ux8+YbP4vuU6k8W8z7IWe19vZbf4dqWDyWLT42usFpd3zWGz+Nx7hNFixvl9TBYTj01mtlh7 5C67xdwvU5ktnjzsY3Pg99g56y67x+I9L5k8Nq3qZPO4c20Pm8fmJfUefVtWMXp83iQXwB7F ZZOSmpNZllqkb5fAlXG0+Q57QeMaxoprpw6zNTDO6GXsYuTkkBAwkTh/pZmpi5GLQ0hgBaNE x8wPzBDOF0aJp/2/WUCqhAQ+M0qsXJYF09Hw+TY7RNFyRon5a3dCdbQySexuXg3WwSZgIPHg zTJ2EFtEoJVRYmaTOkgRs8AlZom7N9eCFQkLmEncm/aeGcRmEVCVeHr5BROIzStgK7HxSxMb xDp5iT2LvoPFOQXsJFb+XA5VIyhxcuYTsDnMQDXNW2czQ9Q3c0rsbwyGsF0k5my4yAJhC0u8 Or6FHcKWkTg9uQcqni8xY/N7IJsDyK6QuHvQC8K0lvh4hhnEZBbQlFi/Sx+i2FFiwXuQ30Eq +CRuvBWE2M8nMWnbdGaIMK9ER5sQRLWqxPE9k6DOkpZ40nKbCcL2kLh2u491AqPiLCSfzELy ySyEvQsYmVcxiqeWFuempxYb5qWW6xUn5haX5qXrJefnbmIEprHT/45/2sE499VHvUOMTByM hxglOJiVRHjDjkqlCvGmJFZWpRblxxeV5qQWH2KU5mBREufVtj2ZLCSQnliSmp2aWpBaBJNl 4uCUamBK8xW3F3t9drK+3EaOv8nei7Vl+XojP3Jc0PvNducWd8fq9IvKG6v2/5w5PSB5s99k g0mv1jtE7JWz9b9+Oa55q9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p8bGKx7dyt9+/8OO4LXcnWJlihpLI3hqlmT9Wf9ce2fRhn87unfP0m6uyJ7x UJpZccGujEl9jN57nzlq/5zcxX4g14dn8xs5ZX7pk4d2fei9ei4vbbZti4LpadGlYrovbl1Y ec+8WkRc6tW79c71P+Wb/RZdnqt/QLn66TEpT2eBfgnFj0vuH2P/vnlff77DHB7ZRXYrFRLm JNfanjdiemMePXX1A9+MWz++v3st963ipO+K6x8u77y9gneee8CRTNe98x7E6IT+vZlz4uDJ 4FW5jWfPTX7bLPta99n7D/YVO3LVEpbuL1TRLOb4/PPcmwlGV7crsRRnJBpqMRcVJwIApw64 5EUDAAA= X-CMS-MailID: 20231003111714eucas1p19c2351845d47b4ed1da8bc1b866e3353 X-Msg-Generator: CA X-RootMTR: 20231003111714eucas1p19c2351845d47b4ed1da8bc1b866e3353 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231003111714eucas1p19c2351845d47b4ed1da8bc1b866e3353 References: <20231003111638.241542-1-m.majewski2@samsung.com> Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@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 --- v2 -> v3: Fixed formatting of some comments. v1 -> v2: We take clocks into account; anything that sets temperature thresholds needs clk. drivers/thermal/samsung/exynos_tmu.c | 400 +++++++++++++++------------ 1 file changed, 226 insertions(+), 174 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 343e27c61528..667bb18205fc 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -158,10 +158,12 @@ enum soc_type { * in the positive-TC generator block * 0 < reference_voltage <= 31 * @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) + * @tmu_set_low_temp: SoC specific method to set trip (falling threshold) + * @tmu_set_high_temp: SoC specific method to set trip (rising threshold) + * @tmu_set_crit_temp: SoC specific method to set critical temperature + * @tmu_disable_low: SoC specific method to disable an interrupt (falling threshold) + * @tmu_disable_high: SoC specific method to disable an interrupt (rising threshold) * @tmu_initialize: SoC specific TMU initialization method * @tmu_control: SoC specific TMU control method * @tmu_read: SoC specific TMU temperature read method @@ -183,13 +185,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); @@ -279,49 +281,28 @@ 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 i, num_trips = thermal_zone_get_num_trips(tzd); - int ret = 0, temp; + int ret, temp; ret = thermal_zone_get_crit_temp(tzd, &temp); + if (ret) { + /* FIXME: Remove this special case */ + if (data->soc == SOC_ARCH_EXYNOS5433) + return 0; - if (ret && data->soc != SOC_ARCH_EXYNOS5433) { /* FIXME */ dev_err(&pdev->dev, "No CRITICAL trip point defined in device tree!\n"); - goto out; + return ret; } 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); - } - clk_enable(data->clk); - num_trips = min_t(int, num_trips, data->ntrip); + data->tmu_set_crit_temp(data, temp / MCELSIUS); - /* Write temperature code for rising and falling threshold */ - for (i = 0; i < num_trips; 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); - } - -err: clk_disable(data->clk); mutex_unlock(&data->lock); -out: - return ret; + + return 0; } static u32 get_con_reg(struct exynos_tmu_data *data, u32 con) @@ -354,17 +335,58 @@ 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) @@ -376,33 +398,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) @@ -432,44 +470,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) @@ -505,34 +556,48 @@ 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) @@ -547,87 +612,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 { @@ -635,7 +657,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); } @@ -873,13 +894,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; @@ -892,14 +915,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; @@ -911,14 +936,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; @@ -929,14 +956,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; @@ -972,9 +1001,32 @@ 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); + clk_enable(data->clk); + + 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); + + clk_disable(data->clk); + 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)