xref: /linux/drivers/clk/tegra/cvb.h (revision dd5b2498d845f925904cb2afabb6ba11bfc317c5)
1 /*
2  * Utility functions for parsing Tegra CVB voltage tables
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
11  * more details.
12  *
13  */
14 
15 #ifndef __DRIVERS_CLK_TEGRA_CVB_H
16 #define __DRIVERS_CLK_TEGRA_CVB_H
17 
18 #include <linux/types.h>
19 
20 struct device;
21 
22 #define MAX_DVFS_FREQS	40
23 
24 struct rail_alignment {
25 	int offset_uv;
26 	int step_uv;
27 };
28 
29 struct cvb_coefficients {
30 	int c0;
31 	int c1;
32 	int c2;
33 };
34 
35 struct cvb_table_freq_entry {
36 	unsigned long freq;
37 	struct cvb_coefficients coefficients;
38 };
39 
40 struct cvb_cpu_dfll_data {
41 	u32 tune0_low;
42 	u32 tune0_high;
43 	u32 tune1;
44 	unsigned int tune_high_min_millivolts;
45 };
46 
47 struct cvb_table {
48 	int speedo_id;
49 	int process_id;
50 
51 	int min_millivolts;
52 	int max_millivolts;
53 
54 	int speedo_scale;
55 	int voltage_scale;
56 	struct cvb_table_freq_entry entries[MAX_DVFS_FREQS];
57 	struct cvb_cpu_dfll_data cpu_dfll_data;
58 };
59 
60 const struct cvb_table *
61 tegra_cvb_add_opp_table(struct device *dev, const struct cvb_table *cvb_tables,
62 			size_t count, struct rail_alignment *align,
63 			int process_id, int speedo_id, int speedo_value,
64 			unsigned long max_freq);
65 void tegra_cvb_remove_opp_table(struct device *dev,
66 				const struct cvb_table *table,
67 				unsigned long max_freq);
68 
69 #endif
70