From patchwork Fri Jan 8 23:26:53 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 71885 X-Patchwork-Delegate: paul@pwsan.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id o08NRhim008198 for ; Fri, 8 Jan 2010 23:27:50 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754301Ab0AHX1F (ORCPT ); Fri, 8 Jan 2010 18:27:05 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754306Ab0AHX1E (ORCPT ); Fri, 8 Jan 2010 18:27:04 -0500 Received: from mail-px0-f174.google.com ([209.85.216.174]:41422 "EHLO mail-px0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754284Ab0AHX1B (ORCPT ); Fri, 8 Jan 2010 18:27:01 -0500 Received: by pxi4 with SMTP id 4so2403672pxi.33 for ; Fri, 08 Jan 2010 15:27:01 -0800 (PST) Received: by 10.142.3.35 with SMTP id 35mr18831197wfc.205.1262993220999; Fri, 08 Jan 2010 15:27:00 -0800 (PST) Received: from localhost (deeprootsystems.com [216.254.16.51]) by mx.google.com with ESMTPS id 20sm19032453pzk.5.2010.01.08.15.26.59 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 08 Jan 2010 15:27:00 -0800 (PST) From: Kevin Hilman To: linux-omap@vger.kernel.org Cc: paul@pwsan.com Subject: [PATCH 3/3] OMAP: hwmod: allow idle after HWMOD_INIT_NO_IDLE Date: Fri, 8 Jan 2010 15:26:53 -0800 Message-Id: <1262993213-19866-4-git-send-email-khilman@deeprootsystems.com> X-Mailer: git-send-email 1.6.6.rc2.1.g42108 In-Reply-To: <1262993213-19866-3-git-send-email-khilman@deeprootsystems.com> References: <1262993213-19866-1-git-send-email-khilman@deeprootsystems.com> <1262993213-19866-2-git-send-email-khilman@deeprootsystems.com> <1262993213-19866-3-git-send-email-khilman@deeprootsystems.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 307deea..2de4cc3 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -869,7 +869,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; @@ -884,6 +890,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; }