From patchwork Fri Sep 7 10:19:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 11233 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id CD1AD23E41 for ; Fri, 7 Sep 2012 10:19:53 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 75706A19620 for ; Fri, 7 Sep 2012 10:19:53 +0000 (UTC) Received: by mail-iy0-f180.google.com with SMTP id j25so2827276iaf.11 for ; Fri, 07 Sep 2012 03:19:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=3kHSwI9E/qzR1v5Zba7kAFt54H00NxWE0KHwy7o3Ufo=; b=nxf+4BiuHof6dxhqQc6Yb1+y4KBp1pwctywskRzUDXSz+UQQAMRkoB1NxjMax5qCMC roWUUSsut9AThdxbJtCFrC25DZZQylGIFibrNy9jebMahB365Mymd1kmFboWeFxEA1LZ 2YStHuC9/6n9l5BW2gy9Oio48f3m4rsv2gyS05lt4QKmeRRILkBQfMcQuSiRgT3v4Fqa u+LeMD08AnMp9h4niqq09DNzeqUHj4LZPjTywFjHMz+ylCRhzxWvdQ+PeIxn+b+Lsr6o TQQ2z0r5MdcaoLQ2P1udyGdSvJVHSqNh9Qm/UKuB3v0Ym+dm+nJi725ucpzf/VnbpHq6 WkpA== Received: by 10.42.60.139 with SMTP id q11mr6222724ich.53.1347013193223; Fri, 07 Sep 2012 03:19:53 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp371154igc; Fri, 7 Sep 2012 03:19:52 -0700 (PDT) Received: by 10.204.129.215 with SMTP id p23mr2413188bks.3.1347013192405; Fri, 07 Sep 2012 03:19:52 -0700 (PDT) Received: from mail-bk0-f50.google.com (mail-bk0-f50.google.com [209.85.214.50]) by mx.google.com with ESMTPS id hy16si4637905bkc.57.2012.09.07.03.19.51 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 07 Sep 2012 03:19:52 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.214.50 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) client-ip=209.85.214.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.214.50 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) smtp.mail=daniel.lezcano@linaro.org Received: by mail-bk0-f50.google.com with SMTP id j5so1367058bkw.37 for ; Fri, 07 Sep 2012 03:19:51 -0700 (PDT) Received: by 10.205.126.13 with SMTP id gu13mr2323371bkc.79.1347013191833; Fri, 07 Sep 2012 03:19:51 -0700 (PDT) Received: from localhost.localdomain (AToulouse-651-1-16-21.w92-149.abo.wanadoo.fr. [92.149.191.21]) by mx.google.com with ESMTPS id n5sm3018481bkv.14.2012.09.07.03.19.49 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 07 Sep 2012 03:19:51 -0700 (PDT) From: Daniel Lezcano To: rjw@sisk.pl, lenb@kernel.org Cc: linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org, patches@linaro.org, linaro-dev@lists.linaro.org, pdeschrijver@nvidia.com, lorenzo.pieralisi@arm.com Subject: [PATCH 6/6] cpuidle : add cpuidle_register_states function Date: Fri, 7 Sep 2012 12:19:32 +0200 Message-Id: <1347013172-12465-7-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1347013172-12465-1-git-send-email-daniel.lezcano@linaro.org> References: <1347013172-12465-1-git-send-email-daniel.lezcano@linaro.org> X-Gm-Message-State: ALoCoQmaJUwOSw9NXy1bZscBWOzJjskdxDeKsgOomDjs6NXzKmkKqa5D3jZ10KzS4tVGM5fHkexK 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 Acked-by: Peter De Schrijver Tested-by: Peter De Schrijver --- drivers/cpuidle/cpuidle.c | 21 +++++++++++++++++++++ include/linux/cpuidle.h | 10 +++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index 062f54e..ebb10c9 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -487,6 +487,27 @@ 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; + + cpuidle_pause_and_lock(); + + dev->states = states; + dev->state_count = state_count; + + cpuidle_resume_and_unlock(); + + return 0; +} +EXPORT_SYMBOL_GPL(cpuidle_register_states); + #ifdef CONFIG_SMP static void smp_callback(void *v) diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index 5cf18b5..85cabfd 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h @@ -151,7 +151,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); @@ -163,7 +165,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; } @@ -176,7 +177,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) { }