From patchwork Thu May 20 23:59:29 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 101272 X-Patchwork-Delegate: khilman@deeprootsystems.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4KNuaZb007893 for ; Thu, 20 May 2010 23:59:34 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755258Ab0ETX7e (ORCPT ); Thu, 20 May 2010 19:59:34 -0400 Received: from mail-pz0-f185.google.com ([209.85.222.185]:58147 "EHLO mail-pz0-f185.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754516Ab0ETX7d (ORCPT ); Thu, 20 May 2010 19:59:33 -0400 Received: by pzk15 with SMTP id 15so206250pzk.15 for ; Thu, 20 May 2010 16:59:32 -0700 (PDT) Received: by 10.115.132.22 with SMTP id j22mr701382wan.125.1274399972325; Thu, 20 May 2010 16:59:32 -0700 (PDT) Received: from localhost (c-24-18-179-55.hsd1.wa.comcast.net [24.18.179.55]) by mx.google.com with ESMTPS id b6sm3418549wam.21.2010.05.20.16.59.31 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 20 May 2010 16:59:31 -0700 (PDT) From: Kevin Hilman To: linux-omap@vger.kernel.org Subject: [PATCH] OMAP: hwmod: allow idle after HWMOD_INIT_NO_IDLE Date: Thu, 20 May 2010 16:59:29 -0700 Message-Id: <1274399970-21732-1-git-send-email-khilman@deeprootsystems.com> X-Mailer: git-send-email 1.7.0.2 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.3 (demeter.kernel.org [140.211.167.41]); Thu, 20 May 2010 23:59:34 +0000 (UTC) diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 2fff39f..a127c9b 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -939,7 +939,13 @@ static int _enable(struct omap_hwmod *oh) */ static int _idle(struct omap_hwmod *oh) { - if (oh->_state != _HWMOD_STATE_ENABLED) { + /* + * To idle, hwmod must be enabled, EXCEPT if hwmod was + * initialized using the INIT_NO_IDLE flag. In this case it + * will not yet be enabled so we have to allow it to be idled. + */ + if ((oh->_state != _HWMOD_STATE_ENABLED) && + !(oh->flags & HWMOD_INIT_NO_IDLE)) { WARN(1, "omap_hwmod: %s: idle state can only be entered from " "enabled state\n", oh->name); return -EINVAL; @@ -954,6 +960,9 @@ static int _idle(struct omap_hwmod *oh) oh->_state = _HWMOD_STATE_IDLE; + /* Clear init flag which should only affect first call to idle */ + oh->flags &= ~HWMOD_INIT_NO_IDLE; + return 0; }