From patchwork Wed Jul 25 10:46:02 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 1236351 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id A5B714025E for ; Wed, 25 Jul 2012 10:46:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756484Ab2GYKqQ (ORCPT ); Wed, 25 Jul 2012 06:46:16 -0400 Received: from mail-bk0-f46.google.com ([209.85.214.46]:49251 "EHLO mail-bk0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756483Ab2GYKqP (ORCPT ); Wed, 25 Jul 2012 06:46:15 -0400 Received: by mail-bk0-f46.google.com with SMTP id j10so402048bkw.19 for ; Wed, 25 Jul 2012 03:46:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=XpN2ZMHUV4ScBVsA29irrFQu8PfqGqredjQcNIeiTGo=; b=i3aC6UiqMKRredQMtjh3kGfuOonc0WyUVkRtuYUgS1rtfMGcMGz0DPOzD0jdwiMPDG IIrAGwdvXBmq6IHX4DYxCdrLcVKLBesUVqH9Ah/kR75+a4zf3Rc14E+9ocWlXUBdIMh1 ekU43mkqVdEmv9ypA3rN1v5WvL9HHekAHhZIBmEVMy2SR6ujRANBT1JafIrF4TMeO076 DN+PqrtRPNwDSSpkLCJXEatKPFVfoOw6SSPe3WX94iXAz+3jxtt3iv13s8njXxE44yZX sUeN+4GZSUhDOcBiDN4aiWoOIex84Qebj6buBxCL42vjBYrR6ZFH8cdtEOhVrxi6VIW9 xF3g== Received: by 10.205.119.208 with SMTP id fv16mr12015453bkc.100.1343213174139; Wed, 25 Jul 2012 03:46:14 -0700 (PDT) Received: from localhost.localdomain (AToulouse-159-1-76-78.w92-134.abo.wanadoo.fr. [92.134.219.78]) by mx.google.com with ESMTPS id z19sm12485781bkw.10.2012.07.25.03.46.12 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 25 Jul 2012 03:46:13 -0700 (PDT) From: Daniel Lezcano To: linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org, linaro-dev@lists.linaro.org Subject: [PATCH 5/5][RFC] cpuidle : add cpuidle_register_states function Date: Wed, 25 Jul 2012 12:46:02 +0200 Message-Id: <1343213162-8064-6-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1343213162-8064-1-git-send-email-daniel.lezcano@linaro.org> References: <1343213162-8064-1-git-send-email-daniel.lezcano@linaro.org> X-Gm-Message-State: ALoCoQnhRTwtUwL2broDWD7PZ09DvLHlQ4++HVPUEtXMXAmQck3JDxuHnI4IH+whXVt+CC+zZkN8 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The tegra3 and big.LITTLE architecture have different cpu latencies. This API allows to specify a different cpu latency for a specific cpu. With the previous patches, we use the per cpuidle device states pointer, this function overrides this pointer. Signed-off-by: Daniel Lezcano Acked-by: Deepthi Dharwar --- drivers/cpuidle/cpuidle.c | 17 +++++++++++++++++ include/linux/cpuidle.h | 10 +++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index 199878a..3b21b68 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -456,6 +456,23 @@ void cpuidle_unregister_device(struct cpuidle_device *dev) EXPORT_SYMBOL_GPL(cpuidle_unregister_device); +int cpuidle_register_states(struct cpuidle_device *dev, + struct cpuidle_state *states, + int state_count) +{ + if (!dev || !states) + return -EINVAL; + + if (state_count <= 0) + return -EINVAL; + + dev->states = states; + dev->state_count = state_count; + + return 0; +} +EXPORT_SYMBOL_GPL(cpuidle_register_state); + #ifdef CONFIG_SMP static void smp_callback(void *v) diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index 40a04a1..425200d 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h @@ -144,7 +144,9 @@ extern void cpuidle_driver_unref(void); extern void cpuidle_unregister_driver(struct cpuidle_driver *drv); extern int cpuidle_register_device(struct cpuidle_device *dev); extern void cpuidle_unregister_device(struct cpuidle_device *dev); - +extern int cpuidle_register_states(struct cpuidle_device *dev, + struct cpuidle_state *states, + int state_count); extern void cpuidle_pause_and_lock(void); extern void cpuidle_resume_and_unlock(void); extern void cpuidle_pause(void); @@ -156,7 +158,6 @@ extern int cpuidle_wrap_enter(struct cpuidle_device *dev, int (*enter)(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index)); extern int cpuidle_play_dead(void); - #else static inline void disable_cpuidle(void) { } static inline int cpuidle_idle_call(void) { return -ENODEV; } @@ -169,7 +170,10 @@ static inline void cpuidle_unregister_driver(struct cpuidle_driver *drv) { } static inline int cpuidle_register_device(struct cpuidle_device *dev) {return -ENODEV; } static inline void cpuidle_unregister_device(struct cpuidle_device *dev) { } - +static inline int cpuidle_register_states(struct cpuidle_device *dev, + struct cpuidle_state *states, + int state_count) +{ return -ENODEV; } static inline void cpuidle_pause_and_lock(void) { } static inline void cpuidle_resume_and_unlock(void) { } static inline void cpuidle_pause(void) { }