From patchwork Wed Oct 25 13:30:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 13436139 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 92502C0032E for ; Wed, 25 Oct 2023 13:31:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344584AbjJYNa7 (ORCPT ); Wed, 25 Oct 2023 09:30:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235030AbjJYNax (ORCPT ); Wed, 25 Oct 2023 09:30:53 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83BBC18C for ; Wed, 25 Oct 2023 06:30:49 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20231025133048euoutp018338af2f8d46b97043f8e4c6f2d88d58~RXN852OCP2920229202euoutp01a for ; Wed, 25 Oct 2023 13:30:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20231025133048euoutp018338af2f8d46b97043f8e4c6f2d88d58~RXN852OCP2920229202euoutp01a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1698240648; bh=eb8mbc98REMcBZ07pJdFy0917NkB5OE4nrZXufMorTE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DG/S7D41jP5u5bqqcxu8C/k8Crsqro0w00obh++bmeHdEqpDJaQsCVnR4qbX6iDZC JruDLGNhaPOqBV45GV1iFR4c1+av/J2HTEEDdkaAkQ3kA0qFFAJeUn1ZxXaZx2niMv ZdPmip0t0RKi4ex88Ca8+sm528OnwYAH2BDaUfYc= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20231025133047eucas1p1f0f67fc201f2576579b58cb14a9dd2d2~RXN8i0PSv1622416224eucas1p1I; Wed, 25 Oct 2023 13:30:47 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 13.0B.37758.78819356; Wed, 25 Oct 2023 14:30:47 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20231025133047eucas1p2bef6136656645815da1ff884f4f8d1d0~RXN8DxRSn2546925469eucas1p2j; Wed, 25 Oct 2023 13:30:47 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20231025133047eusmtrp21ca9fa31ad4b4f70f73333a8c4f7f9a5~RXN8DF7Wn1205012050eusmtrp2a; Wed, 25 Oct 2023 13:30:47 +0000 (GMT) X-AuditID: cbfec7f5-7ffff7000002937e-41-65391887fb96 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 24.26.25043.78819356; Wed, 25 Oct 2023 14:30:47 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231025133046eusmtip2566ff2ed17159f364f37707238adffe4~RXN7JV-kv1374613746eusmtip2g; Wed, 25 Oct 2023 13:30:46 +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 , Lukasz Luba Subject: [PATCH v4 1/8] thermal: exynos: remove an unnecessary field description Date: Wed, 25 Oct 2023 15:30:20 +0200 Message-ID: <20231025133027.524152-2-m.majewski2@samsung.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231025133027.524152-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrKKsWRmVeSWpSXmKPExsWy7djPc7rtEpapBoePG1g8mLeNzeLw/AqL qQ+fsFl833KdyWLeZ1mLva+3slt8u9LBZLHp8TVWi8u75rBZfO49wmgx4/w+JouFTS3sFhOP TWa2WHvkLrvF3C9TmS2ePOxjcxDwWDNvDaPHzll32T0W73nJ5LFpVSebx51re9g8Ni+p9+jb sorR4/MmuQCOKC6blNSczLLUIn27BK6MU0fmsBWsYq9YvecQSwPjZLYuRk4OCQETiZu7TzF2 MXJxCAmsYJS49HcJC4TzhVHiw/NlzBDOZ0aJI3euAZVxgLUcfOwD0i0ksJxRYu30eIiaViaJ C8d6mEESbAIGEg/eLGMHsUUEWhklZjapgxQxC3xllrj6ej5YkbBAkMT6kx+YQGwWAVWJH9cm MILYvAK2Ej+vn2SCuE9eYs+i72A2p4CdRO/x62wQNYISJ2c+YQGxmYFqmrfOBrtUQqCfU2Lz wdVsEJe6SLS9joCYIyzx6vgWdghbRuL/zvlQ8/MlZmx+zwJRXiFx96AXhGkt8fEMM4jJLKAp sX6XPkTUUWL1PQUIk0/ixltBiPV8EpO2TWeGCPNKdLQJQUxWlTi+ZxIzhC0t8aTlNtRGD4mr F5pZJjAqzkLyyCwkj8xCWLuAkXkVo3hqaXFuemqxcV5quV5xYm5xaV66XnJ+7iZGYEo7/e/4 1x2MK1591DvEyMTBeIhRgoNZSYQ30sciVYg3JbGyKrUoP76oNCe1+BCjNAeLkjivaop8qpB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8oZmBqaGJmaWBqaWZsZI4r2dBR6KQQHpiSWp2ampBahFMHxMHp1QD06xFzy7u K6nNygieYZJh4aB7ViB5y53NigtnWCxs6K1tEpj6raOz9vScK5mNYVH59/d15rLUKj218ru4 PK90udBuXymPT0vTH+vL5/6Z/ezFvSsPopueBhSYhCu/qzx5iTXxk+CeA8+cX/5Y67AgSGKf dUHn6WydvwKMRg+Fcnv3+rDGy8ZvEEnNPXbNKyE048iCdU6TVIMWOh0pPVhuax1WYWZ4pyX5 oGqE/DUdjr9LJe6s+mOvdnzfr6o1DMaNJmrzGmqnPhc2ergo59T3hyonL5yfbJnbybn/wwvX 5fFSZzY/lHBY5bbyv4Ml9zzx02uKvdjP5n1M4L3kl3ndYWlYd8eqPUeljsnMKZ19QYmlOCPR UIu5qDgRAM127G1LAwAA X-CMS-MailID: 20231025133047eucas1p2bef6136656645815da1ff884f4f8d1d0 X-Msg-Generator: CA X-RootMTR: 20231025133047eucas1p2bef6136656645815da1ff884f4f8d1d0 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231025133047eucas1p2bef6136656645815da1ff884f4f8d1d0 References: <20231025133027.524152-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 123ec81e1943..187086658e8f 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 Wed Oct 25 13:30:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 13436140 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 03649C0032E for ; Wed, 25 Oct 2023 13:31:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344549AbjJYNbF (ORCPT ); Wed, 25 Oct 2023 09:31:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234995AbjJYNay (ORCPT ); Wed, 25 Oct 2023 09:30:54 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F4BF132 for ; Wed, 25 Oct 2023 06:30:52 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20231025133050euoutp02f1f70706afaafe625f100f96a49249fa~RXN-Ue_hl1109011090euoutp02x for ; Wed, 25 Oct 2023 13:30:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20231025133050euoutp02f1f70706afaafe625f100f96a49249fa~RXN-Ue_hl1109011090euoutp02x DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1698240650; bh=7/6FemRmnMZSvOrVZ5Dgthh/u/9EWRsMZanz4+6xfv0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ASJDuyeOtJHmKHcLeIDV0z2BIPUPgCGYhxZcq0tbsB+PDRmKhT5+cdk6WATbbl/CE l7x4qm9Jr7hpJUQ5VTF+dDBaihIwILPARlQI3/hP/XyKmyjJUMVqt2UaPg9CFwU/Q2 YJVmi7RnvIHpxOoOcz2+HzbxXy9DUmQhdPFGphSw= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20231025133050eucas1p1fb11806b8605d2603dcf2bfe6c8d4dc1~RXN_nXEJm1383513835eucas1p1h; Wed, 25 Oct 2023 13:30:50 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 17.0B.37758.A8819356; Wed, 25 Oct 2023 14:30:50 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20231025133049eucas1p11f9c4dc6d235418175c94340ad15f5a7~RXN_GZW081436614366eucas1p1f; Wed, 25 Oct 2023 13:30:49 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20231025133049eusmtrp12281dbeb629fdd771180328bf20b9b5a~RXN_FpG1C0853808538eusmtrp1i; Wed, 25 Oct 2023 13:30:49 +0000 (GMT) X-AuditID: cbfec7f5-7ffff7000002937e-4b-6539188ade45 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id ED.98.10549.98819356; Wed, 25 Oct 2023 14:30:49 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231025133048eusmtip26bd5f7522c50974cc574acd1083a3e46~RXN9OFLFq1156911569eusmtip2j; Wed, 25 Oct 2023 13:30:48 +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 , Lukasz Luba Subject: [PATCH v4 2/8] thermal: exynos: drop id field Date: Wed, 25 Oct 2023 15:30:21 +0200 Message-ID: <20231025133027.524152-3-m.majewski2@samsung.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231025133027.524152-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrOKsWRmVeSWpSXmKPExsWy7djP87pdEpapBteuslo8mLeNzeLw/AqL qQ+fsFl833KdyWLeZ1mLva+3slt8u9LBZLHp8TVWi8u75rBZfO49wmgx4/w+JouFTS3sFhOP TWa2WHvkLrvF3C9TmS2ePOxjcxDwWDNvDaPHzll32T0W73nJ5LFpVSebx51re9g8Ni+p9+jb sorR4/MmuQCOKC6blNSczLLUIn27BK6MrtNvmAom8VQc/z2LpYHxE2cXIyeHhICJxMR5l1i6 GLk4hARWMEr0ffoF5XxhlJi2Zh0rhPOZUeLF89XsMC2zJs5kBbGFBJYzSmzfYQ5R1MoksX3y KxaQBJuAgcSDN8vAGkQEWhklZjapgxQxC3xllrj6ej4zSEJYwEzi4oKVTCA2i4CqxPI9r4Bs Dg5eAVuJBadiIZbJS+xZ9B2shFPATqL3+HU2EJtXQFDi5MwnYLuYgWqat85mBpkvIdDPKXFl 72omiGYXif87j7BA2MISr45vgfpARuL05B6oeL7EjM3vWUD2SghUSNw96AVhWkt8PMMMYjIL aEqs36UPUewo0fj8LytEBZ/EjbeCEAfwSUzaNp0ZIswr0dEmBFGtKnF8zyRmCFta4knLbaiz PCS+dK5knMCoOAvJK7OQvDILYe8CRuZVjOKppcW56anFxnmp5XrFibnFpXnpesn5uZsYgWnt 9L/jX3cwrnj1Ue8QIxMH4yFGCQ5mJRHeSB+LVCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8qiny qUIC6Yklq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qwkzutZ0JEoJJCeWJKanZpakFoE08fEwSnVwLTydOyz vrRbtd2CmVXyFxKUQ1M1zs44kijHxHf3w1n9M/ErQ3/L+p7b6KC1/G+bpY9erYXt9nCnl7br tRqsWyp808TNZvMwZ/ktWuFW1fq0M6x46ZzpvQ/aZ9ZOdErdvIYn5KjS+edu01ZWMf/8LZi7 4WZa1Jvuc1ZTbx438Vt95bmG2itmW+dD8/6sOnU1+90ug8AnG/6GmOZOc8h7XvHWs9s7L22z 1krNGWlnuL2r1PreiLpn3359dImyX+XSwxWxTg/qFi620okwnlMiUrQi4X/qyX1s+41kkkV7 t9pVzbmZ/ua5/rt397eJRu5ITE/crai1JrIuvvxyg07Mj4uHCpTS+Dey/ZDYtXNatBJLcUai oRZzUXEiALIlgTxMAwAA X-CMS-MailID: 20231025133049eucas1p11f9c4dc6d235418175c94340ad15f5a7 X-Msg-Generator: CA X-RootMTR: 20231025133049eucas1p11f9c4dc6d235418175c94340ad15f5a7 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231025133049eucas1p11f9c4dc6d235418175c94340ad15f5a7 References: <20231025133027.524152-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 187086658e8f..4ff32245d2a9 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 Wed Oct 25 13:30:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 13436141 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 3DBABC25B6D for ; Wed, 25 Oct 2023 13:31:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344633AbjJYNbH (ORCPT ); Wed, 25 Oct 2023 09:31:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344557AbjJYNaz (ORCPT ); Wed, 25 Oct 2023 09:30:55 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99B66184 for ; Wed, 25 Oct 2023 06:30:53 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20231025133052euoutp0117243f8fbf97e72d34703ded1570e4c9~RXOAnkj2w3146731467euoutp01o for ; Wed, 25 Oct 2023 13:30:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20231025133052euoutp0117243f8fbf97e72d34703ded1570e4c9~RXOAnkj2w3146731467euoutp01o DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1698240652; bh=z+drqHSTXutvqyghqqSngnAvaJMAvU0O0c1Ke0HntPc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sdoefb5rzBYfu4joDNDMvr+PxZzL2AfdlPG4l4lpjYuUwXOhfGRAdnbJYpW163kG5 4MVlRu4XLcVsOhoaTsIKWNF9+1Ce/hT5Ref9pfJCatBMfaPjHOHyPa4Q/ulw8RQkUL 7Mvq1qoH5Yc5VhIn/yyci0oS+Ben0XxhpAPPb2n4= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20231025133051eucas1p15e5c88bdda3a341b45c84fc259234b93~RXOAOQyhN1623816238eucas1p1N; Wed, 25 Oct 2023 13:30:51 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 99.0B.37758.B8819356; Wed, 25 Oct 2023 14:30:51 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20231025133051eucas1p1e9ed4202abb45c5d2f738fdd213503ee~RXN-j3CTt1436614366eucas1p1p; Wed, 25 Oct 2023 13:30:51 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20231025133051eusmtrp1659aa83e9230f2e56552a8b5f9d22858~RXN-jKaTf0869708697eusmtrp1w; Wed, 25 Oct 2023 13:30:51 +0000 (GMT) X-AuditID: cbfec7f5-815ff7000002937e-54-6539188b968a Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 00.A8.10549.B8819356; Wed, 25 Oct 2023 14:30:51 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231025133050eusmtip2c8c8b9f20b0952930e64108434998a21~RXN_uTT0j1260512605eusmtip26; Wed, 25 Oct 2023 13:30:50 +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 , Lukasz Luba Subject: [PATCH v4 3/8] thermal: exynos: switch from workqueue-driven interrupt handling to threaded interrupts Date: Wed, 25 Oct 2023 15:30:22 +0200 Message-ID: <20231025133027.524152-4-m.majewski2@samsung.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231025133027.524152-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrKKsWRmVeSWpSXmKPExsWy7djP87rdEpapBlMOGVg8mLeNzeLw/AqL qQ+fsFl833KdyWLeZ1mLva+3slt8u9LBZLHp8TVWi8u75rBZfO49wmgx4/w+JouFTS3sFhOP TWa2WHvkLrvF3C9TmS2ePOxjcxDwWDNvDaPHzll32T0W73nJ5LFpVSebx51re9g8Ni+p9+jb sorR4/MmuQCOKC6blNSczLLUIn27BK6MT5OOMxXskayY/OwJWwPjJNEuRg4OCQETiW+bArsY OTmEBFYwSqw6WtDFyAVkf2GUOHpzPxNE4jOjRPcJHRAbpH76tj52iKLljBIbD7cyQjitTBIn Wt6wg1SxCRhIPHizDMwWEWhllJjZpA5SxCzwlVni6uv5zCCrhQUKJWZuqwepYRFQlZj9sZcV xOYVsJU48+4QO8Q2eYk9i76DXcEpYCfRe/w6G0SNoMTJmU9YQGxmoJrmrb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s8edaFxtEUTOTxOYn/WwgCTYBA4kHb5aBdYsIdDJKdG0+B9bNLPCfWeLrTAUQW1gg X2L+xlPMIDaLgKrE7I+9rCA2r4CtxJl3h6A2yEvsWfQdrJdTwE6i9/h1sAVCQDUTOh6yQ9QL Spyc+YQFYr68RPPW2cwTGAVmIUnNQpJawMi0ilEktbQ4Nz232FCvODG3uDQvXS85P3cTIzAS tx37uXkH47xXH/UOMTJxMB5ilOBgVhLhjfSxSBXiTUmsrEotyo8vKs1JLT7EaAp090RmKdHk fGAqyCuJNzQzMDU0MbM0MLU0M1YS5/Us6EgUEkhPLEnNTk0tSC2C6WPi4JRqYErKZtAWLvP4 ovNRqXCduew0tib9C4EnNsdW+NU3NeiznGVey9SW4ZgzWWJr26ZeLgYOq8XnqydGsNjxBuzN u/rg+9+6zq9TpO7M8vmTwf6kbM+RIM7jlRuWpD3NVt8+SfmUqOCdLr7pjmZ/s5aLcksvnq86 TyKwJyU0PaNUYKWV3TPPwkyOl5+SrtpmOskxz9StevzS9nRex8a5YTq/8+X3ZZt17JOVK7vG +2Z99oakEzaPV1t4Ruap9m+x3lNx+ANj5FbuBTYncgUMPEK+PO3+svhOvmnljCsP1hbVVmj3 COb1b6n8HSUyLfnT2kfMaxvFPHkF1xkdSXyySkmvYbbpYmflxb332bgXT0xXYinOSDTUYi4q TgQAvCnIt00DAAA= X-CMS-MailID: 20231025133051eucas1p1e9ed4202abb45c5d2f738fdd213503ee X-Msg-Generator: CA X-RootMTR: 20231025133051eucas1p1e9ed4202abb45c5d2f738fdd213503ee X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231025133051eucas1p1e9ed4202abb45c5d2f738fdd213503ee References: <20231025133027.524152-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 4ff32245d2a9..c144592d4584 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 Wed Oct 25 13:30:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 13436142 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 6125BC25B47 for ; Wed, 25 Oct 2023 13:31:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344579AbjJYNbQ (ORCPT ); Wed, 25 Oct 2023 09:31:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344574AbjJYNa5 (ORCPT ); Wed, 25 Oct 2023 09:30:57 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03FC71A1 for ; Wed, 25 Oct 2023 06:30:55 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20231025133053euoutp022043796fdd0bf917644bbcc7c0a4f3b5~RXOBwOrVn1402314023euoutp02F for ; Wed, 25 Oct 2023 13:30:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20231025133053euoutp022043796fdd0bf917644bbcc7c0a4f3b5~RXOBwOrVn1402314023euoutp02F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1698240653; bh=u+wG+TE9TCSLBpYrR24io87ZkJPG2GggSUyjgW3CH9Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O/DepxjHH+IjhkvkPHbLUswuGcb8KNPKNw5x2ow/ffS4oUDP6Ot4Kl0Yy5KN7Q7JU wipN0Fk6SBShAnpVCj8hL4G2YRAyAprM1OpQCbXMxbqc/Sf5ZnKYz4FeMxRUFxuND7 I6k6asIj5jGoI3Kd9rK9Xg2f7KodZ3Yl07TAe4iI= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20231025133053eucas1p179baa1a44f15f85dc545ca7baf99ee87~RXOBWM70G1384813848eucas1p1k; Wed, 25 Oct 2023 13:30:53 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id BD.E7.42423.C8819356; Wed, 25 Oct 2023 14:30:53 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20231025133052eucas1p2278dc2030aa8fd20868cd4f3605a8a2f~RXOA82tyC2480624806eucas1p2y; Wed, 25 Oct 2023 13:30:52 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20231025133052eusmtrp2688ee67cfbfc501af1ab89e01d71a863~RXOA8AW6i1214112141eusmtrp2F; Wed, 25 Oct 2023 13:30:52 +0000 (GMT) X-AuditID: cbfec7f2-a3bff7000002a5b7-07-6539188c2890 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id EA.26.25043.C8819356; Wed, 25 Oct 2023 14:30:52 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231025133051eusmtip2556b6720bd3d6eacf23c309e31d6ea86~RXOAF5dwe1204812048eusmtip2f; Wed, 25 Oct 2023 13:30:51 +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 , Lukasz Luba Subject: [PATCH v4 4/8] thermal: exynos: handle devm_regulator_get_optional return value correctly Date: Wed, 25 Oct 2023 15:30:23 +0200 Message-ID: <20231025133027.524152-5-m.majewski2@samsung.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231025133027.524152-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrMKsWRmVeSWpSXmKPExsWy7djP87q9EpapBjO9LR7M28ZmcXh+hcXU h0/YLL5vuc5kMe+zrMXe11vZLb5d6WCy2PT4GqvF5V1z2Cw+9x5htJhxfh+TxcKmFnaLiccm M1usPXKX3WLul6nMFk8e9rE5CHismbeG0WPnrLvsHov3vGTy2LSqk83jzrU9bB6bl9R79G1Z xejxeZNcAEcUl01Kak5mWWqRvl0CV8bMDVUFS7gqDt6ewdjAuJuji5GTQ0LAROLajI1MXYxc HEICKxglpv88yQ7hfGGUONfSC5X5zCjR8XwbSxcjB1jL2cfmEPHljBL9E7ezQDitTB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Ni+p9+jb sorR4/MmuQCOKD2bovzSklSFjPziElulaEMLIz1DSws9IxNLPUNj81grI1MlfTublNSczLLU In27BL2MmRuqCpZwVRy8PYOxgXE3RxcjB4eEgInE2cfmXYxcHEICSxkl9j++xtzFyAkUl5Y4 /GUKO4QtLPHnWhcbRFEzk8SuD7fZQBJsAgYSD94sYwdJiAh0Mkp0bT7HBJJgFvjPLPF1pgKI LSyQJLF71jpWEJtFQFXiX+8LRpDNvAK2Ep/XhEIskJfYs+g7WCungJ1E7/HrYPOFgEomdDwE O4JXQFDi5MwnLBDj5SWat85mnsAoMAtJahaS1AJGplWMIqmlxbnpucVGesWJucWleel6yfm5 mxiBMbjt2M8tOxhXvvqod4iRiYPxEKMEB7OSCG+kj0WqEG9KYmVValF+fFFpTmrxIUZToLMn MkuJJucDk0BeSbyhmYGpoYmZpYGppZmxkjivZ0FHopBAemJJanZqakFqEUwfEwenVANTFZeU z/S/vdaLvU5fdtVVajb88ykrbeWMKCbdBTM3+zVkblJc/bHtqsiplUX/H/nq7ryxdKaCrEtT bhJPf+R0+9uBMyrO2C9gWOG93ajxzIx73CrxET83Tbggd0zBPqB5h5Fh78K1AoUuPp8mOW7w afPm+rVk+a5Vd+ULT2Qti1b4/V/8OdOsV7Idf0IDDn/4ya5x07JTee0T3qDEqxw2q35G/Prj dVAmJvLQZq8VHsdT1E99f6f5NDF9e7+vRbQU56tZPf1WPm9lG88bLu5e8NDi+pzDUQ9dErcs esS81uPJN7PD+6b/iZjn8b7SsJPn2vqkhnOhy7Wvimifcuvb/7jEQqjoUeLdIG3fLy+XKbEU ZyQaajEXFScCACrPyKRKAwAA X-CMS-MailID: 20231025133052eucas1p2278dc2030aa8fd20868cd4f3605a8a2f X-Msg-Generator: CA X-RootMTR: 20231025133052eucas1p2278dc2030aa8fd20868cd4f3605a8a2f X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231025133052eucas1p2278dc2030aa8fd20868cd4f3605a8a2f References: <20231025133027.524152-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. Meanwhile there is no reason to output the error in case of -ENODEV. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Mateusz Majewski --- v3 -> v4: Moved info about not outputting error to the correct commit message. 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 c144592d4584..8bcad8a70dc5 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 Wed Oct 25 13:30:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 13436143 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 AB6B9C25B6D for ; Wed, 25 Oct 2023 13:31:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344552AbjJYNbU (ORCPT ); Wed, 25 Oct 2023 09:31:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344593AbjJYNbA (ORCPT ); Wed, 25 Oct 2023 09:31:00 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92CAA18A for ; Wed, 25 Oct 2023 06:30:57 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20231025133056euoutp01b87596693526118232b9082411ab2469~RXOEehgVZ3146731467euoutp01u for ; Wed, 25 Oct 2023 13:30:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20231025133056euoutp01b87596693526118232b9082411ab2469~RXOEehgVZ3146731467euoutp01u DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1698240656; bh=SZ2xtU4liTdPRXyiaem1RPsDZRIMzUg5tNmbRIlLQxE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LK+/8XrtshrtjVA0E1AN79caM7yN0+Rlqg9KjW6LQKEB1mUiJEElNb3omF+JLxUwf wTD7qahYcedyTWvGSSUomPbZgNtcohL7o64hMBsYV39hEFDaQhJcmFOMJNENP61Nux /NgJ+xJi7FzvZeDkNkWAlY8tzI6UnA/uyw5Usp8A= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20231025133054eucas1p127c5cb897bb40dcf748e7bab9b7faa29~RXOCyci2M1623116231eucas1p1J; Wed, 25 Oct 2023 13:30:54 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 32.F7.42423.E8819356; Wed, 25 Oct 2023 14:30:54 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20231025133054eucas1p23c3ad3e8a8f96608f5574a3b7910589d~RXOCVOe6a2546925469eucas1p2r; Wed, 25 Oct 2023 13:30:54 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20231025133054eusmtrp1c83fbd185478dbc629ba3833705764e0~RXOCUfUts0869708697eusmtrp16; Wed, 25 Oct 2023 13:30:54 +0000 (GMT) X-AuditID: cbfec7f2-a3bff7000002a5b7-0f-6539188ee5ce Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 03.A8.10549.D8819356; Wed, 25 Oct 2023 14:30:54 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231025133053eusmtip2e92e61bda4d306cbc6ba5344d82e7d40~RXOBcVMwi1260512605eusmtip28; Wed, 25 Oct 2023 13:30:53 +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 , Lukasz Luba Subject: [PATCH v4 5/8] thermal: exynos: simplify regulator (de)initialization Date: Wed, 25 Oct 2023 15:30:24 +0200 Message-ID: <20231025133027.524152-6-m.majewski2@samsung.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231025133027.524152-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrJKsWRmVeSWpSXmKPExsWy7djP87p9EpapBjOWyFk8mLeNzeLw/AqL qQ+fsFl833KdyWLeZ1mLva+3slt8u9LBZLHp8TVWi8u75rBZfO49wmgx4/w+JouFTS3sFhOP TWa2WHvkL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XW5UFNAwAA X-CMS-MailID: 20231025133054eucas1p23c3ad3e8a8f96608f5574a3b7910589d X-Msg-Generator: CA X-RootMTR: 20231025133054eucas1p23c3ad3e8a8f96608f5574a3b7910589d X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231025133054eucas1p23c3ad3e8a8f96608f5574a3b7910589d References: <20231025133027.524152-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. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Mateusz Majewski --- v3 -> v4: Resolved merge conflict and moved info about not outputting error to the correct commit message. 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 8bcad8a70dc5..3bdcbab7466f 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; } @@ -1124,9 +1108,6 @@ static void exynos_tmu_remove(struct platform_device *pdev) clk_unprepare(data->clk); if (!IS_ERR(data->clk_sec)) clk_unprepare(data->clk_sec); - - if (!IS_ERR(data->regulator)) - regulator_disable(data->regulator); } #ifdef CONFIG_PM_SLEEP From patchwork Wed Oct 25 13:30:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 13436144 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 09153C25B70 for ; Wed, 25 Oct 2023 13:31:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235022AbjJYNbd (ORCPT ); Wed, 25 Oct 2023 09:31:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344602AbjJYNbC (ORCPT ); Wed, 25 Oct 2023 09:31:02 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E873918D for ; Wed, 25 Oct 2023 06:30:57 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20231025133056euoutp010437e29492f66bfcdf84afe99e808270~RXOEuPmEP3169731697euoutp01f for ; Wed, 25 Oct 2023 13:30:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20231025133056euoutp010437e29492f66bfcdf84afe99e808270~RXOEuPmEP3169731697euoutp01f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1698240656; bh=dXf9wUUf5w5y7OBV4KeN+1ChCSvq94K/h1PmwKd1DP4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W1xZYTZLCJE9PX4xThAgbQjNA4E4u5wbvXzcojQ+zPPDgRAcDh5vHAvQ9aIjDkf9u DmQny275+1MaGNyTRpeWT6P1g8j8GHtBoi4Mh4NhHHkYsR9Ct+34CucxDT13PTHtdM mRRFsK26CRBf0fL0di+1qBWqgcSuDnzmJ74xXtWI= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20231025133056eucas1p1a2adf2d26aadcbaf08cef52eeb4cec47~RXOEKnNpU1622416224eucas1p1c; Wed, 25 Oct 2023 13:30:56 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id BE.0B.37758.F8819356; Wed, 25 Oct 2023 14:30:56 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20231025133055eucas1p13779e9c86720bf460c12b28c6d830f2a~RXODnVXLp1383513835eucas1p1n; Wed, 25 Oct 2023 13:30:55 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20231025133055eusmtrp118dc2d78f39781360c357af53597bfe6~RXODmrwpP0869708697eusmtrp1_; Wed, 25 Oct 2023 13:30:55 +0000 (GMT) X-AuditID: cbfec7f5-815ff7000002937e-68-6539188f47c1 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 35.A8.10549.F8819356; Wed, 25 Oct 2023 14:30:55 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231025133054eusmtip20ca3122846fae9c23e3274de6df353cb~RXOCxF0RM1587515875eusmtip2C; Wed, 25 Oct 2023 13:30:54 +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 , Lukasz Luba Subject: [PATCH v4 6/8] thermal: exynos: stop using the threshold mechanism on Exynos 4210 Date: Wed, 25 Oct 2023 15:30:25 +0200 Message-ID: <20231025133027.524152-7-m.majewski2@samsung.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231025133027.524152-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrBKsWRmVeSWpSXmKPExsWy7djPc7oTJCxTDV4tYbR4MG8bm8Xh+RUW Ux8+YbP4vuU6k8W8z7IWe19vZbf4dqWDyWLT42usFpd3zWGz+Nx7hNFixvl9TBYLm1rYLSYe m8xssfbIXXaLuV+mMls8edjH5iDgsWbeGkaPnbPusnss3vOSyWPTqk42jzvX9rB5bF5S79G3 ZRWjx+dNcgEcUVw2Kak5mWWpRfp2CVwZf858YytYyV8x8eVktgbGdzxdjJwcEgImEofnv2Lu YuTiEBJYwShx88pTNgjnC6PEtYn7GCGcz4wSf1+/ZYJpufL7JTtEYjmjxMt1u6FaWpkkVq5s ZASpYhMwkHjwZhk7iC0i0MooMbNJHaSIWeArs8TV1/OZQRLCAjES5+/NB2tgEVCV2NmxFKyB V8BWYv6ppVDr5CX2LPoOZnMK2En0Hr/OBlEjKHFy5hMWEJsZqKZ562ywLyQEujklljesZYVo dpE4e/Y2C4QtLPHq+BZ2CFtG4vTkHqh4vsSMze+BbA4gu0Li7kEvCNNa4uMZZhCTWUBTYv0u fYhiR4nHn5qgivkkbrwVhDiAT2LStunMEGFeiY42IYhqVYnjeyYxQ9jSEk9abjNBlHhIPGxl ncCoOAvJJ7OQfDILYe0CRuZVjOKppcW56anFxnmp5XrFibnFpXnpesn5uZsYgYnt9L/jX3cw rnj1Ue8QIxMH4yFGCQ5mJRHeSB+LVCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8qinyqUIC6Ykl qdmpqQWpRTBZJg5OqQamdZfVdfx9m/5rftqz1ZTzyJStmhGzfk8LaPK0iMq4djG+Rn/51Ase 9bPP1CrmdalFJ5rKt3IWCm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Uri3Za/3puxt/6k2TZQ+D 1kSluTy3PdHkbNPh+1/8Wt/cCbMfNaX2/PpTelRKeIqhh+Vxnz095TtePfxXnhnXZn8o9eGb X4IXyos3izw2EYqeoR0qIRnmO+dPvUFUzxRzt7BnP/6tq9JimVZwuP9acfmcTVNZjh33fi1m WTmvIYMx+fajrgI5iUzr7MWJzBmP2tn/Bt6QyF7veb/b1cxDS+vjAdVrC9/F3C6qyijw27N6 bWie9/Kd98rFQrexN+ydaPVu8tpvbpIzKsV8i2cqau3UkwibUzLv2VHLJ8WRd5VYijMSDbWY i4oTAdmYmvpMAwAA X-CMS-MailID: 20231025133055eucas1p13779e9c86720bf460c12b28c6d830f2a X-Msg-Generator: CA X-RootMTR: 20231025133055eucas1p13779e9c86720bf460c12b28c6d830f2a X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231025133055eucas1p13779e9c86720bf460c12b28c6d830f2a References: <20231025133027.524152-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 3bdcbab7466f..d918bf6d5359 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 Wed Oct 25 13:30:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Majewski X-Patchwork-Id: 13436146 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 1248FC07545 for ; Wed, 25 Oct 2023 13:31:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344602AbjJYNbo (ORCPT ); Wed, 25 Oct 2023 09:31:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344612AbjJYNbD (ORCPT ); Wed, 25 Oct 2023 09:31:03 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C82C1B4 for ; Wed, 25 Oct 2023 06:31:00 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20231025133059euoutp021a1305767465ef158ff06f210cb95a88~RXOHMppEq1108811088euoutp029 for ; Wed, 25 Oct 2023 13:30:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20231025133059euoutp021a1305767465ef158ff06f210cb95a88~RXOHMppEq1108811088euoutp029 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1698240659; bh=HFjJa1RguNICip8Nann+GThTo5GBNLI3URdePUvmffE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AZnpX9HH0dxpg/Fb8UgwEWRPgmQ2/XFHTfdBBGsTgwk/IGA05MOVeX4anW/ntKrOS y5NL14fIFSkUIHFN1mhdFKpdoLQIt0e7FO5qogoVfAePkIHerm1z09VKAt6lKhS6Ug /BiPplyYdRRNeom3fvKbIFxZh3QF/iacHMqWqcFo= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20231025133058eucas1p2ae0d7e96fc3ee9387e28f79996425503~RXOGmIoDt2604026040eucas1p2z; Wed, 25 Oct 2023 13:30:58 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 01.1B.37758.29819356; Wed, 25 Oct 2023 14:30:58 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20231025133058eucas1p149f79722039a90e6e61172ae323b813a~RXOGQN_Qm1623116231eucas1p1O; Wed, 25 Oct 2023 13:30:58 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20231025133058eusmtrp2bd86726330a5eef4a72f334cb7034e18~RXOGPR-CE1214112141eusmtrp2S; Wed, 25 Oct 2023 13:30:58 +0000 (GMT) X-AuditID: cbfec7f5-7ffff7000002937e-73-653918925873 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id EF.26.25043.29819356; Wed, 25 Oct 2023 14:30:58 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231025133057eusmtip2debfa402ef1f59ea66a6f1930eb75707~RXOFRU8VK1376613766eusmtip2l; Wed, 25 Oct 2023 13:30:57 +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 , Lukasz Luba Subject: [PATCH v4 7/8] thermal: exynos: split initialization of TMU and the thermal zone Date: Wed, 25 Oct 2023 15:30:26 +0200 Message-ID: <20231025133027.524152-8-m.majewski2@samsung.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231025133027.524152-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrGKsWRmVeSWpSXmKPExsWy7djPc7qTJCxTDdp7NCwezNvGZnF4foXF 1IdP2Cy+b7nOZDHvs6zF3tdb2S2+Xelgstj0+BqrxeVdc9gsPvceYbSYcX4fk8XCphZ2i4nH JjNbrD1yl91i7pepzBZPHvaxOQh4rJm3htFj56y77B6L97xk8ti0qpPN4861PWwem5fUe/Rt WcXo8XmTXABHFJdNSmpOZllqkb5dAlfG+tcNjAV31Cs63ts0MC5T6GLk5JAQMJG4vGErSxcj F4eQwApGiec3prJDOF8YJX482MEIUiUk8JlR4ubMWJiO18+2sEIULWeUuLHzNVR7K5PE3Xmf mUGq2AQMJB68WcYOYosItDJKzGxSByliFvjKLHH19XywImGBaImemQ/AVrAIqEps3zCb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LU In27BL2M9a8bGAvuqFd0vLdpYFym0MXIySEhYCLx+tkW1i5GLg4hgaWMEhMeTWGHSEhLHP4C YwtL/LnWxQZR1MwkMXv2GhaQBJuAgcSDN8vYQRIiAp2MEl2bzzGBJJgF/jNLfJ0JtkJYIFLi wqyrjCA2i4CqxPYNs9lAbF4BW4kjE4+zQWyQl9iz6DtYL6eAnUTv8etgcSGgmgkdD9kh6gUl Ts58wgIxX16ieets5gmMArOQpGYhSS1gZFrFKJJaWpybnltspFecmFtcmpeul5yfu4kRGIfb jv3csoNx5auPeocYmTgYDzFKcDArifBG+likCvGmJFZWpRblxxeV5qQWH2I0Bbp7IrOUaHI+ MBHklcQbmhmYGpqYWRqYWpoZK4nzehZ0JAoJpCeWpGanphakFsH0MXFwSjUwLVP4tGe2ZvCf 3W+8BWb/7zROvGjqrrOFPWrHlonVx/s/PZ71zf2cGJsK70X7S49ebi3k3O7P6zwlWzCg+1/9 WXt+9p7+H0VcNbcZbPc9eLs+SmXKvPmnExKPvxbP5NM2FSp3OeYa98i5+l3h7OvmD2obrfju fNe977Wq8Ynd/BLx9sY9T4RXcy1ZXT//chNjXc8yd9cNL6wtfzGkP0thttea7dbDYvnc3+tT /PKJSZwNB7/GLi1tLXh77MPuL0cXrE89JRcWplCn/+NkWOnOEi7Oi63pNk9DDavvvW1meCjC cGiRd0TsA4buzWYnlaqXlznv+vHwocPKOzNnXlBf8+Ha9uq7+z7/OWBSsdbAUImlOCPRUIu5 qDgRAGyks51MAwAA X-CMS-MailID: 20231025133058eucas1p149f79722039a90e6e61172ae323b813a X-Msg-Generator: CA X-RootMTR: 20231025133058eucas1p149f79722039a90e6e61172ae323b813a X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231025133058eucas1p149f79722039a90e6e61172ae323b813a References: <20231025133027.524152-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. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Mateusz Majewski --- v3 -> v4: Reordered calls done while leaving exynos_tmu_initialize so that they mirror the calls done while entering this function. 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 d918bf6d5359..6b3a7dd05c68 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); } + + if (!IS_ERR(data->clk_sec)) + clk_disable(data->clk_sec); + clk_disable(data->clk); + 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 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 Wed Oct 25 13:30: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: 13436145 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 77A6EC25B47 for ; Wed, 25 Oct 2023 13:31:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344658AbjJYNbh (ORCPT ); Wed, 25 Oct 2023 09:31:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344639AbjJYNbH (ORCPT ); Wed, 25 Oct 2023 09:31:07 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 873181B2 for ; Wed, 25 Oct 2023 06:31:02 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20231025133101euoutp024639fa2b02af4fd3f16bb265abf6e325~RXOI_cur-1189611896euoutp02f for ; Wed, 25 Oct 2023 13:31:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20231025133101euoutp024639fa2b02af4fd3f16bb265abf6e325~RXOI_cur-1189611896euoutp02f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1698240661; bh=8Q8COwCQ4Q59tC09KlZwlNLVcpTGQ+H4Qu1qwU38McY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DLhhQ6VaydvVWBxmfzvThAHoQt0Zma/61iNWvZ51Wz0L14Jty5CzD5PRFpGp1OuPC g90ITIroFc1emSarRzjRcnwX/w+btS7qr2PerCTGxDc6CGitLbkk/nTRA+P7WfEsFY ZxGOTtUd9e/7jXDTSPvS6MikmozJj5vn+2EMXV7Y= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20231025133100eucas1p112adedd678f2b2820a9295a1dfbdd609~RXOIcX3g81621516215eucas1p1n; Wed, 25 Oct 2023 13:31:00 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 78.F7.42423.49819356; Wed, 25 Oct 2023 14:31:00 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20231025133100eucas1p14e6de58e52560d165bdb8b809e406278~RXOH1uBW81623816238eucas1p1c; Wed, 25 Oct 2023 13:31:00 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20231025133100eusmtrp2ef98d90ccef4e1c7c016449015edc309~RXOH0-EVS1214112141eusmtrp2W; Wed, 25 Oct 2023 13:31:00 +0000 (GMT) X-AuditID: cbfec7f2-a51ff7000002a5b7-26-65391894f8a1 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id C1.36.25043.39819356; Wed, 25 Oct 2023 14:30:59 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20231025133059eusmtip29ba736219f8220756bff4c65186c867c~RXOG8mSFY1587515875eusmtip2F; Wed, 25 Oct 2023 13:30:59 +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 , Lukasz Luba Subject: [PATCH v4 8/8] thermal: exynos: use set_trips Date: Wed, 25 Oct 2023 15:30:27 +0200 Message-ID: <20231025133027.524152-9-m.majewski2@samsung.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231025133027.524152-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrJKsWRmVeSWpSXmKPExsWy7djP87pTJCxTDfZPV7Z4MG8bm8Xh+RUW Ux8+YbP4vuU6k8W8z7IWe19vZbf4dqWDyWLT42usFpd3zWGz+Nx7hNFixvl9TBYLm1rYLSYe m8xssfbIXXaLuV+mMls8edjH5iDgsWbeGkaPnbPusnss3vOSyWPTqk42jzvX9rB5bF5S79G3 ZRWjx+dNcgEcUVw2Kak5mWWpRfp2CVwZDzr/MRY0rmGsOHSplbmBcUYvYxcjJ4eEgInEij27 2UBsIYEVjBIL36d1MXIB2V8YJV4+62CFcD4zSix4v5YJpuP9oZcsEInljBIHdyyGclqZJJp2 rQWbyyZgIPHgzTJ2EFtEoJVRYmaTOkgRs8BXZomrr+czgySEBcwkmpd9YAGxWQRUJR4+ewMW 5xWwlfj/5SMrxDp5iT2LvoOt5hSwk+g9fp0NokZQ4uTMJ2C9zEA1zVtnM0PU93NKHN5YCWG7 SExfdxsqLizx6vgWdghbRuL/zvlQ7+RLzNj8HmgOB5BdIXH3oBeEaS3x8QwziMksoCmxfpc+ RLGjxIZJ/awQFXwSN94KQuznk5i0bTozRJhXoqNNCKJaVeL4nklQ66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cQWAqqZ0PGQ HaJeUOLkzCcsEPPlJZq3zmaewCgwC0lqFpLUAkamVYwiqaXFuem5xUZ6xYm5xaV56XrJ+bmb GIHRuO3Yzy07GFe++qh3iJGJg/EQowQHs5IIb6SPRaoQb0piZVVqUX58UWlOavEhRlOguycy S4km5wPTQV5JvKGZgamhiZmlgamlmbGSOK9nQUeikEB6YklqdmpqQWoRTB8TB6dUA1Oq+eqc U9FfojNyTH0nf29hmWahZpcnosh6mfVN54KgvL4LFltv3qzcIHjR++atPHe//VckxdzY/GIX vPv8kPOGkniRJs/vnXwKSVIhgtf5j8c7npNqSpqre1/3xw75ozfcW5X3R/Ys8uuc2DpZm/dL 2d1umWn8Jm2REb82XZbYziyf7H/dSqqt6t29P9Xndh+O3R2SYLK5KuC+/lqdYJvzK8KWbjgU afJfRGpK08x9rX4NaTlz0j6pZbL9WsaeqXq674tY/P7+xTYcAtITmx8w75FneRx3InG3pHap lnHUhCVrK38uXFvluPrzdsfVGbozw6y03+ioXUhzNbI20FGoCzD78O21QfTan9fXKrEUZyQa ajEXFScCAI2og3JPAwAA X-CMS-MailID: 20231025133100eucas1p14e6de58e52560d165bdb8b809e406278 X-Msg-Generator: CA X-RootMTR: 20231025133100eucas1p14e6de58e52560d165bdb8b809e406278 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20231025133100eucas1p14e6de58e52560d165bdb8b809e406278 References: <20231025133027.524152-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 6b3a7dd05c68..6d19e72a490d 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)