xref: /openbmc/linux/drivers/clk/tegra/cvb.h (revision 909bad2d)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Utility functions for parsing Tegra CVB voltage tables
4  */
5 
6 #ifndef __DRIVERS_CLK_TEGRA_CVB_H
7 #define __DRIVERS_CLK_TEGRA_CVB_H
8 
9 #include <linux/types.h>
10 
11 struct device;
12 
13 #define MAX_DVFS_FREQS	40
14 
15 struct rail_alignment {
16 	int offset_uv;
17 	int step_uv;
18 };
19 
20 struct cvb_coefficients {
21 	int c0;
22 	int c1;
23 	int c2;
24 };
25 
26 struct cvb_table_freq_entry {
27 	unsigned long freq;
28 	struct cvb_coefficients coefficients;
29 };
30 
31 struct cvb_cpu_dfll_data {
32 	u32 tune0_low;
33 	u32 tune0_high;
34 	u32 tune1;
35 	unsigned int tune_high_min_millivolts;
36 };
37 
38 struct cvb_table {
39 	int speedo_id;
40 	int process_id;
41 
42 	int min_millivolts;
43 	int max_millivolts;
44 
45 	int speedo_scale;
46 	int voltage_scale;
47 	struct cvb_table_freq_entry entries[MAX_DVFS_FREQS];
48 	struct cvb_cpu_dfll_data cpu_dfll_data;
49 };
50 
51 const struct cvb_table *
52 tegra_cvb_add_opp_table(struct device *dev, const struct cvb_table *cvb_tables,
53 			size_t count, struct rail_alignment *align,
54 			int process_id, int speedo_id, int speedo_value,
55 			unsigned long max_freq);
56 void tegra_cvb_remove_opp_table(struct device *dev,
57 				const struct cvb_table *table,
58 				unsigned long max_freq);
59 
60 #endif
61