From patchwork Thu Mar 9 09:28:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 13167125 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 C88C5C61DA4 for ; Thu, 9 Mar 2023 09:29:44 +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: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:In-Reply-To:References: List-Owner; bh=JbLE+zvRepxOEn7QKIeNhfnf1ApVGJdVnJ8730o6HUY=; b=Q9w3jMz6E4vp8j 6auZ+but28vvedt3RqtkkmSnwUDOj2PJ3va3oIohdp/P+Wr9eTGtVH5PAttBOF7hAbXRcRuVOrkSR gbKFCMcbBBtDe9FlqqYzT590TsXuvoDTp0+hB9sGnFtzKTWAhGtF7Oa09r25fMaFB81feiHePmECc 19xxuKqWd/DERNbJK6ugl2SlM13cSDfmxj8i7x11w5T5FNG0Blq3Vo3UdE0g2hUA8lwHEiXM3QXRp AUnjD+isqchIHRwa72qtNiOvPcg2l2d2CmxdEjzfefGa4JFZeu7pmgOGK3dquP2hUww2paGimVVkB k30pXbYkbYyqaJ6CTCAQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1paCZn-008nCi-Qa; Thu, 09 Mar 2023 09:28:43 +0000 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1paCZk-008nBN-QS for linux-arm-kernel@lists.infradead.org; Thu, 09 Mar 2023 09:28:42 +0000 Received: by mail-wm1-x32c.google.com with SMTP id bg16-20020a05600c3c9000b003eb34e21bdfso3116040wmb.0 for ; Thu, 09 Mar 2023 01:28:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678354117; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=9b973OIjh2A0q4it2tRxdKfeAcI3pT5uZD5jTJWInpI=; b=G+l5L/kty7Cqd1UGH7h73jbKUw7aklIia6azseJH39wkkEaOOPIHa+jUVGAKq39HuS F+rNWQnOoNPXodONWQLntoaQ0fYQegKV1wB6xzs6i0QzX0SrhxHtokArpDSXHJGchZHT vaX/4pZMBZpnvAWjCzbMJNXEVKIx42yMyLcWdAeg6ZU362GZorQMtXl8VYyv++dDVHLt hAw4zHxpdg2+W+MfGur3ZAhdibifekvB3KCfSkGfoVoMHOHtq6LsEqbrPo+K2K2dv6+k Rq3LyjhJe1MHyxsV3KsOGjVOl6iBrx5RvBoIjyvCZHbLtHY8qp8szWH+pzoYMa07LOK+ sSqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678354117; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9b973OIjh2A0q4it2tRxdKfeAcI3pT5uZD5jTJWInpI=; b=QNH+cruxIKfI0dQ2DpoSOD0g/5T/LenN49ik6ySX/1ZRV91Ip4jbRIEH3ph+wTs/Ve nIUfGow9K8RhTFOGOVYU2vfzsw8wU1SB57Psu3DY+32ur5tHyEO2AXw35bTbVZcNWN35 PokO/FSrnd0E+4vg12AILXjnJqEVnOh81E5fZ04fkfvVgJE/8QncirnGfl025TVwP8Q7 gMjhbWpbzpvu5Har/Mx8u03fjA+fUrVTFqfyHu/qzQUM3RsVQbA6316gSbjphWb0RF2A KaiApq7rtKg41qOr1kLQNs60hFUYh2stfFgv/fcyYq4JNMV2wtRv0fDGX5RJccuA/usj ugtA== X-Gm-Message-State: AO0yUKWqk4tWqKMezI7rGst4uWmNJa1FnqlUrCrzA90gY5Ck98Ynwn7k iZhrWI5mQTv3tZf/ksxc2WxXtQ== X-Google-Smtp-Source: AK7set9CmFy5X9yst6x08qHlf6fDRK2tjy3pL7GjWnLHumXofZsdSLKRxGtBypu4Cq+yfr2HvfJi0A== X-Received: by 2002:a05:600c:3d14:b0:3df:9858:c033 with SMTP id bh20-20020a05600c3d1400b003df9858c033mr18417688wmb.8.1678354117269; Thu, 09 Mar 2023 01:28:37 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:fbda:65f5:e873:7527]) by smtp.gmail.com with ESMTPSA id t24-20020a1c7718000000b003e209186c07sm1888894wmi.19.2023.03.09.01.28.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Mar 2023 01:28:36 -0800 (PST) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Amit Kucheria , Zhang Rui , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-arm-kernel@lists.infradead.org (moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE) Subject: [PATCH v2 1/2] thermal/drivers/imx: Remove get_trip_temp ops Date: Thu, 9 Mar 2023 10:28:20 +0100 Message-Id: <20230309092821.1590586-1-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230309_012840_875221_719017A4 X-CRM114-Status: GOOD ( 10.63 ) 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 i.MX thermal sensor uses the generic trip points. The thermal framework can return the critical temperature directly. Remove the pointless get_trip_temp ops. Signed-off-by: Daniel Lezcano Reviewed-by: Fabio Estevam --- drivers/thermal/imx_thermal.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index c3136978adee..69ed482167f7 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -330,13 +330,6 @@ static int imx_change_mode(struct thermal_zone_device *tz, return 0; } -static int imx_get_crit_temp(struct thermal_zone_device *tz, int *temp) -{ - *temp = trips[IMX_TRIP_CRITICAL].temperature; - - return 0; -} - static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip, int temp) { @@ -384,7 +377,6 @@ static struct thermal_zone_device_ops imx_tz_ops = { .unbind = imx_unbind, .get_temp = imx_get_temp, .change_mode = imx_change_mode, - .get_crit_temp = imx_get_crit_temp, .set_trip_temp = imx_set_trip_temp, }; From patchwork Thu Mar 9 09:28:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 13167126 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 D2F6BC64EC4 for ; Thu, 9 Mar 2023 09:29:46 +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=NtFG5My9NWYYEyEqeHXVv4+fxNiZd2AHtBUEHTbB3QQ=; b=El46yA24FNj4Yl b5pkgd8PEd0/8XC77mF9526CBCSoyUt1xUQNyI3tP8pUHrwrFOAdHJka1qp4K8s7DM6Y/1uuYpxdX Y4DaxrlvvCduTJoGRgAXsoR5ixNulKcsacHCvQ6VdGgBxSnkADwejtc0azCsMUfrDZ7xZjkx8XKIw T+W0+KA0TvJvVfJZRBo+kn0F4g+limWNqmun1EQP2Oz748Re6z5eATwEUg1j0HvfbiivBA9Jt/PGK kVNUUMXTVfMNNh02JrdjD6E0gZW83KcQfvN/RrHt/u6+WxHIM9WOfvQj/BNGPUGfR1+BBz6vy4Fg9 3i3orV+/ZY0peO3PHOzg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1paCZv-008nFX-Nw; Thu, 09 Mar 2023 09:28:51 +0000 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1paCZm-008nBf-0V for linux-arm-kernel@lists.infradead.org; Thu, 09 Mar 2023 09:28:43 +0000 Received: by mail-wm1-x329.google.com with SMTP id d41-20020a05600c4c2900b003e9e066550fso760616wmp.4 for ; Thu, 09 Mar 2023 01:28:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678354118; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WcGx4aXFMGk9frr8lRdRWgHBNAcfS5az84l0THU0sOA=; b=iIRdp1V9x4ezfgFrAzbTLkkLE9LA3+EGI2x/sDlKAzubklLkFSd1URVKMbRJU05BOJ WaDYfK8g2ckNQqyLd7zgsLKOckAAQ2qZne9bdqbbcbw+BmzgfaM4UOi8g1XMnl8S383M hlSXR/wmOs/qy/Q76QXA4/0J1Cuqxg2OzL94d0D9SpSpln9i/BMwSLcw0QJQIVEhkIK2 w2jD5KL7cBlaPje33MUF4LgLp7rDrSl3Viz40kUlM3IMqSoXvrzTZJqiw24JfqgLR/B5 Fx3JSD6MDAhKEgHyGRfnGLm8f2k8i+o+QeVRWrvYvwMv3wP4ATjtqiaVFd+c5SDoKuYs kU7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678354118; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WcGx4aXFMGk9frr8lRdRWgHBNAcfS5az84l0THU0sOA=; b=USNv0YW3S6G/BIQF2ZX8ycAsz4ep0ICeJsF8O3gL1B7bOzHH58rcTNipr5taJ0hTvM 1nYkJ60uGoLSH9vbf9v5nA+7oKiWY7DwgpXsmbnxzVH7+nQDTC+R7iY5F1ZNC0lMMPV3 USlWELX+1+Qqugv8CpTVqWrK9ZlF7/P5/3rZbeha6uTYadYGZcL3Vh6OAj4g5SbQ+Cd2 y3lJSS75kSPVEwkvgaRhQl7mJg8vnXLOwI73c03aOYOs3LlrX7AOLcRbDwfrc2ivBCYa BSgleww8Siq1MEHUTG9FJMilOdxlrVuawzkqWkcxn/cxkydga4/ri8Cxzr8Tak1cVV9M CsFg== X-Gm-Message-State: AO0yUKVwZw42DDT7iCmrWwsiEg/gHpidHOyMvskE2Nsx3XI7yFbdQ+Ln peYAyiHVGXmzOc3QISb6JPiBEw== X-Google-Smtp-Source: AK7set+By9EwomiJf5i1g8bGGFMzDBsr1VRRx7TXY8qeoGJsWAg9TiHaBltIM1IfQPpPOFHAV4GN5w== X-Received: by 2002:a05:600c:1c20:b0:3dc:5b88:e6dd with SMTP id j32-20020a05600c1c2000b003dc5b88e6ddmr20167527wms.10.1678354118182; Thu, 09 Mar 2023 01:28:38 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:fbda:65f5:e873:7527]) by smtp.gmail.com with ESMTPSA id t24-20020a1c7718000000b003e209186c07sm1888894wmi.19.2023.03.09.01.28.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Mar 2023 01:28:37 -0800 (PST) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Amit Kucheria , Zhang Rui , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-arm-kernel@lists.infradead.org (moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE) Subject: [PATCH v2 2/2] thermal/drivers/imx: Use the thermal framework for the trip point Date: Thu, 9 Mar 2023 10:28:21 +0100 Message-Id: <20230309092821.1590586-2-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230309092821.1590586-1-daniel.lezcano@linaro.org> References: <20230309092821.1590586-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230309_012842_069476_61BFD166 X-CRM114-Status: GOOD ( 21.43 ) 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 thermal framework provides an API to get the trip related to a trip point id. We want to consolidate the generic trip points code, thus preventing the different drivers to deal with the trip points after they registered them. The set_trip_temp ops will be changed regarding the above changes but first we need to rework a bit the different implementation in the drivers. The goal is to prevent using the trip id but use a trip point passed as parameter which will contain all the needed information. As we don't have the trip point passed as parameter yet, we get the trip point using the generic trip thermal framewrok APIs and use it to take exactly the same decisions. The difference with this change and the previous code is from where we get the thermal trip point (which is the same). No functional change intended. Signed-off-by: Daniel Lezcano Reviewed-by: Fabio Estevam --- V2: - Remove extra tab inserted in the previous version --- drivers/thermal/imx_thermal.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index 69ed482167f7..13c56e45cdbc 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c @@ -330,26 +330,29 @@ static int imx_change_mode(struct thermal_zone_device *tz, return 0; } -static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip, +static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip_id, int temp) { struct imx_thermal_data *data = thermal_zone_device_priv(tz); + struct thermal_trip trip; int ret; ret = pm_runtime_resume_and_get(data->dev); if (ret < 0) return ret; + ret = __thermal_zone_get_trip(tz, trip_id, &trip); + if (ret) + return ret; + /* do not allow changing critical threshold */ - if (trip == IMX_TRIP_CRITICAL) + if (trip.type == THERMAL_TRIP_CRITICAL) return -EPERM; /* do not allow passive to be set higher than critical */ if (temp < 0 || temp > trips[IMX_TRIP_CRITICAL].temperature) return -EINVAL; - trips[IMX_TRIP_PASSIVE].temperature = temp; - imx_set_alarm_temp(data, temp); pm_runtime_put(data->dev);