| 
					
				 | 
			
			
				@@ -0,0 +1,75 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * OMAP powerdomain control 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * Copyright (C) 2007-2008, 2011 Texas Instruments, Inc. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * Copyright (C) 2007-2011 Nokia Corporation 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * Written by Paul Walmsley 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * Added OMAP4 specific support by Abhijit Pagare <abhijitpagare@ti.com> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * State counting code by Tero Kristo <tero.kristo@nokia.com> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * This program is free software; you can redistribute it and/or modify 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * it under the terms of the GNU General Public License version 2 as 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * published by the Free Software Foundation. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#undef DEBUG 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include <linux/kernel.h> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include <linux/types.h> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include <linux/list.h> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include <linux/errno.h> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include <linux/string.h> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include <trace/events/power.h> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include "cm2xxx_3xxx.h" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include "prcm44xx.h" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include "cm44xx.h" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include "prm2xxx_3xxx.h" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include "prm44xx.h" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include <asm/cpu.h> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include "powerdomain.h" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include "clockdomain.h" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include "soc.h" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include "pm.h" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#define PWRDM_TRACE_STATES_FLAG	(1<<31) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+enum { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	PWRDM_STATE_NOW = 0, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	PWRDM_STATE_PREV, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/* pwrdm_list contains all registered struct powerdomains */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static LIST_HEAD(pwrdm_list); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static struct pwrdm_ops *arch_pwrdm; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/* Private functions */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+static struct powerdomain *_pwrdm_lookup(const char *name) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	struct powerdomain *pwrdm, *temp_pwrdm; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	pwrdm = NULL; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	list_for_each_entry(temp_pwrdm, &pwrdm_list, node) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if (!strcmp(name, temp_pwrdm->name)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			pwrdm = temp_pwrdm; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	return pwrdm; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * _pwrdm_register - register a powerdomain 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * @pwrdm: struct powerdomain * to register 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * Adds a powerdomain to the internal powerdomain list.  Returns 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * -EINVAL if given a null pointer, -EEXIST if a powerdomain is 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * already registered by the provided name, or 0 upon success. 
			 |