1 /* linux/arch/arm/mach-exynos/include/mach/busfreq_exynos5.h
3 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
6 * EXYNOS5 - BUSFreq support
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #ifndef __ASM_ARCH_BUSFREQ_H
14 #define __ASM_ARCH_BUSFREQ_H __FILE__
16 #include <linux/notifier.h>
18 #include <mach/ppmu.h>
21 #define LOAD_HISTORY_SIZE 5
22 #define DIVIDING_FACTOR 10000
24 #define TIMINGROW_OFFSET 0x34
26 extern unsigned int exynos_result_of_asv;
27 extern unsigned int exynos_result_mif_asv;
28 extern bool exynos_lot_id;
29 extern bool exynos_lot_is_nzvpu;
30 extern bool int_vol_lock;
31 extern bool g3d_vol_lock;
33 enum busfreq_level_idx {
51 struct device *dev[PPMU_TYPE_END];
52 struct delayed_work worker;
53 unsigned long curr_freq[PPMU_TYPE_END];
54 unsigned long max_freq[PPMU_TYPE_END];
55 unsigned long min_freq[PPMU_TYPE_END];
56 struct regulator *vdd_reg[PPMU_TYPE_END];
57 unsigned int sampling_rate;
58 struct kobject *busfreq_kobject;
59 struct busfreq_table *table[PPMU_TYPE_END];
60 unsigned long long time_in_state[PPMU_TYPE_END][LV_INT_END];
61 unsigned long long last_time[PPMU_TYPE_END];
62 unsigned int load_history[PPMU_END][LOAD_HISTORY_SIZE];
65 struct notifier_block exynos_buspm_notifier;
66 struct notifier_block exynos_reboot_notifier;
67 struct notifier_block exynos_request_notifier;
68 struct attribute_group busfreq_attr_group;
69 int (*init) (struct device *dev, struct busfreq_data *data);
70 void (*monitor) (struct busfreq_data *data, struct opp **mif_opp,
71 struct opp **int_opp);
72 void (*target) (struct busfreq_data *data,
73 enum ppmu_type type, int index);
74 unsigned int (*get_int_volt) (unsigned long freq);
75 int (*get_table_index) (unsigned long freq, enum ppmu_type type);
76 void (*busfreq_prepare) (int index);
77 void (*busfreq_post) (int index);
78 void (*busfreq_suspend) (void);
79 void (*busfreq_resume) (void);
81 /* Dividers calculated at boot/probe-time */
82 unsigned int lex_divtable[LV_INT_END];
83 unsigned int r0x_divtable[LV_INT_END];
84 unsigned int r1x_divtable[LV_INT_END];
85 unsigned int cdrex_divtable[LV_MIF_END];
86 unsigned int cdrex2_divtable[LV_MIF_END];
89 struct busfreq_table {
93 unsigned int clk_topdiv;
94 unsigned int clk_dmc0div;
95 unsigned int clk_dmc1div;
98 void exynos_request_apply(unsigned long freq);
99 unsigned long step_down(struct busfreq_data *data,
100 enum ppmu_type type, int step);
101 int exynos5250_init(struct device *dev, struct busfreq_data *data);
102 void exynos5250_prepare(int index);
103 void exynos5250_post(int index);
105 #endif /* __ASM_ARCH_BUSFREQ_H */