hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/drivers/gpu/drm/bridge/analogix/analogix_dp_core.h
....@@ -1,19 +1,16 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * Header file for Analogix DP (Display Port) core interface driver.
34 *
45 * Copyright (C) 2012 Samsung Electronics Co., Ltd.
56 * Author: Jingoo Han <jg1.han@samsung.com>
6
- *
7
- * This program is free software; you can redistribute it and/or modify it
8
- * under the terms of the GNU General Public License as published by the
9
- * Free Software Foundation; either version 2 of the License, or (at your
10
- * option) any later version.
117 */
128
139 #ifndef _ANALOGIX_DP_CORE_H
1410 #define _ANALOGIX_DP_CORE_H
1511
1612 #include <drm/drm_crtc.h>
13
+#include <drm/drm_bridge.h>
1714 #include <drm/drm_dp_helper.h>
1815
1916 #define DP_TIMEOUT_LOOP_COUNT 100
....@@ -74,6 +71,8 @@
7471 TRAINING_PTN1,
7572 TRAINING_PTN2,
7673 TRAINING_PTN3,
74
+ TEST_PATTERN_80BIT,
75
+ TEST_PATTERN_HBR2,
7776 DP_NONE
7877 };
7978
....@@ -125,13 +124,6 @@
125124 POWER_ALL
126125 };
127126
128
-enum dp_irq_type {
129
- DP_IRQ_TYPE_HP_CABLE_IN = BIT(0),
130
- DP_IRQ_TYPE_HP_CABLE_OUT = BIT(1),
131
- DP_IRQ_TYPE_HP_CHANGE = BIT(2),
132
- DP_IRQ_TYPE_UNKNOWN = BIT(3),
133
-};
134
-
135127 struct video_info {
136128 char *name;
137129 struct drm_display_mode mode;
....@@ -147,8 +139,10 @@
147139
148140 int max_link_rate;
149141 enum link_lane_count_type max_lane_count;
142
+ u32 lane_map[4];
150143
151144 bool video_bist_enable;
145
+ bool force_stream_valid;
152146 };
153147
154148 struct link_train {
....@@ -164,37 +158,48 @@
164158 enum link_training_state lt_state;
165159 };
166160
161
+struct analogix_dp_compliance {
162
+ struct drm_dp_phy_test_params phytest;
163
+ int test_link_rate;
164
+ u8 test_lane_count;
165
+ unsigned long test_type;
166
+ bool test_active;
167
+};
168
+
167169 struct analogix_dp_device {
168170 struct drm_encoder *encoder;
169171 struct device *dev;
170172 struct drm_device *drm_dev;
171173 struct drm_connector connector;
172
- struct drm_bridge *bridge;
174
+ struct drm_bridge bridge;
173175 struct drm_dp_aux aux;
176
+ struct clk_bulk_data *clks;
177
+ int nr_clks;
174178 unsigned int irq;
175179 void __iomem *reg_base;
176180
177181 struct video_info video_info;
178182 struct link_train link_train;
179183 struct phy *phy;
180
- bool phy_enabled;
181184 int dpms_mode;
182185 struct gpio_desc *hpd_gpiod;
183
- int hpd_irq;
184186 bool force_hpd;
185
- bool psr_enable;
186187 bool fast_train_enable;
188
+ bool psr_supported;
189
+ struct work_struct modeset_retry_work;
187190
188191 struct mutex panel_lock;
189192 bool panel_is_prepared;
190193
194
+ u8 dpcd[DP_RECEIVER_CAP_SIZE];
191195 struct analogix_dp_plat_data *plat_data;
196
+ struct extcon_dev *extcon;
197
+ struct analogix_dp_compliance compliance;
192198 };
193199
194200 /* analogix_dp_reg.c */
195201 void analogix_dp_enable_video_mute(struct analogix_dp_device *dp, bool enable);
196202 void analogix_dp_stop_video(struct analogix_dp_device *dp);
197
-void analogix_dp_lane_swap(struct analogix_dp_device *dp, bool enable);
198203 void analogix_dp_init_analog_param(struct analogix_dp_device *dp);
199204 void analogix_dp_init_interrupt(struct analogix_dp_device *dp);
200205 void analogix_dp_reset(struct analogix_dp_device *dp);
....@@ -210,7 +215,6 @@
210215 int analogix_dp_init_analog_func(struct analogix_dp_device *dp);
211216 void analogix_dp_init_hpd(struct analogix_dp_device *dp);
212217 void analogix_dp_force_hpd(struct analogix_dp_device *dp);
213
-enum dp_irq_type analogix_dp_get_irq_type(struct analogix_dp_device *dp);
214218 void analogix_dp_clear_hotplug_interrupts(struct analogix_dp_device *dp);
215219 void analogix_dp_reset_aux(struct analogix_dp_device *dp);
216220 void analogix_dp_init_aux(struct analogix_dp_device *dp);
....@@ -222,6 +226,7 @@
222226 void analogix_dp_get_lane_count(struct analogix_dp_device *dp, u32 *count);
223227 void analogix_dp_enable_enhanced_mode(struct analogix_dp_device *dp,
224228 bool enable);
229
+bool analogix_dp_get_enhanced_mode(struct analogix_dp_device *dp);
225230 void analogix_dp_set_training_pattern(struct analogix_dp_device *dp,
226231 enum pattern_set pattern);
227232 void analogix_dp_set_lane_link_training(struct analogix_dp_device *dp);
....@@ -245,17 +250,21 @@
245250 void analogix_dp_disable_scrambling(struct analogix_dp_device *dp);
246251 void analogix_dp_enable_psr_crc(struct analogix_dp_device *dp);
247252 int analogix_dp_send_psr_spd(struct analogix_dp_device *dp,
248
- struct edp_vsc_psr *vsc, bool blocking);
253
+ struct dp_sdp *vsc, bool blocking);
249254 ssize_t analogix_dp_transfer(struct analogix_dp_device *dp,
250255 struct drm_dp_aux_msg *msg);
251256 void analogix_dp_set_video_format(struct analogix_dp_device *dp);
252257 void analogix_dp_video_bist_enable(struct analogix_dp_device *dp);
253258 bool analogix_dp_ssc_supported(struct analogix_dp_device *dp);
254
-void analogix_dp_phy_power_on(struct analogix_dp_device *dp);
259
+int analogix_dp_phy_power_on(struct analogix_dp_device *dp);
255260 void analogix_dp_phy_power_off(struct analogix_dp_device *dp);
256261 void analogix_dp_audio_config_spdif(struct analogix_dp_device *dp);
257262 void analogix_dp_audio_config_i2s(struct analogix_dp_device *dp);
258263 void analogix_dp_audio_enable(struct analogix_dp_device *dp);
259264 void analogix_dp_audio_disable(struct analogix_dp_device *dp);
265
+void analogix_dp_init(struct analogix_dp_device *dp);
266
+void analogix_dp_irq_handler(struct analogix_dp_device *dp);
267
+void analogix_dp_phy_test(struct analogix_dp_device *dp);
268
+void analogix_dp_check_device_service_irq(struct analogix_dp_device *dp);
260269
261270 #endif /* _ANALOGIX_DP_CORE_H */