summaryrefstree
path: root/kernel/arch/arm/mach-exynos/include/mach/asv-exynos7_cal.h
blob: 263dcaa272bb2023d2d1e7bce8878cd6857c0322 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*
 * linux/arch/arm/mach-exynos/include/mach/asv-exynos7_cal.h
 *
 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
 *		http://www.samsung.com/
 *
 * EXYNOS7 - support ASV drvier to interact with cal.
 *
 * 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.
*/

#ifndef __ASM_ARCH_NEW_EXYNOS5_ASV_CAL_H
#define __ASM_ARCH_NEW_EXYNOS5_ASV_CAL_H __FILE__

/* Use by ASV drvier */
#include <linux/io.h>
#include <mach/map.h>
#include <mach/otp.h>
#include <mach/asv-exynos.h>

u32 re_err(void);

#define Assert(b) (!(b) ? re_err() : 0)

#define SetBits(uAddr, uBaseBit, uMaskValue, uSetValue) \
	do { \
		__raw_writel((__raw_readl((const volatile void __iomem *)uAddr) & \
		 ~((uMaskValue) << (uBaseBit))) | \
		 (((uMaskValue) & (uSetValue)) << (uBaseBit)), uAddr) \
	} while (0);

#define GetBits(uAddr, uBaseBit, uMaskValue) \
	((__raw_readl((const volatile void __iomem *) uAddr) >> (uBaseBit)) & (uMaskValue))

#define ENABLE		(1)
#define DISABLE		(0)

#define CHIPID_ASV_INFO S5P_VA_CHIPID6

enum SYSC_DVFS_SEL {
	SYSC_DVFS_ATL,
	SYSC_DVFS_APO,
	SYSC_DVFS_INT,
	SYSC_DVFS_MIF,
	SYSC_DVFS_G3D,
	SYSC_DVFS_CAM,
	SYSC_DVFS_NUM
};

enum SYSC_DVFS_LVL {
	SYSC_DVFS_L0 = 0,
	SYSC_DVFS_L1,
	SYSC_DVFS_L2,
	SYSC_DVFS_L3,
	SYSC_DVFS_L4,
	SYSC_DVFS_L5,
	SYSC_DVFS_L6,
	SYSC_DVFS_L7,
	SYSC_DVFS_L8,
	SYSC_DVFS_L9,
	SYSC_DVFS_L10,
	SYSC_DVFS_L11,
	SYSC_DVFS_L12,
	SYSC_DVFS_L13,
	SYSC_DVFS_L14,
	SYSC_DVFS_L15,
	SYSC_DVFS_L16,
	SYSC_DVFS_L17,
	SYSC_DVFS_L18,
	SYSC_DVFS_L19,
	SYSC_DVFS_L20,
	SYSC_DVFS_L21,
	SYSC_DVFS_L22,
	SYSC_DVFS_L23,
	SYSC_DVFS_L24,
};


enum SYSC_ASV_GROUP {
	SYSC_ASV_0 = 0,
	SYSC_ASV_1,
	SYSC_ASV_2,
	SYSC_ASV_3,
	SYSC_ASV_4,
	SYSC_ASV_5 = 5,
	SYSC_ASV_6,
	SYSC_ASV_7,
	SYSC_ASV_8,
	SYSC_ASV_9,
	SYSC_ASV_10,
	SYSC_ASV_11 = 11,
	SYSC_ASV_12 = 12,
	SYSC_ASV_13,
	SYSC_ASV_14,
	SYSC_ASV_15 = 15,
	SYSC_ASV_MAX /* ASV limit */
};

void cal_init(void);
s32 cal_get_min_lv(u32 id);
u32 cal_get_volt(u32 id, s32 level);
u32 cal_get_freq(u32 id, s32 level);

bool cal_use_dynimic_abb(u32 id);

void cal_set_ema(u32 id , u32 setvolt);
bool cal_use_dynimic_ema(u32 id);

u32 cal_get_ids_hpm_group(void);
u32 cal_get_table_ver(void);
u32 cal_get_dram_size(void);
bool cal_is_fused_speed_grp(void);
u32 cal_get_ids(void);
u32 cal_get_hpm(void);
u32 cal_get_asv_grp(u32 id, s32 level);

#endif