Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1874046ybb; Sun, 29 Mar 2020 15:55:03 -0700 (PDT) X-Google-Smtp-Source: ADFU+vv8XCqAXQ9Skw2jZD4jfMr1Tlfcj0HYS8+83z5q/wDyKoiKnDA71ll4R3f8OnTWrv1HvPQH X-Received: by 2002:a9d:926:: with SMTP id 35mr6967830otp.319.1585522503466; Sun, 29 Mar 2020 15:55:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585522503; cv=none; d=google.com; s=arc-20160816; b=d4Ujvh/btZy1F+gNys/ErSm+jnUdTENykttrh6ZoP68Mit4wZAlgi43I/c8DpPqVDY zJNhJHfrMiBYdNMqDEwmeQysS04FNAdxmm8XktMHe5BdBHXKl1cue6P8F/3dzJCuLHYX 677kb1kHZKsxPbyUObNdTq5E4yyJXY26oNQ939B58lv9tSoUD7mr/954QdqBTCIA2/Py Yvt0OH+Tu3okaoWNx9sZVtam8fUM6qUgO6DCa3LGt5s3ATTI+2WACbKNcG3fSuvRUXDx ScGXJIgGT59I38QwlCGJ9hfUhigVAiciOV5k2XTPyVuo+cnymGiu/Dth+1dIGvcqdr8J 6KGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=1LHaTJUSb6YlKNJo8uEXGOXHLnntD8wG0lKLYJJal8o=; b=NIodU3O+8wO2z3MyJSjFJPQaihzMrxE2y7LnRDOfnZffKwEv1lIiLv8Ga1+9uGTeup FRiZ9pbPbs9t4fi4OBqcjkpivxsXqqPfMPfvC6Er8zr+roIuS3JYxXn4OX3IlNbvQCzu IrwYSxjb0Pl3uNC9tD8ps7jOc+ySa8RCXcy9sBM+xyEu61yXF00XOuzcYQK6ZXwlYDao OLjsvjn8CVH+X5oucsAP8oVD0MQwyBcyvjOZ9otnyQUQFCYzisUlQ4WHUQBOx5LFoR4k qH5LQxWzs7RKpMjmJllg+LyldGs7qeYEKGNboaVUZhpon9+ZzoADFBdr4talErdLGEiH 4sFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ncVvgdou; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id z5si5600718oiz.209.2020.03.29.15.54.50; Sun, 29 Mar 2020 15:55:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ncVvgdou; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1729252AbgC2WHW (ORCPT + 99 others); Sun, 29 Mar 2020 18:07:22 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:43588 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729154AbgC2WHV (ORCPT ); Sun, 29 Mar 2020 18:07:21 -0400 Received: by mail-wr1-f65.google.com with SMTP id m11so13052629wrx.10 for ; Sun, 29 Mar 2020 15:07:20 -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; bh=1LHaTJUSb6YlKNJo8uEXGOXHLnntD8wG0lKLYJJal8o=; b=ncVvgdoulw7o7+hBR1P2C+5Gs5JoBGlqRw0Sy1xicTm6q81nvOAS+m7a5UAWRL9hRH yEbh65k8Qx8xlZhH0t43wKusHLa9vKtTn3P+o7chr1k8b9HOg212dwNDe5UIqqTkPvM5 NjK59RhAv/AjjS9C+ePeOxUTr8KWfjEGW0BnrhZMLZGYwJHih6Qa7NlJ/q3h/TBv2CvI qzt8o6Axgo5Rp3OXRAuFzRgZOB7AaPhJpa0QD51Rx0V4DJiIolUALmRUp3al9xzVNBGD TgMdtaHIkMZxLrKJPW3dDuRzt6b6bi9q5B+CInP1E93ReaqlZkh762PlTAokY1xMgBP/ HxFw== 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; bh=1LHaTJUSb6YlKNJo8uEXGOXHLnntD8wG0lKLYJJal8o=; b=Dy0BnKZ026E9BIhvzy9ueopaZGFrjOF60mSEKIOaW+YUvhv2gIs99AlWGOWJ3s1PfH EqXmLJ7W5B0kGuec9ddNLIE0TRHNR3pqfo42i5Q6rGb3E/sU9UHV/XBDjiC+N5vwShkV a1HChE2M100rZ1+xQevR2F7Dp/tO5bQHfUOcg2arKLXuDbgqvzmOzV8jTjddata5Gqfj V4AcEiS1u3S/0lVugPJELwUGefW2blmirslGctLAqG3WzUQ2PDaHn0mzEK+CiJUv7pCc 7YRfqz14piA7PANjNR2SUXqfgC17EbVyihrw54ZhhWLymg4skVIQxFbzE8zmmvItiF36 LZKw== X-Gm-Message-State: ANhLgQ0xGtp/d3CRRL4PkU5gde7CZxQE2GpU0FXza/Q2DVVGdUZ4aVk2 Vq62Nu2mMZOyhlBr0nnS451WHQ== X-Received: by 2002:a5d:4d07:: with SMTP id z7mr11842551wrt.92.1585519639340; Sun, 29 Mar 2020 15:07:19 -0700 (PDT) Received: from localhost.localdomain ([2a01:e34:ed2f:f020:78b1:4459:6959:42d0]) by smtp.gmail.com with ESMTPSA id j188sm20026740wmj.36.2020.03.29.15.07.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Mar 2020 15:07:18 -0700 (PDT) From: Daniel Lezcano To: rafael@kernel.org, robh@kernel.org Cc: daniel.lezcano@linaro.org, "Rafael J. Wysocki" , Lorenzo Pieralisi , Sudeep Holla , linux-pm@vger.kernel.org (open list:CPU IDLE TIME MANAGEMENT FRAMEWORK), linux-kernel@vger.kernel.org (open list), linux-arm-kernel@lists.infradead.org (open list:CPUIDLE DRIVER - ARM PSCI) Subject: [PATCH 4/4] thermal: cpuidle: Register cpuidle cooling device Date: Mon, 30 Mar 2020 00:03:20 +0200 Message-Id: <20200329220324.8785-4-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200329220324.8785-1-daniel.lezcano@linaro.org> References: <20200329220324.8785-1-daniel.lezcano@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The cpuidle driver can be used as a cooling device by injecting idle cycles. The DT binding for the idle state added an optional When the property is set, register the cpuidle driver with the idle state node pointer as a cooling device. The thermal framework will do the association automatically with the thermal zone via the cooling-device defined in the device tree cooling-maps section. Signed-off-by: Daniel Lezcano --- drivers/cpuidle/cpuidle-arm.c | 5 +++++ drivers/cpuidle/cpuidle-psci.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c index 9e5156d39627..2406ac0ae134 100644 --- a/drivers/cpuidle/cpuidle-arm.c +++ b/drivers/cpuidle/cpuidle-arm.c @@ -8,6 +8,7 @@ #define pr_fmt(fmt) "CPUidle arm: " fmt +#include #include #include #include @@ -124,6 +125,10 @@ static int __init arm_idle_init_cpu(int cpu) if (ret) goto out_kfree_drv; + ret = cpuidle_cooling_register(drv); + if (ret) + pr_err("Failed to register the idle cooling device: %d\n", ret); + return 0; out_kfree_drv: diff --git a/drivers/cpuidle/cpuidle-psci.c b/drivers/cpuidle/cpuidle-psci.c index edd7a54ef0d3..8e805bff646f 100644 --- a/drivers/cpuidle/cpuidle-psci.c +++ b/drivers/cpuidle/cpuidle-psci.c @@ -9,6 +9,7 @@ #define pr_fmt(fmt) "CPUidle PSCI: " fmt #include +#include #include #include #include @@ -305,6 +306,10 @@ static int __init psci_idle_init_cpu(int cpu) if (ret) goto out_kfree_drv; + ret = cpuidle_cooling_register(drv); + if (ret) + pr_err("Failed to register the idle cooling device: %d\n", ret); + return 0; out_kfree_drv: -- 2.17.1