From patchwork Fri Aug 5 14:57:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 12937360 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 0FCDFC00140 for ; Fri, 5 Aug 2022 15:00:21 +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=dXxzbKRBxTDmlrRwHTADf55JgE9IYcImiLcf4qW8Sk0=; b=badI02aZZNoLkh h2+LHsUt8tyK/LSUkWaMX7wxSzCAVpJ/cE5OLj6LHPgUGdQu/F4Hy7ZjRMW9/F7wnxeNAnakrZIeu vNlL5PeKQlbvaqD7o1qsUJjDhtbTSbrGofC0a+VM8dJDdWiEQzvcCMPM/MIxEWzLOB4amVipwWJkb lckCN7rlN+MuRwJWiU6tJywikhuONIPESMRoCPhUN7AEwUK+dD35jVh11u32p022gwQDMd+Behew2 CRs/95Se6rfYWlYMxF1jrqLspfMATLm1C+vrUED3K6TQl6jRRaWz5ipN+0RRxHW9oQ6gsBTN6NZCN btv+IeFGhPFj+vt0GWRg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJyn4-00G4b6-M8; Fri, 05 Aug 2022 14:59:06 +0000 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJymH-00G44F-E8 for linux-arm-kernel@lists.infradead.org; Fri, 05 Aug 2022 14:58:18 +0000 Received: by mail-wr1-x42c.google.com with SMTP id j15so3556599wrr.2 for ; Fri, 05 Aug 2022 07:58:14 -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=aqMaHXWxSF1AlY1fJjS12uTHlTBPz1oDnaX+N99K3gQ=; b=mqQrqmu+YhBQKIHfpM02TKn8UWOFfqRsUFuFQbbJhvSQ1LoPwTt3dwHLaiqSpzdN9E PDpn+KG6MZAitd5QWudINdRdVFMHC7KHDPtJAaAyFwGBpaCu+pnqgRQ+c+hxkSPqaNnI xuknQtd0BI0OZPGvyBNOG7x4KlSHpLzhNqqXbupqSM0iyzaxoAFl9fdcgGB8CbqG6amo YCVbnf5NLwOjibh0MIqn1QgFTo48NZYHi9Ny5K8znbP8gQfuFsPlJHCiZjFkbVS1o/4K kCB+tJwwyjdYmFGKsTxwBcH7jWy1vH2kc0HqgTLKmYSJ9g4F0GwMNwAX0CjWGJdtniBs ZFxQ== 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=aqMaHXWxSF1AlY1fJjS12uTHlTBPz1oDnaX+N99K3gQ=; b=UJEh3P2dkxSL6xyHbHx0O6C8phxwgThXVtdRIziRWG3L5RoOP5qrwZnFsosn8NMxmW SWTYUTS0gqYegesQUBlBa2cpHA4qcd5A/rfJX9QWF4cvPSeTfehpFXK4YbjBYV+eet7V UfmrCDwkf/KDgiOeUYIS8sRpGEs39OsN3+jZ60Xyyt5DFbIX4HYYD5VgDKwF6jTfbsCj ZDAFmJK9C7umNhtW5uxjt5UkEVNG9DHNtMqAnkXO38OGXyKWBA4zTh4v1BaxRB45Byc5 mW5pG2NIU07cITfhQ65wpDQkx1p+Bue77akwyNAevytJXoJy1sz3sLONY9Qqw7cpU6yQ 0Khw== X-Gm-Message-State: ACgBeo0g7+d6qNGAAD8XZ7jlbCLBgKP64WZyE72iE5yxnBanPse9ZfwL ruZTXxy2BmTh7PJsQxpWzpcL8A== X-Google-Smtp-Source: AA6agR4JSLzRCO8BJrj8mF8xZLtYg+aL9xK+By9lyb4B7Jxec+U/RjWtTI1b7bJsL6XswKljIgLBLQ== X-Received: by 2002:a5d:590f:0:b0:21f:c78:4693 with SMTP id v15-20020a5d590f000000b0021f0c784693mr4489792wrd.544.1659711492875; Fri, 05 Aug 2022 07:58:12 -0700 (PDT) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:aef0:8606:da6b:79ef]) by smtp.gmail.com with ESMTPSA id y1-20020adfd081000000b0022159d92004sm3102448wrh.82.2022.08.05.07.58.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Aug 2022 07:58:12 -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 , Nicolas Saenz Julienne , Broadcom Kernel Team , Florian Fainelli , Ray Jui , Scott Branden , 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 v1 20/26] thermal/drivers/broadcom: Use generic thermal_zone_get_trip() function Date: Fri, 5 Aug 2022 16:57:23 +0200 Message-Id: <20220805145729.2491611-21-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220805145729.2491611-1-daniel.lezcano@linaro.org> References: <20220805145729.2491611-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-20220805_075817_510634_B1370988 X-CRM114-Status: GOOD ( 14.94 ) 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;