From patchwork Wed Mar 8 21:48: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: 13166483 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 1D5EDC678D5 for ; Wed, 8 Mar 2023 21:49:49 +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=u/6/R2md2KOB2G l6bSzZSQdmUOg3JiuCQiS22xAp+Ap+YoWAASX5DnBU4uwnlEmDfOcZQJQ1D8A+nN1K8mtCthaXEGn ojgygec8kacnekaAsO2a9ptzcAGE2fKb/qKiwwv/idY6XpDwGfQyNXiU2KmbRwmt6z7Peyk+Ocymt lefEB0bivekJ0+EJQMFzolSVaan3tXI4CXoHbZXWE4naNLRogOCA6n/S/Rbh55am4aPupfBP3+1Wz Ms94z0h9r+/4I5rrBV138rswSZvgVyz+s+kpQjKBvuNOEQdQlZMf3TgicBPu5QrWCQBJ/j65NmEZH Z063Qsi1Nn4ebA2X7QGg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pa1eY-006sYy-RV; Wed, 08 Mar 2023 21:48:54 +0000 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pa1eQ-006sWm-Si for linux-arm-kernel@lists.infradead.org; Wed, 08 Mar 2023 21:48:48 +0000 Received: by mail-wr1-x434.google.com with SMTP id h11so30102wrm.5 for ; Wed, 08 Mar 2023 13:48:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678312126; 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=cq/H5/ad7yCYKfKtBDkoMCDyjA6SJAqabbPEbcckw/Z2foFpFzd+ESkm5TZAYDAMHO Y0NRnvGmAWJtfjsTW8xUQqYsOI5Y3+UCfULiDAQpjEzNXhnZusDyW3n7etpiwskcIM+T YixbLgPJuVHiIAPDNaWKqY++xS3tXCxcVg69CMeNYWN6dlraMp7GrFWHMY5gbI4RZwkg atcFXJacNRcnA7eIIdpPYAfaP/QhnhWY7J4tXnp/jrMy50ELtfn4pTsRm4ujD4JyAnPq NMFGHSHFqJ8EdlfJqPoLeBnwRK2tUrISb3EUy+VT5xH58ScHxNFIRdD9Wsmu3bz8SGSh bGgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678312126; 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=YN2d+zoS/+a3xPmGNog4JzBunGppVic/fGFWrKW8whHB44+UJQQHf/sNJ7uudDeWQT O/KrpqKELncq/h5fQVet1qdeLjOiLj1B8ggBMo4IcpZH4fAyEZaYTRNEnqmjoXewwEoc rN/Gw/OJa9hiM89Q88xEN70sjaWbTP916qvRBwy8cbggxqG9WRBb8mJkeB1hfhOspk6V HnNXvVllTCq1zxoW/IQCk7owoVLW/XhahPYsmP+Kg2tKLKW4EvJ6SFqMQlEETIFN6yal yuBvyYrJbiV5tArlPzZl536Czsq0k/5rf58nli25p+FGDqKQmYD/IH2FYvYzuYbspl73 rJIA== X-Gm-Message-State: AO0yUKUf4xh82Tn0oqSl4b+AR3MBRGS3wvEUARuSJyPPit/97Wdn1tnh dQ1BMcBV+q9DVcVV7sdGHbteZw== X-Google-Smtp-Source: AK7set9dNQIoqJwJ1YDp+pOXC2yzZe8SPtUpY47j+15NDVfKGPTAxNPVDJYhNaO50DjaF0ITnaNgKQ== X-Received: by 2002:a5d:62c3:0:b0:2c5:5237:3b21 with SMTP id o3-20020a5d62c3000000b002c552373b21mr13902966wrv.69.1678312118499; Wed, 08 Mar 2023 13:48:38 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:fbda:65f5:e873:7527]) by smtp.gmail.com with ESMTPSA id z6-20020adfd0c6000000b002c55efa9cbesm16065713wrh.39.2023.03.08.13.48.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 13:48:38 -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 1/2] thermal/drivers/imx: Remove get_trip_temp ops Date: Wed, 8 Mar 2023 22:48:21 +0100 Message-Id: <20230308214822.1317086-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-20230308_134846_953482_1FC31FBA X-CRM114-Status: GOOD ( 10.67 ) 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 --- 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 Wed Mar 8 21:48:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 13166482 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 2E3AEC678D5 for ; Wed, 8 Mar 2023 21:49:42 +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=AfCNISfHqykfhq8dMpjIaC1QtuIA5kcsHx+AiAqOPxY=; b=IS3UDumUTYhrQn 8Fitfzm7EI3yNM8h1mfUugADQHu8M27GNYOpKkERGb/Nw2j3RFDxcpJ8Akv361kVbMM46seOlpFny TVoe9vVwXSqMnfrDkPcJVhE6n6CSVLrZxdQx7POupA6mvgNHAA4FyS5kImbIcnvdqd7evYXXwNM8y 5O7HCsR410lJockd4qVAd8qgBt818yiku4I5Muidkq55+MDKLlx4BkgJmyJA0TNQLQLWhPFajKZ7K idwq9gdI2XgB8malttYyDAH43dUdjXT1RZlpV4vJcoVNMPkd+7A7b3nzmNpT0h9rW6DqHgHSkJcU5 hI+XOuw7ifmv/lE4sbjQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pa1eR-006sXU-0v; Wed, 08 Mar 2023 21:48:47 +0000 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pa1eN-006sWm-Mo for linux-arm-kernel@lists.infradead.org; Wed, 08 Mar 2023 21:48:45 +0000 Received: by mail-wr1-x434.google.com with SMTP id h11so29949wrm.5 for ; Wed, 08 Mar 2023 13:48:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678312121; 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=bSi6Beth8Hd606NS4V715NDwa0mm95xS/EhiukW+s4A=; b=l6+xSoB8aU6pf5jOSHIdYTf6mhvsf4dNHL0DDvpOnx020ewh76Hmaz37YLZZBOMHUL 6rZidRg2vYmnd1dliOQBg3N6gMokd+sv43Lq7yoc9/UA4XOtjKB5Y9eKPdwF/ZzPn6LE TNT0mSJC015lzvtsNG27OuKKJt/y0S0iNu9NGG5YdjsIOZXgpuzp2koitg62T2Hsyuhh rMF/os4aI/1JAHBSH+lx9F65yJHAGICp54WNlSrqTgWOklbqyb9PVMBweaA8Gw9d59YK 3NL7bdJzch8Udk7nUxyoxJ4V4d77BXnGts5Y2E6VMgESMDOnHOfWU7SFUt1UPUJ8p4h6 SKGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678312121; 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=bSi6Beth8Hd606NS4V715NDwa0mm95xS/EhiukW+s4A=; b=vc3oFBdbYSxIVz+hlhQPnw/uW841fXDhWJtx/ldF8LQX00u1SmRe+0UdE7yyF7DAqz lEKPRojusIgAHkUzx+P/+b+tgGR83wr1hblKIm9coI9Ea2ggdsEL03GuhytkWTDDUlCW aRe/KY8/hBgDKb27d+SmzmzuRVsQC6DxBHCQXXeDrZj6dx1jPKTWAK3Tv3OfOj0rT79x HyQq7gg4C0Wi2WYx9wFU4N8bGznI4z5xVhZYlWdUU9opPpALCOVJ6rmOodU3QjhJNc+8 R4NTAuc3+uj32PnE86eTTQ8K2VkNsCstMjhjQc2Dr/qmBAyis3wfmFBRbeRlC2aHhmbS /kWQ== X-Gm-Message-State: AO0yUKX/FHxu0fdE5YDs7unhfK8ob5wUkGKFWfdcsBr/nv3USZbPTTi4 c70qDsIkuqWjtfy4hxBSclOLSA== X-Google-Smtp-Source: AK7set9vuN8INCmFZBDldnjaZzya3b21KVx/xTSSssDzxqlXf8GDST84z4Er4IgIf1dKoCZy3qx6pw== X-Received: by 2002:adf:df8f:0:b0:2c8:dc8f:3951 with SMTP id z15-20020adfdf8f000000b002c8dc8f3951mr12301392wrl.5.1678312119704; Wed, 08 Mar 2023 13:48:39 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:fbda:65f5:e873:7527]) by smtp.gmail.com with ESMTPSA id z6-20020adfd0c6000000b002c55efa9cbesm16065713wrh.39.2023.03.08.13.48.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 13:48:39 -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 2/2] thermal/drivers/imx: Use the thermal framework for the trip point Date: Wed, 8 Mar 2023 22:48:22 +0100 Message-Id: <20230308214822.1317086-2-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230308214822.1317086-1-daniel.lezcano@linaro.org> References: <20230308214822.1317086-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-20230308_134843_764012_3721D238 X-CRM114-Status: GOOD ( 21.49 ) 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 --- drivers/thermal/imx_thermal.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index 69ed482167f7..e4e82bdf34f1 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);