From patchwork Tue Sep 18 08:52:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Pihet X-Patchwork-Id: 1471431 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 4D13A400EC for ; Tue, 18 Sep 2012 08:58:49 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TDtaI-0004Na-6G; Tue, 18 Sep 2012 08:55:12 +0000 Received: from mail-wi0-f177.google.com ([209.85.212.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TDtXq-0002tN-VX for linux-arm-kernel@lists.infradead.org; Tue, 18 Sep 2012 08:52:47 +0000 Received: by wibhn17 with SMTP id hn17so2568628wib.0 for ; Tue, 18 Sep 2012 01:52:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=pvX5JB/EHGy9XfLWZ60UgBPTRM4Fh2ft1Yt4HvpfvMc=; b=hK3+D9+1BQWB2tgVCDEmHS6vBTEZSYm+n/3bALygar1T3N0cDdfi2Pzdr+9fRnO7NJ PfGohfDopQSCDwoSv6JOEWY1QFY9hb6VbVzef68C052XKocHsNegGRhBwePFvvpN+uS8 QgVm6VR1yvSFeATB5DG7syRT2v/h2dNj/DI4+ZFORFaMBLiNctzJly2JQgLBo+1ifLAW /GdqNfC7tIX9DW8r3fjzxRwes0Str7LCvxBqkN4JE3MZyLH8Fa+tnJOnYvKKwzVF/wnY e+mgGNZhx913VtcLHd2ohGfmXfFkuWbzvELrVs4OqQFIuqk69oyVSW5uIdGzM03H/acx rZPg== Received: by 10.180.90.104 with SMTP id bv8mr21753523wib.22.1347958347474; Tue, 18 Sep 2012 01:52:27 -0700 (PDT) Received: from localhost.localdomain (179.59-66-87.adsl-dyn.isp.belgacom.be. [87.66.59.179]) by mx.google.com with ESMTPS id ct3sm21831091wib.5.2012.09.18.01.52.26 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 18 Sep 2012 01:52:27 -0700 (PDT) From: Jean Pihet To: linux-omap@vger.kernel.org, paul@pwsan.com, linux-arm-kernel@lists.infradead.org, khilman@ti.com Subject: [PATCH 2/8] ARM: OMAP2+: hwmod: manage the wake-up latency constraints Date: Tue, 18 Sep 2012 10:52:06 +0200 Message-Id: <1347958332-2205-3-git-send-email-j-pihet@ti.com> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: <1347958332-2205-1-git-send-email-j-pihet@ti.com> References: <1347958332-2205-1-git-send-email-j-pihet@ti.com> X-Gm-Message-State: ALoCoQk32X2NY2nGOWlQC9YGXB61Myd76g9j731XdZUNZ3MDs0Z8xoSmqhbQkCLjw/ss2OWUUHNW X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.212.177 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Jean Pihet X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The OMAP PM code implements a handler for the per-device PM QoS framework. The handler queries the omap_hwmod layer in order to manage the power domains wake-up latency constraints. Hwmod retrieves the correct power domain and if it exists it calls the corresponding power domain function. Tested on OMAP3 Beagleboard and OMAP4 Pandaboard in RET/OFF using wake-up latency constraints on MPU, CORE and PER. Signed-off-by: Jean Pihet --- arch/arm/mach-omap2/omap_hwmod.c | 44 +++++++++++++++++++++++++- arch/arm/plat-omap/include/plat/omap_hwmod.h | 5 +++ 2 files changed, 48 insertions(+), 1 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 6ca8e51..5990835 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -145,6 +145,7 @@ #include "powerdomain.h" #include #include +#include #include #include "cm2xxx_3xxx.h" @@ -3554,10 +3555,51 @@ ohsps_unlock: } /** + * omap_hwmod_set_wakeuplat_constraint - Set or update a wake-up latency + * constraint + * @oh: struct omap_hwmod* to which the target device belongs to. + * @cookie: identifier of the constraints list for @oh. + * @min_latency: the minimum allowed wake-up latency for @oh. + * + * Returns the return value from pwrdm_wakeuplat_update_constraint(), + * or -EINVAL in case of invalid parameters. + */ +int omap_hwmod_set_wakeuplat_constraint(struct omap_hwmod *oh, void *cookie, + long min_latency) +{ + struct powerdomain *pwrdm = omap_hwmod_get_pwrdm(oh); + + if (!pwrdm) + return -EINVAL; + + return pwrdm_wakeuplat_update_constraint(pwrdm, cookie, min_latency); +} + +/** + * omap_hwmod_remove_wakeuplat_constraint - Release a wake-up latency + * constraint + * @oh: struct omap_hwmod* to which the target device belongs to. + * @cookie: identifier of the constraints list for @oh. + * + * Removes a wakeup latency contraint. Returns the return value from + * pwrdm_wakeuplat_remove_constraint(), or -EINVAL in case of invalid + * parameters. + */ +int omap_hwmod_remove_wakeuplat_constraint(struct omap_hwmod *oh, void *cookie) +{ + struct powerdomain *pwrdm = omap_hwmod_get_pwrdm(oh); + + if (!pwrdm) + return -EINVAL; + + return pwrdm_wakeuplat_remove_constraint(pwrdm, cookie); +} + +/** * omap_hwmod_get_context_loss_count - get lost context count * @oh: struct omap_hwmod * * - * Query the powerdomain of of @oh to get the context loss + * Query the powerdomain of @oh to get the context loss * count for this device. * * Returns the context loss count of the powerdomain assocated with @oh diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h index 6132972..fa0b350 100644 --- a/arch/arm/plat-omap/include/plat/omap_hwmod.h +++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h @@ -640,6 +640,11 @@ int omap_hwmod_for_each_by_class(const char *classname, void *user); int omap_hwmod_set_postsetup_state(struct omap_hwmod *oh, u8 state); + +int omap_hwmod_set_wakeuplat_constraint(struct omap_hwmod *oh, void *cookie, + long min_latency); +int omap_hwmod_remove_wakeuplat_constraint(struct omap_hwmod *oh, void *cookie); + int omap_hwmod_get_context_loss_count(struct omap_hwmod *oh); int omap_hwmod_no_setup_reset(struct omap_hwmod *oh);