From patchwork Tue Aug 9 22:04:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 12940025 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 545BBC19F2D for ; Tue, 9 Aug 2022 22:08:07 +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=mMjKODOPuxNSMHRx6sLDPA7/X4hPA9FdN7Okm/tRvOo=; b=nTyk9TLHM+5drq IIQPbw3wk+DywZQPKip/PbBqwtvUlZc1oT85lTZEHumHK64rQ/QbzKgbctsL1Wo8i37HG21PzsyVF BGr1UMMlm0Au0l5BmByHWzpqe5tdUekWwyXdP6z08s9krh5aD3aPKa2OYEp7yRh+fL0YPemUfUBBD +PfSSyefC2LHoDzmoQ2Zh/o9D1su8zoCPADcjGWUcpammhLVbJ2gAYqYH9wqnBVm7kRz6KodiroGE dTB+qDdPTR2guXf9wk1lUu/BZ3L5gS86gRseGDlKXktZVBDrANehrNfBbXCWmHV2SVSSt0zBOhXBg 804Jv1Yq2QgI/5jyzc5g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oLXN7-006vWX-1x; Tue, 09 Aug 2022 22:06:45 +0000 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oLXLq-006upV-BK for linux-arm-kernel@lists.infradead.org; Tue, 09 Aug 2022 22:05:31 +0000 Received: by mail-wr1-x435.google.com with SMTP id n4so13987186wrp.10 for ; Tue, 09 Aug 2022 15:05:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=RuOkdBUevpNwOF5uxKYPUxVuiSYnY/XeiYrwbyLTKVs=; b=jCNREL2wvW5Mt/Jx47kkKqrkQYSxrNhtbo/YUXfdyuGbaMqFonANOTppRgCHOvVlRh nAO8aL/UEwwb2MXaPozfGKUhb+nB7ztAqZ3MZ4ChLnkrU0PQaTCEl8UljO6HAtCLBQ8g bNkqOH56RW1+trgVV3mCHeYSlX++/c2y6xvjKqd2QYlLF+1h2CRcjwASR0Z5SyxFh9wK XvqFQjWkPUB9tg74PqHmQetBYqaTNulmjnE+VYSCWeRgxh1vn/IhfSYT49ff1i9QmFy5 0kj88VosKBabAVvaUEMiS1Q5n+mMr5OPPCApaTPbgTzMbEy2TD3llXndJKN7LuwKWuXE FL8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=RuOkdBUevpNwOF5uxKYPUxVuiSYnY/XeiYrwbyLTKVs=; b=fY8uFCgA8/MuAzOLjtiW/RbW9eDj2shfEZ+20oSaOCIhV9ahgkSc+I99y0hOxx1RDE TEMFyVJW0P7bcLXoVDkLgjyUI8Qi+pPepKGRAiVXvG/z3KAMh4PCJEhnXy7pmKZrTGYn /qrBdE897mD0E3W9C5rJYsc5c5+H+eai7kvp8tLP6wbzOjFwGqJNXnodwruId4YHsiW/ 9oPISnh1uGcTLJtcYwS/tICjrQ8CgMVjcMn27dDXmG6y3hgGIP0DOUlL0OnLHkiuUXVr zTYuAtwIGTjHkh+DmcmmuHhxk7hpw+PS3ucMaWx4vgrt2k7gqBMoLqp0sRLMfeG1SpXW 6e+A== X-Gm-Message-State: ACgBeo1g6g0F7d14E4oa0+88gQylRBTPy3HpMG/hEOZA0z+38yO1Grt6 1o5ZbyD/TyL8G9zR4YDyI1LtiA== X-Google-Smtp-Source: AA6agR5NGbThSbhVZ+tZO3ogBhTmCAhnaSQPK4NshdFqQqNV6OfuTIurkNF/5/N9B6xXxOhrZOKwEQ== X-Received: by 2002:adf:d4c2:0:b0:21e:ddf3:8b14 with SMTP id w2-20020adfd4c2000000b0021eddf38b14mr15888310wrk.355.1660082723860; Tue, 09 Aug 2022 15:05:23 -0700 (PDT) Received: from localhost.localdomain (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id m21-20020a05600c3b1500b003a317ee3036sm293583wms.2.2022.08.09.15.05.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Aug 2022 15:05:23 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Amit Kucheria , Florian Fainelli , Ray Jui , Scott Branden , Broadcom Kernel Team , Nicolas Saenz Julienne , linux-rpi-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE) Subject: [PATCH v2 20/26] thermal/drivers/broadcom: Use generic thermal_zone_get_trip() function Date: Wed, 10 Aug 2022 00:04:30 +0200 Message-Id: <20220809220436.711020-21-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220809220436.711020-1-daniel.lezcano@linaro.org> References: <20220809220436.711020-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-20220809_150526_428352_D25CC072 X-CRM114-Status: GOOD ( 15.23 ) 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 gives the possibility to register the trip points with the thermal zone. When that is done, no get_trip_* ops are needed and they can be removed. Convert ops content logic into generic trip points and register them with the thermal zone. Signed-off-by: Daniel Lezcano --- drivers/thermal/broadcom/bcm2835_thermal.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/broadcom/bcm2835_thermal.c b/drivers/thermal/broadcom/bcm2835_thermal.c index 2c67841a1115..5485e59d03a9 100644 --- a/drivers/thermal/broadcom/bcm2835_thermal.c +++ b/drivers/thermal/broadcom/bcm2835_thermal.c @@ -18,6 +18,7 @@ #include #include +#include "../thermal_core.h" #include "../thermal_hwmon.h" #define BCM2835_TS_TSENSCTL 0x00 @@ -224,7 +225,8 @@ static int bcm2835_thermal_probe(struct platform_device *pdev) */ val = readl(data->regs + BCM2835_TS_TSENSCTL); if (!(val & BCM2835_TS_TSENSCTL_RSTB)) { - int trip_temp, offset, slope; + struct thermal_trip trip; + int offset, slope; slope = thermal_zone_get_slope(tz); offset = thermal_zone_get_offset(tz); @@ -232,7 +234,7 @@ static int bcm2835_thermal_probe(struct platform_device *pdev) * For now we deal only with critical, otherwise * would need to iterate */ - err = tz->ops->get_trip_temp(tz, 0, &trip_temp); + err = thermal_zone_get_trip(tz, 0, &trip); if (err < 0) { dev_err(&pdev->dev, "Not able to read trip_temp: %d\n", @@ -249,7 +251,7 @@ static int bcm2835_thermal_probe(struct platform_device *pdev) val |= (0xFE << BCM2835_TS_TSENSCTL_RSTDELAY_SHIFT); /* trip_adc value from info */ - val |= bcm2835_thermal_temp2adc(trip_temp, + val |= bcm2835_thermal_temp2adc(trip.temperature, offset, slope) << BCM2835_TS_TSENSCTL_THOLD_SHIFT;