From patchwork Tue Feb 19 04:27:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Ni X-Patchwork-Id: 10819177 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CFB9313BF for ; Tue, 19 Feb 2019 04:27:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE33E2BA2B for ; Tue, 19 Feb 2019 04:27:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B17332BA1B; Tue, 19 Feb 2019 04:27:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5303A2BA1B for ; Tue, 19 Feb 2019 04:27:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725991AbfBSE1Z (ORCPT ); Mon, 18 Feb 2019 23:27:25 -0500 Received: from hqemgate16.nvidia.com ([216.228.121.65]:19399 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726280AbfBSE1Y (ORCPT ); Mon, 18 Feb 2019 23:27:24 -0500 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 18 Feb 2019 20:27:28 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 18 Feb 2019 20:27:23 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 18 Feb 2019 20:27:23 -0800 Received: from HQMAIL112.nvidia.com (172.18.146.18) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 19 Feb 2019 04:27:23 +0000 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL112.nvidia.com (172.18.146.18) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 19 Feb 2019 04:27:22 +0000 Received: from hqnvemgw02.nvidia.com (172.16.227.111) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Tue, 19 Feb 2019 04:27:22 +0000 Received: from niwei-ubuntu.nvidia.com (Not Verified[10.19.225.182]) by hqnvemgw02.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Mon, 18 Feb 2019 20:27:22 -0800 From: Wei Ni To: , , CC: , , , , , , Wei Ni Subject: [PATCH v8 1/3] thermal: tegra: remove unnecessary warnings Date: Tue, 19 Feb 2019 12:27:02 +0800 Message-ID: <1550550424-7979-2-git-send-email-wni@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1550550424-7979-1-git-send-email-wni@nvidia.com> References: <1550550424-7979-1-git-send-email-wni@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1550550448; bh=H2tMaD6EuSRBWNSqbuveB+Na3FZ5r96G1deVMgO5yaM=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-NVConfidentiality:MIME-Version: Content-Type; b=W0gTkt/EpbJvTTK7wElkRJKZI6pGMRXj0WNrdaRsGQkX694ZM4vxPmB4eH4gVB3Hd q4PRUYhuP1WTc8xm3MOw/JGLQ1yrAljr9Xu0daTiZMPHYAfooyIEhOS31OGn5fnWZ7 Vva2TIPgn5gUGcGJc88t7N50tIM/uZDR1CftWWiAvm5v3dKqmKQKi+tAKZI7S1jpCT jb1763FLh5D0BCt2DXGM8aWuZvusz32fX3470i02qY25L6MFwxiGj9qDelDB7favez GA+6UoaULWZ9Xkv0GM3uMI9iGzUUWGt5DE7uR5D4GHezWfmgWQlid6iHQ9sMT31/Qd huYSc+xvEDS3A== Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Convert warnings to info as not all platforms may have all the thresholds and sensors enabled. Signed-off-by: Wei Ni Reviewed-by: Daniel Lezcano --- drivers/thermal/tegra/soctherm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c index 45b41b885f49..fa50484e1c84 100644 --- a/drivers/thermal/tegra/soctherm.c +++ b/drivers/thermal/tegra/soctherm.c @@ -569,7 +569,7 @@ static int tegra_soctherm_set_hwtrips(struct device *dev, set_throttle: ret = get_hot_temp(tz, &trip, &temperature); if (ret) { - dev_warn(dev, "throttrip: %s: missing hot temperature\n", + dev_info(dev, "throttrip: %s: missing hot temperature\n", sg->name); return 0; } @@ -600,7 +600,7 @@ static int tegra_soctherm_set_hwtrips(struct device *dev, } if (i == THROTTLE_SIZE) - dev_warn(dev, "throttrip: %s: missing throttle cdev\n", + dev_info(dev, "throttrip: %s: missing throttle cdev\n", sg->name); return 0; From patchwork Tue Feb 19 04:27:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Ni X-Patchwork-Id: 10819175 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ED76313BF for ; Tue, 19 Feb 2019 04:27:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D91232BA1B for ; Tue, 19 Feb 2019 04:27:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC34B2BA37; Tue, 19 Feb 2019 04:27:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 76F192BA1B for ; Tue, 19 Feb 2019 04:27:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726400AbfBSE11 (ORCPT ); Mon, 18 Feb 2019 23:27:27 -0500 Received: from hqemgate16.nvidia.com ([216.228.121.65]:19404 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726355AbfBSE10 (ORCPT ); Mon, 18 Feb 2019 23:27:26 -0500 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 18 Feb 2019 20:27:30 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 18 Feb 2019 20:27:25 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 18 Feb 2019 20:27:25 -0800 Received: from HQMAIL104.nvidia.com (172.18.146.11) by HQMAIL106.nvidia.com (172.18.146.12) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 19 Feb 2019 04:27:25 +0000 Received: from hqnvemgw02.nvidia.com (172.16.227.111) by HQMAIL104.nvidia.com (172.18.146.11) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Tue, 19 Feb 2019 04:27:25 +0000 Received: from niwei-ubuntu.nvidia.com (Not Verified[10.19.225.182]) by hqnvemgw02.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Mon, 18 Feb 2019 20:27:25 -0800 From: Wei Ni To: , , CC: , , , , , , Wei Ni Subject: [PATCH v8 2/3] thermal: tegra: fix memory allocation Date: Tue, 19 Feb 2019 12:27:03 +0800 Message-ID: <1550550424-7979-3-git-send-email-wni@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1550550424-7979-1-git-send-email-wni@nvidia.com> References: <1550550424-7979-1-git-send-email-wni@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1550550450; bh=YyV1Q4P3M1Aaxq+b6vcrQ+iGB+gPdSAP7h/eyJwZlAo=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-NVConfidentiality:MIME-Version: Content-Type; b=bqXFvTX4ey8FFnWrx5rcP19AhdRywuC7rlyMXmCbKNiSaL11WnjNoYiS19b2oarnU Thdu1DeIhh+J2DFWRg+ZgnYaFOAx30j7SGBY2MiA80jDxgw/U27F8Wf3N7qOngOU6x o0eNurni0HJKh+KSEHStiiUYxhJ2lLs5i47P3Pyd/tuQ25mut863Savp4oiO/bI4/T d/u95zk/BZeegXbfO6xJbeIeD91UEAoo/U2lmCuXXKKTXrPjmQ1I8ay3zgtSnkP4e3 4i3WeRUtDhc3EzBvWQ8ppD+2jGIinEyPmSeS7QM+6EDmxNeVfLN3RMnt2h2zMtFS6I OIjuuoQM8xbFw== Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fix memory allocation to store the pointers to thermal_zone_device. Signed-off-by: Wei Ni Acked-by: Thierry Reding Reviewed-by: Daniel Lezcano --- drivers/thermal/tegra/soctherm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c index fa50484e1c84..b1ead6ea4c73 100644 --- a/drivers/thermal/tegra/soctherm.c +++ b/drivers/thermal/tegra/soctherm.c @@ -1329,7 +1329,7 @@ static int tegra_soctherm_probe(struct platform_device *pdev) } tegra->thermctl_tzs = devm_kcalloc(&pdev->dev, - soc->num_ttgs, sizeof(*z), + soc->num_ttgs, sizeof(z), GFP_KERNEL); if (!tegra->thermctl_tzs) return -ENOMEM; From patchwork Tue Feb 19 04:27:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Ni X-Patchwork-Id: 10819173 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C54ED13B5 for ; Tue, 19 Feb 2019 04:27:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B1FD52BA1B for ; Tue, 19 Feb 2019 04:27:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A5B082BA34; Tue, 19 Feb 2019 04:27:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 470062BA1B for ; Tue, 19 Feb 2019 04:27:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726461AbfBSE13 (ORCPT ); Mon, 18 Feb 2019 23:27:29 -0500 Received: from hqemgate15.nvidia.com ([216.228.121.64]:14039 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726452AbfBSE13 (ORCPT ); Mon, 18 Feb 2019 23:27:29 -0500 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 18 Feb 2019 20:27:28 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 18 Feb 2019 20:27:28 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 18 Feb 2019 20:27:28 -0800 Received: from HQMAIL102.nvidia.com (172.18.146.10) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 19 Feb 2019 04:27:28 +0000 Received: from HQMAIL104.nvidia.com (172.18.146.11) by HQMAIL102.nvidia.com (172.18.146.10) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 19 Feb 2019 04:27:27 +0000 Received: from hqnvemgw02.nvidia.com (172.16.227.111) by HQMAIL104.nvidia.com (172.18.146.11) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Tue, 19 Feb 2019 04:27:27 +0000 Received: from niwei-ubuntu.nvidia.com (Not Verified[10.19.225.182]) by hqnvemgw02.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Mon, 18 Feb 2019 20:27:27 -0800 From: Wei Ni To: , , CC: , , , , , , Wei Ni Subject: [PATCH v8 3/3] thermal: tegra: add get_trend ops Date: Tue, 19 Feb 2019 12:27:04 +0800 Message-ID: <1550550424-7979-4-git-send-email-wni@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1550550424-7979-1-git-send-email-wni@nvidia.com> References: <1550550424-7979-1-git-send-email-wni@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1550550448; bh=MXUJIjHbG+ZKGPfT8LRa84XRIYBLZT6uhPgUFP3p22U=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-NVConfidentiality:MIME-Version: Content-Type; b=C2P3GGYGrEKAzKce/dS+a9LopiBFiBlS6ZEbZKklalIgLhwXa0A2sQaf6frhsvcwc MjP9N3vVym5qXC0T67OyPxKvMFhMPK0ARQ6XnCbudOP3nXH3YB5xun90Rzq20kqUFp PFr2jelkYjEuWd+emi0uSNV8dhC2ofWYYjwOWC42OeDwuVBF3WbcUkWheroAPIx2XM dnc4nT2odECcjDUMKgKFoD11cOAnJB0zVBgo/T06oFBADfCuJs1UuaX6ZBA+gxrouX TPJBQLpXvgFLD1+o8wrzb9/MNbJtb/HwfCnX0J3E6TI5qZlleBoCATp/DCCvy8A6Gw p6JZF8clpMlag== Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add support for get_trend ops that allows soctherm sensors to be used with the step-wise governor. Signed-off-by: Wei Ni --- drivers/thermal/tegra/soctherm.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c index b1ead6ea4c73..70043a28eb7a 100644 --- a/drivers/thermal/tegra/soctherm.c +++ b/drivers/thermal/tegra/soctherm.c @@ -488,9 +488,41 @@ static int tegra_thermctl_set_trip_temp(void *data, int trip, int temp) return 0; } +static int tegra_thermctl_get_trend(void *data, int trip, + enum thermal_trend *trend) +{ + struct tegra_thermctl_zone *zone = data; + struct thermal_zone_device *tz = zone->tz; + int trip_temp, temp, last_temp, ret; + + if (!tz) + return -EINVAL; + + ret = tz->ops->get_trip_temp(zone->tz, trip, &trip_temp); + if (ret) + return ret; + + temp = READ_ONCE(tz->temperature); + last_temp = READ_ONCE(tz->last_temperature); + + if (temp > trip_temp) { + if (temp >= last_temp) + *trend = THERMAL_TREND_RAISING; + else + *trend = THERMAL_TREND_STABLE; + } else if (temp < trip_temp) { + *trend = THERMAL_TREND_DROPPING; + } else { + *trend = THERMAL_TREND_STABLE; + } + + return 0; +} + static const struct thermal_zone_of_device_ops tegra_of_thermal_ops = { .get_temp = tegra_thermctl_get_temp, .set_trip_temp = tegra_thermctl_set_trip_temp, + .get_trend = tegra_thermctl_get_trend, }; static int get_hot_temp(struct thermal_zone_device *tz, int *trip, int *temp)