forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 1f93a7dfd1f8d5ff7a5c53246c7534fe2332d6f4
kernel/include/soc/rockchip/rockchip_dmc.h
....@@ -31,17 +31,49 @@
3131 #define SCREEN_DUAL_LVDS_10BIT 12
3232 #define SCREEN_DP 13
3333
34
-#ifdef CONFIG_ARM_ROCKCHIP_DMC_DEVFREQ
34
+#define DMCFREQ_TABLE_END ~1u
35
+
36
+struct freq_map_table {
37
+ unsigned int min;
38
+ unsigned int max;
39
+ unsigned long freq;
40
+};
41
+
42
+struct rl_map_table {
43
+ unsigned int pn; /* panel number */
44
+ unsigned int rl; /* readlatency */
45
+};
46
+
47
+struct dmcfreq_common_info {
48
+ struct device *dev;
49
+ struct devfreq *devfreq;
50
+ struct freq_map_table *vop_bw_tbl;
51
+ struct freq_map_table *vop_frame_bw_tbl;
52
+ struct rl_map_table *vop_pn_rl_tbl;
53
+ struct delayed_work msch_rl_work;
54
+ unsigned long vop_req_rate;
55
+ unsigned int read_latency;
56
+ unsigned int auto_freq_en;
57
+ bool is_msch_rl_work_started;
58
+ int (*set_msch_readlatency)(unsigned int rl);
59
+};
60
+
61
+struct dmcfreq_vop_info {
62
+ unsigned int line_bw_mbyte;
63
+ unsigned int frame_bw_mbyte;
64
+ unsigned int plane_num;
65
+};
66
+
67
+#if IS_REACHABLE(CONFIG_ARM_ROCKCHIP_DMC_DEVFREQ)
3568 void rockchip_dmcfreq_lock(void);
3669 void rockchip_dmcfreq_lock_nested(void);
3770 void rockchip_dmcfreq_unlock(void);
71
+int rockchip_dmcfreq_write_trylock(void);
72
+void rockchip_dmcfreq_write_unlock(void);
3873 int rockchip_dmcfreq_wait_complete(void);
39
-int rockchip_dmcfreq_vop_bandwidth_request(struct devfreq *devfreq,
40
- unsigned int bw_mbyte);
41
-void rockchip_dmcfreq_vop_bandwidth_update(struct devfreq *devfreq,
42
- unsigned int line_bw_mbyte,
43
- unsigned int frame_bw_mbyte,
44
- unsigned int plane_num);
74
+int rockchip_dmcfreq_vop_bandwidth_init(struct dmcfreq_common_info *info);
75
+int rockchip_dmcfreq_vop_bandwidth_request(struct dmcfreq_vop_info *vop_info);
76
+void rockchip_dmcfreq_vop_bandwidth_update(struct dmcfreq_vop_info *vop_info);
4577 #else
4678 static inline void rockchip_dmcfreq_lock(void)
4779 {
....@@ -55,23 +87,33 @@
5587 {
5688 }
5789
90
+static inline int rockchip_dmcfreq_write_trylock(void)
91
+{
92
+ return 0;
93
+}
94
+
95
+static inline void rockchip_dmcfreq_write_unlock(void)
96
+{
97
+}
98
+
5899 static inline int rockchip_dmcfreq_wait_complete(void)
59100 {
60101 return 0;
61102 }
62103
63104 static inline int
64
-rockchip_dmcfreq_vop_bandwidth_request(struct devfreq *devfreq,
65
- unsigned int bw_mbyte)
105
+rockchip_dmcfreq_vop_bandwidth_request(struct dmcfreq_vop_info *vop_info)
66106 {
67107 return 0;
68108 }
69109
70110 static inline void
71
-rockchip_dmcfreq_vop_bandwidth_update(struct devfreq *devfreq,
72
- unsigned int line_bw_mbyte,
73
- unsigned int frame_bw_mbyte,
74
- unsigned int plane_num)
111
+rockchip_dmcfreq_vop_bandwidth_update(struct dmcfreq_vop_info *vop_info)
112
+{
113
+}
114
+
115
+static inline void
116
+rockchip_dmcfreq_vop_bandwidth_init(struct dmcfreq_common_info *info)
75117 {
76118 }
77119 #endif