From patchwork Thu Dec 19 22:19:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 182192 Delivered-To: patch@linaro.org Received: by 2002:a92:d0a:0:0:0:0:0 with SMTP id 10csp1083513iln; Thu, 19 Dec 2019 14:19:55 -0800 (PST) X-Google-Smtp-Source: APXvYqx6M0hSg9t7OV/doapv4lubQ1enQycmEKwQcQyF1GE3Mfh3e1KMf9EIgT2gPSdUxY39ivmp X-Received: by 2002:a9d:1d02:: with SMTP id m2mr10456417otm.45.1576793995292; Thu, 19 Dec 2019 14:19:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576793995; cv=none; d=google.com; s=arc-20160816; b=WyCASc5eerTuYvbKi3uIYBYqjWbfN+HRSwdNMxVGur0htIqgZYQ9oexX71zvlmDp7U w6zJpCLgjcZYS0YKEe5syFa4SQhGOfEGR8gRHOtTER3GAt9lkimT/ALykrxJA3tMlHqh iZmcJ+ap/n1y0tecOTHI3W+On+wUYsubxgGJ4/2gNcelwSdQVgY30qA8mWy0/9Uu+DvQ NAPEfczPtAan7OI42l3urfWDQ9ouEeafIvZmiiJ/Kc09uKasJPX+RUThEx3+IHgzhk0/ qWQUK8axifSEFQeWn1Ha0quQqqEu5KZ3vWPepFLwCJmo4KU+zNzSZz4WchbB3Qp2ayPx 3J5Q== 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=xIw0nWMVvmMwb4Q12xq9FnKNnehOct3euxpTG4ta6kw=; b=FUI7K0Nb+3imTzOCpZDWzOoUG+rIrDFI7WhzYoZjOzz0o6n1tfhGi6RzTiDnFizXR+ pDk3AOi0TenPLkaZhHHIwRiO8Pd/r3mNspG37bSH1zCtTWAd7uLtHSgo9iO5PfQKEjkH pylnjNAvWi4LTzoSjTeNyH5nuxO9Dr6TnXGQ6/QoIDE5CgKvUimZxLW4skSLg1n/Z4YB 40bIgqXAuPj9mg3t7ukuJD+Vb9xddiHE/QpVmrH+3qShoUBPaQm7h3HKAweBk3Xf8KBK t2GpQOpH/zQ5kOc7dP+V/XDkLcjPEIyJDwlTXLmIPfO93Khdf7bA+FzXFTWdstcGkMQe PrYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UELwUgkI; 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 s68si3902886oih.275.2019.12.19.14.19.54; Thu, 19 Dec 2019 14:19:55 -0800 (PST) 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=UELwUgkI; 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 S1727167AbfLSWTy (ORCPT + 27 others); Thu, 19 Dec 2019 17:19:54 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:34159 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726986AbfLSWTv (ORCPT ); Thu, 19 Dec 2019 17:19:51 -0500 Received: by mail-wr1-f68.google.com with SMTP id t2so7565592wrr.1 for ; Thu, 19 Dec 2019 14:19:50 -0800 (PST) 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=xIw0nWMVvmMwb4Q12xq9FnKNnehOct3euxpTG4ta6kw=; b=UELwUgkIqMLM8KbzghW/nxo2zlVq5P1wRHZQUzemcp1Mo4En6J69er+/z19UrnXzq7 4HWSjAk+mRtSYwkLpV0E70UgihbarSN4mbe41sDDk/fTL33TfqmA44/eiUmYo4Werjy2 Z1NmTMYj1xIYm1jjYDhBQ2bjLvrH42FibRjvlf7t5WV5ZxJYLRs3uDjkNtVKqyVsPozN r91Aht9GVlVNOPAPNvxZTCeLr0vtxmeHo9ROBM2yXck7D7JMjjyH6T9hfg2E2NDELFT+ HpB9sxM+GD5/Arv6Y63UTZ4J6zEZ1BXoI6+M79zEvpj7O0THPCzg4N97UOuxdqx4bSks jnOQ== 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=xIw0nWMVvmMwb4Q12xq9FnKNnehOct3euxpTG4ta6kw=; b=ocap/CY00h7zw6mv3NQ/xTZ+2j5ma/tMBSEKKbLHqFIMOwC4TXn7nkrOpaLc5f3olW 1IDyuPbTFhzCD2YliFbeNgiV74ZEmGQgCuYE7RO2zI1AMQaEGAZYULsEXLMh2ibXwJZH gTv1yVFvB9kNaq7AyrrmvdCMxWzzrsG+P97vKYmNbDlNZYUmifmnbYpdEkeFIv6cweVI sKXCQ/S+/HHagdMDuuBcyef39lmp8PIQOowPEg+Q2/JEYSOPj77VnvgCC7yfk5TcqhVu hYlNK3q0ds6Fi89pLKMtvHBbjvH+r5QtAQB6KfSezxnwNk7++GheA/AzV2VRaJvHQPeD tbMg== X-Gm-Message-State: APjAAAUqHc2ho9GFAkWbMR6fsqivpnJiGOl6gb/y8OSY2DuypRU2RGRi ad0T/Mr9RYmUBrY3abmQmvhuFEhBgoc= X-Received: by 2002:adf:ef49:: with SMTP id c9mr11527564wrp.292.1576793989331; Thu, 19 Dec 2019 14:19:49 -0800 (PST) Received: from localhost.localdomain ([2a01:e34:ed2f:f020:58d:4e9b:2833:86c3]) by smtp.gmail.com with ESMTPSA id n189sm8161765wme.33.2019.12.19.14.19.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2019 14:19:48 -0800 (PST) From: Daniel Lezcano To: daniel.lezcano@linaro.org Cc: "Rafael J. Wysocki" , linux-pm@vger.kernel.org (open list:CPU IDLE TIME MANAGEMENT FRAMEWORK), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 2/2] thermal: cpuidle: Register cpuidle cooling device Date: Thu, 19 Dec 2019 23:19:28 +0100 Message-Id: <20191219221932.15930-2-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191219221932.15930-1-daniel.lezcano@linaro.org> References: <20191219221932.15930-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/dt_idle_states.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.17.1 diff --git a/drivers/cpuidle/dt_idle_states.c b/drivers/cpuidle/dt_idle_states.c index d06d21a9525d..34bd65197342 100644 --- a/drivers/cpuidle/dt_idle_states.c +++ b/drivers/cpuidle/dt_idle_states.c @@ -8,6 +8,7 @@ #define pr_fmt(fmt) "DT idle-states: " fmt +#include #include #include #include @@ -205,6 +206,13 @@ int dt_init_idle_driver(struct cpuidle_driver *drv, err = -EINVAL; break; } + + if (of_find_property(state_node, "#cooling-cells", NULL)) { + err = cpuidle_of_cooling_register(state_node, drv); + if (err) + break; + } + of_node_put(state_node); }