Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp558953ybt; Fri, 10 Jul 2020 06:54:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7F/AMvvJ4Smp90Zge+mZJDt6gvqLLs9LIswlL9Xer49CG4bye4+LE8B1Tp0wEaleAfSLc X-Received: by 2002:a50:d513:: with SMTP id u19mr75133295edi.241.1594389270563; Fri, 10 Jul 2020 06:54:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594389270; cv=none; d=google.com; s=arc-20160816; b=kOoJuIiO3m2nWGl21FYQg/ZTUISJz8g7g7NYiDpCjR1h1EqZh1C5M9g+Yj0xkFNTGp pAHLkv/nyZAcuI5wb9yZ2EuSU7QYHPXqAzTKG/r8UxDthurSDMFeefiDzD79KE4KXCOY REPt8rOROBl9AoYPwZWRpxiwiuYsd3uIqGctRT/uNMXZCvimVzONLhbTCR7YWEiwFsCi l2mEbs5owHVezWw/ISSDYjtNF2bI37Ji7RzT5ixfoLA2ixRG8Bz9FXd6qh4XtElH+XMQ rRKxKi/hyEg7wA3xSgtlpG5Gm4eqQQGzqUQ8MoT/NUeXFz9lHY2/muJELE/XDJsfpiLi 20zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0Hf2EQhK7szwaDYevZJPMqkaBsz8dSW+eokQabw43h0=; b=FN3Skx3Z3QJox77K2ZQwncDrB/DPvboKeuAPVNOmwAe/OfaOThLd/zj06LwonlTU9E MnxXRNmpdtzOwzWCWyncvGm2kfqyZzdF9RrHvnewdyNt9s/GnZ1Ru/VKwnwvlJqiGQzQ eylSC0f3VdvajI/0LRUnVlJ8qcQGQflY1MrwQGPIbcLMKHwSZutbV/jbn1ZDie+FGuEP IkYZxLl3l3px0vRuztQNOK4X/jzJrI290VOmVk0BflxnbyoONfkf1nNP+DNxY1ySdPD0 yo2yVVtD2vbWb/0J9ejHQvZhMnVS4ZkPojZaSjU7OkrLN6lWSeWmmzX32RzIvDD1+tzh /93A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OFVDGDmD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id co20si4131143edb.131.2020.07.10.06.54.07; Fri, 10 Jul 2020 06:54:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OFVDGDmD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728202AbgGJNwF (ORCPT + 99 others); Fri, 10 Jul 2020 09:52:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728065AbgGJNwA (ORCPT ); Fri, 10 Jul 2020 09:52:00 -0400 Received: from mail-qv1-xf43.google.com (mail-qv1-xf43.google.com [IPv6:2607:f8b0:4864:20::f43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 377A0C08E806 for ; Fri, 10 Jul 2020 06:52:00 -0700 (PDT) Received: by mail-qv1-xf43.google.com with SMTP id m9so2567204qvx.5 for ; Fri, 10 Jul 2020 06:52:00 -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=0Hf2EQhK7szwaDYevZJPMqkaBsz8dSW+eokQabw43h0=; b=OFVDGDmDk2rsL22Q4OLH5sVL2ZMmlniVU/Ydrcah/Q7eV5oVyW+i2owNIXJhdUgzu4 oJL8XGEIhQIMoMQKKk24I/CCznLtco1zHe/7pSq0RjsXKN7TUI3dW8OEs7hGHrHaE0w2 gk4mkcdbZGQHm3gd8DYfTS3DKBkKfQuhlLQm3W3tAmhQ81D4Szi55btLM8eufONuYmBB Hc3g972A2kAj/pbdHNI06mO7dqcLMtyMo5MMFDwcMyYrghUJvMDovI2b200HTnqv/aPJ pj7VCHr2BRDkIQUVek+yXbOzYf8eUdWVo3SDjYkgjCuv/kLO1R5doaaaqyFYovc0wxYz ZtPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0Hf2EQhK7szwaDYevZJPMqkaBsz8dSW+eokQabw43h0=; b=jQxbgEvE2ZBfgmUPam+X8/5MefMutWQfAE06P+tXhw7zA00VyrkietV/4D3tPrM7HK SlBBgltHaBU82MVqYVB2QjlCdAwdLYC9FMAtkZVupRy9dZy2hREJGfbeIynhPmN0g0AG oMeEWrWN1F4ihRxL6lJmZ2jQ8UpUjjUVc2gVA2fh2XhBHMINJJMTeAn9i+QCMOmp3sQE NzlEOF+/MCd9rIDOIQHj/S5ErymlX2ldjO3gra5fPfFLs0HfWDi+UFPBJ3onsth6uw0J dw5PEv3YOxlyFB+iGyon9SizRnFdANZ0X0L9HYIeR68M8P4SY7AI1H6lGvB12z2C4xZ1 d1/A== X-Gm-Message-State: AOAM532Q6A2ACmi7aCG+ueSq21dB0uKotbwQJVbWHl1a+XffJQgdCR/D XMZXdfAmL4nZW+TkBSlaEIEH/A== X-Received: by 2002:ad4:504a:: with SMTP id m10mr55427983qvq.172.1594389119450; Fri, 10 Jul 2020 06:51:59 -0700 (PDT) Received: from pop-os.fios-router.home (pool-71-255-246-27.washdc.fios.verizon.net. [71.255.246.27]) by smtp.googlemail.com with ESMTPSA id h197sm7574059qke.51.2020.07.10.06.51.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 06:51:58 -0700 (PDT) From: Thara Gopinath To: daniel.lezcano@linaro.org, rui.zhang@intel.com, robh+dt@kernel.org Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 3/4] thermal:core:Add genetlink notifications for monitoring falling temperature Date: Fri, 10 Jul 2020 09:51:53 -0400 Message-Id: <20200710135154.181454-4-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200710135154.181454-1-thara.gopinath@linaro.org> References: <20200710135154.181454-1-thara.gopinath@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add notification calls for trip type THERMAL_TRIP_COLD when temperature crosses the trip point in either direction. Signed-off-by: Thara Gopinath --- drivers/thermal/thermal_core.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 750a89f0c20a..e2302ca1cd3b 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -429,12 +429,21 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, int trip) tz->ops->get_trip_hyst(tz, trip, &hyst); if (tz->last_temperature != THERMAL_TEMP_INVALID) { - if (tz->last_temperature < trip_temp && - tz->temperature >= trip_temp) - thermal_notify_tz_trip_up(tz->id, trip); - if (tz->last_temperature >= trip_temp && - tz->temperature < (trip_temp - hyst)) - thermal_notify_tz_trip_down(tz->id, trip); + if (type == THERMAL_TRIP_COLD) { + if (tz->last_temperature > trip_temp && + tz->temperature <= trip_temp) + thermal_notify_tz_trip_down(tz->id, trip); + if (tz->last_temperature <= trip_temp && + tz->temperature > (trip_temp + hyst)) + thermal_notify_tz_trip_up(tz->id, trip); + } else { + if (tz->last_temperature < trip_temp && + tz->temperature >= trip_temp) + thermal_notify_tz_trip_up(tz->id, trip); + if (tz->last_temperature >= trip_temp && + tz->temperature < (trip_temp - hyst)) + thermal_notify_tz_trip_down(tz->id, trip); + } } if (type == THERMAL_TRIP_CRITICAL || type == THERMAL_TRIP_HOT) -- 2.25.1