From patchwork Thu Jun 16 20:25:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 582488 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E9B7C43334 for ; Thu, 16 Jun 2022 20:26:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378655AbiFPU0M (ORCPT ); Thu, 16 Jun 2022 16:26:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378380AbiFPU0G (ORCPT ); Thu, 16 Jun 2022 16:26:06 -0400 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DCF55C658 for ; Thu, 16 Jun 2022 13:26:02 -0700 (PDT) Received: by mail-pf1-x432.google.com with SMTP id 187so2422152pfu.9 for ; Thu, 16 Jun 2022 13:26:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AnWdYySv2ElBW0uBlpDoztzyY1ZcO3tTNMTwxgds8HI=; b=GnUw6jIKy4VvUtAq6JRtA9tnJe2f9luRge04oe2c7BWHg2z+hxBLeGxTpo5UKooudC Spt5ziAKqtAQRNkf8CC4TNxZKN+emqORto/IDLLduVzH6ifZH/nRCFDTtoBtA6tqhZ3n OybU8GqnJ7ui2k2yjRWJGywen8bXJo99pybWGtUb33KuNybF1yr0CJCglkh+CU52NBAe j97wMsRB2ASdyFtx5zVYVM6rS7jRLACT7iuCver9VZotiUr6d2wxYMCeUhwwo5yJEA9X RzdjgHIqZNuws7JjYNBb+eheHkdw40mfMPLLY9B+EiQxx4CrPLOCsv26RtbO7/KCglhR gBkw== 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=AnWdYySv2ElBW0uBlpDoztzyY1ZcO3tTNMTwxgds8HI=; b=u2ubHe1rUoMr1umEGQTWO1f+BjEZdXgpxv1i/6flTap15ZnMaSX0QPDF8K6LCWviR/ 9nYQ8F6XzRd+0u/C1s3GNr83ahJa1ahZtx86sgqGpSIBwWTnb+xFRLibHmOBc8OvnXEJ LMPeMwQeLDtafThNh/L4Q1Uf318XyIkLjkpV45i3jseRxW9FSIDBJfqPQrXLWzQiwUK9 Os3U0mu7/5aR+cyyN9wsn9p2R6wccH2NuDpM5shmPzRyoKVPI6Wld2/+EmK418cFUKUZ TRk0HgnTp+ClWtUAidlynIGbGjUzE5RhEiRpSerTo/WJCrliosb19tgwhUA423pYQTGt jLaw== X-Gm-Message-State: AJIora9vMVv5HFu8PckAX3UKyW76bgSZGn5UGMzH5tFNaQOEqoSmAMr7 3H/5Tyr/0ywPhRH75htsA6c/j1SiFgsS4fj8 X-Google-Smtp-Source: AGRyM1v6ATZDbmHo1v8ebjcpZanCb94Ax4IX7JfyHmqaHedp3fccRz2rZtv8sHSrbAmiYg4dYmQzPw== X-Received: by 2002:a63:8ac2:0:b0:408:a936:8cc8 with SMTP id y185-20020a638ac2000000b00408a9368cc8mr6020293pgd.343.1655411161592; Thu, 16 Jun 2022 13:26:01 -0700 (PDT) Received: from mai.imgcgcw.net ([192.77.111.2]) by smtp.gmail.com with ESMTPSA id a5-20020aa79705000000b0051bb0be7109sm2182960pfg.78.2022.06.16.13.26.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jun 2022 13:26:01 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, rafael@kernel.org Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Amit Kucheria , Zhang Rui Subject: [PATCH 3/3] thermal/drivers/u8500: Remove the get_trend function Date: Thu, 16 Jun 2022 22:25:37 +0200 Message-Id: <20220616202537.303655-3-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220616202537.303655-1-daniel.lezcano@linaro.org> References: <20220616202537.303655-1-daniel.lezcano@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The get_trend function relies on the interrupt to set the raising or dropping trend. However the interpolated temperature is already giving the temperature information to the thermal framework which is able to deduce the trend. Remove the trend code. Signed-off-by: Daniel Lezcano Acked-by: Linus Walleij --- drivers/thermal/db8500_thermal.c | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/drivers/thermal/db8500_thermal.c b/drivers/thermal/db8500_thermal.c index 21d4d6e6409a..ed40cfd9ab7d 100644 --- a/drivers/thermal/db8500_thermal.c +++ b/drivers/thermal/db8500_thermal.c @@ -53,7 +53,6 @@ static const unsigned long db8500_thermal_points[] = { struct db8500_thermal_zone { struct thermal_zone_device *tz; - enum thermal_trend trend; unsigned long interpolated_temp; unsigned int cur_index; }; @@ -73,24 +72,12 @@ static int db8500_thermal_get_temp(void *data, int *temp) return 0; } -/* Callback to get temperature changing trend */ -static int db8500_thermal_get_trend(void *data, int trip, enum thermal_trend *trend) -{ - struct db8500_thermal_zone *th = data; - - *trend = th->trend; - - return 0; -} - static struct thermal_zone_of_device_ops thdev_ops = { .get_temp = db8500_thermal_get_temp, - .get_trend = db8500_thermal_get_trend, }; static void db8500_thermal_update_config(struct db8500_thermal_zone *th, unsigned int idx, - enum thermal_trend trend, unsigned long next_low, unsigned long next_high) { @@ -98,7 +85,6 @@ static void db8500_thermal_update_config(struct db8500_thermal_zone *th, th->cur_index = idx; th->interpolated_temp = (next_low + next_high)/2; - th->trend = trend; /* * The PRCMU accept absolute temperatures in celsius so divide @@ -127,8 +113,7 @@ static irqreturn_t prcmu_low_irq_handler(int irq, void *irq_data) } idx -= 1; - db8500_thermal_update_config(th, idx, THERMAL_TREND_DROPPING, - next_low, next_high); + db8500_thermal_update_config(th, idx, next_low, next_high); dev_dbg(&th->tz->device, "PRCMU set max %ld, min %ld\n", next_high, next_low); @@ -149,8 +134,7 @@ static irqreturn_t prcmu_high_irq_handler(int irq, void *irq_data) next_low = db8500_thermal_points[idx]; idx += 1; - db8500_thermal_update_config(th, idx, THERMAL_TREND_RAISING, - next_low, next_high); + db8500_thermal_update_config(th, idx, next_low, next_high); dev_dbg(&th->tz->device, "PRCMU set max %ld, min %ld\n", next_high, next_low); @@ -210,8 +194,7 @@ static int db8500_thermal_probe(struct platform_device *pdev) dev_info(dev, "thermal zone sensor registered\n"); /* Start measuring at the lowest point */ - db8500_thermal_update_config(th, 0, THERMAL_TREND_STABLE, - PRCMU_DEFAULT_LOW_TEMP, + db8500_thermal_update_config(th, 0, PRCMU_DEFAULT_LOW_TEMP, db8500_thermal_points[0]); platform_set_drvdata(pdev, th); @@ -232,8 +215,7 @@ static int db8500_thermal_resume(struct platform_device *pdev) struct db8500_thermal_zone *th = platform_get_drvdata(pdev); /* Resume and start measuring at the lowest point */ - db8500_thermal_update_config(th, 0, THERMAL_TREND_STABLE, - PRCMU_DEFAULT_LOW_TEMP, + db8500_thermal_update_config(th, 0, PRCMU_DEFAULT_LOW_TEMP, db8500_thermal_points[0]); return 0;