From patchwork Sun May 15 06:41:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 12849999 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 217E2C433EF for ; Sun, 15 May 2022 06:43:15 +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:MIME-Version:References: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=dhAA+AK7V1qljj/JcukMIanYrh7ZPUEk7SOkmIIPe10=; b=PkBh9GVgwwKxmb hioOSd6AIsDEjF3R4PlsK5pv041S6q/ATFbRHdzkRN04k4N/6RhZNQYde6f21VFNg+K60U5HjMJr0 u4ZLM7mBlLqaPYSoK059ex6gwWRGUbM+PnbQteqavGm086KY/IkZ5pu7CvAPKJREXDUuIbUmtXhn+ gPwSKu20t2yy/9K0g7z5z3jT4wlItgrW1/pCBxc1ROHxGShFw6MZIJhfHI1+YopmXVdB9bC3CIg5c 2hFbxHv4v8VcWAQL3/5iPFroWJFkBaHpwRtqtVqjtt/djF8nEbNLZZbxlSbmmvTulT6li5J4NT3D3 ugi+TX4pwIAfNIUvGSWA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nq7xD-003Jl4-FX; Sun, 15 May 2022 06:42:11 +0000 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nq7xB-003JkK-4K for linux-arm-kernel@lists.infradead.org; Sun, 15 May 2022 06:42:10 +0000 Received: by mail-pl1-x636.google.com with SMTP id s14so11653212plk.8 for ; Sat, 14 May 2022 23:42:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yUsWY8yO7JINjNZjm2YNwG/QCXLT5+H4ss9vbx5Zd0w=; b=W4TO+xCxh/8tDfBX3UQBWoDFjUykmIMldo50JqnI8/SRLznz0WeUDf2jrPuAak/fEc t0QcGx0qKWPl3sPVp8I3sfh3FrZ1GS6nVFhJcbopsv6a70Pvr4eVBWY3JVGv518rCGY1 Tu04TkWzKudEwoLfCxRM/sq7beVEHT6QHN/1SFx05fsnvWefiAX9XNbxgG3M1MkU56c3 3I4A0NkgAAVOQ5csvjbjjggxw0ZHIQVEFk9DzLazqqT5A0kKrfuw4y/2u+bZtK5TXt+J YslAF7jV2r2s8pEwWPcqDokf3RkqthbSb/G7APGMRHe/Oq82/1anL3BDCM3y9MvXIzNz +EAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yUsWY8yO7JINjNZjm2YNwG/QCXLT5+H4ss9vbx5Zd0w=; b=kTZg1C5tOCo313VROrL6zZ851spJZyJcRKTTun8SMFP/dsoJKJ0/TtRNebpi1+jJbx IfdaS4QNEAT0HugMPUIFNDScrg/4qaOa/oYF5Q02zcPGN2P1v7ze8Dtb4WDkULdsj+W2 qY5V1Tm5sP6XzO14GUq3Hrpdc94UB8v8mwpBWLXAUC/1bbgWCY0gPoWw1QfjgU9YbQM/ +ZJIYauu0yf7C1rwRPSWuMHDsNX+XHSe5+n+CgHYRMO1fKb20kF8/TLQ0EWzj0Yb5xpO B8RL/S3slicPJdst2JgQWTz9AVHsFN5kick+GYKqZyD4BNicxT4DG8PeU/2/nYYpmmXL TtIA== X-Gm-Message-State: AOAM531wiMPEbLLIFmA8npapvqVxcuFXKacl0le85NT6w5ZssIvWT8D1 rSGklGscJqFVU1cbmpq/yZ0= X-Google-Smtp-Source: ABdhPJz33p0ux51f2WvaEY+nQUYH4tVmxqP3fLiRfjM7Jqpa5ngaRasABu7YzWql7RGfMLkmAYYzKw== X-Received: by 2002:a17:90b:350d:b0:1dc:6680:6f1d with SMTP id ls13-20020a17090b350d00b001dc66806f1dmr24421442pjb.27.1652596927259; Sat, 14 May 2022 23:42:07 -0700 (PDT) Received: from alarm.. ([103.51.72.28]) by smtp.gmail.com with ESMTPSA id g24-20020a170902d5d800b0015e8d4eb2e3sm4568687plh.301.2022.05.14.23.42.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 May 2022 23:42:06 -0700 (PDT) From: Anand Moon To: Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Alim Akhtar , linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Anand Moon Subject: [PATCHv2 1/6] thermal: exynos: Enable core tmu hardware clk flag on exynos platform Date: Sun, 15 May 2022 06:41:18 +0000 Message-Id: <20220515064126.1424-2-linux.amoon@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220515064126.1424-1-linux.amoon@gmail.com> References: <20220515064126.1424-1-linux.amoon@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220514_234209_211255_747E8F85 X-CRM114-Status: GOOD ( 14.44 ) 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 Use clk_prepare_enable api to enable tmu internal hardware clock flag on, use clk_disable_unprepare to disable the clock. Cc: Bartlomiej Zolnierkiewicz Signed-off-by: Anand Moon --- v1: split te changes and improve the commit message. --- drivers/thermal/samsung/exynos_tmu.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index f4ab4c5b4b62..75b3afadb5be 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -1054,14 +1054,14 @@ static int exynos_tmu_probe(struct platform_device *pdev) goto err_sensor; } } else { - ret = clk_prepare(data->clk_sec); + ret = clk_prepare_enable(data->clk_sec); if (ret) { dev_err(&pdev->dev, "Failed to get clock\n"); goto err_sensor; } } - ret = clk_prepare(data->clk); + ret = clk_prepare_enable(data->clk); if (ret) { dev_err(&pdev->dev, "Failed to get clock\n"); goto err_clk_sec; @@ -1122,10 +1122,10 @@ static int exynos_tmu_probe(struct platform_device *pdev) err_sclk: clk_disable_unprepare(data->sclk); err_clk: - clk_unprepare(data->clk); + clk_disable_unprepare(data->clk); err_clk_sec: if (!IS_ERR(data->clk_sec)) - clk_unprepare(data->clk_sec); + clk_disable_unprepare(data->clk_sec); err_sensor: if (!IS_ERR(data->regulator)) regulator_disable(data->regulator); @@ -1142,9 +1142,9 @@ static int exynos_tmu_remove(struct platform_device *pdev) exynos_tmu_control(pdev, false); clk_disable_unprepare(data->sclk); - clk_unprepare(data->clk); + clk_disable_unprepare(data->clk); if (!IS_ERR(data->clk_sec)) - clk_unprepare(data->clk_sec); + clk_disable_unprepare(data->clk_sec); if (!IS_ERR(data->regulator)) regulator_disable(data->regulator); From patchwork Sun May 15 06:41:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 12850000 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 3FE35C433EF for ; Sun, 15 May 2022 06:43:25 +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:MIME-Version:References: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=BXynZrOPQwZD4V0hsgKbtWQrm/pzw77zEl3gLg7ik4A=; b=gLLYmYnTVrTppm a4JtXumM0Ih9r+agRmakiZ+ww1Tyk98426StVdBF5f1p8X2uESpQHuHZRS/CF0ymAosr2mSay2nVx MF+4xStBVaaHDuOwY09MV7ZtlO1ofODTiW2elbIaMOwJjTYYpnLQOGZTH3wPU7rdHMqsOpt+wU2Xk GLV35siQIHOJJ9POHjv7XTm9RB8rH/3pLfJYd7SLxrL85IuDx4AWLRa59SG5FwhWyT0h/wISpQu/L 51HqabRXyoCKn8I9bgWWXkDW1oUcW0OYKO53UumARVP6RGZRBq3X7ryjGfz07vnhHhMK+1Dsj/VX4 j6vEJei/EvcjZI2HG2vg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nq7xM-003JoJ-Jj; Sun, 15 May 2022 06:42:20 +0000 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nq7xI-003Jm7-0L for linux-arm-kernel@lists.infradead.org; Sun, 15 May 2022 06:42:17 +0000 Received: by mail-pj1-x1033.google.com with SMTP id cu23-20020a17090afa9700b001d98d8e53b7so10916338pjb.0 for ; Sat, 14 May 2022 23:42:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RNX8IttIs7gPKZ/ZnlljxMvfqRG5qWD1gnAXVMMqp+0=; b=XEBWuyekW9Udsy/Vmpi4TY/XNvR6qWx5rXCSqsQu38ntjFvrZ7UBEto6MpPBdQJnzp H/QYIJJVqffc+impBIGZY/MgvA6BcxfpypE61Mv5qsOkhdyooPNwgtunUKmau/HX6NHB jlmk2eGVS+8L5jSUCeHPBenPyLuAWSCf5azOXgnp06e7zouH7VdOzz2MHJyrJbnkAEHs pKZtPck8GEuNzxbYjkerb3Y4Ob2PUYY3uBLf4/WDR5fHiVARgxItMmdrluI7oX0g8+Wy QGGGu4wbaA83ceJnAikUtq37nFoDIa9sRNceKxsp2XAzM5oTC9mCnlyesgVnHxR9FBKC AOvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RNX8IttIs7gPKZ/ZnlljxMvfqRG5qWD1gnAXVMMqp+0=; b=X9ShFLQq/Il+Zlq87k2Hw/gYe+USWq2C2A0kQzZvfL88zEHaiJVjek52vipnKUCqpd 26XlQoEbFyAaIqt1i4RXa04xNgUMC2EGzii1vUHtYGNo7ru+u54PQ/laJyjOIH/R4FqL ad4zpsF5qkBvd5mkxLu7OvXyNcLLA91gUWWkBHhpFi90/0g/EZA7+hVUEN98n849UweY 13dPajdfRcT/9kJdUst0CWu5NIRdI07iReR/XjdRyxSfyVN1lKXG8C5rlsjSbklIAEmI YvkiHzq4oIxQ8MOpNivh0BjMkNxu5gU7Lq5MmM3feesJ8EwxWW64CK6f5lz+tflW3H1n mXcw== X-Gm-Message-State: AOAM530QKgvWn685Uwq7MoSMqTmgUR9zClKxMDDOBqc/j9u4aKqP4VpK ZYQ0zH5U8TE4WcIJ3BYyaiI= X-Google-Smtp-Source: ABdhPJyT8+/XLu+q/7btdUnRMr1o9G/m+//8acAzxbS43SlpLD4HVZDMbTlxRTchAJLWw+4FK5O7pQ== X-Received: by 2002:a17:90a:f2ce:b0:1d9:a18f:87f3 with SMTP id gt14-20020a17090af2ce00b001d9a18f87f3mr24550386pjb.213.1652596934488; Sat, 14 May 2022 23:42:14 -0700 (PDT) Received: from alarm.. ([103.51.72.28]) by smtp.gmail.com with ESMTPSA id g24-20020a170902d5d800b0015e8d4eb2e3sm4568687plh.301.2022.05.14.23.42.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 May 2022 23:42:14 -0700 (PDT) From: Anand Moon To: Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Alim Akhtar , linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Anand Moon Subject: [PATCHv2 2/6] thermal: exynos: Reorder the gpu clock initialization for exynos5420 SoC Date: Sun, 15 May 2022 06:41:19 +0000 Message-Id: <20220515064126.1424-3-linux.amoon@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220515064126.1424-1-linux.amoon@gmail.com> References: <20220515064126.1424-1-linux.amoon@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220514_234216_087208_7238A3E1 X-CRM114-Status: GOOD ( 16.30 ) 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 Reorder the tmu_gpu clock initialization for exynos5422 SoC. Cc: Bartlomiej Zolnierkiewicz Signed-off-by: Anand Moon --- v1: split the changes and improve the commit messages --- drivers/thermal/samsung/exynos_tmu.c | 43 ++++++++++++++-------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 75b3afadb5be..1ef90dc52c08 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -1044,42 +1044,41 @@ static int exynos_tmu_probe(struct platform_device *pdev) dev_err(&pdev->dev, "Failed to get clock\n"); ret = PTR_ERR(data->clk); goto err_sensor; - } - - 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; - } } else { - ret = clk_prepare_enable(data->clk_sec); + ret = clk_prepare_enable(data->clk); if (ret) { dev_err(&pdev->dev, "Failed to get clock\n"); goto err_sensor; } } - ret = clk_prepare_enable(data->clk); - if (ret) { - dev_err(&pdev->dev, "Failed to get clock\n"); - goto err_clk_sec; - } - switch (data->soc) { + case SOC_ARCH_EXYNOS5420_TRIMINFO: + data->clk_sec = devm_clk_get(&pdev->dev, "tmu_triminfo_apbif"); + if (IS_ERR(data->clk_sec)) { + dev_err(&pdev->dev, "Failed to get triminfo clock\n"); + ret = PTR_ERR(data->clk_sec); + goto err_clk_apbif; + } else { + ret = clk_prepare_enable(data->clk_sec); + if (ret) { + dev_err(&pdev->dev, "Failed to get clock\n"); + goto err_clk_apbif; + } + } + break; case SOC_ARCH_EXYNOS5433: case SOC_ARCH_EXYNOS7: data->sclk = devm_clk_get(&pdev->dev, "tmu_sclk"); if (IS_ERR(data->sclk)) { dev_err(&pdev->dev, "Failed to get sclk\n"); ret = PTR_ERR(data->sclk); - goto err_clk; + goto err_clk_sec; } else { ret = clk_prepare_enable(data->sclk); if (ret) { dev_err(&pdev->dev, "Failed to enable sclk\n"); - goto err_clk; + goto err_clk_sec; } } break; @@ -1119,13 +1118,13 @@ static int exynos_tmu_probe(struct platform_device *pdev) err_thermal: thermal_zone_of_sensor_unregister(&pdev->dev, data->tzd); -err_sclk: - clk_disable_unprepare(data->sclk); -err_clk: - clk_disable_unprepare(data->clk); err_clk_sec: if (!IS_ERR(data->clk_sec)) clk_disable_unprepare(data->clk_sec); +err_sclk: + clk_disable_unprepare(data->sclk); +err_clk_apbif: + clk_disable_unprepare(data->clk); err_sensor: if (!IS_ERR(data->regulator)) regulator_disable(data->regulator); From patchwork Sun May 15 06:41:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 12850001 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 D00E0C433F5 for ; Sun, 15 May 2022 06:43:32 +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:MIME-Version:References: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=QHOJULi8thnTGRIy/OLQvWWK0Ek/6UoH6Ne5SjWPVJQ=; b=NV/7rAzoKtvFFb yz6TmSd2kdCWX1yDkL5pHhaTIpgAiqMccHWcijA4BtFLvXpGNPyEoUTXl2z/CHeip3sCy0ZCBjW/Y bski2k48RDLJKwRM1V8qrKOQGxeo8v7iajy07qlmnQEDtFQroI3RZjX65dBs6jVxsLmoMnFEq/Okc twMeU0jNwp0Hck5+DQwHtLVKliSQ8E1cBwsFnd3s3sB0vWYH+DqPwZ5dgzYS3Q10VvNVDbyzHf5Ea rjbXP00T//kSNI5/nsuwkEVBK7yeNmkmFgiIE5x4xkTfdw1JNT9/U6wdOWyFp+Eg9KCMdVHjp/JPv liqFKehI+9RGiaEi/ebg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nq7xW-003JsO-SF; Sun, 15 May 2022 06:42:31 +0000 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nq7xP-003JpB-4s for linux-arm-kernel@lists.infradead.org; Sun, 15 May 2022 06:42:24 +0000 Received: by mail-pl1-x62d.google.com with SMTP id q7so242737plx.3 for ; Sat, 14 May 2022 23:42:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5SvJ/++bycunC3OKTAB9+JnJnOimY+H66XGtoS2w60s=; b=jrwaBKFl5d35QZ+3Gee2JrXoy7jVYCOzlLjUKMZ00zqNMc4yv3WfXcp3A1Irk2aD4y NHYe7fdu1w2rvINacTdaZsuNalurMXEFmu4dajXvHlIF6fEcGSuSAAmI821cUxO7UjLm T6xQdGAjpDNecUPguBmvEsOWjR1ScYtxo3v9VVkxtPaTlR+ZZ53VXeWYZQfx/fFNIilS az/p6n/0+RaYr0W8QnQe3gwjPHsOEx+GTyAjfDIEUoMbDqWNZW5aPLZENyceBVgKT/VO e8GRHJRCpNaEmFe89deWgZRv2GlMK56yVyuKiATL3+K/sJNTjosJiHhakkCww3cKbfZh 2EEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5SvJ/++bycunC3OKTAB9+JnJnOimY+H66XGtoS2w60s=; b=Ws2eg5Fk00dS8e3TX1HDePqdhllE/qRJNHmKg9nQyW/Ra8btfz+XpLSxL2pt5raFKc ZnziI8844JO/TEGxvH80TtusKrm+qIrkXDA3P6dHgeOZpyY3yi8nWXDf3RWb9xTtTjLT c+EcqUodvO7DST2F354yKbgnZoFFseCopNvg8V6+CE0r/W5OPojao5sXc/eweeWjK57v 79dXZLiXgQkT7f+3n6upfemAUFx11aWkD7DfzYGCANtoRwF861hTTR/y7Lsz4QGcerwB ArMKUbkaOLZhVPk9tg0iORjXKmhnRPE6jByR1SevV95MHUXzjL3fXXALHX43dGyhifl4 tAfg== X-Gm-Message-State: AOAM531Mqm4XX+vy4VtCpkhrJ3zorVQ6KavWLAgkHAFhQjur/2Da6WLd FLzBxk6/3ZRTS1gQh1ck9Dg= X-Google-Smtp-Source: ABdhPJzWcVVfdugYBkVY7O80ZUsr97cxYMYWRp1vfSYA4vb0IAvOv+WNAehaqvlWeMBCDABHd9zg/A== X-Received: by 2002:a17:90a:ba11:b0:1df:2d09:1308 with SMTP id s17-20020a17090aba1100b001df2d091308mr3500270pjr.184.1652596941625; Sat, 14 May 2022 23:42:21 -0700 (PDT) Received: from alarm.. ([103.51.72.28]) by smtp.gmail.com with ESMTPSA id g24-20020a170902d5d800b0015e8d4eb2e3sm4568687plh.301.2022.05.14.23.42.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 May 2022 23:42:21 -0700 (PDT) From: Anand Moon To: Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Alim Akhtar , linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Anand Moon Subject: [PATCHv2 3/6] thermal: exynos: Check before clk_disable_unprepare() not needed Date: Sun, 15 May 2022 06:41:20 +0000 Message-Id: <20220515064126.1424-4-linux.amoon@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220515064126.1424-1-linux.amoon@gmail.com> References: <20220515064126.1424-1-linux.amoon@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220514_234223_261640_03266D30 X-CRM114-Status: GOOD ( 14.69 ) 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 All code in clk_disable_unprepare() already checks the clk ptr using IS_ERR_OR_NULL so there is no need to check it again before calling it. A lot of other drivers already rely on this behaviour, so it's safe to do so here. Cc: Bartlomiej Zolnierkiewicz Signed-off-by: Anand Moon --- v1: improve the commit message --- drivers/thermal/samsung/exynos_tmu.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 1ef90dc52c08..58ff1b577c47 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -289,8 +289,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev) mutex_lock(&data->lock); clk_enable(data->clk); - if (!IS_ERR(data->clk_sec)) - clk_enable(data->clk_sec); + clk_enable(data->clk_sec); status = readb(data->base + EXYNOS_TMU_REG_STATUS); if (!status) { @@ -323,8 +322,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev) err: clk_disable(data->clk); mutex_unlock(&data->lock); - if (!IS_ERR(data->clk_sec)) - clk_disable(data->clk_sec); + clk_disable(data->clk_sec); out: return ret; } @@ -1119,8 +1117,7 @@ static int exynos_tmu_probe(struct platform_device *pdev) err_thermal: thermal_zone_of_sensor_unregister(&pdev->dev, data->tzd); err_clk_sec: - if (!IS_ERR(data->clk_sec)) - clk_disable_unprepare(data->clk_sec); + clk_disable_unprepare(data->clk_sec); err_sclk: clk_disable_unprepare(data->sclk); err_clk_apbif: @@ -1142,8 +1139,7 @@ static int exynos_tmu_remove(struct platform_device *pdev) clk_disable_unprepare(data->sclk); clk_disable_unprepare(data->clk); - if (!IS_ERR(data->clk_sec)) - clk_disable_unprepare(data->clk_sec); + clk_disable_unprepare(data->clk_sec); if (!IS_ERR(data->regulator)) regulator_disable(data->regulator); From patchwork Sun May 15 06:41:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 12850002 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 DA883C433EF for ; Sun, 15 May 2022 06:43:47 +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:MIME-Version:References: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=B5WdpblbO4jUh+UyDkTxaUF4KKug88IqM/nJW+9fOoQ=; b=tlen9rTpgTTy4h 4vU5kT2CSQa/2kUQzMC1JTd4qUVJE76FYitzhm2USmRJztpvBPbDHcLPE47tbMzPvSDyVn/MXEgYn Gc4RJZQX8Uk0YkH9UNFUjtDkOJRG/TF/4SRlF65e4ig9KrV1L4fLJ5+tRg5cxE9JlBtsqk6bNpCqV iteqv+spqRCjChlDGJa7ochjY8jMGqI/HXkVvtRCzGq++JhRflGeAhu2Bs0JOKkI0pYN4/At3iQej FMPJInnTV9TBui90wf2gseXk/pfqhg3rhaFir6WRgrQk4U+sPgWaEsNUA3SJI1u03pgoLFeZb68Nt ludn4hVeFwW8zZaPtzdA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nq7xk-003Jz0-2W; Sun, 15 May 2022 06:42:44 +0000 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nq7xW-003Jrr-8v for linux-arm-kernel@lists.infradead.org; Sun, 15 May 2022 06:42:31 +0000 Received: by mail-pf1-x434.google.com with SMTP id i24so11303877pfa.7 for ; Sat, 14 May 2022 23:42:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=R70u7aKcalBy/OfNQ27Efmy9t/Kzj8CNy0QFYWzkyIg=; b=PaEiC5KNfp1oJ/1byQ6sKlb0XBZfuoy6H+ca9hxE+ZFIADImwXIyvZxMv1kib9xMx0 KTqjrr7jmOjS9m39Cd1LLBR2qBa4esr4sSl3jOkjCEGWxe1/zsfsJPsNwKzejKr/fRue +dKW+uzQoiD47Leg5jEwcVSqDZQbWUzqnG5QQVmHUJk4vtTyid2Bz5pJV2dD9vpSpMyT Bl38jdSs/16kPbWX2g/9C4G8tbyaHx8ZgmztmyadkG50zTUQztkaSHK9DHjsE1h7G8Ua D4Ztmk3bZj2MuU9koAvETVgAdEu7ynJjF1VCMfHr75L2G3maOutPGjHsDdmjaCqB3Ha0 DWow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=R70u7aKcalBy/OfNQ27Efmy9t/Kzj8CNy0QFYWzkyIg=; b=JF1WhE3q8CG5FSgFFOUOx+t6fhljWyR6Q9hp6ZJg4bRTkxT0VOBSwTgepsuX0XuEHp DQ6FYhS9AanCMJ1iHrfqJhaTAn9cQApj6kkFb4Omc+4G4E0ikb9OB5hobKl3SyR64EJ1 VUm+5axytfFdip/EFg9a+LYnWcONG7Vew+I4966IPyvSWnPUFQmgBHLVT7ZT7jUxR08v ml3Z67zlAuQ+1Omwz7Wbh+hjrVAGYDqEDyUnNZ0ZQiAv81akv79zLKqLEiEOG9CWqWCK wRIi1lA6fb8iUjKW687IidYIzUd/Kka4slTHYCzbSuOMLIcflhqTv1Xz8Uk9zBzVA9xT 4Mtg== X-Gm-Message-State: AOAM532t0lnq+T/F11Fkq/iqu4f5HoHLDVtyKji3eVXId+FvCRszVOeD O6REfD2Bljq2ryRx1jV7Cwk5t/B1kR6vjdhF X-Google-Smtp-Source: ABdhPJw1IgUFDGp0uoKhqpfGvW0FjfkaLTJupB0PEcRiLm+MbVXGkcGdILpLntVDoY7cYo5x/NFAZg== X-Received: by 2002:a63:5f07:0:b0:3db:8691:f66e with SMTP id t7-20020a635f07000000b003db8691f66emr10455711pgb.567.1652596948704; Sat, 14 May 2022 23:42:28 -0700 (PDT) Received: from alarm.. ([103.51.72.28]) by smtp.gmail.com with ESMTPSA id g24-20020a170902d5d800b0015e8d4eb2e3sm4568687plh.301.2022.05.14.23.42.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 May 2022 23:42:28 -0700 (PDT) From: Anand Moon To: Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Alim Akhtar , linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Anand Moon Subject: [PATCHv2 4/6] thermal: exynos: fixed the efuse min/max value for exynos5422 Date: Sun, 15 May 2022 06:41:21 +0000 Message-Id: <20220515064126.1424-5-linux.amoon@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220515064126.1424-1-linux.amoon@gmail.com> References: <20220515064126.1424-1-linux.amoon@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220514_234230_384861_2D888D1D X-CRM114-Status: GOOD ( 15.19 ) 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 As per Exynos5422 user manaul e-Fuse range min~max range is 16~76. if e-Fuse value is out of this range, then thermal sensor may not sense thermal data properly. Cc: Bartlomiej Zolnierkiewicz Signed-off-by: Anand Moon Reviewed-by: Krzysztof Kozlowski Reported-by: kernel test robot --- v1: Fix the commit message --- drivers/thermal/samsung/exynos_tmu.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 58ff1b577c47..0faec0f16db6 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -926,12 +926,14 @@ static int exynos_map_dt_data(struct platform_device *pdev) data->gain = 8; data->reference_voltage = 16; data->efuse_value = 55; - if (data->soc != SOC_ARCH_EXYNOS5420 && - data->soc != SOC_ARCH_EXYNOS5420_TRIMINFO) + if (data->soc == SOC_ARCH_EXYNOS5420 && + data->soc == SOC_ARCH_EXYNOS5420_TRIMINFO) { + data->min_efuse_value = 16; + data->max_efuse_value = 76; + } else { data->min_efuse_value = 40; - else - data->min_efuse_value = 0; - data->max_efuse_value = 100; + data->max_efuse_value = 100; + } break; case SOC_ARCH_EXYNOS5433: data->tmu_set_trip_temp = exynos5433_tmu_set_trip_temp; From patchwork Sun May 15 06:41:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 12850003 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 ACBA5C433EF for ; Sun, 15 May 2022 06:43:55 +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:MIME-Version:References: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=hE1f2diqp5DRy8YvORsWq9L+6LYteHa1xshlYv5bRwI=; b=Qwugs7Ovf0vTYZ vdIR3ntnGH8+ABzlFdHbt1QgLwZ+Nj2BwniVhBUW4vOuBpm6NmbMbnCAQAAfL6ZBbB/JRWf2G5eku 4K/pKIJdWjyM8abVrlIxGW5iy0ZEV2FNLE6UOXKLKfwpg67hGSQQqqpurN1piTCLnA2WDBh6rqHyO 64nVb169YrzFnshRAN2thbaA2TBbA0CzyrX4iczMJAAVrP2TUWROvZzCZTjHxzfAvj/dnGXwze/uR wHQcljpt6ayweTgiyU07WLY5AcTvFYoqWVrv8bd68FpM/wEad0mGeN99BD0PiGNmnrILjOq/uG+Ew SXSFM90/ibZnyo11QJqg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nq7xx-003K4l-6d; Sun, 15 May 2022 06:42:57 +0000 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nq7xd-003JvB-Nd for linux-arm-kernel@lists.infradead.org; Sun, 15 May 2022 06:42:39 +0000 Received: by mail-pg1-x530.google.com with SMTP id h186so8645259pgc.3 for ; Sat, 14 May 2022 23:42:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jHoiiJnHaNxKGmdGlLTGyX4TUtGSyjY88OutPdITYRg=; b=TXw+i+bQKAdvXrV/lWICdHZCsWSVMpk+d2HPACKk2B6zaN09RH3YvbXXGnyLPeUnAh UwecqpTwVTVeFg0LcSwMIM9hMwYT9mY+90XbciLa/O8d1gHIltBYIXQ4fqzPtP+Tgg/R rwtbAAb6E+Cs+M7ZyGKRz2EYNpE5uwu/vNxoWoFOgm6V2a2AC9Pv3fIIik1tCJt/SLhb 75J58Ohml89s8iHDQ2nkCCjfYhsKiHMei+VN0JZi2dL/U89NeG+9yeT21k3yAiQHQMqd eKouDFbwHvEes25IR2t0xgSUQ77zeAFygXUWxVNvwKuyOnYmxP28jbFBdsFjofxn4tiL xW5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jHoiiJnHaNxKGmdGlLTGyX4TUtGSyjY88OutPdITYRg=; b=Tnjqb20tC/ltYUGf2wZPQpkYWORdrQn8s2KaK1rFHhlX18DBKFMRyyqlVccqPazuPu KVn/C72OjlcO1QSCzPUSEtpilibWBNWPW5sNcKOSkssce8eNmohIY8Lqehxtufu6GKbM 2lk6kDYET5Po7bfyOjwXHOZjNDenua7l9IsxyBPXfRAU/4RVoYGmREc304jv1D4AuPwr cSO7bJtSDqRRv2JwVmfKVnyIpJpzzT7k2Zg+iIENDqKqUz6dyRP5wMasvyd/jbEAjKNe /zJUjYaIv5Lony4pnKWUnb5KAHCx8TtAFArjZXgDYlHV8qWfdHHxfUyCSAHA8GYQvSua ye5g== X-Gm-Message-State: AOAM533hR9c9OsiCrhOPKOU9GnjSh98b2LaAbWsM3LaKeHjMBUGu+ye7 WxMTpbspPr/UyvgpmxDD9eQ= X-Google-Smtp-Source: ABdhPJyVg2kGbF7B3nhQRG6rI1vby0IkE4VgLt98KUxzOmJrd5yLL/6h83HAjfdjuWTewrm7Tsj0vQ== X-Received: by 2002:a05:6a00:98c:b0:50d:f856:53d8 with SMTP id u12-20020a056a00098c00b0050df85653d8mr12020989pfg.49.1652596956582; Sat, 14 May 2022 23:42:36 -0700 (PDT) Received: from alarm.. ([103.51.72.28]) by smtp.gmail.com with ESMTPSA id g24-20020a170902d5d800b0015e8d4eb2e3sm4568687plh.301.2022.05.14.23.42.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 May 2022 23:42:36 -0700 (PDT) From: Anand Moon To: Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Alim Akhtar , linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Anand Moon Subject: [PATCHv2 5/6] thermal: exynos: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Date: Sun, 15 May 2022 06:41:22 +0000 Message-Id: <20220515064126.1424-6-linux.amoon@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220515064126.1424-1-linux.amoon@gmail.com> References: <20220515064126.1424-1-linux.amoon@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220514_234237_823002_61FBFA92 X-CRM114-Status: GOOD ( 16.35 ) 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 Use the newlly introduced pm_sleep_ptr() macro, and mark the functions __maybe_unused. These functions can then be moved outside the CONFIG_PM_SUSPEND block, and the compiler can then process them and detect build failures independently of the config. If unused, they will simply be discarded by the compiler. Cc: Bartlomiej Zolnierkiewicz Signed-off-by: Anand Moon Reviewed-by: Krzysztof Kozlowski --- v1: new patch in this series. --- drivers/thermal/samsung/exynos_tmu.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 0faec0f16db6..f8a527f19383 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -1149,15 +1149,14 @@ static int exynos_tmu_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP -static int exynos_tmu_suspend(struct device *dev) +static int __maybe_unused exynos_tmu_suspend(struct device *dev) { exynos_tmu_control(to_platform_device(dev), false); return 0; } -static int exynos_tmu_resume(struct device *dev) +static int __maybe_unused exynos_tmu_resume(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); @@ -1169,15 +1168,11 @@ static int exynos_tmu_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(exynos_tmu_pm, exynos_tmu_suspend, exynos_tmu_resume); -#define EXYNOS_TMU_PM (&exynos_tmu_pm) -#else -#define EXYNOS_TMU_PM NULL -#endif static struct platform_driver exynos_tmu_driver = { .driver = { .name = "exynos-tmu", - .pm = EXYNOS_TMU_PM, + .pm = pm_sleep_ptr(&exynos_tmu_pm), .of_match_table = exynos_tmu_match, }, .probe = exynos_tmu_probe, From patchwork Sun May 15 06:41:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 12850004 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 6C45CC433F5 for ; Sun, 15 May 2022 06:44:13 +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:MIME-Version:References: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=eydQK0a4Zl2Qo3RVPkvspr+6NHJvhMvPgGDx68RhxBk=; b=qMB+nkEZf8nrBp rP49WGplxDNtyLI9f/yanQ7wRwNVqZQ9DuMdIW06Di2sZ1yZclrBVCWY8dG1jkXJ/tTfCvN6OJD+6 tqZT7P5EYaDmRtJ5S1gw/C67qFx8hRrl/OtP3b4NfPaJTigBvM5rjjBj3s0WcDyyqX+x3x6CHEpsg Y30/k8mQH+AYN1sE4NISoMwCBipXaB3r9/WvDzOW9bEIeRJhp2hoxiWqpnd7fASnkSRDui3jgl6sh IIs2BlE7e5br1ezsdD8lEwtSOsIEu1npNU/vetcYY+SJRb1DyRTnlbeCy5VTsK4LFvqZdD8/Y+Zfn fUi87PUeLznmWpU8hHwg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nq7yD-003KDa-3Q; Sun, 15 May 2022 06:43:13 +0000 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nq7xl-003JzM-GQ for linux-arm-kernel@lists.infradead.org; Sun, 15 May 2022 06:42:47 +0000 Received: by mail-pg1-x531.google.com with SMTP id 191so119717pgf.4 for ; Sat, 14 May 2022 23:42:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=D4Q6w6yEvGwJK0TRipYAGtfiK43Dmnd3tJ7ygkkWia4=; b=IOLCGdIAmm3LunK3vBZkd/zL03BzIKvSMk+Utas+4Rbjc1kgqSnZVisi+yBAvrPSDX y/Rykv02QICz7x6MMGfUNDMjOAi4QyP4CLjK2VAtFwUkiLT3BX177/DXaBBSNwn+3pqJ /0ff8f8msGQ6Vt+K0aLeKn6GW8pHmSYYnpdjnAb62dJmQvKUMfH2MLQ535Rd7tTii5XG 3BaPorgEEpb36Ei2LBex0KVE+uwJOOByOUuGpxiizr+744YJpAdXdIbAHw92oxLozHGE PhIFmkCTc9jLTwxecZUGpxlplo/YS2t1cDMhwxol4xU22WvCo5uuGreWf8bAEF0GIvfv gW2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=D4Q6w6yEvGwJK0TRipYAGtfiK43Dmnd3tJ7ygkkWia4=; b=rN/vhfnNprv1uThpMU9heSba46AbMrD0/SpsxVX/gD2c7OdxakKof2a4ncPCIj1nUx cuV5tLPsjoYaqkOVfjWDr3VUzH8Ajci44qVWJWxnssjoV+oK1Xo+BJ6mX8aqamKUKD9j qJNYmYzoE/ZT8SKetUYiM8FC88E+QCisG6F+4BP4m8PvRP7JPIdBZkU2b0g6VzZCGDzo yk5OlTxOYj4ghlMW1T1NfZztOYFwKAQC6Umj6CkFg50/YA9MLlLiWZCvjFSSmV656V/S yV0TTlsLMG11C0WF+rlMyZH8DAwrHUuJx8i3c98DM7aMvxQ0Y/X7AXqa/ICjkRCQrUBS c1YQ== X-Gm-Message-State: AOAM531R8Mg/N4YN72zK2oXWGQvZpLQynTE6wTE6EDzyjIe9bbRI48II meSTuZ8KwEaXV4hahB5pULM= X-Google-Smtp-Source: ABdhPJzaWlQJYvbQ+EagfN3qdp16Rk+tbk02UoNETO2+CAcbdrv7RLtNe2Z7jSDRK6RLvZbVgRfX3A== X-Received: by 2002:a62:1ad4:0:b0:510:c635:e516 with SMTP id a203-20020a621ad4000000b00510c635e516mr12359143pfa.42.1652596964160; Sat, 14 May 2022 23:42:44 -0700 (PDT) Received: from alarm.. ([103.51.72.28]) by smtp.gmail.com with ESMTPSA id g24-20020a170902d5d800b0015e8d4eb2e3sm4568687plh.301.2022.05.14.23.42.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 14 May 2022 23:42:43 -0700 (PDT) From: Anand Moon To: Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , "Rafael J. Wysocki" , Daniel Lezcano , Amit Kucheria , Zhang Rui , Alim Akhtar , linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Anand Moon Subject: [PATCHv2 6/6] thermal: exynos: Add runtime power management for tmu Date: Sun, 15 May 2022 06:41:23 +0000 Message-Id: <20220515064126.1424-7-linux.amoon@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220515064126.1424-1-linux.amoon@gmail.com> References: <20220515064126.1424-1-linux.amoon@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220514_234245_598235_F3774055 X-CRM114-Status: GOOD ( 17.59 ) 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 Add runtime power management for exynos thermal driver. Cc: Bartlomiej Zolnierkiewicz Signed-off-by: Anand Moon --- v1: new patch in this series. --- drivers/thermal/samsung/exynos_tmu.c | 29 ++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index f8a527f19383..be9b98caf2ba 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -20,6 +20,7 @@ #include #include #include +#include #include @@ -1106,6 +1107,15 @@ static int exynos_tmu_probe(struct platform_device *pdev) goto err_thermal; } + pm_runtime_set_active(&pdev->dev); + pm_runtime_set_autosuspend_delay(&pdev->dev, 1000); + pm_runtime_use_autosuspend(&pdev->dev); + pm_runtime_enable(&pdev->dev); + + ret = pm_runtime_resume_and_get(&pdev->dev); + if (ret < 0) + goto disable_runtime_pm; + ret = devm_request_irq(&pdev->dev, data->irq, exynos_tmu_irq, IRQF_TRIGGER_RISING | IRQF_SHARED, dev_name(&pdev->dev), data); if (ret) { @@ -1113,11 +1123,16 @@ static int exynos_tmu_probe(struct platform_device *pdev) goto err_thermal; } + pm_runtime_put(&pdev->dev); + exynos_tmu_control(pdev, true); return 0; err_thermal: thermal_zone_of_sensor_unregister(&pdev->dev, data->tzd); +disable_runtime_pm: + pm_runtime_put_noidle(&pdev->dev); + pm_runtime_disable(&pdev->dev); err_clk_sec: clk_disable_unprepare(data->clk_sec); err_sclk: @@ -1143,6 +1158,9 @@ static int exynos_tmu_remove(struct platform_device *pdev) clk_disable_unprepare(data->clk); clk_disable_unprepare(data->clk_sec); + pm_runtime_put_noidle(&pdev->dev); + pm_runtime_disable(&pdev->dev); + if (!IS_ERR(data->regulator)) regulator_disable(data->regulator); @@ -1151,18 +1169,25 @@ static int exynos_tmu_remove(struct platform_device *pdev) static int __maybe_unused exynos_tmu_suspend(struct device *dev) { - exynos_tmu_control(to_platform_device(dev), false); + struct platform_device *pdev = to_platform_device(dev); - return 0; + exynos_tmu_control(pdev, false); + + return pm_runtime_force_suspend(&pdev->dev); } static int __maybe_unused exynos_tmu_resume(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); + int ret; exynos_tmu_initialize(pdev); exynos_tmu_control(pdev, true); + ret = pm_runtime_force_resume(&pdev->dev); + if (ret) + return ret; + return 0; }