From patchwork Fri Apr 8 11:09:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 12806426 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BAA6BC433EF for ; Fri, 8 Apr 2022 11:10:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=MvNu0OaJpEROkEdi7qiscQzs/avKXdLh2M1B/MSqRsc=; b=ET8zmSg75JEaqS TD+5gVC4TSvflrECWRQ44naZ5Y38PvYxlM4vFW6ZAWsBw4H0u5ppAQxt3JI5q0kOUHuAInwkVOtGq P1ewLw8urNMnJeINora3T/k0RRWQvpnRe5OUQIYxT+hehiAjWA0dM4bNj4exLNVqnELhSFUPg6qlZ gF88aajt9JOKlqaOpWo97FsmhrCUH5Jk/Y6OOteWgdsp3cZSYO26tclHGcR5+QWhZeKMP4RaayjjO qPzlN4kDTz8DFuG+psEdVSzd9ks4NJnkPMUS/gJ6RXiVwXpItK9sLRRqkurtiwaokP5PhRYSDuJaf TnFzgq4EyB7nGw2UyfgQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ncmUi-00GV45-Ub; Fri, 08 Apr 2022 11:09:37 +0000 Received: from mx1.tq-group.com ([93.104.207.81]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ncmUe-00GV2A-NR for linux-arm-kernel@lists.infradead.org; Fri, 08 Apr 2022 11:09:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1649416172; x=1680952172; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=IqnIPBsHWhvZbm8kM51kc2kEYT//7sWoxLqS4RXRUXI=; b=eswWnsT4GHO+YypKYBguiM5fH+EMOWpR0uhRt/4sWsetez85OtyD4DdE d6P1XkFGqEe0XQgqTi55kOmFFtSv9QZdku5IWGE9cwBWbDhcPuT3+fJ81 RkGc7qmcA5xfMak5+vZGKejuFXqeSy6F8V0FJKw7yXArnttEQuCc6EkAL BqIH0MzEeiykBldwVBBM5LmNft+2DNUCfngn08qzemZRpweoy1ZTyok2V f5ioJOOPEvl9h9eWlpsmDPKYN+VwGUg868jeOY4syQXqTb6vGIMgD5FvH 9DBosY2T6BUBKR4ipB6tMrv2ECh9ocTQbQGMj+tDSljWqpQ/AoAP/6owP g==; X-IronPort-AV: E=Sophos;i="5.90,244,1643670000"; d="scan'208";a="23186343" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 08 Apr 2022 13:09:25 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Fri, 08 Apr 2022 13:09:25 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Fri, 08 Apr 2022 13:09:25 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1649416165; x=1680952165; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=IqnIPBsHWhvZbm8kM51kc2kEYT//7sWoxLqS4RXRUXI=; b=GjUw6kxmTc5yuEhvC4CFnvowXbhuug0+2HRAncY0MhS30maYSWXCjPeq PmQ2KiIh41ULg3j28VSSZRdetACwPhetnNcRg+/WVXi1pzFqPqykx5zt+ 4cBskVtTq9kOK79kOwg2YUCNskukyTZR7FBmY0QJj0np1c+gP8eqskEOy +pce9mAii/ecFI7NygB8oTMkB9xyVHyWlD9tloDu5d4WdaGmxMNiAoeWe veRllRES6RmtDr1/xQTq4TzpjNzMJcRFXEvUi9E5YxnN3vEXdH/4b4D/5 u9kcyFgwAE3vA/GoSGEFelnSmhAxw+uKywpRLzbmriiQLkeZMafZ2w/dD g==; X-IronPort-AV: E=Sophos;i="5.90,244,1643670000"; d="scan'208";a="23186342" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 08 Apr 2022 13:09:25 +0200 Received: from steina-w.tq-net.de (unknown [10.123.49.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 3095E280070; Fri, 8 Apr 2022 13:09:25 +0200 (CEST) From: Alexander Stein To: Daniel Lezcano , "Rafael J . Wysocki" , Amit Kucheria , Zhang Rui , Shawn Guo , Sascha Hauer , Fabio Estevam Cc: Alexander Stein , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/2] thermal: imx8mm: Add hwmon support Date: Fri, 8 Apr 2022 13:09:19 +0200 Message-Id: <20220408110920.3809225-1-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220408_040933_190707_D9DDE249 X-CRM114-Status: GOOD ( 11.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Expose thermal sensors as HWMON devices. Signed-off-by: Alexander Stein --- drivers/thermal/imx8mm_thermal.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/thermal/imx8mm_thermal.c b/drivers/thermal/imx8mm_thermal.c index af666bd9e8d4..ca8e2c393030 100644 --- a/drivers/thermal/imx8mm_thermal.c +++ b/drivers/thermal/imx8mm_thermal.c @@ -16,6 +16,7 @@ #include #include "thermal_core.h" +#include "thermal_hwmon.h" #define TER 0x0 /* TMU enable */ #define TPS 0x4 @@ -176,6 +177,9 @@ static int imx8mm_tmu_probe(struct platform_device *pdev) goto disable_clk; } tmu->sensors[i].hw_id = i; + + if (devm_thermal_add_hwmon_sysfs(tmu->sensors[i].tzd)) + dev_warn(&pdev->dev, "failed to add hwmon sysfs attributes\n"); } platform_set_drvdata(pdev, tmu); From patchwork Fri Apr 8 11:09:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 12806427 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C12E5C433F5 for ; Fri, 8 Apr 2022 11:10:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JUhtPQrd3QxvVFo6bAKwlQRxQ+4bX7tbU2e9iNRfZdU=; b=k8UkxMrBaYyRi8 d+H8AlrfF+ILjX0hbshgqSSwHmjAv9D3sgA3UJHrVUAVGRnnXuK00tPxAw9754bYjBLt0mhljE+eR QpHxsIQX8dTTeqXREwPKkc9bZtzbzNVPn0rOhHVfJ46QyU+zd/qYrCWTTG4nXTd+Yx42CvfF/TQpm k/wDcgIA+KeebQ2jC7OPbSF09cCfbAchYYfY7+grLIydNM7uzUrkjwtTuVbfZaivBTGX4dDOt9wiQ 9+5LQkFWkY08aF1hYzx5Z6m8qhFb/cOFgrP0msIrdj/zCyg4Z45xt+mmOcrLVGvoN+1CaknOh9Vos pa3w575q26jRSAtFsxSA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ncmUr-00GV5B-BC; Fri, 08 Apr 2022 11:09:45 +0000 Received: from mx1.tq-group.com ([93.104.207.81]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ncmUh-00GV2A-0X for linux-arm-kernel@lists.infradead.org; Fri, 08 Apr 2022 11:09:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1649416175; x=1680952175; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DgXZH7WbSxWernALJcj9Fpx8ZlVIXSraIrzfrlCm1qs=; b=hTe57VgKoH+JpzKR00fsy9awMXvQeG5aR9wIoRL1dsq3+OxaqUezZYdH mZNbK+HrB6TAZ2nk0rqomqi4laFsFPbdETKAaOETOqxpX9pBOwpxToVa6 m3GE+p3Es5V+WhW1rxx0KpCeo+UbW4XPG6hgdWEeoNY6mfutRki4MmO3l vNsQgo0t2vhIxdAphKyKqqcJUqVC9aLFN5IJ1QdPey3wMuaP1HVNiI839 s2K9SX3GGR5oZfGVauvOp+BrXJF6OHBv3mbk0pcObWBJvvhHv8UBms/E5 PhSMqC7MzAjxHN5jp8/SxYTXKQwkaY0HL6KgnjxvMvWPiFDf7dOZ7GwW0 g==; X-IronPort-AV: E=Sophos;i="5.90,244,1643670000"; d="scan'208";a="23186346" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 08 Apr 2022 13:09:26 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Fri, 08 Apr 2022 13:09:26 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Fri, 08 Apr 2022 13:09:26 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1649416166; x=1680952166; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DgXZH7WbSxWernALJcj9Fpx8ZlVIXSraIrzfrlCm1qs=; b=W3qM+hKcvN+v7GKu+0DlpUleHmypsfZJIvozJgONU/PwYmlblgWR0yjQ 8bIhl33KPcNJ5mtSYb9U+nNM+bdHeGfVvoHZJGQAko02m8sL68P/PhoR5 WyEsL0bDk89vNyE9XgDlWCHUFzOoYCcGpOY7N9J8KCcS+PBxEk4B1gBY1 pJSfyMCzbucKBiYcBxDEcfDByZzKNCST7GIULRxvIaj54ZVVB1uVfWscE YMfjO28naYmxDU7Dw52E7PTD76ETLiinPz9w0I82hbwp8hrU81d+yDszY t1ew3wdTqI7z/vDDnG9c7aQBzbDzTaw3u6CnaGCAU1xT+bD2bJU45RjlV g==; X-IronPort-AV: E=Sophos;i="5.90,244,1643670000"; d="scan'208";a="23186344" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 08 Apr 2022 13:09:26 +0200 Received: from steina-w.tq-net.de (unknown [10.123.49.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 694F9280075; Fri, 8 Apr 2022 13:09:25 +0200 (CEST) From: Alexander Stein To: Daniel Lezcano , "Rafael J . Wysocki" , Amit Kucheria , Zhang Rui , Shawn Guo , Sascha Hauer , Fabio Estevam Cc: Alexander Stein , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/2] thermal/drivers/thermal_helpers: Adjust output format Date: Fri, 8 Apr 2022 13:09:20 +0200 Message-Id: <20220408110920.3809225-2-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220408110920.3809225-1-alexander.stein@ew.tq-group.com> References: <20220408110920.3809225-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220408_040935_400715_BBE6CB29 X-CRM114-Status: GOOD ( 13.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Outputs like this where -1 is printed as unsigned is somewhat misleading thermal thermal_zone1: Trip3[type=0,temp=48000]:trend=4,throttle=1 thermal cooling_device3: cur_state=1 thermal cooling_device3: old_target=-1, target=2 thermal cooling_device3: zone1->target=1 thermal cooling_device3: zone1->target=2 thermal cooling_device3: zone1->target=18446744073709551615 thermal cooling_device3: set to state 2 With THERMAL_NO_TARGET assigning -1 as unsigned it make sense to print the target as signed integer, even if the type is actually unsigned. Signed-off-by: Alexander Stein --- An alternative would be to change thermal_instance::target from unsigned long to long, but this would entail a lot of API & driver changes as well which looks less intriguing. drivers/thermal/thermal_helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/thermal/thermal_helpers.c b/drivers/thermal/thermal_helpers.c index 3edd047e144f..0d0da6670267 100644 --- a/drivers/thermal/thermal_helpers.c +++ b/drivers/thermal/thermal_helpers.c @@ -199,7 +199,7 @@ void __thermal_cdev_update(struct thermal_cooling_device *cdev) /* Make sure cdev enters the deepest cooling state */ list_for_each_entry(instance, &cdev->thermal_instances, cdev_node) { - dev_dbg(&cdev->device, "zone%d->target=%lu\n", + dev_dbg(&cdev->device, "zone%d->target=%ld\n", instance->tz->id, instance->target); if (instance->target == THERMAL_NO_TARGET) continue;