From mboxrd@z Thu Jan 1 00:00:00 1970 From: jean.pihet@newoldbits.com Subject: [PATCH 2/6] OMAP2+: omap_hwmod: manage the wake-up latency constraints Date: Mon, 12 Dec 2011 17:18:17 +0100 Message-ID: <1323706701-6627-3-git-send-email-j-pihet@ti.com> References: <1323706701-6627-1-git-send-email-j-pihet@ti.com> Return-path: Received: from mail-ee0-f46.google.com ([74.125.83.46]:33188 "EHLO mail-ee0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751203Ab1LLQS6 (ORCPT ); Mon, 12 Dec 2011 11:18:58 -0500 Received: by mail-ee0-f46.google.com with SMTP id c4so1674351eek.19 for ; Mon, 12 Dec 2011 08:18:57 -0800 (PST) In-Reply-To: <1323706701-6627-1-git-send-email-j-pihet@ti.com> Sender: linux-omap-owner@vger.kernel.org List-Id: linux-omap@vger.kernel.org To: Kevin Hilman , Linux PM mailing list , linux-omap@vger.kernel.org, "Rafael J. Wysocki" , Paul Walmsley , magnus.damm@gmail.com, Todd Poynor Cc: linux-arm , Jean Pihet From: Jean Pihet Hwmod is queried from the OMAP_PM layer 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 | 27 +++++++++++++++++++++++++- arch/arm/plat-omap/include/plat/omap_hwmod.h | 2 + 2 files changed, 28 insertions(+), 1 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 529142a..c3a4cc4 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -143,6 +143,7 @@ #include "powerdomain.h" #include #include +#include #include #include "cm2xxx_3xxx.h" @@ -2616,10 +2617,34 @@ ohsps_unlock: } /** + * omap_hwmod_set_wkup_constraint- set/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. + * @min_latency: the minimum allowed wake-up latency for @oh. + * + * Returns 0 upon success, -EINVAL in case of invalid parameters, or + * the return value from pwrdm_set_wkup_lat_constraint. + */ +int omap_hwmod_set_wkup_lat_constraint(struct omap_hwmod *oh, + void *cookie, long min_latency) +{ + struct powerdomain *pwrdm = omap_hwmod_get_pwrdm(oh); + + if (!pwrdm) { + pr_err("%s: Error: could not find powerdomain " + "for %s\n", __func__, oh->name); + return -EINVAL; + } + + return pwrdm_set_wkup_lat_constraint(pwrdm, cookie, 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 8b372ed..222f792 100644 --- a/arch/arm/plat-omap/include/plat/omap_hwmod.h +++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h @@ -600,6 +600,8 @@ 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_wkup_lat_constraint(struct omap_hwmod *oh, void *cookie, + long min_latency); int omap_hwmod_get_context_loss_count(struct omap_hwmod *oh); int omap_hwmod_no_setup_reset(struct omap_hwmod *oh); -- 1.7.5.4