Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp106146pxk; Wed, 16 Sep 2020 20:30:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx99NbWrKlfgiSB5H5I1E2shgq56oNuVTG/XwBtU85CwAijOxnU4vZUZRCNF5w/OaeGf8Q6 X-Received: by 2002:a05:6402:3193:: with SMTP id di19mr30280184edb.211.1600313415105; Wed, 16 Sep 2020 20:30:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600313415; cv=none; d=google.com; s=arc-20160816; b=RKvetgGyzLd1GzfmIEyxX7c5C0hQydFiUNUe0DEdZ0RYQnyU3mgOiMRk0QSPhyfOCe O3VCpKh1xWPQqU9gr6CY7dYXV120XOlXGd0Q/RNWq8sy6ga7umYYsrfHoPy8Xrjfqi2f mtJE/B7aNTlXI+b8lfDWwRXHElGXch3cJdzojHRg1emCiP5dNz1/59ihX+fhgOkAR+ij 5gPiOq5T9MMzI4p0ACnr2nGGMJlPKrxIM8DzIyGiYmTc/gJ/iUU3yQL3MuOVJ2qHsiW2 16p2ZSyRhUilAi8VC4R2CXZx7GUlYsdBsohklqRL3CT0AURgPwKSc5+sQpCpwYWBnPtA 4WWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1NcquyWzHDIuJiug62gYGv91t6olYNR2dy8wB4N3YW8=; b=MdFDdj2R/bVR5iSPj936M0AW9giJRMM6prD+XEGe4ysk3buGQ7o4hWKoAR4CcPrM+S 7TtEZER9RaIcwIg3t4v7pGM50h/wMQnMxId/SOPhj2IYAZ9saUfeaIQFBjgpI3TUiTMs wno1S6CCzntoz4lw6FuItjlI7CS7Pm/su31C/aVkv4EZ48fD1cjWTOkzTALg/IbbXMNU E4TYz01sL+6SUKoecyN4fRY8QSaig9CJWk4bh9g8SmQ+u0JQv2CygTyA94NIt8TVx4Oi 7+FGix1oXHgOg1he+aGJmwGsfhqGz+aAx0GWWsFCBdo0esCZ0iMgxFFbv66R50TtqD2l niwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZjT3HZ9I; 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 z12si12214645eju.152.2020.09.16.20.29.52; Wed, 16 Sep 2020 20:30:15 -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=ZjT3HZ9I; 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 S1726255AbgIQD2W (ORCPT + 99 others); Wed, 16 Sep 2020 23:28:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725858AbgIQD2N (ORCPT ); Wed, 16 Sep 2020 23:28:13 -0400 Received: from mail-qt1-x843.google.com (mail-qt1-x843.google.com [IPv6:2607:f8b0:4864:20::843]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FC43C06121C for ; Wed, 16 Sep 2020 20:22:31 -0700 (PDT) Received: by mail-qt1-x843.google.com with SMTP id z2so764134qtv.12 for ; Wed, 16 Sep 2020 20:22:31 -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=1NcquyWzHDIuJiug62gYGv91t6olYNR2dy8wB4N3YW8=; b=ZjT3HZ9IWjRR2EMUmN6dGhhCAsiNbkb1deW8KLeL6QC+L2ejiNBxDXnA6PoXafOEeA 8hQzQMOism0hxclUr6bt1SZwSU6oplOEAFDa6VmagRr/5wXMtw9cpwwDW593D7M5vGOG +iwNVaWP8BEWDAIOR6fFPTyXAt1YbO69uuoyUUAX0FwirgmlXHYeInYlJIFf6/44gRd6 t5fqMzOMJocRgAb0SsdQQXsy+qN/oIm2sTU8S/kehGc6KzlLNVuFgIItfaFfCpt0Azcp yJlAAUi2gNynmw7ku7zJLgHuQ5CDWtpJiqsFn/FGPV257NxWv0MAK+/sM9DAUPfgp/xG uJHQ== 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=1NcquyWzHDIuJiug62gYGv91t6olYNR2dy8wB4N3YW8=; b=daN1SDopngIxs5fMa01cb1LspsAOI8lJNL3lHJ5F3Zk/6E82VOB8oDFNeer98Hlz9r dZ1FiTVZq69fLW/wSEdkYwpa9+1E4hdbhsGiuwotVmwM+aj4WqqIqLNsxdb2+wR+nSGn ouRxNalBprBgi5oJOg+2ekOdCVXa1msqXp9Bpk/D7P9RWxk2/1MqqnC+AGW3KfOk+jZA a94GRjLjI3AoWv0bqeaMxCUVeNV05kfSmRgyQsVQ8or6gupEcJixBZTld8tdaPA0nypA qF3VsNqcTGR9COkcLc83vPKxZOCcSCrLGIrohJERIs7RjiHnGZcPktukz7sMbDeJUNmU cZuQ== X-Gm-Message-State: AOAM530NnaMRQ681zTWUqapR4aocHWBq6KEDElVcdsyz/GDVgkvlBsYB ndZzNeXx+eGXgVtX7fsXv7Qpig== X-Received: by 2002:ac8:c47:: with SMTP id l7mr26784465qti.112.1600312950684; Wed, 16 Sep 2020 20:22:30 -0700 (PDT) Received: from pop-os.fios-router.home (pool-71-163-245-5.washdc.fios.verizon.net. [71.163.245.5]) by smtp.googlemail.com with ESMTPSA id g45sm21370801qtb.60.2020.09.16.20.22.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 20:22:30 -0700 (PDT) From: Thara Gopinath To: rui.zhang@intel.com, daniel.lezcano@linaro.org, robh+dt@kernel.org, agross@kernel.org, bjorn.andersson@linaro.org Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, lukasz.luba@arm.com, amitk@kernel.org Subject: [PATCH RFC 3/8] thermal: thermal_of: Extend thermal dt driver to support bi-directional monitoring of a thermal trip point. Date: Wed, 16 Sep 2020 23:22:21 -0400 Message-Id: <20200917032226.820371-4-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200917032226.820371-1-thara.gopinath@linaro.org> References: <20200917032226.820371-1-thara.gopinath@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce of_thermal_get_trip_monitor_type to return the direction of monitoring of a thermal trip point. Also translate the DT information regarding trip point monitor direction into the thermal framework. Signed-off-by: Thara Gopinath --- drivers/thermal/thermal_of.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c index 69ef12f852b7..5bc7f5bab772 100644 --- a/drivers/thermal/thermal_of.c +++ b/drivers/thermal/thermal_of.c @@ -328,6 +328,20 @@ static int of_thermal_get_trip_hyst(struct thermal_zone_device *tz, int trip, return 0; } +static int of_thermal_get_trip_monitor_type + (struct thermal_zone_device *tz, int trip, + enum thermal_trip_monitor_type *type) +{ + struct __thermal_zone *data = tz->devdata; + + if (trip >= data->ntrips || trip < 0) + return -EDOM; + + *type = data->trips[trip].monitor_type; + + return 0; +} + static int of_thermal_set_trip_hyst(struct thermal_zone_device *tz, int trip, int hyst) { @@ -363,6 +377,7 @@ static struct thermal_zone_device_ops of_thermal_ops = { .set_trip_temp = of_thermal_set_trip_temp, .get_trip_hyst = of_thermal_get_trip_hyst, .set_trip_hyst = of_thermal_set_trip_hyst, + .get_trip_mon_type = of_thermal_get_trip_monitor_type, .get_crit_temp = of_thermal_get_crit_temp, .bind = of_thermal_bind, @@ -801,6 +816,7 @@ static int thermal_of_populate_trip(struct device_node *np, { int prop; int ret; + bool is_monitor_falling; ret = of_property_read_u32(np, "temperature", &prop); if (ret < 0) { @@ -822,6 +838,12 @@ static int thermal_of_populate_trip(struct device_node *np, return ret; } + ret = of_property_read_bool(np, "monitor-falling"); + if (is_monitor_falling) + trip->monitor_type = THERMAL_TRIP_MONITOR_FALLING; + else + trip->monitor_type = THERMAL_TRIP_MONITOR_RISING; + /* Required for cooling map matching */ trip->np = np; of_node_get(np); -- 2.25.1