From patchwork Mon Sep 11 13:34: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: 13379351 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6435DEE7FF4 for ; Mon, 11 Sep 2023 13:36:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:References:MIME-Version:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=pDxVya5Xu2oLFrPVWG7RCJ3yHOl/MRKXaK3ILGThdEE=; b=NRiZbqwmAhqPcM 2dt9UGloSMjj5mW0UEimwMUrX5IFj7XxMM/ygneuqIBKRZd4caOqfrT1BPSuJpYn8ih0HCV/3Ym9f rlltvp34+yJLxUZpbJm0k5NDPli7jZpK2IiOzqPbHNDKNQSuXiv7buWRL1VhQbxHSwNuolRAN0mpq djn2qeTndjPgmCsL7CY6v16ZhXXsIJbGQ3jhT+XxFqMNl/YAhF4U4SmFa+hPNIardAZQlXhS9t58O dQqdls68ViIedM5i0RChhiWRjuWXP4vWjIEKAnsNOt3LBZSCeejF4Uf9lSZviDRsGnuRrty2WXUlg F5gNuiSmWvlh38PbIpJg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qfh5N-000cXO-35; Mon, 11 Sep 2023 13:36:17 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qfh5K-000cWb-0i for linux-arm-kernel@lists.infradead.org; Mon, 11 Sep 2023 13:36:16 +0000 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20230911133612euoutp025d140b4defb1ac7ffced5c69236da350~D26HDU2921313113131euoutp02h for ; Mon, 11 Sep 2023 13:36:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20230911133612euoutp025d140b4defb1ac7ffced5c69236da350~D26HDU2921313113131euoutp02h DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1694439372; bh=KEJwLcfqNIjrIdBLofc1siG7b7b+QXBN4yDVWX5CT1s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y9DhIskjlHGa8Xxsb2MS9ZabecNECpC1cPimeb7GPz3MHStDP1pS5OdsvSUFoU2Fn bzQm46NC05LF+oAHUZw691hahF2d2+ks+OHB1mDrsb6L+sf0FN1JysEDL1x8uJ+FOB hHUH2MwqNd2KrjjdAgAlKWdnqqFwuRgrJx+vtn+A= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230911133612eucas1p2c831c1925d270486dcbf601a6eaff060~D26GvMDhT1199911999eucas1p2M; Mon, 11 Sep 2023 13:36:12 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id D1.B1.42423.CC71FF46; Mon, 11 Sep 2023 14:36:12 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20230911133611eucas1p286e43809a6ca785911c0bbdce15dc15d~D26GWN5KZ0493804938eucas1p25; Mon, 11 Sep 2023 13:36:11 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230911133611eusmtrp2225c2df081edc27773ab5988e93838c9~D26GVhK9x0862108621eusmtrp2Y; Mon, 11 Sep 2023 13:36:11 +0000 (GMT) X-AuditID: cbfec7f2-a51ff7000002a5b7-4e-64ff17cc51bb Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 1C.7A.14344.BC71FF46; Mon, 11 Sep 2023 14:36:11 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230911133610eusmtip206ee8e112c4c553376e284fb923c64a7~D26FToWWL0267702677eusmtip2Q; Mon, 11 Sep 2023 13:36: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 v2 1/7] thermal: exynos: remove an unnecessary field description Date: Mon, 11 Sep 2023 15:34:25 +0200 Message-ID: <20230911133435.14061-2-m.majewski2@samsung.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230911133435.14061-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrLKsWRmVeSWpSXmKPExsWy7djPc7pnxP+nGCzu5bZ4MG8bm8Xh+RUW Ux8+YbP4vuU6k8W8z7IWe19vZbf4dqWDyWLT42usFpd3zWGz+Nx7hNFixvl9TBYTj01mtlh7 5C67xdwvU5ktnjzsY3Pg99g56y67x+I9L5k8Nq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h+RUW Ux8+YbP4vuU6k8W8z7IWe19vZbf4dqWDyWLT42usFpd3zWGz+Nx7hNFixvl9TBYTj01mtlh7 5C67xdwvU5ktnjzsY3Pg99g56y67x+I9L5k8Nq3qZPO4c20Pm8fmJfUefVtWMXp83iQXwB6l Z1OUX1qSqpCRX1xiqxRtaGGkZ2hpoWdkYqlnaGwea2VkqqRvZ5OSmpNZllqkb5egl7GwZwNT wXO2ive//zE3MF5l7WLk5JAQMJE40b0AyObiEBJYyihxdN9iNoiEtMThL1PYIWxhiT/Xutgg ipqZJF79ng5WxCZgIPHgzTJ2kISIQCejRNfmc0wgCWaBW8wS919rgdjCAgESH/+cAIuzCKhK /Li6jRHE5hWwkdh9+jsjxAZ5iee37oBt4xSwlTi7djqQzQG0zUai/4wORLmgxMmZT1ggxstL NG+dzTyBUWAWktQsJKkFjEyrGEVSS4tz03OLjfSKE3OLS/PS9ZLzczcxAmNu27GfW3Ywrnz1 Ue8QIxMH4yFGCQ5mJRHekkN/U4R4UxIrq1KL8uOLSnNSiw8xmgKdPZFZSjQ5Hxj1eSXxhmYG poYmZpYGppZmxkrivJ4FHYlCAumJJanZqakFqUUwfUwcnFINTPUv/z58stHox8RtZpb72ts+ 7l9ysbVx0p/KyeLieX9v/8iN6FSZr+qR6faEYcaN0/EX1NLuZZ9bsG+agXDvxWPPFDh2Jl0v mXGX07J2quzlywJJrLvuSy2/YryRpe/xIp1j66TcHZsNvX/2p5yZ2cz4tvLpj9uXdh2WXm98 T3o/84TZ066+XC22e9ayYib+7RUhThdXpLa+zlVKdNx1aedJTv6U36c+Wdzdq2d2yE1l9rGL p71eG17fonugfPLJxM6z0/3j2eW6Lu+8ev5fQPmmML6olts2UtHfuZQja81+S1l/PNY4Xzb4 vRtH3VH2+40bb33lyywQDDgsoLXdzliEu5fRqftxZMea9mki34SUWIozEg21mIuKEwF+XEuT QgMAAA== X-CMS-MailID: 20230911133611eucas1p286e43809a6ca785911c0bbdce15dc15d X-Msg-Generator: CA X-RootMTR: 20230911133611eucas1p286e43809a6ca785911c0bbdce15dc15d X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230911133611eucas1p286e43809a6ca785911c0bbdce15dc15d References: <20230911133435.14061-1-m.majewski2@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230911_063614_630028_527F72A3 X-CRM114-Status: GOOD ( 13.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org It seems that the field has been removed in one of the previous commits, but the description has been forgotten. Signed-off-by: Mateusz Majewski Reviewed-by: Krzysztof Kozlowski --- 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 Mon Sep 11 13:34: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: 13379352 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B8A4AEE57DF for ; Mon, 11 Sep 2023 13:36:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:References:MIME-Version:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=St7Cj33Dqil7jkREUSGuhfb2a7SMZbQW5Jjby/jjvdM=; b=eTNIjtmOuBPV/9 HQEKKyyZNcDABgos5YxAZCxDTDAN9o+Mpn92IgAFTxaonAN2RW2xn4/c6CG44/eFlJw6aIiB5V/Sd WpLg511a+o590XxF5nRakttY/Ywnr8XEIgeVPTF1JHWu0PQUInI9FwvuR4kJM9DOkIsVHqzy4tv1v Mh5tGwPS0txoGqo9iL4jTP9FkVYybmemtkJZuzH6SrJyKKrmlNnLrE4ZnrA3ND6BFM1A5RTfRLx5I CMVtWhqzS3IDAEgGoXd3I1mRmbKnhDAj88guPp8nVZCaV67g16PyA+1wCELLX5/LThXZx4VxX2oEs Rb0Cnq5K+/kDqL2PqVew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qfh5V-000caO-2j; Mon, 11 Sep 2023 13:36:25 +0000 Received: from mailout1.w1.samsung.com ([210.118.77.11]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qfh5P-000cX8-29 for linux-arm-kernel@lists.infradead.org; Mon, 11 Sep 2023 13:36:21 +0000 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20230911133614euoutp01df6017375e6886de363a56b67e9eca99~D26I0aiwY2283022830euoutp01L for ; Mon, 11 Sep 2023 13:36:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20230911133614euoutp01df6017375e6886de363a56b67e9eca99~D26I0aiwY2283022830euoutp01L DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1694439374; bh=+NqJJH6X7tjJ6+L0iqf3etPp0U96Y5vmOPMMdXKrkyk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gL49LS8pN2n8bl4Z2YCwljc/5qiPRvxI2blDai5o2dbafyUHwMxP8zmLrNNdXjSRc zOTUSDvCchEZTTOWJz81CkE0tDhxaDVmvUmCPZaUNHDofo5unDkyKM+4uCflyHtjqw iKS2zDmHliAt6d/KGy2qQMNdtI/t0ocL1zG3Hvy0= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230911133614eucas1p2a6f24ec6a713974c775678e9c2003a01~D26IbnJrG2317523175eucas1p26; Mon, 11 Sep 2023 13:36:14 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id B5.B1.42423.EC71FF46; Mon, 11 Sep 2023 14:36:14 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20230911133613eucas1p1671b7d154e1d567b02516d8c4d8074ab~D26IBuEM31288212882eucas1p1u; Mon, 11 Sep 2023 13:36:13 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230911133613eusmtrp263e49da0aa697d53623dc88f9bfdfffc~D26IBDe3x0864008640eusmtrp2U; Mon, 11 Sep 2023 13:36:13 +0000 (GMT) X-AuditID: cbfec7f2-a51ff7000002a5b7-5a-64ff17ce85f2 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 17.BB.10549.DC71FF46; Mon, 11 Sep 2023 14:36:13 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230911133612eusmtip2be196bc65de7d8b30f10c76d75aaf216~D26Gwe_vL0323103231eusmtip2N; Mon, 11 Sep 2023 13:36: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 v2 2/7] thermal: exynos: drop id field Date: Mon, 11 Sep 2023 15:34:26 +0200 Message-ID: <20230911133435.14061-3-m.majewski2@samsung.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230911133435.14061-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrHKsWRmVeSWpSXmKPExsWy7djPc7rnxP+nGCy9yWzxYN42NovD8yss pj58wmbxfct1Jot5n2Ut9r7eym7x7UoHk8Wmx9dYLS7vmsNm8bn3CKPFjPP7mCwmHpvMbLH2 yF12i7lfpjJbPHnYx+bA77Fz1l12j8V7XjJ5bFrVyeZx59oeNo/NS+o9+rasYvT4vEkugD2K yyYlNSezLLVI3y6BK2PCxV0sBZN4Km4ff8fawPiJs4uRk0NCwERi7cc1bF2MXBxCAisYJRat +wnlfGGU+D9zAQuE85lR4lvHDXaYlpbe7awgtpDAckaJ1muuEEWtTBK7J99lAkmwCRhIPHiz DKxBRKCVUWJmkzpIEbPAJWaJuzfXsoAkhAXMJA603QBrYBFQlXhwagFYnFfARuLkY4hBEgLy Es9v3QEbxClgK3F27XR2iBpBiZMzn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mjxK0DLxghEtISh79MYYewhSX+XOti gyhqZpL4PekfM0iCTcBA4sGbZewgCRGBTkaJrs3nmEASzAK3mCXuv9YCsYUFzCQOtN0Ai7MI qEo8OLWABcTmFbCROPn4LhPEBnmJ57fugG3jFLCVOLt2OpDNAbTNRqL/jA5EuaDEyZlPWCDG y0s0b53NPIFRYBaS1CwkqQWMTKsYRVJLi3PTc4sN9YoTc4tL89L1kvNzNzECY27bsZ+bdzDO e/VR7xAjEwfjIUYJDmYlEd6SQ39ThHhTEiurUovy44tKc1KLDzGaAp09kVlKNDkfGPV5JfGG ZgamhiZmlgamlmbGSuK8ngUdiUIC6YklqdmpqQWpRTB9TBycUg1MwS8PH1raGOjDvGW3/sfN bDPWH7M79YXDhjtCruuL5MXmlA1hUxaEP2FjzGPIn3HudcA/9kWesf7K0fs/n8pIm/H7x+Ot s0QZ9+25/yhp3w6pC2ec20XaDz8JZjwu9aIxS2Jm6YXnbQl/jf2Lzn2dF7+5+YyZc+qrtZnb l8++t+D79MOzDBcV117wC/A9y3FixfoqJQYVnR1cez9Us+Sxaad3tdcKa4sltuczXNO03G38 6YBhk2SEs0z1+zZBj+A7m1vlk7do70x3DVurp/j0443pvw3CFn8Q3/XzXeCvTQJztz8/wHDb XZKbi9umabsva1npzz4JPqXtPGyGQZGMfPZi3MbFQnyzqhcZBjxQYinOSDTUYi4qTgQAwn0I NUIDAAA= X-CMS-MailID: 20230911133613eucas1p1671b7d154e1d567b02516d8c4d8074ab X-Msg-Generator: CA X-RootMTR: 20230911133613eucas1p1671b7d154e1d567b02516d8c4d8074ab X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230911133613eucas1p1671b7d154e1d567b02516d8c4d8074ab References: <20230911133435.14061-1-m.majewski2@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230911_063620_093922_DDE4ACD6 X-CRM114-Status: GOOD ( 15.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Mon Sep 11 13:34: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: 13379354 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7AC24EEB580 for ; Mon, 11 Sep 2023 13:36:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:References:MIME-Version:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=sc4ruv4x3LTLA5JkJzz/zuw2M8efd/SOGwFG44VaF+k=; b=xhUaal5uP8m8DB rc1kwHZse6nZ0n1pFFZCJao1KSTJj56DluTvoUQs/HR6nMsZOthHBKAoORs8F8syPmq9fLyaVxGO7 BZ60lk4NL9d0XeHwFAtgFdmNlPGiVASHnTxluB6YGfS+hkkWe6js/+VGmgUQw0gLkXmiZoAvmTyXH JARL+4U+iDIulKAiNSlpYyjeEIKamo9gCSAgZZPA9jT2GEp0NpZDs+Ci9HGv4rqZp9lntWA9BNPIj 0u7YQagtUw1+gwPehqWEMeUL7aJXwcJTAhQpcX83a8cUgHriYCXxoi0WJUD4CvbnmDUAB0hM10u0I O6Z1zwlceWL3o1+CfUHA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qfh5R-000cYi-1q; Mon, 11 Sep 2023 13:36:21 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qfh5O-000cXM-0M for linux-arm-kernel@lists.infradead.org; Mon, 11 Sep 2023 13:36:20 +0000 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20230911133616euoutp021dbdb46514d32940b10bb3abe2f8446f~D26KobMh01658316583euoutp02E for ; Mon, 11 Sep 2023 13:36:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20230911133616euoutp021dbdb46514d32940b10bb3abe2f8446f~D26KobMh01658316583euoutp02E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1694439376; bh=pq/kPzrdSjU01Z636IhckK77P9sciHZtEKXMXxtJZQs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WYVL03MGhD1VtRR0P07h1qlUGoMRDpN0AKO3SwveQZhIGE9DjkPZYLlq69U5lXfrq BALQHY5tEr4HGFqsFgDpIsV3dqXtUTkqO8khHhyRAhecueuwREh5+yjyAMe/u+wVVI fhgfJRF1BUgh+HkbZP1opT/QgDEkZnUMhw1F1O58= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230911133616eucas1p2697a9b235b9a5b8c8e178c54b5c0f4cd~D26KMUhoE1710917109eucas1p20; Mon, 11 Sep 2023 13:36:16 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 78.B1.42423.FC71FF46; Mon, 11 Sep 2023 14:36:15 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20230911133615eucas1p123b3bed5bfa998bda65196d425f9b49d~D26J0kcQK1222512225eucas1p1u; Mon, 11 Sep 2023 13:36:15 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230911133615eusmtrp2ed989fffc1414750f73187076b5a049c~D26Jz3JM70862108621eusmtrp2k; Mon, 11 Sep 2023 13:36:15 +0000 (GMT) X-AuditID: cbfec7f2-a51ff7000002a5b7-60-64ff17cf1211 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id B9.BB.10549.FC71FF46; Mon, 11 Sep 2023 14:36:15 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230911133614eusmtip2b7efd7b129eb7cc246b92048d8b56b38~D26IXahex0323103231eusmtip2O; Mon, 11 Sep 2023 13:36: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 v2 3/7] thermal: exynos: switch from workqueue-driven interrupt handling to threaded interrupts Date: Mon, 11 Sep 2023 15:34:27 +0200 Message-ID: <20230911133435.14061-4-m.majewski2@samsung.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230911133435.14061-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrLKsWRmVeSWpSXmKPExsWy7djP87rnxf+nGOycZW7xYN42NovD8yss pj58wmbxfct1Jot5n2Ut9r7eym7x7UoHk8Wmx9dYLS7vmsNm8bn3CKPFjPP7mCwmHpvMbLH2 yF12i7lfpjJbPHnYx+bA77Fz1l12j8V7XjJ5bFrVyeZx59oeNo/NS+o9+rasYvT4vEkugD2K yyYlNSezLLVI3y6BK2PigwfMBT8lKna9im5gvCLSxcjJISFgIvGkq4+ti5GLQ0hgBaPEzlVd TBDOF0aJd5duMEI4nxklFjb9ZYVpufr1BFRiOaPElwk3WCCcViaJV0cnsoBUsQkYSDx4s4wd xBYRaGWUmNmkDlLELHCJWeLuzbVARRwcwgKFEttm6YPUsA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vCLSxcjJISFgInH16wnGLkYuDiGBpYwSszcsZ4FISEsc/jKFHcIWlvhzrYsN oqiZSWLKlRtgRWwCBhIP3ixjB0mICHQySnRtPscEkmAWuMUscf+1FogtLJAv8XnnE1YQm0VA VeLVxLlgNq+AjcT0k+egtslLPL91B2wbp4CtxNm104FsDqBtNhL9Z3QgygUlTs58wgIxXl6i eets5gmMArOQpGYhSS1gZFrFKJJaWpybnltsqFecmFtcmpeul5yfu4kRGHHbjv3cvINx3quP eocYmTgYDzFKcDArifCWHPqbIsSbklhZlVqUH19UmpNafIjRFOjsicxSosn5wJjPK4k3NDMw NTQxszQwtTQzVhLn9SzoSBQSSE8sSc1OTS1ILYLpY+LglGpgip9dvP6kUs9s9vdOAoGRFhvi ltxQu6x9MnEG43f3g1VatR8muNatq3ed6Z0nz+UmJTbx2cXQyWWrXT7tEjohtO+F6rXJ9x7r FUUEL+1+GNBaVzyfd+K7o0EHoiwS/uf5SW/cfdEjq/PF49WpmwwO/5tkIj57N69ZnOeag6tN qs/ubXGYMONuxHOb6QV9C4Wn6Lqt05zOsufGRW2uMo4Udk4eKz7xY6vnnda4JHVnNd+67Zyc 5syR8hvb4pxzNzq1VdnM9i3+F67Rv9Vc9sKMLX28f6QKPt9nqNh661NHl3dwlmOc05VT83xt hA8ulRJcWDf/tdU8OfUYSZY+Ce5nU9xa4xjj/6kmPnRKPi+rxFKckWioxVxUnAgA7Lfc0EED AAA= X-CMS-MailID: 20230911133615eucas1p123b3bed5bfa998bda65196d425f9b49d X-Msg-Generator: CA X-RootMTR: 20230911133615eucas1p123b3bed5bfa998bda65196d425f9b49d X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230911133615eucas1p123b3bed5bfa998bda65196d425f9b49d References: <20230911133435.14061-1-m.majewski2@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230911_063618_507230_F7151AF8 X-CRM114-Status: GOOD ( 18.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The workqueue boilerplate is mostly one-to-one what the threaded interrupts do. Signed-off-by: Mateusz Majewski Reviewed-by: Krzysztof Kozlowski --- 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..ba9414b419ef 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 Mon Sep 11 13:34: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: 13379353 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8EAF5EE7FF4 for ; Mon, 11 Sep 2023 13:36:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:References:MIME-Version:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PQ0XF34745C83awPd53KSCZhQJV+gW4JtfgKUxRTs2A=; b=cpGOMS76tTWixb oNJ4Mjoh8nqxObbBtJAUXE26nkvfer9dH2yF7qCEXSljmmI02Au1xsYpKCD+X9ydwUZ9QLRCmYdrf CbCtvOHWCQ1FFtJUNViPTs706XNzA5OKZpSvyyAYyzLzLsXxk62h8IL438taFd++vcswospeLH6sO cxz5C+ybYKD083E4bVCdjQ2mt4xvp6Hi/UURJe8WDh0sZrBAQPm+Ecc0ucLbk/QUGOlVWQky58EGn 8rwBeXtXeWJ5mFE8T4nwx+XDVbur3xaMXqFajy4aPUrjfSYeml7zpnwSW3+ABJqEJToaPOeI0zQ2X /9vptFbOZiKSuWgWBziw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qfh5W-000cb2-1M; Mon, 11 Sep 2023 13:36:26 +0000 Received: from mailout1.w1.samsung.com ([210.118.77.11]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qfh5P-000cXY-29 for linux-arm-kernel@lists.infradead.org; Mon, 11 Sep 2023 13:36:23 +0000 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20230911133617euoutp01bc86d1466e8f50cb41b6cdad34f7881b~D26LvYxhB2488224882euoutp01M for ; Mon, 11 Sep 2023 13:36:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20230911133617euoutp01bc86d1466e8f50cb41b6cdad34f7881b~D26LvYxhB2488224882euoutp01M DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1694439377; bh=XK7PxtizlL9SCG8mpzlPzuWhrWWnEfkUq3uRXLUzkvs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JhzOz5pi0iGal+9x88x/9a/faJyiiRDNUpkdAoaaE4KZbaSlXbSQ4GEXDLUj9TSBF HES1YrZO5P+uBmabW+AjMOwZIt5IBisORpoTBWgXYRyabWUcIS7ARXPzIEnKOMlF0Y tSsmov2rKJkNNPt4943Szhd4BOv2GojIE15XL3xo= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230911133617eucas1p2852362073e5b3efcfe5a588de775a982~D26LdnZAl1712617126eucas1p2m; Mon, 11 Sep 2023 13:36:17 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 5F.03.37758.1D71FF46; Mon, 11 Sep 2023 14:36:17 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20230911133616eucas1p10c5eeb0f0240dde975ccc5935cb5c311~D26LG-1cl1320013200eucas1p1r; Mon, 11 Sep 2023 13:36:16 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230911133616eusmtrp263c0d6531ca98ddf4e69411c98dadc0a~D26LGV6d60864008640eusmtrp2f; Mon, 11 Sep 2023 13:36:16 +0000 (GMT) X-AuditID: cbfec7f5-7ffff7000002937e-68-64ff17d13616 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id A1.8A.14344.0D71FF46; Mon, 11 Sep 2023 14:36:16 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230911133615eusmtip2d8a0d394a91b865243032bb81b27e6ea~D26KEkLPs3194931949eusmtip2U; Mon, 11 Sep 2023 13:36:15 +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 v2 4/7] thermal: exynos: simplify regulator (de)initialization Date: Mon, 11 Sep 2023 15:34:28 +0200 Message-ID: <20230911133435.14061-5-m.majewski2@samsung.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230911133435.14061-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrHKsWRmVeSWpSXmKPExsWy7djP87oXxf+nGLz6IWTxYN42NovD8yss pj58wmbxfct1Jot5n2Ut9r7eym7x7UoHk8Wmx9dYLS7vmsNm8bn3CKPFjPP7mCwmHpvMbLH2 yF12i7lfpjJbPHnYx+bA77Fz1l12j8V7XjJ5bFrVyeZx59oeNo/NS+o9+rasYvT4vEkugD2K yyYlNSezLLVI3y6BK+Pf3IMsBZ8kKm5/OcbYwDhDpIuRk0NCwETi8KMJrF2MXBxCAisYJS7c u88I4XxhlFi3aR47hPOZUeLEvt/sMC3HWicyQSSWM0rs7W6Aqmplkvg8fzITSBWbgIHEgzfL wDpEBFoZJWY2qYMUMQtcYpa4e3MtC0hCWCBA4v78I2wgNouAqsTTdx/A4rwCNhL/1u1hhlgn L/H81h2wQZwCthJn105nh6gRlDg58wlYPTNQTfPW2cwgCyQEmjklvm85zQLR7CLxsvc41CBh iVfHt0D9ICPxf+d8Jgg7X2LG5vdA9RxAdoXE3YNeEKa1xMczzCAms4CmxPpd+hDFjhIbNvxn h6jgk7jxV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YIRbISzy/dQdsGaeArcTZtdPZQVqFgGr6z+hAlAtKnJz5hAVi urxE89bZzBMYBWYhSc1CklrAyLSKUSS1tDg3PbfYSK84Mbe4NC9dLzk/dxMjMN62Hfu5ZQfj ylcf9Q4xMnEwHmKU4GBWEuEtOfQ3RYg3JbGyKrUoP76oNCe1+BCjKdDZE5mlRJPzgRGfVxJv aGZgamhiZmlgamlmrCTO61nQkSgkkJ5YkpqdmlqQWgTTx8TBKdXA1P/QzTnC3afI1HN27uaJ bW9aNJtCHxX0rft+4PRFzxD9hpvTn15do7F6y+Ja16+zdj/ZdCPVk0lXNncjo9etExv+dM8S ik3oFn6+8MPU46UOb6QTimsN3Z6uVvav337I78N5/l2qL1mNPGpmxEilZ/XPPLCrSOXDoVmT Oi+Uzmg63pd0SEjIWPhO9A9Hvtxf6Tp2h+K6XLbMMbqRq8K6oa/hgKXhsfWBx53F2idaHnS3 7j9mvER84ZFT3puSJ0W8niw04cyi1WEdbb83r2xZsfjQp1cFYbv38nQcvuhkELPk0v3yEP/P p0INjP+aWga3f1/m3Pdxj07nSzUBrf06tckONfLP4+8sC/QI1dW9pcRSnJFoqMVcVJwIAP7Z hWlAAwAA X-CMS-MailID: 20230911133616eucas1p10c5eeb0f0240dde975ccc5935cb5c311 X-Msg-Generator: CA X-RootMTR: 20230911133616eucas1p10c5eeb0f0240dde975ccc5935cb5c311 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230911133616eucas1p10c5eeb0f0240dde975ccc5935cb5c311 References: <20230911133435.14061-1-m.majewski2@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230911_063620_091801_8B11D575 X-CRM114-Status: GOOD ( 18.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This does reduce the error granularity a bit, but the code simplification seems to be worth it. Signed-off-by: Mateusz Majewski --- drivers/thermal/samsung/exynos_tmu.c | 33 +++++++--------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index ba9414b419ef..8451deb65f43 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,42 +992,34 @@ static int exynos_tmu_probe(struct platform_device *pdev) * TODO: Add regulator as an SOC feature, so that regulator enable * is a compulsory call. */ - data->regulator = devm_regulator_get_optional(&pdev->dev, "vtmu"); - if (!IS_ERR(data->regulator)) { - ret = regulator_enable(data->regulator); - if (ret) { - dev_err(&pdev->dev, "failed to enable vtmu\n"); - return ret; - } - } else { - if (PTR_ERR(data->regulator) == -EPROBE_DEFER) + ret = devm_regulator_get_enable_optional(&pdev->dev, "vtmu"); + if (ret) { + if (ret == -EPROBE_DEFER) return -EPROBE_DEFER; - dev_info(&pdev->dev, "Regulator node (vtmu) not found\n"); + dev_info(&pdev->dev, "Failed to get regulator node (vtmu)\n"); } ret = exynos_map_dt_data(pdev); if (ret) - goto err_sensor; + return ret; data->clk = devm_clk_get(&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; } } @@ -1099,10 +1089,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; } @@ -1117,9 +1103,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 Mon Sep 11 13:34: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: 13379355 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B608FEE7FF4 for ; Mon, 11 Sep 2023 13:36:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:References:MIME-Version:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=H26qbPmbhDmD9qJJDdMecm0+74o1HHdspCxC/hhaY4M=; b=BHb3oNUkvVMgL/ 63eZK8OodZPQPLOGdBiZLDDqIZVFTjHF8ckGAe/SS1XvzZH4aOW+aofbzHYr0qc90gh+DkiysJfzl r1Ttxwot6Zx1//2mgRWcMHY5Cix3tUN5CNFtwkVpR4k/VtxQBJdlOoh2RYrTOoCB6WWx7+UCP6gc8 jP74UV7LhK0YIFaxLGz+6K5SFIhAyijfCV0smw9XF1cwATlguUW2Ra62hSAttWZgLTUCFtJCnwaQu 6Z84x6yPimrD0zDJg4WLaywFEDxdDWHywc8suGUtDP42hNHmPC6GGUwb2j324iBkLGuMdBHUu54PG 4shqHKDsliPVSdC20xSQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qfh5a-000ccs-25; Mon, 11 Sep 2023 13:36:30 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qfh5R-000cYZ-1V for linux-arm-kernel@lists.infradead.org; Mon, 11 Sep 2023 13:36:27 +0000 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20230911133619euoutp02f96bb7bfb167b8884cd6f6a8c723022f~D26NvDfzM1422114221euoutp02I for ; Mon, 11 Sep 2023 13:36:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20230911133619euoutp02f96bb7bfb167b8884cd6f6a8c723022f~D26NvDfzM1422114221euoutp02I DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1694439379; bh=AAP3lLPpv5qsQMoGVy1YUvE2PsB1a2G8WmcojJFngHc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HtBGZ2S811lW7DksCnRHuiskKatvLOtRnzlmEhilIVAEq7Jw5gcrkSiQPFqZFvtDE vGHeT5KIg1DN9/5wvhwJBoOa0BD+y0CTawBKK2WkYfrL5wTS0rA+YVo4eikGIy0CS+ TxtERhwVFQy3jjOZZ9kvE3mSLXoYWtw2KaXK7lI8= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230911133619eucas1p26167a4c2db92fefc14bdf12855d54026~D26NXQxeB1560815608eucas1p2V; Mon, 11 Sep 2023 13:36:19 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 5B.B1.42423.3D71FF46; Mon, 11 Sep 2023 14:36:19 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20230911133618eucas1p2d40b075ee6baebbec9f991eb01f21d89~D26M5xJ5x2314623146eucas1p2d; Mon, 11 Sep 2023 13:36:18 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230911133618eusmtrp22a0face45ce4adcde68bbd79a49352ed~D26M5AlLS0862108621eusmtrp2u; Mon, 11 Sep 2023 13:36:18 +0000 (GMT) X-AuditID: cbfec7f2-a3bff7000002a5b7-6b-64ff17d3cd0b Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id C3.8A.14344.2D71FF46; Mon, 11 Sep 2023 14:36:18 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230911133617eusmtip25e8141ecc53adabce50419a6af992bef~D26L0r9QR0735907359eusmtip22; Mon, 11 Sep 2023 13:36:17 +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 v2 5/7] thermal: exynos: stop using the threshold mechanism on Exynos 4210 Date: Mon, 11 Sep 2023 15:34:29 +0200 Message-ID: <20230911133435.14061-6-m.majewski2@samsung.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230911133435.14061-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrPKsWRmVeSWpSXmKPExsWy7djP87qXxf+nGPSuErV4MG8bm8Xh+RUW Ux8+YbP4vuU6k8W8z7IWe19vZbf4dqWDyWLT42usFpd3zWGz+Nx7hNFixvl9TBYTj01mtlh7 5C67xdwvU5ktnjzsY3Pg99g56y67x+I9L5k8Nq3qZPO4c20Pm8fmJfUefVtWMXp83iQXwB7F ZZOSmpNZllqkb5fAlXH9xRbGgpX8FYdaP7E0ML7j6WLk5JAQMJG4umACYxcjF4eQwApGiWkf n7FAOF8YJX5t/8IM4XxmlLi78QsrTMvDX0ehqpYzSjTe38YO4bQySez+cIIFpIpNwEDiwZtl 7CC2iEAro8TMJnWQImaBS8wSd2+uBSsSFoiRODbtO5jNIqAqsfP+UbAVvAI2EpcXvmeGWCcv 8fzWHbBBnAK2EmfXTmeHqBGUODnzCVgvM1BN89bZYLdKCDRzSnxrbIK61UXi7KpNjBC2sMSr 41vYIWwZif875zNB2PkSMza/BxrEAWRXSNw96AVhWkt8PMMMYjILaEqs36UPUewocXbXMkaI Cj6JG28FIQ7gk5i0bTozRJhXoqNNCKJaVeL4nklQf0hLPGm5DbXSQ+LH5x9MExgVZyF5ZRaS V2Yh7F3AyLyKUTy1tDg3PbXYMC+1XK84Mbe4NC9dLzk/dxMjMI2d/nf80w7Gua8+6h1iZOJg PMQowcGsJMJbc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tSg/vqg0J7X4EKMp0NkTmaVEk/OBMZ9XEm9o ZmBqaGJmaWBqaWasJM7rWdCRKCSQnliSmp2aWpBaBNPHxMEp1cC05lnwZP3FL3Vzj0SIdU3a FWSTHu50+btF4M8ANi+FazyBR17/XnX1Cc+boAlvdU4L2k7jDJBsriw4e/r05SOMoSvuWs9/ ey/XIbVi49poL4tYNt/cqFp+K9t9hzbuWbD67tRpi79veRb2J11+17evL14nNn0VV3A6v6ml mu37IcdpkRHWe+02uq+yT5pkH9vpX/Nu/422L3wZQVtqXWwMDn14/njvX1f7UwwrO4KOa919 demj/sRs8/IJa/xXHZVWKjr7/oQt8ySjILuqinPfuTl1xF+UbLVUmNARLJ7Y/2He3ZcbZr/q mvb40/TF+UuZvJObOLavavXbMiF4TmJfnPuCD8KMf8qshDTnF6+qUWIpzkg01GIuKk4EADSU f/RBAwAA X-CMS-MailID: 20230911133618eucas1p2d40b075ee6baebbec9f991eb01f21d89 X-Msg-Generator: CA X-RootMTR: 20230911133618eucas1p2d40b075ee6baebbec9f991eb01f21d89 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230911133618eucas1p2d40b075ee6baebbec9f991eb01f21d89 References: <20230911133435.14061-1-m.majewski2@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230911_063621_896518_E1BB2B8F X-CRM114-Status: GOOD ( 18.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Exynos 4210 supports setting a base threshold value, which is added to all trip points. This might be useful, but is not really necessary in our usecase, so we always set it to 0 to simplify the code a bit. Additionally, this change makes it so that we convert the value to the calibrated one in a slightly different place. This is more correct morally, though it does not make any change when single-point calibration is being used (which is the case currently). Reviewed-by: Krzysztof Kozlowski Signed-off-by: Mateusz Majewski --- drivers/thermal/samsung/exynos_tmu.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 8451deb65f43..77afbf9f2db0 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 Mon Sep 11 13:34: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: 13379356 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C00B7EEB57D for ; Mon, 11 Sep 2023 13:36:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:References:MIME-Version:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DVbOpM9zJfj5vEKu5mY5pHIH3vg7ZeEMIPDLypeuXeM=; b=eDZP2Rt0ykixym o0qICA319Onr2/jksUEIYxDhfRNptM7z5cD+rWnj/FwYVbw7LK4uyHfiiXsw3kNoQeAKlr+EWQCa9 B2XYcI/F67PU3udX8k6dt+DnFzHu83GN4UFTaXhe3jDmE7M361qDUflEBqdP8SQYzcyxIUJoyzeNN zd+4oQQSeDZ5fh4AnayZyM+zsjkDOMLsvqf/Vn+2LziES+c8dd2D7dDqjjENfwL8ev9MO67IA7SGS awQvTUlIrcJUpFemqw9CjwFniMNqTEPG0wjs/hx58s+dra4oTD9EPcN70h5a8bt35iWJrT+sG+5GE Tfl4vSlaHbktVcqHqGMQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qfh5a-000ccQ-0P; Mon, 11 Sep 2023 13:36:30 +0000 Received: from mailout1.w1.samsung.com ([210.118.77.11]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qfh5T-000cZJ-2Y for linux-arm-kernel@lists.infradead.org; Mon, 11 Sep 2023 13:36:26 +0000 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20230911133621euoutp01e39e89a3295b96b48318da4b3f0ac17d~D26PMk2Mi2283422834euoutp01S for ; Mon, 11 Sep 2023 13:36:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20230911133621euoutp01e39e89a3295b96b48318da4b3f0ac17d~D26PMk2Mi2283422834euoutp01S DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1694439381; bh=AHRUH7iv0+JjlcsKRA9WgTab92k33Ne0onjy9WkFjoQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ls2WySLP+bdPSsdu80HvhvF/+o5fw744lkgNiBkT0ER247DILu1Cz8gOWgG0z/eRM BtnHSuGOZVj62ct4YN704VzelERJlS1zD2CvYNAufv8RH0DeU2HnfzF7QR00L1Eq+u uybfqTp7Mvmea1aIhw69Qz5GpO5nysCa7r5HWXvo= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230911133621eucas1p22a8ec8768ab851d4e58c47518c002376~D26O2XA2e1712617126eucas1p2s; Mon, 11 Sep 2023 13:36:21 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id A3.13.37758.4D71FF46; Mon, 11 Sep 2023 14:36:20 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20230911133620eucas1p27a0d0f480638c97fa59bf9c4f34a02cb~D26OeqwID0331103311eucas1p28; Mon, 11 Sep 2023 13:36:20 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230911133620eusmtrp267269e8199ae0082d7e133eb8ff20c7d~D26Od9wl60864008640eusmtrp2s; Mon, 11 Sep 2023 13:36:20 +0000 (GMT) X-AuditID: cbfec7f5-7ffff7000002937e-74-64ff17d4ac0b Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id B8.8A.14344.4D71FF46; Mon, 11 Sep 2023 14:36:20 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230911133619eusmtip227c9f2ad6cd3f8dbcaf512ab8f14f89d~D26NNk7cJ0797807978eusmtip2f; Mon, 11 Sep 2023 13:36:19 +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 v2 6/7] thermal: exynos: split initialization of TMU and the thermal zone Date: Mon, 11 Sep 2023 15:34:30 +0200 Message-ID: <20230911133435.14061-7-m.majewski2@samsung.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230911133435.14061-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrLKsWRmVeSWpSXmKPExsWy7djP87pXxP+nGEw5aWnxYN42NovD8yss pj58wmbxfct1Jot5n2Ut9r7eym7x7UoHk8Wmx9dYLS7vmsNm8bn3CKPFjPP7mCwmHpvMbLH2 yF12i7lfpjJbPHnYx+bA77Fz1l12j8V7XjJ5bFrVyeZx59oeNo/NS+o9+rasYvT4vEkugD2K yyYlNSezLLVI3y6BK2PTj/ksBRPVKvYenM7YwPhDrouRk0NCwETi25tWxi5GLg4hgRWMEqtu PGKDcL4wSnQ/mcYCUiUk8JlRYtb0cpiOJa86WSGKljNKHNl+iAnCaWWSeLlmPVgHm4CBxIM3 y9hBbBGBVkaJmU3qIEXMApeYJe7eXAtUxMEhLBAt8WqCF0gNi4CqxIL3N5lAbF4BG4mLW5cx QmyTl3h+6w7YHE4BW4mza6ezQ9QISpyc+QRsFzNQTfP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Yk/17rYIGqa mSQ2fc8AsdkEDCQevFkGVMPFISLQySjRtfkcE0iCWeAWs8T911ogtrBApMTmP5vAmlkEVCUW vL8JVsMrYCNxcesyRogF8hLPb90BW8YpYCtxdu10IJsDaJmNRP8ZHYhyQYmTM5+wQIyXl2je Opt5AqPALCSpWUhSCxiZVjGKpJYW56bnFhvpFSfmFpfmpesl5+duYgTG27ZjP7fsYFz56qPe IUYmDsZDjBIczEoivCWH/qYI8aYkVlalFuXHF5XmpBYfYjQFOnsis5Rocj4w4vNK4g3NDEwN TcwsDUwtzYyVxHk9CzoShQTSE0tSs1NTC1KLYPqYODilGpj4j64Ksi1p32+99c987Z6Vv69v iHn/3ubmzYUnLxwXnPEkoXZWqMSX7VsONz1zXKA68cuFAyqHUt7ssfXQ8e+cdFc5benhL9uu 3GkOuuhhGPo2TPTbwZxrTV2Lrh1UnlLE3vmB3WzJorUbMpK1Ol5tyBZcJHJ04sLux6YcnZGp j78o/3rLkX1GjFn0pk/s9BU8u9wf8238/dzqab7tRzVreadF198+aLGz23XX3e2CrGc/x9PS wqR8t+fWGqsi7HdVXrSJOzpp8SbuphlLlHdc3TNr7lQ1FqaLc6et+bfL2iBSyeHghVe28g+F qwPXOIt1pZ6qSylIWF8xoTeMdefisil7r2a/XN+5aZbp5NovukosxRmJhlrMRcWJAHfPoRdA AwAA X-CMS-MailID: 20230911133620eucas1p27a0d0f480638c97fa59bf9c4f34a02cb X-Msg-Generator: CA X-RootMTR: 20230911133620eucas1p27a0d0f480638c97fa59bf9c4f34a02cb X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230911133620eucas1p27a0d0f480638c97fa59bf9c4f34a02cb References: <20230911133435.14061-1-m.majewski2@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230911_063624_209098_36C27CB3 X-CRM114-Status: GOOD ( 23.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- 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 77afbf9f2db0..7b23ec73f93a 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; } @@ -1038,10 +1052,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)) { @@ -1052,9 +1068,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 Mon Sep 11 13:34: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: 13379357 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 55B0EEE57DF for ; Mon, 11 Sep 2023 13:37:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:References:MIME-Version:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HzlTKp1Juc4CiaiZWeX6GBFrikiwasRdVtY74wwckNU=; b=xZL+1jIuLuOn46 D0XUrJ2r8MLEf2Vs3rLv5rC5vyzrhk3pXUL504at3r3LJhTcTCORapHVvcsxDgzhl4td36OFXj+ou 4WSOHGU5nv+OCUKlzI+rBWEnhZqi5X26NoDNHt9kOCdR5D7I6Ks3D8sXKXvVItGsv7LRzGizS6rW1 CoNl7iDwH3BN7+qhAPEbGYLEczSZ4HYwCSKgW1vA2s4lnTciGTsk4gdx0C68z0hrVocBRz5poGK4k PgLNogsue/oYSAigRQbQPrk5CDZgqiZI0mk3XW2DJH0vfFfjoClAwt5/ry9A/6awCgkNp3hRcahyp i5gSTb2DilhaIihVY2Ng==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qfh5e-000cet-31; Mon, 11 Sep 2023 13:36:34 +0000 Received: from mailout1.w1.samsung.com ([210.118.77.11]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qfh5V-000ca4-2w for linux-arm-kernel@lists.infradead.org; Mon, 11 Sep 2023 13:36:29 +0000 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20230911133623euoutp010d661e3fd35b6041834ec38f9fb27ccc~D26RcisBh2283922839euoutp01N for ; Mon, 11 Sep 2023 13:36:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20230911133623euoutp010d661e3fd35b6041834ec38f9fb27ccc~D26RcisBh2283922839euoutp01N DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1694439383; bh=K1X4F1+qpvpsy7/LqvjjMKRf/OuSoXogge+V1JLoBIQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tgboJFSfvxcxnQsrGka36ELyD/8iH5nU4TCG9t/EglnexMTpJr+h9fedPXvWwXBKJ lyI2lcfStmPfz+HZBjxBEk9PxJTKGHToAGW2JpmwaUjMX2p/rZydDs8zo97PzjKYN+ MR1Z5hsyYcqh9V0UFx2RrQGGw617VbRVb8Etrjxg= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230911133622eucas1p2b8c930566154ddd02b1e0fd338e4d352~D26QoOtZf0333903339eucas1p2U; Mon, 11 Sep 2023 13:36:22 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id A0.C1.42423.6D71FF46; Mon, 11 Sep 2023 14:36:22 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20230911133622eucas1p2d27118647d37fa2fe2973773f70359c4~D26QGurLd0331103311eucas1p2A; Mon, 11 Sep 2023 13:36:22 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230911133622eusmtrp2707164b800192825b48c11a15749bf3b~D26QF-msC0862108621eusmtrp2D; Mon, 11 Sep 2023 13:36:22 +0000 (GMT) X-AuditID: cbfec7f2-a51ff7000002a5b7-7c-64ff17d63e3c Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 75.CB.10549.6D71FF46; Mon, 11 Sep 2023 14:36:22 +0100 (BST) Received: from AMDC4515.eu.corp.samsungelectronics.net (unknown [106.120.51.28]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230911133621eusmtip2c2d1ecc75aea807168a6b8a75a54a05f~D26O5dmwe0058100581eusmtip24; Mon, 11 Sep 2023 13:36:20 +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 v2 7/7] thermal: exynos: use set_trips Date: Mon, 11 Sep 2023 15:34:31 +0200 Message-ID: <20230911133435.14061-8-m.majewski2@samsung.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230911133435.14061-1-m.majewski2@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrPKsWRmVeSWpSXmKPExsWy7djP87rXxP+nGOx+rmvxYN42NovD8yss pj58wmbxfct1Jot5n2Ut9r7eym7x7UoHk8Wmx9dYLS7vmsNm8bn3CKPFjPP7mCwmHpvMbLH2 yF12i7lfpjJbPHnYx+bA77Fz1l12j8V7XjJ5bFrVyeZx59oeNo/NS+o9+rasYvT4vEkugD2K yyYlNSezLLVI3y6BK2PHxSbmgoOrGStWHZrE2sD4poexi5GTQ0LAROLq9wYmEFtIYAWjxOue iC5GLiD7C6PEtBntTBDOZ0aJz+fmMMF0bLj+F6pjOaPEqy4piKJWJok9f+eDJdgEDCQevFnG DmKLCLQySsxsUgcpYha4xCxx9+ZaFpCEsICZxIFPp1hBbBYBVYn5Mx+DNfAK2EhMP3mMHWKb vMTzW3fAbE4BW4mza6dD1QhKnJz5BGwOM1BN89bZzCALJASaOSVOvzgB1ewi8ehuKwuELSzx 6vgWqLiMxP+d86HeyZeYsfk9UA0HkF0hcfegF4RpLfHxDDOIySygKbF+lz5EsaPExQO/WCEq +CRuvBWEOIBPYtK26cwQYV6JjjYhiGpVieN7JjFD2NIST1puQ630kJh29AH7BEbFWUhemYXk lVkIexcwMq9iFE8tLc5NTy02zEst1ytOzC0uzUvXS87P3cQITGOn/x3/tINx7quPeocYmTgY DzFKcDArifCWHPqbIsSbklhZlVqUH19UmpNafIhRmoNFSZxX2/ZkspBAemJJanZqakFqEUyW iYNTqoEprsSzcmOjhOQWJ4PwnQtcTre6nqtaYXx6jjRn2RSNSN1m95ft/o53NmpKrvI1Zua+ nZ8/afYtf+O52+TjfyqYXVi3lssgxOlIHv+E/4nBp7Xmrbrhlyb9au8/8cJXYo3fDLorJMR7 NCvzfjnMyfa9riE8V5efYf2uApNZFyNW66vNULhdeDjohOivlZ9buj5mcZZ7WJo6Tz6i7qcv Xi+/f2l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x2SXBM6jizz+SK87mXd+yWNamY7d1n123OU7HRfskxchH3a66/9 KbV7v20TX/BIbfIhUe/2bk9RjRKFVQ8ypwutY/XpldvNxvhE9btk9tYVP57deayRa/x7F7te qoS4XdIkxcOMJuKx7xUm2pv9vif49rU10xqryYe+qBzumHH84z0lluKMREMt5qLiRAA9/2t+ RAMAAA== X-CMS-MailID: 20230911133622eucas1p2d27118647d37fa2fe2973773f70359c4 X-Msg-Generator: CA X-RootMTR: 20230911133622eucas1p2d27118647d37fa2fe2973773f70359c4 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230911133622eucas1p2d27118647d37fa2fe2973773f70359c4 References: <20230911133435.14061-1-m.majewski2@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230911_063626_346873_3BD46A97 X-CRM114-Status: GOOD ( 29.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- v1 -> v2: We take clocks into account; anything that sets temperature thresholds needs clk. drivers/thermal/samsung/exynos_tmu.c | 397 +++++++++++++++------------ 1 file changed, 223 insertions(+), 174 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 7b23ec73f93a..44ab9d9ae30d 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,56 @@ static void exynos_tmu_control(struct platform_device *pdev, bool on) mutex_unlock(&data->lock); } -static void exynos4210_tmu_set_trip_temp(struct exynos_tmu_data *data, - int trip_id, u8 temp) +static void exynos_tmu_update_bit(struct exynos_tmu_data *data, int reg_off, + int bit_off, bool enable) { - temp = temp_to_code(data, temp); - writeb(temp, data->base + EXYNOS4210_TMU_REG_TRIG_LEVEL0 + trip_id * 4); + u32 interrupt_en; + + interrupt_en = readl(data->base + reg_off); + if (enable) + interrupt_en |= 1 << bit_off; + else + interrupt_en &= ~(1 << bit_off); + writel(interrupt_en, data->base + reg_off); } -/* failing thresholds are not supported on Exynos4210 */ -static void exynos4210_tmu_set_trip_hyst(struct exynos_tmu_data *data, - int trip, u8 temp, u8 hyst) +static void exynos4210_tmu_set_low_temp(struct exynos_tmu_data *data, u8 temp) { + /* Failing thresholds are not supported on Exynos 4210. + * We use polling instead. + */ +} + +static void exynos4210_tmu_set_high_temp(struct exynos_tmu_data *data, u8 temp) +{ + temp = temp_to_code(data, temp); + writeb(temp, data->base + EXYNOS4210_TMU_REG_TRIG_LEVEL0 + 4); + exynos_tmu_update_bit(data, EXYNOS_TMU_REG_INTEN, + EXYNOS_TMU_INTEN_RISE0_SHIFT + 4, true); +} + +static void exynos4210_tmu_disable_low(struct exynos_tmu_data *data) +{ + /* Again, this is handled by polling. */ +} + +static void exynos4210_tmu_disable_high(struct exynos_tmu_data *data) +{ + exynos_tmu_update_bit(data, EXYNOS_TMU_REG_INTEN, + EXYNOS_TMU_INTEN_RISE0_SHIFT + 4, false); +} + +static void exynos4210_tmu_set_crit_temp(struct exynos_tmu_data *data, u8 temp) +{ + /* Hardware critical temperature handling is not supported on Exynos 4210. + * We still set the critical temperature threshold, but this is only to + * make sure it is handled as soon as possible. It is just a normal interrupt. + */ + + temp = temp_to_code(data, temp); + writeb(temp, data->base + EXYNOS4210_TMU_REG_TRIG_LEVEL0 + 12); + exynos_tmu_update_bit(data, EXYNOS_TMU_REG_INTEN, + EXYNOS_TMU_INTEN_RISE0_SHIFT + 12, true); } static void exynos4210_tmu_initialize(struct platform_device *pdev) @@ -376,33 +396,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 +468,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 +554,47 @@ static void exynos5433_tmu_initialize(struct platform_device *pdev) cal_type ? 2 : 1); } -static void exynos7_tmu_set_trip_temp(struct exynos_tmu_data *data, - int trip, u8 temp) +static void exynos7_tmu_update_temp(struct exynos_tmu_data *data, u8 temp, + int idx, bool rise) { unsigned int reg_off, bit_off; u32 th; + void __iomem *reg; - reg_off = ((7 - trip) / 2) * 4; - bit_off = ((8 - trip) % 2); + reg_off = ((7 - idx) / 2) * 4; + bit_off = ((8 - idx) % 2); - th = readl(data->base + EXYNOS7_THD_TEMP_RISE7_6 + reg_off); + reg = data->base + + (rise ? EXYNOS7_THD_TEMP_RISE7_6 : EXYNOS7_THD_TEMP_FALL7_6) + + reg_off; + th = readl(reg); th &= ~(EXYNOS7_TMU_TEMP_MASK << (16 * bit_off)); th |= temp_to_code(data, temp) << (16 * bit_off); - writel(th, data->base + EXYNOS7_THD_TEMP_RISE7_6 + reg_off); + writel(th, reg); + + exynos_tmu_update_bit(data, EXYNOS5433_TMU_REG_INTEN, + (rise ? EXYNOS7_TMU_INTEN_RISE0_SHIFT : + EXYNOS_TMU_INTEN_FALL0_SHIFT) + + idx, + true); } -static void exynos7_tmu_set_trip_hyst(struct exynos_tmu_data *data, - int trip, u8 temp, u8 hyst) +static void exynos7_tmu_set_low_temp(struct exynos_tmu_data *data, u8 temp) { - unsigned int reg_off, bit_off; - u32 th; + exynos7_tmu_update_temp(data, temp, 0, false); +} - reg_off = ((7 - trip) / 2) * 4; - bit_off = ((8 - trip) % 2); +static void exynos7_tmu_set_high_temp(struct exynos_tmu_data *data, u8 temp) +{ + exynos7_tmu_update_temp(data, temp, 1, true); +} - th = readl(data->base + EXYNOS7_THD_TEMP_FALL7_6 + reg_off); - th &= ~(EXYNOS7_TMU_TEMP_MASK << (16 * bit_off)); - th |= temp_to_code(data, temp - hyst) << (16 * bit_off); - writel(th, data->base + EXYNOS7_THD_TEMP_FALL7_6 + reg_off); +static void exynos7_tmu_set_crit_temp(struct exynos_tmu_data *data, u8 temp) +{ + /* Like Exynos 4210, Exynos 7 does not seem to support critical temperature + * handling in hardware. Again, we still set a separate interrupt for it. + */ + exynos7_tmu_update_temp(data, temp, 7, true); } static void exynos7_tmu_initialize(struct platform_device *pdev) @@ -547,87 +609,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 +654,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 +891,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 +912,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 +933,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 +953,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 +998,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)