diff options
author | Colin Cross <ccross@android.com> | 2011-04-07 15:47:13 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:37:04 -0800 |
commit | 8420371387e8dc3e794778f9cacff238c7c8b173 (patch) | |
tree | 6703b7c6ab7bcb03f1fc25c1960fc732ae317e81 /arch/arm/mach-tegra/dvfs.h | |
parent | 6f684ec070749294806ab4baac14b2b6fabdf71d (diff) |
ARM: tegra: Add dvfs
Change-Id: I865e52cae592507c642b92dde3a8293db2d0228f
Signed-off-by: Colin Cross <ccross@android.com>
Diffstat (limited to 'arch/arm/mach-tegra/dvfs.h')
-rw-r--r-- | arch/arm/mach-tegra/dvfs.h | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/dvfs.h b/arch/arm/mach-tegra/dvfs.h new file mode 100644 index 000000000000..68622b899c59 --- /dev/null +++ b/arch/arm/mach-tegra/dvfs.h @@ -0,0 +1,93 @@ +/* + * + * Copyright (C) 2010 Google, Inc. + * + * Author: + * Colin Cross <ccross@google.com> + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef _TEGRA_DVFS_H_ +#define _TEGRA_DVFS_H_ + +#define MAX_DVFS_FREQS 16 + +struct clk; +struct dvfs_rail; + +/* + * dvfs_relationship between to rails, "from" and "to" + * when the rail changes, it will call dvfs_rail_update on the rails + * in the relationship_to list. + * when determining the voltage to set a rail to, it will consider each + * rail in the relationship_from list. + */ +struct dvfs_relationship { + struct dvfs_rail *to; + struct dvfs_rail *from; + int (*solve)(struct dvfs_rail *, struct dvfs_rail *); + + struct list_head to_node; /* node in relationship_to list */ + struct list_head from_node; /* node in relationship_from list */ +}; + +struct dvfs_rail { + const char *reg_id; + int min_millivolts; + int max_millivolts; + int nominal_millivolts; + int step; + bool disabled; + + struct list_head node; /* node in dvfs_rail_list */ + struct list_head dvfs; /* list head of attached dvfs clocks */ + struct list_head relationships_to; + struct list_head relationships_from; + struct regulator *reg; + int millivolts; + int new_millivolts; + bool suspended; +}; + +struct dvfs { + /* Used only by tegra2_clock.c */ + const char *clk_name; + int cpu_process_id; + + /* Must be initialized before tegra_dvfs_init */ + int freqs_mult; + unsigned long freqs[MAX_DVFS_FREQS]; + const int *millivolts; + struct dvfs_rail *dvfs_rail; + bool auto_dvfs; + + /* Filled in by tegra_dvfs_init */ + int max_millivolts; + int num_freqs; + + int cur_millivolts; + unsigned long cur_rate; + struct list_head node; + struct list_head debug_node; + struct list_head reg_node; +}; + +void tegra2_init_dvfs(void); +int tegra_enable_dvfs_on_clk(struct clk *c, struct dvfs *d); +int dvfs_debugfs_init(struct dentry *clk_debugfs_root); +int tegra_dvfs_late_init(void); +int tegra_dvfs_init_rails(struct dvfs_rail *dvfs_rails[], int n); +void tegra_dvfs_add_relationships(struct dvfs_relationship *rels, int n); +void tegra_dvfs_rail_enable(struct dvfs_rail *rail); +void tegra_dvfs_rail_disable(struct dvfs_rail *rail); + +#endif |