From patchwork Thu Dec 3 13:35:52 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tero Kristo X-Patchwork-Id: 64523 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nB3Dd4Kb029070 for ; Thu, 3 Dec 2009 13:39:04 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756061AbZLCNip (ORCPT ); Thu, 3 Dec 2009 08:38:45 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756060AbZLCNip (ORCPT ); Thu, 3 Dec 2009 08:38:45 -0500 Received: from smtp.nokia.com ([192.100.105.134]:41233 "EHLO mgw-mx09.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756059AbZLCNio (ORCPT ); Thu, 3 Dec 2009 08:38:44 -0500 Received: from esebh106.NOE.Nokia.com (esebh106.ntc.nokia.com [172.21.138.213]) by mgw-mx09.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id nB3DcBT6006829; Thu, 3 Dec 2009 07:38:40 -0600 Received: from esebh102.NOE.Nokia.com ([172.21.138.183]) by esebh106.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 3 Dec 2009 15:38:36 +0200 Received: from mgw-sa02.ext.nokia.com ([147.243.1.48]) by esebh102.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Thu, 3 Dec 2009 15:38:36 +0200 Received: from localhost.localdomain (sokoban.ntc.nokia.com [172.22.144.95]) by mgw-sa02.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id nB3DcXE6006549; Thu, 3 Dec 2009 15:38:35 +0200 From: Tero Kristo To: linux-arm-kernel@lists.infradead.org Cc: linux-omap@vger.kernel.org Subject: [PATCHv2 1/2] ARM: VFP: Fixed suspend and added context save support Date: Thu, 3 Dec 2009 15:35:52 +0200 Message-Id: <1259847353-22725-2-git-send-email-tero.kristo@nokia.com> X-Mailer: git-send-email 1.5.4.3 In-Reply-To: <1259847353-22725-1-git-send-email-tero.kristo@nokia.com> References: <> <1259847353-22725-1-git-send-email-tero.kristo@nokia.com> X-OriginalArrivalTime: 03 Dec 2009 13:38:36.0937 (UTC) FILETIME=[EA6D0F90:01CA741D] X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c index 2d7423a..920a33b 100644 --- a/arch/arm/vfp/vfpmodule.c +++ b/arch/arm/vfp/vfpmodule.c @@ -329,22 +329,34 @@ static void vfp_enable(void *unused) #ifdef CONFIG_PM #include -static int vfp_pm_suspend(struct sys_device *dev, pm_message_t state) +void vfp_pm_save_context(void) { - struct thread_info *ti = current_thread_info(); u32 fpexc = fmrx(FPEXC); + unsigned int cpu = get_cpu(); + + /* Save last_VFP_context if needed */ + if (last_VFP_context[cpu]) { + /* Enable vfp to save context */ + if (!(fpexc & FPEXC_EN)) { + vfp_enable(NULL); + fmxr(FPEXC, fpexc | FPEXC_EN); + } - /* if vfp is on, then save state for resumption */ - if (fpexc & FPEXC_EN) { printk(KERN_DEBUG "%s: saving vfp state\n", __func__); - vfp_save_state(&ti->vfpstate, fpexc); + vfp_save_state(last_VFP_context[cpu], fpexc); /* disable, just in case */ - fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_EN); + fmxr(FPEXC, fpexc & ~FPEXC_EN); + + last_VFP_context[cpu] = NULL; } - /* clear any information we had about last context state */ - memset(last_VFP_context, 0, sizeof(last_VFP_context)); + put_cpu(); +} + +static int vfp_pm_suspend(struct sys_device *dev, pm_message_t state) +{ + vfp_pm_save_context(); return 0; }