.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
---|
1 | 2 | /* |
---|
2 | 3 | * Header file for Analogix DP (Display Port) core interface driver. |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2012 Samsung Electronics Co., Ltd. |
---|
5 | 6 | * 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. |
---|
11 | 7 | */ |
---|
12 | 8 | |
---|
13 | 9 | #ifndef _ANALOGIX_DP_CORE_H |
---|
14 | 10 | #define _ANALOGIX_DP_CORE_H |
---|
15 | 11 | |
---|
16 | 12 | #include <drm/drm_crtc.h> |
---|
| 13 | +#include <drm/drm_bridge.h> |
---|
17 | 14 | #include <drm/drm_dp_helper.h> |
---|
18 | 15 | |
---|
19 | 16 | #define DP_TIMEOUT_LOOP_COUNT 100 |
---|
.. | .. |
---|
74 | 71 | TRAINING_PTN1, |
---|
75 | 72 | TRAINING_PTN2, |
---|
76 | 73 | TRAINING_PTN3, |
---|
| 74 | + TEST_PATTERN_80BIT, |
---|
| 75 | + TEST_PATTERN_HBR2, |
---|
77 | 76 | DP_NONE |
---|
78 | 77 | }; |
---|
79 | 78 | |
---|
.. | .. |
---|
125 | 124 | POWER_ALL |
---|
126 | 125 | }; |
---|
127 | 126 | |
---|
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 | | - |
---|
135 | 127 | struct video_info { |
---|
136 | 128 | char *name; |
---|
137 | 129 | struct drm_display_mode mode; |
---|
.. | .. |
---|
147 | 139 | |
---|
148 | 140 | int max_link_rate; |
---|
149 | 141 | enum link_lane_count_type max_lane_count; |
---|
| 142 | + u32 lane_map[4]; |
---|
150 | 143 | |
---|
151 | 144 | bool video_bist_enable; |
---|
| 145 | + bool force_stream_valid; |
---|
152 | 146 | }; |
---|
153 | 147 | |
---|
154 | 148 | struct link_train { |
---|
.. | .. |
---|
164 | 158 | enum link_training_state lt_state; |
---|
165 | 159 | }; |
---|
166 | 160 | |
---|
| 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 | + |
---|
167 | 169 | struct analogix_dp_device { |
---|
168 | 170 | struct drm_encoder *encoder; |
---|
169 | 171 | struct device *dev; |
---|
170 | 172 | struct drm_device *drm_dev; |
---|
171 | 173 | struct drm_connector connector; |
---|
172 | | - struct drm_bridge *bridge; |
---|
| 174 | + struct drm_bridge bridge; |
---|
173 | 175 | struct drm_dp_aux aux; |
---|
| 176 | + struct clk_bulk_data *clks; |
---|
| 177 | + int nr_clks; |
---|
174 | 178 | unsigned int irq; |
---|
175 | 179 | void __iomem *reg_base; |
---|
176 | 180 | |
---|
177 | 181 | struct video_info video_info; |
---|
178 | 182 | struct link_train link_train; |
---|
179 | 183 | struct phy *phy; |
---|
180 | | - bool phy_enabled; |
---|
181 | 184 | int dpms_mode; |
---|
182 | 185 | struct gpio_desc *hpd_gpiod; |
---|
183 | | - int hpd_irq; |
---|
184 | 186 | bool force_hpd; |
---|
185 | | - bool psr_enable; |
---|
186 | 187 | bool fast_train_enable; |
---|
| 188 | + bool psr_supported; |
---|
| 189 | + struct work_struct modeset_retry_work; |
---|
187 | 190 | |
---|
188 | 191 | struct mutex panel_lock; |
---|
189 | 192 | bool panel_is_prepared; |
---|
190 | 193 | |
---|
| 194 | + u8 dpcd[DP_RECEIVER_CAP_SIZE]; |
---|
191 | 195 | struct analogix_dp_plat_data *plat_data; |
---|
| 196 | + struct extcon_dev *extcon; |
---|
| 197 | + struct analogix_dp_compliance compliance; |
---|
192 | 198 | }; |
---|
193 | 199 | |
---|
194 | 200 | /* analogix_dp_reg.c */ |
---|
195 | 201 | void analogix_dp_enable_video_mute(struct analogix_dp_device *dp, bool enable); |
---|
196 | 202 | void analogix_dp_stop_video(struct analogix_dp_device *dp); |
---|
197 | | -void analogix_dp_lane_swap(struct analogix_dp_device *dp, bool enable); |
---|
198 | 203 | void analogix_dp_init_analog_param(struct analogix_dp_device *dp); |
---|
199 | 204 | void analogix_dp_init_interrupt(struct analogix_dp_device *dp); |
---|
200 | 205 | void analogix_dp_reset(struct analogix_dp_device *dp); |
---|
.. | .. |
---|
210 | 215 | int analogix_dp_init_analog_func(struct analogix_dp_device *dp); |
---|
211 | 216 | void analogix_dp_init_hpd(struct analogix_dp_device *dp); |
---|
212 | 217 | 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); |
---|
214 | 218 | void analogix_dp_clear_hotplug_interrupts(struct analogix_dp_device *dp); |
---|
215 | 219 | void analogix_dp_reset_aux(struct analogix_dp_device *dp); |
---|
216 | 220 | void analogix_dp_init_aux(struct analogix_dp_device *dp); |
---|
.. | .. |
---|
222 | 226 | void analogix_dp_get_lane_count(struct analogix_dp_device *dp, u32 *count); |
---|
223 | 227 | void analogix_dp_enable_enhanced_mode(struct analogix_dp_device *dp, |
---|
224 | 228 | bool enable); |
---|
| 229 | +bool analogix_dp_get_enhanced_mode(struct analogix_dp_device *dp); |
---|
225 | 230 | void analogix_dp_set_training_pattern(struct analogix_dp_device *dp, |
---|
226 | 231 | enum pattern_set pattern); |
---|
227 | 232 | void analogix_dp_set_lane_link_training(struct analogix_dp_device *dp); |
---|
.. | .. |
---|
245 | 250 | void analogix_dp_disable_scrambling(struct analogix_dp_device *dp); |
---|
246 | 251 | void analogix_dp_enable_psr_crc(struct analogix_dp_device *dp); |
---|
247 | 252 | 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); |
---|
249 | 254 | ssize_t analogix_dp_transfer(struct analogix_dp_device *dp, |
---|
250 | 255 | struct drm_dp_aux_msg *msg); |
---|
251 | 256 | void analogix_dp_set_video_format(struct analogix_dp_device *dp); |
---|
252 | 257 | void analogix_dp_video_bist_enable(struct analogix_dp_device *dp); |
---|
253 | 258 | 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); |
---|
255 | 260 | void analogix_dp_phy_power_off(struct analogix_dp_device *dp); |
---|
256 | 261 | void analogix_dp_audio_config_spdif(struct analogix_dp_device *dp); |
---|
257 | 262 | void analogix_dp_audio_config_i2s(struct analogix_dp_device *dp); |
---|
258 | 263 | void analogix_dp_audio_enable(struct analogix_dp_device *dp); |
---|
259 | 264 | 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); |
---|
260 | 269 | |
---|
261 | 270 | #endif /* _ANALOGIX_DP_CORE_H */ |
---|