hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/include/soc/rockchip/rockchip_dmc.h
....@@ -31,17 +31,53 @@
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_4k_rate;
55
+ unsigned long vop_req_rate;
56
+ unsigned int read_latency;
57
+ unsigned int auto_freq_en;
58
+ unsigned int stall_time_ns;
59
+ bool is_msch_rl_work_started;
60
+ int (*set_msch_readlatency)(unsigned int rl);
61
+};
62
+
63
+struct dmcfreq_vop_info {
64
+ unsigned int line_bw_mbyte;
65
+ unsigned int frame_bw_mbyte;
66
+ unsigned int plane_num;
67
+ unsigned int plane_num_4k;
68
+};
69
+
70
+#if IS_REACHABLE(CONFIG_ARM_ROCKCHIP_DMC_DEVFREQ)
3571 void rockchip_dmcfreq_lock(void);
3672 void rockchip_dmcfreq_lock_nested(void);
3773 void rockchip_dmcfreq_unlock(void);
74
+int rockchip_dmcfreq_write_trylock(void);
75
+void rockchip_dmcfreq_write_unlock(void);
3876 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);
77
+int rockchip_dmcfreq_vop_bandwidth_init(struct dmcfreq_common_info *info);
78
+int rockchip_dmcfreq_vop_bandwidth_request(struct dmcfreq_vop_info *vop_info);
79
+void rockchip_dmcfreq_vop_bandwidth_update(struct dmcfreq_vop_info *vop_info);
80
+unsigned int rockchip_dmcfreq_get_stall_time_ns(void);
4581 #else
4682 static inline void rockchip_dmcfreq_lock(void)
4783 {
....@@ -55,25 +91,41 @@
5591 {
5692 }
5793
94
+static inline int rockchip_dmcfreq_write_trylock(void)
95
+{
96
+ return 0;
97
+}
98
+
99
+static inline void rockchip_dmcfreq_write_unlock(void)
100
+{
101
+}
102
+
58103 static inline int rockchip_dmcfreq_wait_complete(void)
59104 {
60105 return 0;
61106 }
62107
63108 static inline int
64
-rockchip_dmcfreq_vop_bandwidth_request(struct devfreq *devfreq,
65
- unsigned int bw_mbyte)
109
+rockchip_dmcfreq_vop_bandwidth_request(struct dmcfreq_vop_info *vop_info)
66110 {
67111 return 0;
68112 }
69113
70114 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)
115
+rockchip_dmcfreq_vop_bandwidth_update(struct dmcfreq_vop_info *vop_info)
75116 {
76117 }
118
+
119
+static inline void
120
+rockchip_dmcfreq_vop_bandwidth_init(struct dmcfreq_common_info *info)
121
+{
122
+}
123
+
124
+static inline unsigned int
125
+rockchip_dmcfreq_get_stall_time_ns(void)
126
+{
127
+ return 0;
128
+}
77129 #endif
78130
79131 #endif