From patchwork Thu Sep 17 03:22:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 11781355 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AB95F139F for ; Thu, 17 Sep 2020 03:28:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8FB5320936 for ; Thu, 17 Sep 2020 03:28:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="kPWL4eCu" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726210AbgIQD2d (ORCPT ); Wed, 16 Sep 2020 23:28:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726200AbgIQD2T (ORCPT ); Wed, 16 Sep 2020 23:28:19 -0400 Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 105FEC061797 for ; Wed, 16 Sep 2020 20:22:29 -0700 (PDT) Received: by mail-qk1-x743.google.com with SMTP id q5so886373qkc.2 for ; Wed, 16 Sep 2020 20:22:29 -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=gOjR8vxr5WwVeS1m/lfV7tbojY1ErwXvE0dsI9QW/uo=; b=kPWL4eCuolVXw35vyUzORP0/S/rIAepUZMAvp7ZZdAhaDRpkH1E25kh74NGxkqvub6 EHm7NsrHU7o8gAX4/7USoUt2l7awOKN6znJPoujEb9pcEkXkf6C0D+fZuW4s0eA0dKsL pYXjrlIcUsEe2LpunJ4kvAnWvvQSJ0NCJSXQ4dZ8R62GQw9TYY0cgCnEM+cmgHMfsMIu kLYLB+SnzfkuWKUf2lRGiJxt4TWy94+YT0h203bINrOr9nJvTELxnsSvjonnFlzPTfwb wyJcbIu0O1rtvGkQT61nfZ0I77Foo3LV8MySGrc2Vvt7r7QD1ULzvuaTFiGDgnFfq+/5 DTHA== 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=gOjR8vxr5WwVeS1m/lfV7tbojY1ErwXvE0dsI9QW/uo=; b=mOMHmR+h6hgFg8yR7lHsPZQuC+VWfvqre/78/M6UESgzy27K+MK7K0o8b9sdtCCe/E qouDzAk9KUXHoyNJ/HyExSwFi2+CSDhLs5iLmxAd30g+o8Fh8dBcJKAEJHuysGk4EhNJ W6L6F9ihMdnxvciHpCG1qBSN8Ne7/+8jsp+ig1fyZOlLvC7ap4atBfjYQrey3uBnOp8x OPmpWfrQcSCjsOyvPI5dxndGz4wcFsULt8RqxPZ8AkOvCnXuOUAR0Iv7XNXBwa2hDDUb lcKDMnMgumPYZ5MbIw5BlK3qene5bG5TDsBV9aKcH78LvZWK6r761HYNuwKF3MxC61WY hs2A== X-Gm-Message-State: AOAM530qHH7zVqWSbMeCwtZGZw7kI3vgJG/qqg0XLCu/BEoGSLbIlluJ cJXxN31psbdJZD7blBz4j4Df5g== X-Google-Smtp-Source: ABdhPJwrZ4vSxdjRvdBIWTFXormzDUQW/UqI1T+x0gkPM8a4jmLPzyFxrDQyZ0xg8jAV6ESq5T3LxQ== X-Received: by 2002:a37:5042:: with SMTP id e63mr25056428qkb.453.1600312948930; Wed, 16 Sep 2020 20:22:28 -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.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 20:22:28 -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 1/8] dt-bindings: thermal: Introduce monitor-falling parameter to thermal trip point binding Date: Wed, 16 Sep 2020 23:22:19 -0400 Message-Id: <20200917032226.820371-2-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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Introduce a new binding parameter to thermal trip point description to indicate whether the temperature level specified by the trip point is monitored for a rise or fall in temperature. Signed-off-by: Thara Gopinath --- .../devicetree/bindings/thermal/thermal-zones.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/thermal/thermal-zones.yaml b/Documentation/devicetree/bindings/thermal/thermal-zones.yaml index 3ec9cc87ec50..cc1332ad6c16 100644 --- a/Documentation/devicetree/bindings/thermal/thermal-zones.yaml +++ b/Documentation/devicetree/bindings/thermal/thermal-zones.yaml @@ -161,6 +161,13 @@ patternProperties: The active trip type can be used to control other HW to help in cooling e.g. fans can be sped up or slowed down + monitor-falling: + description: | + boolean, If true, the trip point is being monitored for + falling temperature. If false/absent/default, the trip + point is being monitored for rising temperature. + type: boolean + required: - temperature - hysteresis From patchwork Thu Sep 17 03:22:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 11781349 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8E918618 for ; Thu, 17 Sep 2020 03:28:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 72F26206D4 for ; Thu, 17 Sep 2020 03:28:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="iYF9saol" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726198AbgIQD2H (ORCPT ); Wed, 16 Sep 2020 23:28:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726098AbgIQD2E (ORCPT ); Wed, 16 Sep 2020 23:28:04 -0400 Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7C03C061354 for ; Wed, 16 Sep 2020 20:22:30 -0700 (PDT) Received: by mail-qk1-x744.google.com with SMTP id n133so829003qkn.11 for ; Wed, 16 Sep 2020 20:22:30 -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=myxUO6gc+lFpyY6bxPaw2oxrXJNbpjbu9J+ggDGNP1Q=; b=iYF9saol7Uya9S+s+a5H00YbWk1vk/5ld+bL+/IoAQzNJ84leuLdIk4WZKQoc3IjJ7 458Luy1hzBiiGiPzkWs+JegOxXStBqnEASvcNydckoGa7tcJ7F3c14FGQttP7joLwjfZ qw1Eohni5Xmwr8EyOfpZyf2VSI2daffRU4FDuOU+ocHwwIEy8SsNZ8E3bJqTDd9NxNKz N1zHygoqOkMvs+n02vrxFKxNZrzLWawNw/FjF74zU0xzcGLt7BkPLhyCZ0MY8D39DkVl xia9YMQcIYE6ykJstBekisdhdf0vr588cfSuqVv09iHwjh9ydJg5kh0OXIX+1akr4yqs kD+g== 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=myxUO6gc+lFpyY6bxPaw2oxrXJNbpjbu9J+ggDGNP1Q=; b=bCfFSWa8Nrciw+FEsS3hmg5P+Dso1/mnn0x+69UDi0nh/pRsoDBqu+rYA77pAO9LqE 5cBt2+nAEMBfJ6Xy/JiqfHescEwHCmhjfV9YZHxkoeT+a9NuYtNTMgv99oQVXsEtoZ9m skByVUCZSFnCQvjLeqp2UplX6PROBHcplAYQph7/S/7+X+l0nTQsbtvonjtOVcc1IMod esZIuM6pV7loMyIeP4JTS4kxFwGNXLzi73OlTmDj1N0640PI53+CvlTckK4oSuz1kel4 nQ0jDKmpEf7B+/4oA5aqjGLHNDuqhte0Ec1sxyuZthD9fAhMo9DkNvSNmtlDs/gjk2Ps 3Yeg== X-Gm-Message-State: AOAM531/BFN9WibFQmZaMOYMjDzcWO9dD5eP8typxf9ZII+MXNrzOWrn jT0dwXubLyqtWYd8CcgrCPT4Mw== X-Google-Smtp-Source: ABdhPJyC733LwHdlOPKyh0SJj9Ov7zceVdFCYbRyxyeI44PNS39rWktdOG6zOgaxjUTzbgJIqt7rUg== X-Received: by 2002:ae9:c310:: with SMTP id n16mr11085776qkg.318.1600312949899; Wed, 16 Sep 2020 20:22:29 -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:29 -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 2/8] thermal: Introduce new property monitor_type for trip point. Date: Wed, 16 Sep 2020 23:22:20 -0400 Message-Id: <20200917032226.820371-3-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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Thermal trip points can be defined to indicate whether a temperature rise or a temperature fall is to be monitored. This property can now be defined in the DT bindings for a trip point. To support this following three changes are introduced to thermal core and sysfs code. 1. Define a new variable in thermal_trip to capture the monitor rising/falling information from trip point DT bindings. 2. Define a new ops in thermal_zone_device_ops that can be populated to indicate whether a trip is being monitored for rising or falling temperature. If the ops is not populated or if the binding is missing in the DT, it is assumed that the trip is being monitored for rising temperature. (default behavior today) Signed-off-by: Thara Gopinath --- drivers/thermal/thermal_core.h | 2 ++ include/linux/thermal.h | 2 ++ include/uapi/linux/thermal.h | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h index e00fc5585ea8..c56addfe2284 100644 --- a/drivers/thermal/thermal_core.h +++ b/drivers/thermal/thermal_core.h @@ -77,12 +77,14 @@ int power_actor_set_power(struct thermal_cooling_device *cdev, * @temperature: temperature value in miliCelsius * @hysteresis: relative hysteresis in miliCelsius * @type: trip point type + * @monitor_type: trip point monitor type */ struct thermal_trip { struct device_node *np; int temperature; int hysteresis; enum thermal_trip_type type; + enum thermal_trip_monitor_type monitor_type; }; int get_tz_trend(struct thermal_zone_device *tz, int trip); diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 42ef807e5d84..a50ed958d0bd 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -72,6 +72,8 @@ struct thermal_zone_device_ops { int (*set_trip_temp) (struct thermal_zone_device *, int, int); int (*get_trip_hyst) (struct thermal_zone_device *, int, int *); int (*set_trip_hyst) (struct thermal_zone_device *, int, int); + int (*get_trip_mon_type)(struct thermal_zone_device *, int, + enum thermal_trip_monitor_type *); int (*get_crit_temp) (struct thermal_zone_device *, int *); int (*set_emul_temp) (struct thermal_zone_device *, int); int (*get_trend) (struct thermal_zone_device *, int, diff --git a/include/uapi/linux/thermal.h b/include/uapi/linux/thermal.h index c105054cbb57..d3bb4e4fad69 100644 --- a/include/uapi/linux/thermal.h +++ b/include/uapi/linux/thermal.h @@ -16,6 +16,11 @@ enum thermal_trip_type { THERMAL_TRIP_CRITICAL, }; +enum thermal_trip_monitor_type { + THERMAL_TRIP_MONITOR_RISING = 0, + THERMAL_TRIP_MONITOR_FALLING +}; + /* Adding event notification support elements */ #define THERMAL_GENL_FAMILY_NAME "thermal" #define THERMAL_GENL_VERSION 0x01 From patchwork Thu Sep 17 03:22:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 11781369 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CA442139F for ; Thu, 17 Sep 2020 03:28:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AA1E5206D4 for ; Thu, 17 Sep 2020 03:28:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ZjT3HZ9I" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726115AbgIQD24 (ORCPT ); Wed, 16 Sep 2020 23:28:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726179AbgIQD2P (ORCPT ); Wed, 16 Sep 2020 23:28:15 -0400 Received: from mail-qt1-x841.google.com (mail-qt1-x841.google.com [IPv6:2607:f8b0:4864:20::841]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E8A1C061356 for ; Wed, 16 Sep 2020 20:22:31 -0700 (PDT) Received: by mail-qt1-x841.google.com with SMTP id r8so757000qtp.13 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=GuIxvVgUOHvYNhShnEk+yu52CpD3q4I5k5QQVqme8Qd+TL/WKQiLe6vBkDvUCmM0lp tR8N9PoKxb2Ofl+j6kp/IJzX/oVUuRqCGr+6x77BrnO07LCWrj+bwpFKYz9xhXHP/x5h LZAv9fIYtBMkJBenzNwDh7rVI7TRXoFOacvt+YxyGgaDZ4/e/hvYiq1ReCuw04du7Mxz 6LZXU27qinbA0OWvhIa6Mm76xeJqknCdVycMEE75GRVpZuO06jSAPoY9gQsbN6sLvAYm BUvC3+Dh7QdFplxauzTUGiCpM3i/VRlQa5htQiaBIY4OQ7E5evOJnTQTjG2bYAXV88YZ kO0Q== X-Gm-Message-State: AOAM530UMGj+e5YpqgwNvhmDwM/Brb63kFWTQvXH0sFUnjy3/ECs1whv G6MKSRqM0ANKk/YRGIAU6YGhBQ== X-Google-Smtp-Source: ABdhPJxxKJdjeTdjjcubP0PRHZMaX20uEdalLcV/FelHR/61pinL+LUVDzaruFtZmWuBsDezydob+w== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@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); From patchwork Thu Sep 17 03:22:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 11781365 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5D616618 for ; Thu, 17 Sep 2020 03:28:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3DE9C20872 for ; Thu, 17 Sep 2020 03:28:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="NyQoaVEh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726285AbgIQD2t (ORCPT ); Wed, 16 Sep 2020 23:28:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726187AbgIQD2S (ORCPT ); Wed, 16 Sep 2020 23:28:18 -0400 Received: from mail-qt1-x842.google.com (mail-qt1-x842.google.com [IPv6:2607:f8b0:4864:20::842]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66C45C061221 for ; Wed, 16 Sep 2020 20:22:32 -0700 (PDT) Received: by mail-qt1-x842.google.com with SMTP id c18so800643qtw.5 for ; Wed, 16 Sep 2020 20:22:32 -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=91xhdh0yMbg0WvS++faa8p3tfvFulTbKZKHM2XlY74k=; b=NyQoaVEhlCnIGRqdp321BmI4p2RYV5GPrX3iVW7IPq2tfUJ57cCEZoreEVlu1lbBWZ su5ozIUlgC8gHb1OaMDzEmpfZfLbFTBsoBBLxSNI2Lxcu6VABPH3NcjEYfo1nDSaG5+T oQCuRKV7f8ON4HPr3U6JmB1C09O990Js8g/DDiXG1W0NUbgyhXcWYKETNJcA2zSqDqT2 XkFyfa2T8xEvcAa1fMWzS4jPSjM7XhXkCqIubKkeJ7/1idKK8LLzoxuW7253bFWkJBA/ xy5ZyEK+L0Tx9r3N2KwW5hlwSiLLSyNC1jEWIuTeHNKy4xO4PNjiVvJwHMV63sKQFG2I 9X/g== 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=91xhdh0yMbg0WvS++faa8p3tfvFulTbKZKHM2XlY74k=; b=bLIMVS/JdlqLHVyw33Dso4ZyZfxLfwD2YHCPaPpFO0ybRTOg98qXvRLQwm5AeAZqXF 0RAQcEZR1eXTxzcZhDnElBKkra6gbVdRPA4ZpIg9NyBDBLZuyKzrY/goc0hSx/qeea5q X75/oaMdLB7cTJUulJ3V5Ii9pgYpFYRO9gVG+mVWQbeiB1flClJgdECwIThFSmMICTt8 wMpkkvaCOSmtw7htuDD8QQeCGk+lA6BNhD2ZFdPKlIQHe4+vtnu9oCBp/fb4evAwBHN1 VuYexTHYTYm5m+ObjWMR/phmnR0sLrplLopGsyIbD8pYxMqOAvstY4LhawZcxyga+NRt gFBQ== X-Gm-Message-State: AOAM5321K8eecSyM/BzzbF52SOHGhUcUXb8IfMtuLFrJeSETrXPR6LgB G3CQoEonCeR44+Y1wwDYzLDYow== X-Google-Smtp-Source: ABdhPJzGVKbFfyn5rK7FIWROKX5Y6Ozb4GkKmDTocfvmrnEQHqR5zV7FnxxIy6zJL/wOmfKrZcsJSg== X-Received: by 2002:ac8:75ca:: with SMTP id z10mr13718611qtq.345.1600312951689; Wed, 16 Sep 2020 20:22:31 -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.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 20:22:31 -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 4/8] thermal:core:Add genetlink notifications for monitoring falling temperature Date: Wed, 16 Sep 2020 23:22:22 -0400 Message-Id: <20200917032226.820371-5-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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Add notification calls for trip points that are being monitored for falling temperatures. Signed-off-by: Thara Gopinath --- drivers/thermal/thermal_core.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 72bf159bcecc..bfd436379408 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -417,6 +417,7 @@ static void handle_critical_trips(struct thermal_zone_device *tz, static void handle_thermal_trip(struct thermal_zone_device *tz, int trip) { enum thermal_trip_type type; + enum thermal_trip_monitor_type mon_type; int trip_temp, hyst = 0; /* Ignore disabled trip points */ @@ -428,13 +429,25 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, int trip) if (tz->ops->get_trip_hyst) tz->ops->get_trip_hyst(tz, trip, &hyst); + if (tz->ops->get_trip_mon_type) + tz->ops->get_trip_mon_type(tz, trip, &mon_type); + 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 (mon_type == THERMAL_TRIP_MONITOR_FALLING) { + 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) From patchwork Thu Sep 17 03:22:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 11781381 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 314BB14B7 for ; Thu, 17 Sep 2020 03:29:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 12E7420872 for ; Thu, 17 Sep 2020 03:29:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="TMVcDNfE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726154AbgIQD3N (ORCPT ); Wed, 16 Sep 2020 23:29:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726156AbgIQD2J (ORCPT ); Wed, 16 Sep 2020 23:28:09 -0400 Received: from mail-qt1-x841.google.com (mail-qt1-x841.google.com [IPv6:2607:f8b0:4864:20::841]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 410AEC061224 for ; Wed, 16 Sep 2020 20:22:33 -0700 (PDT) Received: by mail-qt1-x841.google.com with SMTP id e7so768344qtj.11 for ; Wed, 16 Sep 2020 20:22:33 -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=wyquXDsI5PpUswweH/QuIkj+hc4Cb9K+5Ghm5R3vs34=; b=TMVcDNfEewcm+Zlud5OWrLGCMtmG1XeduU2v6C81w3F27mDgOu5Dyjif/uvvhdsYNA ZF8agjfrxmavZWYFccuoVVZlNqDx0D0M8v89KjTasVKsAGJ0woopsXMrlfQW6hml+tj7 HbYKk+7NjJA1wjTkgwVq8paXmKSU7anwXtDDTxJ6UI0n9HIBv1l/7FIFf3nujZ/cMksP D30K4FMm77sR/DQzZYi3o8+kiBT5hGNj53VO3GKFGrms6Ft+lOz/pPXHxlP5KppRbvmu gvcisGJ/2G+AGfGNjBI+cqLJF6D8VAqNrlUesqay0E9Wqa6RHukc2cdU2ZZifdEo+a52 uZkg== 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=wyquXDsI5PpUswweH/QuIkj+hc4Cb9K+5Ghm5R3vs34=; b=nrfhiro5yuwbExozXGoHqDGF1RMtoqUVUcEevQe8HhQ60772Z+/AmJAyfRJruBE/j2 Xb0Zs8shhnSE4VPBE1++B2DIITPfWhIacysZQE8qUOSBml3vvytCtw9cCm8Kk51NumCI wdQgEUjxp2tiuNPN25ZnaQu7QgAKWpmBRJbHBhCDUwgh/dV1+EA8mtbKJbwe9VrxKxz1 /C5sQ5Yn/NDLME/R4M1+ocw7XtHAqRKJs0muTqn/SFkpRuf+96B9MJhy7BkCx1q3FF9w 7vz4/jgDVuGXL8GDhduMiyt+MbvjcHLnMCJCIdOxv977ouaW+TTU5lZtLrQAWXXKxC3G LWwQ== X-Gm-Message-State: AOAM531E/ohjP02K5pJFS+BE1xm5jeqGdiCXazKfeMx0Ii3XUXstgtYL 4mBipHugfq7ORPLVP4VSIMGQfw== X-Google-Smtp-Source: ABdhPJyKE5XKI9TJVppgF3SUV9hJyConQ72DMtIOPoTixmFeCTdqRn/0DKS2tG949jP/2DuCt8Ac/A== X-Received: by 2002:ac8:1108:: with SMTP id c8mr13557566qtj.323.1600312952482; Wed, 16 Sep 2020 20:22:32 -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.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 20:22:32 -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 5/8] thermal: gov_step_wise: Extend thermal step-wise governor to monitor falling temperature. Date: Wed, 16 Sep 2020 23:22:23 -0400 Message-Id: <20200917032226.820371-6-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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From the step wise governor point of view, the policy decisions that has to taken on a thermal trip point that is defined to be monitored for falling temperature is the mirror opposite of the decisions it has to take on a trip point that is monitored for rising temperature. Signed-off-by: Thara Gopinath --- drivers/thermal/gov_step_wise.c | 62 +++++++++++++++++++++++++-------- 1 file changed, 47 insertions(+), 15 deletions(-) diff --git a/drivers/thermal/gov_step_wise.c b/drivers/thermal/gov_step_wise.c index 2ae7198d3067..c036ff7b4fb2 100644 --- a/drivers/thermal/gov_step_wise.c +++ b/drivers/thermal/gov_step_wise.c @@ -35,7 +35,8 @@ * deactivate the thermal instance */ static unsigned long get_target_state(struct thermal_instance *instance, - enum thermal_trend trend, bool throttle) + enum thermal_trend trend, bool throttle, + enum thermal_trip_monitor_type type) { struct thermal_cooling_device *cdev = instance->cdev; unsigned long cur_state; @@ -65,11 +66,24 @@ static unsigned long get_target_state(struct thermal_instance *instance, switch (trend) { case THERMAL_TREND_RAISING: - if (throttle) { - next_target = cur_state < instance->upper ? - (cur_state + 1) : instance->upper; - if (next_target < instance->lower) - next_target = instance->lower; + if (type == THERMAL_TRIP_MONITOR_FALLING) { + if (cur_state <= instance->lower) { + if (!throttle) + next_target = THERMAL_NO_TARGET; + } else { + if (!throttle) { + next_target = cur_state - 1; + if (next_target > instance->upper) + next_target = instance->upper; + } + } + } else { + if (throttle) { + next_target = cur_state < instance->upper ? + (cur_state + 1) : instance->upper; + if (next_target < instance->lower) + next_target = instance->lower; + } } break; case THERMAL_TREND_RAISE_FULL: @@ -77,14 +91,23 @@ static unsigned long get_target_state(struct thermal_instance *instance, next_target = instance->upper; break; case THERMAL_TREND_DROPPING: - if (cur_state <= instance->lower) { - if (!throttle) - next_target = THERMAL_NO_TARGET; + if (type == THERMAL_TRIP_MONITOR_FALLING) { + if (throttle) { + next_target = cur_state < instance->upper ? + (cur_state + 1) : instance->upper; + if (next_target < instance->lower) + next_target = instance->lower; + } } else { - if (!throttle) { - next_target = cur_state - 1; - if (next_target > instance->upper) - next_target = instance->upper; + if (cur_state <= instance->lower) { + if (!throttle) + next_target = THERMAL_NO_TARGET; + } else { + if (!throttle) { + next_target = cur_state - 1; + if (next_target > instance->upper) + next_target = instance->upper; + } } } break; @@ -117,6 +140,8 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip) { int trip_temp; enum thermal_trip_type trip_type; + enum thermal_trip_monitor_type monitor_type = + THERMAL_TRIP_MONITOR_RISING; enum thermal_trend trend; struct thermal_instance *instance; bool throttle = false; @@ -130,9 +155,15 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip) tz->ops->get_trip_type(tz, trip, &trip_type); } + if (tz->ops->get_trip_mon_type) + tz->ops->get_trip_mon_type(tz, trip, &monitor_type); + trend = get_tz_trend(tz, trip); - if (tz->temperature >= trip_temp) { + if (((monitor_type == THERMAL_TRIP_MONITOR_RISING) && + (tz->temperature >= trip_temp)) || + ((monitor_type == THERMAL_TRIP_MONITOR_FALLING) && + (tz->temperature <= trip_temp))) { throttle = true; trace_thermal_zone_trip(tz, trip, trip_type); } @@ -147,7 +178,8 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip) continue; old_target = instance->target; - instance->target = get_target_state(instance, trend, throttle); + instance->target = get_target_state(instance, trend, + throttle, monitor_type); dev_dbg(&instance->cdev->device, "old_target=%d, target=%d\n", old_target, (int)instance->target); From patchwork Thu Sep 17 03:22:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 11781343 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E9447618 for ; Thu, 17 Sep 2020 03:28:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C78CB206D4 for ; Thu, 17 Sep 2020 03:28:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Mn11vOjh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726152AbgIQD2C (ORCPT ); Wed, 16 Sep 2020 23:28:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726101AbgIQD2C (ORCPT ); Wed, 16 Sep 2020 23:28:02 -0400 Received: from mail-qt1-x842.google.com (mail-qt1-x842.google.com [IPv6:2607:f8b0:4864:20::842]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03938C0611C0 for ; Wed, 16 Sep 2020 20:22:34 -0700 (PDT) Received: by mail-qt1-x842.google.com with SMTP id k25so805626qtu.4 for ; Wed, 16 Sep 2020 20:22:33 -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=qA8w6GQLbaTlzp5n8dcgkY3X2oVEZB3DGcmvh59/aDQ=; b=Mn11vOjh/Pgg9MhlRULSR7tXA6ZixO1ybWFY4R1A5pbm+l+dZi99Ik6Dz8/SFCJOZZ s1YfqhkXUuWOVzORUi9/hJLnBRejNT4uBEiqF1uhwCh+pGVe6rI8/wH0UBySQdONPnu2 yLjurEjdnc0DLZb4vBbq62+ijn8pt4QrMJPhkemj1PrGRBphp12LOpX4opxL05I0RVtj 4O8+mjdNL1tEpF8H1h0qLT9RgAl/fEtohF2mzCGlU5XBR+wBCslchXHtSLCafKXLJPmR zg2SqEEqEGnveFdXk3e4S3pvw9LtRrrTjsExiE6jAfAf8k8PpJCoWkHQ+RQB432IqekD qG9Q== 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=qA8w6GQLbaTlzp5n8dcgkY3X2oVEZB3DGcmvh59/aDQ=; b=SX0AMRj/RVniEp1A3AG3PZaCP6VZRP3mwMuS7ZqhKr0pDXp5Ki1ra2qZwF4rdGXHO9 IJAom5IgFcmVWftexhytChr0JeIErvBZr0Nkd09avoW9oKajHYRWe/y13oEJELu5sg9O jTBGiIgwFEcdtlnjwHI3tdEjzibTirYxPYS0VdXG+8VoffM5CMAEnLJwBi8BRItMoYoH 39jIED0A3mQmIv5OxiBL1V6fwqTNZ+H6eHJ7fCEhyVtdWGQj8XoakKhO5Tc16V7nepjl PLxPes8R1ogyuEy2xfB0gt0yNWs5huCribCSE5U1kmQ2R7ohkDWRKM5jZZooOUpX8JHX 3ZyA== X-Gm-Message-State: AOAM532Ems6uQw1J5MFINzolKU0xm/uLR202nuk9bpj5H/9QAd5MfLdz fbvZmg4iY9m33ddj4Umc8QqJCQ== X-Google-Smtp-Source: ABdhPJwE1MP6yxSojZ/oW1Dvar69y++Fse0YxIRP8jIkfmkccLGWZ2OFc+TBgA+kkS9idIbPZJJT8Q== X-Received: by 2002:ac8:44b5:: with SMTP id a21mr13087829qto.314.1600312953278; Wed, 16 Sep 2020 20:22:33 -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.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 20:22:32 -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 6/8] thermal: Modify thermal governors to do nothing for trip points being monitored for falling temperature Date: Wed, 16 Sep 2020 23:22:24 -0400 Message-Id: <20200917032226.820371-7-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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org For now, thermal governors other than step wise governorr do not support monitoring of falling temperature. Hence, in case of calls to the governor for trip points marked as THERMAL_TRIP_MONITOR_FALLING, return doing nothing. Signed-off-by: Thara Gopinath --- drivers/thermal/gov_bang_bang.c | 12 ++++++++++++ drivers/thermal/gov_fair_share.c | 12 ++++++++++++ drivers/thermal/gov_power_allocator.c | 12 ++++++++++++ 3 files changed, 36 insertions(+) diff --git a/drivers/thermal/gov_bang_bang.c b/drivers/thermal/gov_bang_bang.c index 991a1c54296d..a662047e5961 100644 --- a/drivers/thermal/gov_bang_bang.c +++ b/drivers/thermal/gov_bang_bang.c @@ -99,6 +99,18 @@ static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip) static int bang_bang_control(struct thermal_zone_device *tz, int trip) { struct thermal_instance *instance; + enum thermal_trip_monitor_type monitor_type = + THERMAL_TRIP_MONITOR_RISING; + + /* + * Return doing nothing if the trip point is monitored for + * falling temperature + */ + if (tz->ops->get_trip_mon_type) { + tz->ops->get_trip_mon_type(tz, trip, &monitor_type); + if (monitor_type == THERMAL_TRIP_MONITOR_FALLING) + return 0; + } thermal_zone_trip_update(tz, trip); diff --git a/drivers/thermal/gov_fair_share.c b/drivers/thermal/gov_fair_share.c index aaa07180ab48..064ad6ed67ad 100644 --- a/drivers/thermal/gov_fair_share.c +++ b/drivers/thermal/gov_fair_share.c @@ -81,6 +81,18 @@ static int fair_share_throttle(struct thermal_zone_device *tz, int trip) int total_weight = 0; int total_instance = 0; int cur_trip_level = get_trip_level(tz); + enum thermal_trip_monitor_type monitor_type = + THERMAL_TRIP_MONITOR_RISING; + + /* + * Return doing nothing if the trip point is monitored for + * falling temperature + */ + if (tz->ops->get_trip_mon_type) { + tz->ops->get_trip_mon_type(tz, trip, &monitor_type); + if (monitor_type == THERMAL_TRIP_MONITOR_FALLING) + return 0; + } list_for_each_entry(instance, &tz->thermal_instances, tz_node) { if (instance->trip != trip) diff --git a/drivers/thermal/gov_power_allocator.c b/drivers/thermal/gov_power_allocator.c index 5cb518d8f156..0f674cd1b9b8 100644 --- a/drivers/thermal/gov_power_allocator.c +++ b/drivers/thermal/gov_power_allocator.c @@ -606,6 +606,8 @@ static int power_allocator_throttle(struct thermal_zone_device *tz, int trip) { int ret; int switch_on_temp, control_temp; + enum thermal_trip_monitor_type monitor_type = + THERMAL_TRIP_MONITOR_RISING; struct power_allocator_params *params = tz->governor_data; /* @@ -615,6 +617,16 @@ static int power_allocator_throttle(struct thermal_zone_device *tz, int trip) if (trip != params->trip_max_desired_temperature) return 0; + /* + * Return doing nothing if the trip point is monitored for + * falling temperature + */ + if (tz->ops->get_trip_mon_type) { + tz->ops->get_trip_mon_type(tz, trip, &monitor_type); + if (monitor_type == THERMAL_TRIP_MONITOR_FALLING) + return 0; + } + ret = tz->ops->get_trip_temp(tz, params->trip_switch_on, &switch_on_temp); if (!ret && (tz->temperature < switch_on_temp)) { From patchwork Thu Sep 17 03:22:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 11781389 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0D106618 for ; Thu, 17 Sep 2020 03:29:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DF11C20936 for ; Thu, 17 Sep 2020 03:29:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="DjZr4sFD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726002AbgIQD31 (ORCPT ); Wed, 16 Sep 2020 23:29:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726112AbgIQD2C (ORCPT ); Wed, 16 Sep 2020 23:28:02 -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 077F8C0611C3 for ; Wed, 16 Sep 2020 20:22:35 -0700 (PDT) Received: by mail-qt1-x843.google.com with SMTP id r8so757087qtp.13 for ; Wed, 16 Sep 2020 20:22:34 -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=01gqkFqr4FQwurKmO2Ck7GaScSK2pTFzpmpWBR1KqGU=; b=DjZr4sFDsbbUKj1uaHdAF9W4Ujbhv51Un18j9AS9uMZoLIwXHcZVEsoQ/3LUjLF37R kOzz8lsiUt9OGW4LKz8auX6fNumu1PA+PhrYM6M/GBek07tO30zzwpcWrbWiZZR2xZ0u sNtL6h8igfE0yYQQDktkCP7xALhwKdwBLXtb4ibt+9Vrlu0lLevRIoc9Mhq/MWVcK8y+ Xi8V5dj0CsAtOF6oPFFuxi+ViYpNojY7kYNS1hxEmAsopv8P79u3u56FpHNW13dCZgRS FeauQl4ILt0cQ7oSFWBTmubdxfvmll8AHyXyXfLwajcoBf5mPWb9dAiRQQMga2qGiHL8 dT6Q== 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=01gqkFqr4FQwurKmO2Ck7GaScSK2pTFzpmpWBR1KqGU=; b=heTAjKeqCBamdmnyimx1qL8WB0/p3+G8/JxJ62/TY47xlonfoUgYxNTiThZvPo+aVL +NgDPcjIF1YBkFnMlZy2gLMUsacwNZoTr7OBvn3zG1hi38HA88qd45GZgjvYJy/diZ7u JXYkWxcGb/Hy+fhjxkbtoSZXNXP3R8aRY8cS2IUmQ++g6EXVktTHgfBb87V5MHAvr4p6 ElABfri+fB5enRYgQLsRZZm/Kf23CUD3E12/pdioiO6xQ4+aYLUe1vPSCZaewclyLfei 1hiOEErBEooKV8Hx+P6iOXHYsNvHlarKsqEZ+lEP0yNowp5FaXdXpmporPKDEsH099iD 9kQg== X-Gm-Message-State: AOAM531Oysrx1nWoHQG4ggPGX11y7gEgE7YGOOJtJK471DqHwOUur+HQ Z10mFi18Uxks6XWFhPG6u42bpQ== X-Google-Smtp-Source: ABdhPJxAksp2eSmEPqN5uQeMl3cPNkYvy+YewZ8cg9q71F5mEGRa405mrOEZhL5wL6RqHhxDNGYHPg== X-Received: by 2002:ac8:39a7:: with SMTP id v36mr27385800qte.140.1600312954185; Wed, 16 Sep 2020 20:22:34 -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.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 20:22:33 -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 7/8] thermal:core: Add is_warming_dev and supporting warming device api's to the cooling dev framework. Date: Wed, 16 Sep 2020 23:22:25 -0400 Message-Id: <20200917032226.820371-8-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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Introduce a variable is_warming_dev to indicate if a "cooling" device is actually a warming device or not. Also introduce api's to register and unregister warming device. This is a temporary patch. If we agree to replace the term "cooling" with "mitigating" (or any other appropriate term) in the thermal framework, this patch can be dropped. Also I have not added warming_device_register api for all the versions of cooling_device_register because devm_thermal_of_warming_device_register is the only api needed in the kernel today as is evident by the next patch in this series. Signed-off-by: Thara Gopinath --- drivers/thermal/thermal_core.c | 88 +++++++++++++++++++++++++++++----- include/linux/thermal.h | 7 +++ 2 files changed, 83 insertions(+), 12 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index bfd436379408..4aae48a80e00 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1101,7 +1101,8 @@ static void bind_cdev(struct thermal_cooling_device *cdev) */ static struct thermal_cooling_device * __thermal_cooling_device_register(struct device_node *np, - const char *type, void *devdata, + const char *type, bool is_warming_dev, + void *devdata, const struct thermal_cooling_device_ops *ops) { struct thermal_cooling_device *cdev; @@ -1134,6 +1135,7 @@ __thermal_cooling_device_register(struct device_node *np, cdev->updated = false; cdev->device.class = &thermal_class; cdev->devdata = devdata; + cdev->is_warming_dev = is_warming_dev; thermal_cooling_device_setup_sysfs(cdev); dev_set_name(&cdev->device, "cooling_device%d", cdev->id); result = device_register(&cdev->device); @@ -1178,7 +1180,7 @@ struct thermal_cooling_device * thermal_cooling_device_register(const char *type, void *devdata, const struct thermal_cooling_device_ops *ops) { - return __thermal_cooling_device_register(NULL, type, devdata, ops); + return __thermal_cooling_device_register(NULL, type, false, devdata, ops); } EXPORT_SYMBOL_GPL(thermal_cooling_device_register); @@ -1202,7 +1204,7 @@ thermal_of_cooling_device_register(struct device_node *np, const char *type, void *devdata, const struct thermal_cooling_device_ops *ops) { - return __thermal_cooling_device_register(np, type, devdata, ops); + return __thermal_cooling_device_register(np, type, false, devdata, ops); } EXPORT_SYMBOL_GPL(thermal_of_cooling_device_register); @@ -1242,7 +1244,7 @@ devm_thermal_of_cooling_device_register(struct device *dev, if (!ptr) return ERR_PTR(-ENOMEM); - tcd = __thermal_cooling_device_register(np, type, devdata, ops); + tcd = __thermal_cooling_device_register(np, type, false, devdata, ops); if (IS_ERR(tcd)) { devres_free(ptr); return tcd; @@ -1255,6 +1257,49 @@ devm_thermal_of_cooling_device_register(struct device *dev, } EXPORT_SYMBOL_GPL(devm_thermal_of_cooling_device_register); +/** + * devm_thermal_of_warming_device_register() - register an OF thermal warming + * device + * @dev: a valid struct device pointer of a sensor device. + * @np: a pointer to a device tree node. + * @type: the thermal cooling device type. + * @devdata: device private data. + * @ops: standard thermal cooling devices callbacks. + * + * This function will register a warming device with device tree node reference. + * This interface function adds a new thermal warming device (fan/processor/...) + * to /sys/class/thermal/ folder as cooling_device[0-*]. It tries to bind itself + * to all the thermal zone devices registered at the same time. + * + * Return: a pointer to the created struct thermal_cooling_device or an + * ERR_PTR. Caller must check return value with IS_ERR*() helpers. + */ +struct thermal_cooling_device * +devm_thermal_of_warming_device_register(struct device *dev, + struct device_node *np, + char *type, void *devdata, + const struct thermal_cooling_device_ops *ops) +{ + struct thermal_cooling_device **ptr, *tcd; + + ptr = devres_alloc(thermal_cooling_device_release, sizeof(*ptr), + GFP_KERNEL); + if (!ptr) + return ERR_PTR(-ENOMEM); + + tcd = __thermal_cooling_device_register(np, type, true, devdata, ops); + if (IS_ERR(tcd)) { + devres_free(ptr); + return tcd; + } + + *ptr = tcd; + devres_add(dev, ptr); + + return tcd; +} +EXPORT_SYMBOL_GPL(devm_thermal_of_warming_device_register); + static void __unbind(struct thermal_zone_device *tz, int mask, struct thermal_cooling_device *cdev) { @@ -1265,14 +1310,8 @@ static void __unbind(struct thermal_zone_device *tz, int mask, thermal_zone_unbind_cooling_device(tz, i, cdev); } -/** - * thermal_cooling_device_unregister - removes a thermal cooling device - * @cdev: the thermal cooling device to remove. - * - * thermal_cooling_device_unregister() must be called when a registered - * thermal cooling device is no longer needed. - */ -void thermal_cooling_device_unregister(struct thermal_cooling_device *cdev) +static void +__thermal_cooling_device_unregister(struct thermal_cooling_device *cdev) { int i; const struct thermal_zone_params *tzp; @@ -1319,8 +1358,33 @@ void thermal_cooling_device_unregister(struct thermal_cooling_device *cdev) thermal_cooling_device_destroy_sysfs(cdev); put_device(&cdev->device); } + +/** + * thermal_cooling_device_unregister - removes a thermal cooling device + * @cdev: the thermal cooling device to remove. + * + * thermal_cooling_device_unregister() must be called when a registered + * thermal cooling device is no longer needed. + */ +void thermal_cooling_device_unregister(struct thermal_cooling_device *cdev) +{ + __thermal_cooling_device_unregister(cdev); +} EXPORT_SYMBOL_GPL(thermal_cooling_device_unregister); +/** + * thermal_warming_device_unregister - removes a thermal warming device + * @cdev: the thermal warming device to remove. + * + * thermal_warming_device_unregister() must be called when a registered + * thermal warming device is no longer needed. + */ +void thermal_warming_device_unregister(struct thermal_cooling_device *cdev) +{ + __thermal_cooling_device_unregister(cdev); +} +EXPORT_SYMBOL_GPL(thermal_warming_device_unregister); + static void bind_tz(struct thermal_zone_device *tz) { int i, ret; diff --git a/include/linux/thermal.h b/include/linux/thermal.h index a50ed958d0bd..455120f485dd 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -96,6 +96,7 @@ struct thermal_cooling_device_ops { struct thermal_cooling_device { int id; + bool is_warming_dev; char type[THERMAL_NAME_LENGTH]; struct device device; struct device_node *np; @@ -393,7 +394,13 @@ devm_thermal_of_cooling_device_register(struct device *dev, struct device_node *np, char *type, void *devdata, const struct thermal_cooling_device_ops *ops); +struct thermal_cooling_device * +devm_thermal_of_warming_device_register(struct device *dev, + struct device_node *np, + char *type, void *devdata, + const struct thermal_cooling_device_ops *ops); void thermal_cooling_device_unregister(struct thermal_cooling_device *); +void thermal_warming_device_unregister(struct thermal_cooling_device *); struct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name); int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp); int thermal_zone_get_slope(struct thermal_zone_device *tz); From patchwork Thu Sep 17 03:22:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 11781383 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 45505618 for ; Thu, 17 Sep 2020 03:29:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2A52720872 for ; Thu, 17 Sep 2020 03:29:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="WgQWIsUl" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726187AbgIQD3P (ORCPT ); Wed, 16 Sep 2020 23:29:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726151AbgIQD2H (ORCPT ); Wed, 16 Sep 2020 23:28:07 -0400 Received: from mail-qt1-x844.google.com (mail-qt1-x844.google.com [IPv6:2607:f8b0:4864:20::844]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2963C061A28 for ; Wed, 16 Sep 2020 20:22:35 -0700 (PDT) Received: by mail-qt1-x844.google.com with SMTP id c18so800720qtw.5 for ; Wed, 16 Sep 2020 20:22:35 -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=7uYlLNN0UyKBRIab8OLOITLg387YzzBqmIZv+ipj1Bk=; b=WgQWIsUlbXN3VVXSecXh6NSwzMBUdXegJ1UbE5dZ5hL0zTZqMnJXK3IU1YodWCoeuB Y4OEpjgNajgPg+yhYvIAF872GecFsE1BgxlzwnqnA2jGT679cwonprKHeJe8p+UZy5J4 r72IIPcyanDumuLDsqhSxQlUc1HrTMomgmZd3gWrEDjF51lbPdFbSTdtKnYDJe3bi49z HEdjA9fmvjxIv9m2vCLCmsz7H6ZD+ixW5RTucdXqj8nak9ZZl5Ra/dU9HxJrqjt1fx3v 5Uc6+JFwsR2u575L2MXyGO88rbRgDz78wJEGc2KS0sgSp02IBTsoU+HrrDclIL7UUzD5 yPIA== 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=7uYlLNN0UyKBRIab8OLOITLg387YzzBqmIZv+ipj1Bk=; b=P9LmGeIONyTNcUbVMWeqLzQ2oM1is6BQunvAVzqBY5Ouv4lkCG9pL+ekgsS0vNpsAT 69kUb+gfDZf8gPOoQA3SV6ON9ZwpoA5S0eaS3SKdAxfIp/nPCpIlAVFubnUkqYmp1Kiv Hf+17pXQ19GoIot6Sg+P4mAA4TE8M4RbU+8HWyIA+9BWF6JOgLh8i9Lq5bg821KyNZLQ V+M9PVZMvOmtclte0WGwGd9w49YI+6GK1zG2KWKJdjxtCacjdDzYOUiEl6hC1AAXIGUk e7dLepRl/DHvp4SW0DYm/rl7Nt5uYps4zkrMCXzZ1DO6MwM1EZWIRNNSWiiaRXEpQfxl 5ruQ== X-Gm-Message-State: AOAM5323vP/jiBYtm540+1334Z7+xN3qbVs1h4Cz7Ji7BxsBswgQSXcQ g1jZcYHyI4p7zp0afx/mT7UoSQ== X-Google-Smtp-Source: ABdhPJzGL4YEJnZLHDs2gCK48wqeWdvZlE8nmVrQmjPTUaQ1EXFV5sqoz+sP/iUjbWjWIJ3lhJr+wg== X-Received: by 2002:aed:2b86:: with SMTP id e6mr25582795qtd.86.1600312955087; Wed, 16 Sep 2020 20:22:35 -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.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 20:22:34 -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 8/8] soc:qcom:qcom_aoss: Change cooling_device_register to warming_device_register Date: Wed, 16 Sep 2020 23:22:26 -0400 Message-Id: <20200917032226.820371-9-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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Always on subsystem host resources cx and ebi that are used as warming devices. Use the newly introduce _warming_device_register to register these devices with the thermal framework. Signed-off-by: Thara Gopinath --- drivers/soc/qcom/qcom_aoss.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/soc/qcom/qcom_aoss.c b/drivers/soc/qcom/qcom_aoss.c index ed2c687c16b3..4f65c03a5def 100644 --- a/drivers/soc/qcom/qcom_aoss.c +++ b/drivers/soc/qcom/qcom_aoss.c @@ -461,7 +461,7 @@ static int qmp_cooling_device_add(struct qmp *qmp, qmp_cdev->qmp = qmp; qmp_cdev->state = !qmp_cdev_max_state; qmp_cdev->name = cdev_name; - qmp_cdev->cdev = devm_thermal_of_cooling_device_register + qmp_cdev->cdev = devm_thermal_of_warming_device_register (qmp->dev, node, cdev_name, qmp_cdev, &qmp_cooling_device_ops); @@ -501,7 +501,7 @@ static int qmp_cooling_devices_register(struct qmp *qmp) unroll: while (--count >= 0) - thermal_cooling_device_unregister + thermal_warming_device_unregister (qmp->cooling_devs[count].cdev); return ret; @@ -512,7 +512,7 @@ static void qmp_cooling_devices_remove(struct qmp *qmp) int i; for (i = 0; i < QMP_NUM_COOLING_RESOURCES; i++) - thermal_cooling_device_unregister(qmp->cooling_devs[i].cdev); + thermal_warming_device_unregister(qmp->cooling_devs[i].cdev); } static int qmp_probe(struct platform_device *pdev)