From patchwork Thu Mar 10 17:47:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Pihet X-Patchwork-Id: 625521 X-Patchwork-Delegate: khilman@deeprootsystems.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2AHloK2010492 for ; Thu, 10 Mar 2011 17:47:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753762Ab1CJRru (ORCPT ); Thu, 10 Mar 2011 12:47:50 -0500 Received: from mail-wy0-f174.google.com ([74.125.82.174]:55430 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753515Ab1CJRru (ORCPT ); Thu, 10 Mar 2011 12:47:50 -0500 Received: by mail-wy0-f174.google.com with SMTP id 21so1681959wya.19 for ; Thu, 10 Mar 2011 09:47:49 -0800 (PST) Received: by 10.216.244.7 with SMTP id l7mr6248523wer.40.1299779269802; Thu, 10 Mar 2011 09:47:49 -0800 (PST) Received: from localhost.localdomain (5.121-245-81.adsl-dyn.isp.belgacom.be [81.245.121.5]) by mx.google.com with ESMTPS id t72sm605793wei.20.2011.03.10.09.47.48 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 10 Mar 2011 09:47:49 -0800 (PST) From: Jean Pihet To: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Kevin Hilman , paul@pwsan.com Cc: Jean Pihet Subject: [PATCH v2 5/7] OMAP: PM CONSTRAINTS: add a power domains state update function in hwmod Date: Thu, 10 Mar 2011 18:47:25 +0100 Message-Id: <1299779247-20511-6-git-send-email-j-pihet@ti.com> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1299779247-20511-1-git-send-email-j-pihet@ti.com> References: <1299779247-20511-1-git-send-email-j-pihet@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 10 Mar 2011 17:47:51 +0000 (UTC) diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index cf8cc9b..8caf2c5 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -142,6 +142,7 @@ #include "powerdomain.h" #include #include +#include #include #include "cm2xxx_3xxx.h" @@ -2277,11 +2278,37 @@ ohsps_unlock: return ret; } +/* + * omap_hwmod_update_power_state - Update the power domain power state of + * @oh + * + * @oh: struct omap_hwmod* to which the requesting device belongs to. + * @min_latency: the allowed wake-up latency for the power domain of @oh. + * + * Finds the power domain next power state that fulfills the constraint. + * Applies the constraint to the power domain by calling + * pwrdm_wakeuplat_update_pwrst. + * + * Returns 0 upon success. + */ +int omap_hwmod_update_power_state(struct omap_hwmod *oh, long min_latency) +{ + struct powerdomain *pwrdm = omap_hwmod_get_pwrdm(oh); + + if (!PTR_ERR(pwrdm)) { + pr_err("omap_hwmod: Error: could not find parent " + "powerdomain for %s\n", oh->name); + return -EINVAL; + } + + return pwrdm_wakeuplat_update_pwrst(pwrdm, min_latency); +} + /** * 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 65bcad4..f27110e 100644 --- a/arch/arm/plat-omap/include/plat/omap_hwmod.h +++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h @@ -597,6 +597,7 @@ 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_update_power_state(struct omap_hwmod *oh, long min_latency); u32 omap_hwmod_get_context_loss_count(struct omap_hwmod *oh); /*