| Brian Swetland | 600f7cf | 2008-09-09 11:04:14 -0700 | [diff] [blame] | 1 | /* arch/arm/mach-msm/clock.h | 
 | 2 |  * | 
 | 3 |  * Copyright (C) 2007 Google, Inc. | 
| Daniel Walker | 5e96da5 | 2010-05-12 13:43:28 -0700 | [diff] [blame] | 4 |  * Copyright (c) 2007-2010, Code Aurora Forum. All rights reserved. | 
| Brian Swetland | 600f7cf | 2008-09-09 11:04:14 -0700 | [diff] [blame] | 5 |  * | 
 | 6 |  * This software is licensed under the terms of the GNU General Public | 
 | 7 |  * License version 2, as published by the Free Software Foundation, and | 
 | 8 |  * may be copied, distributed, and modified under those terms. | 
 | 9 |  * | 
 | 10 |  * This program is distributed in the hope that it will be useful, | 
 | 11 |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
 | 12 |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
 | 13 |  * GNU General Public License for more details. | 
 | 14 |  * | 
 | 15 |  */ | 
 | 16 |  | 
 | 17 | #ifndef __ARCH_ARM_MACH_MSM_CLOCK_H | 
 | 18 | #define __ARCH_ARM_MACH_MSM_CLOCK_H | 
 | 19 |  | 
| Matt Wagantall | d64560fe | 2011-01-26 16:20:54 -0800 | [diff] [blame] | 20 | #include <linux/init.h> | 
| Brian Swetland | 600f7cf | 2008-09-09 11:04:14 -0700 | [diff] [blame] | 21 | #include <linux/list.h> | 
| Daniel Walker | 5e96da5 | 2010-05-12 13:43:28 -0700 | [diff] [blame] | 22 | #include <mach/clk.h> | 
 | 23 |  | 
| Brian Swetland | 600f7cf | 2008-09-09 11:04:14 -0700 | [diff] [blame] | 24 | #define CLKFLAG_INVERT			0x00000001 | 
 | 25 | #define CLKFLAG_NOINVERT		0x00000002 | 
 | 26 | #define CLKFLAG_NONEST			0x00000004 | 
 | 27 | #define CLKFLAG_NORESET			0x00000008 | 
 | 28 |  | 
 | 29 | #define CLK_FIRST_AVAILABLE_FLAG	0x00000100 | 
| Daniel Walker | 5e96da5 | 2010-05-12 13:43:28 -0700 | [diff] [blame] | 30 | #define CLKFLAG_AUTO_OFF		0x00000200 | 
 | 31 | #define CLKFLAG_MIN			0x00000400 | 
 | 32 | #define CLKFLAG_MAX			0x00000800 | 
 | 33 |  | 
 | 34 | struct clk_ops { | 
 | 35 | 	int (*enable)(unsigned id); | 
 | 36 | 	void (*disable)(unsigned id); | 
 | 37 | 	void (*auto_off)(unsigned id); | 
 | 38 | 	int (*reset)(unsigned id, enum clk_reset_action action); | 
 | 39 | 	int (*set_rate)(unsigned id, unsigned rate); | 
 | 40 | 	int (*set_min_rate)(unsigned id, unsigned rate); | 
 | 41 | 	int (*set_max_rate)(unsigned id, unsigned rate); | 
 | 42 | 	int (*set_flags)(unsigned id, unsigned flags); | 
 | 43 | 	unsigned (*get_rate)(unsigned id); | 
 | 44 | 	unsigned (*is_enabled)(unsigned id); | 
 | 45 | 	long (*round_rate)(unsigned id, unsigned rate); | 
| Stephen Boyd | 2a52220 | 2011-02-23 09:37:41 -0800 | [diff] [blame] | 46 | 	bool (*is_local)(unsigned id); | 
| Daniel Walker | 5e96da5 | 2010-05-12 13:43:28 -0700 | [diff] [blame] | 47 | }; | 
| Brian Swetland | 600f7cf | 2008-09-09 11:04:14 -0700 | [diff] [blame] | 48 |  | 
 | 49 | struct clk { | 
 | 50 | 	uint32_t id; | 
| Daniel Walker | 5e96da5 | 2010-05-12 13:43:28 -0700 | [diff] [blame] | 51 | 	uint32_t remote_id; | 
| Brian Swetland | 600f7cf | 2008-09-09 11:04:14 -0700 | [diff] [blame] | 52 | 	uint32_t count; | 
 | 53 | 	uint32_t flags; | 
| Daniel Walker | 5e96da5 | 2010-05-12 13:43:28 -0700 | [diff] [blame] | 54 | 	struct clk_ops *ops; | 
 | 55 | 	const char *dbg_name; | 
| Brian Swetland | 600f7cf | 2008-09-09 11:04:14 -0700 | [diff] [blame] | 56 | 	struct list_head list; | 
| Brian Swetland | 600f7cf | 2008-09-09 11:04:14 -0700 | [diff] [blame] | 57 | }; | 
 | 58 |  | 
| Daniel Walker | 5e96da5 | 2010-05-12 13:43:28 -0700 | [diff] [blame] | 59 | #define OFF CLKFLAG_AUTO_OFF | 
 | 60 | #define CLK_MIN CLKFLAG_MIN | 
 | 61 | #define CLK_MAX CLKFLAG_MAX | 
 | 62 | #define CLK_MINMAX (CLK_MIN | CLK_MAX) | 
| Brian Swetland | 600f7cf | 2008-09-09 11:04:14 -0700 | [diff] [blame] | 63 |  | 
| Matt Wagantall | d64560fe | 2011-01-26 16:20:54 -0800 | [diff] [blame] | 64 | #ifdef CONFIG_DEBUG_FS | 
 | 65 | int __init clock_debug_init(void); | 
 | 66 | int __init clock_debug_add(struct clk *clock); | 
 | 67 | #else | 
 | 68 | static inline int __init clock_debug_init(void) { return 0; } | 
 | 69 | static inline int __init clock_debug_add(struct clk *clock) { return 0; } | 
 | 70 | #endif | 
 | 71 |  | 
| Brian Swetland | 600f7cf | 2008-09-09 11:04:14 -0700 | [diff] [blame] | 72 | #endif |