From patchwork Wed Aug 24 13:48:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brendan Jackman X-Patchwork-Id: 9297923 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0AC61607D0 for ; Wed, 24 Aug 2016 13:55:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F05FE28F6C for ; Wed, 24 Aug 2016 13:55:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4B4D28FF3; Wed, 24 Aug 2016 13:55:17 +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=-6.9 required=2.0 tests=BAYES_00,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 99EEB28F6C for ; Wed, 24 Aug 2016 13:55:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753286AbcHXNzQ (ORCPT ); Wed, 24 Aug 2016 09:55:16 -0400 Received: from foss.arm.com ([217.140.101.70]:48634 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754213AbcHXNzO (ORCPT ); Wed, 24 Aug 2016 09:55:14 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3D095687; Wed, 24 Aug 2016 06:50:19 -0700 (PDT) Received: from brendan-thinkstation.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D09BA3F32C; Wed, 24 Aug 2016 06:48:37 -0700 (PDT) From: Brendan Jackman To: ulf.hansson@linaro.org, khilman@kernel.org, rjw@rjwysocki.net Cc: andy.gross@linaro.org, sboyd@codeaurora.org, linux-arm-msm@vger.kernel.org, Axel Haslam , devicetree@vger.kernel.org, Marc Titinger , Lina Iyer , Lorenzo Pieralisi , Sudeep Holla Subject: [RFC 3/6] cpuidle: Add device_node pointer in cpuidle_state Date: Wed, 24 Aug 2016 14:48:19 +0100 Message-Id: <20160824134822.3591-4-brendan.jackman@arm.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160824134822.3591-1-brendan.jackman@arm.com> References: <1470351902-43103-3-git-send-email-lina.iyer@linaro.org> <20160824134822.3591-1-brendan.jackman@arm.com> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Store a pointer in the cpuidle_state structure to the Device Tree node from which that state originated, if such a node exists. This will allow plaform-specific components to extract extra idle state information without duplicating the logic that finds the idle state nodes. --- drivers/cpuidle/dt_idle_states.c | 3 +++ include/linux/cpuidle.h | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/cpuidle/dt_idle_states.c b/drivers/cpuidle/dt_idle_states.c index a5c111b..61a70ec 100644 --- a/drivers/cpuidle/dt_idle_states.c +++ b/drivers/cpuidle/dt_idle_states.c @@ -88,6 +88,9 @@ static int init_state_node(struct cpuidle_state *idle_state, */ strncpy(idle_state->name, state_node->name, CPUIDLE_NAME_LEN - 1); strncpy(idle_state->desc, desc, CPUIDLE_DESC_LEN - 1); + + idle_state->of_node = state_node; + return 0; } diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index 8435577..d4ea1e4 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h @@ -14,6 +14,7 @@ #include #include #include +#include #define CPUIDLE_STATE_MAX 10 #define CPUIDLE_NAME_LEN 16 @@ -36,14 +37,15 @@ struct cpuidle_state_usage { }; struct cpuidle_state { - char name[CPUIDLE_NAME_LEN]; - char desc[CPUIDLE_DESC_LEN]; - - unsigned int flags; - unsigned int exit_latency; /* in US */ - int power_usage; /* in mW */ - unsigned int target_residency; /* in US */ - bool disabled; /* disabled on all CPUs */ + char name[CPUIDLE_NAME_LEN]; + char desc[CPUIDLE_DESC_LEN]; + + unsigned int flags; + unsigned int exit_latency; /* in US */ + int power_usage; /* in mW */ + unsigned int target_residency; /* in US */ + bool disabled; /* disabled on all CPUs */ + struct device_node *of_node; int (*enter) (struct cpuidle_device *dev, struct cpuidle_driver *drv,