1 1.8 riastrad /* $NetBSD: radeon_mode.h,v 1.8 2021/12/19 10:38:05 riastradh Exp $ */ 2 1.3 riastrad 3 1.1 riastrad /* 4 1.1 riastrad * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and 5 1.1 riastrad * VA Linux Systems Inc., Fremont, California. 6 1.1 riastrad * Copyright 2008 Red Hat Inc. 7 1.1 riastrad * 8 1.1 riastrad * Permission is hereby granted, free of charge, to any person obtaining a 9 1.1 riastrad * copy of this software and associated documentation files (the "Software"), 10 1.1 riastrad * to deal in the Software without restriction, including without limitation 11 1.1 riastrad * the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 1.1 riastrad * and/or sell copies of the Software, and to permit persons to whom the 13 1.1 riastrad * Software is furnished to do so, subject to the following conditions: 14 1.1 riastrad * 15 1.1 riastrad * The above copyright notice and this permission notice shall be included in 16 1.1 riastrad * all copies or substantial portions of the Software. 17 1.1 riastrad * 18 1.1 riastrad * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 1.1 riastrad * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 1.1 riastrad * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 1.1 riastrad * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 22 1.1 riastrad * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 23 1.1 riastrad * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 1.1 riastrad * OTHER DEALINGS IN THE SOFTWARE. 25 1.1 riastrad * 26 1.1 riastrad * Original Authors: 27 1.1 riastrad * Kevin E. Martin, Rickard E. Faith, Alan Hourihane 28 1.1 riastrad * 29 1.1 riastrad * Kernel port Author: Dave Airlie 30 1.1 riastrad */ 31 1.1 riastrad 32 1.1 riastrad #ifndef RADEON_MODE_H 33 1.1 riastrad #define RADEON_MODE_H 34 1.1 riastrad 35 1.1 riastrad #include <drm/drm_crtc.h> 36 1.1 riastrad #include <drm/drm_edid.h> 37 1.6 riastrad #include <drm/drm_encoder.h> 38 1.1 riastrad #include <drm/drm_dp_helper.h> 39 1.3 riastrad #include <drm/drm_dp_mst_helper.h> 40 1.1 riastrad #include <drm/drm_fixed.h> 41 1.1 riastrad #include <drm/drm_crtc_helper.h> 42 1.1 riastrad #include <linux/i2c.h> 43 1.1 riastrad #include <linux/i2c-algo-bit.h> 44 1.1 riastrad 45 1.1 riastrad struct radeon_bo; 46 1.1 riastrad struct radeon_device; 47 1.1 riastrad 48 1.1 riastrad #define to_radeon_crtc(x) container_of(x, struct radeon_crtc, base) 49 1.1 riastrad #define to_radeon_connector(x) container_of(x, struct radeon_connector, base) 50 1.1 riastrad #define to_radeon_encoder(x) container_of(x, struct radeon_encoder, base) 51 1.1 riastrad 52 1.3 riastrad #define RADEON_MAX_HPD_PINS 7 53 1.3 riastrad #define RADEON_MAX_CRTCS 6 54 1.3 riastrad #define RADEON_MAX_AFMT_BLOCKS 7 55 1.3 riastrad 56 1.1 riastrad enum radeon_rmx_type { 57 1.1 riastrad RMX_OFF, 58 1.1 riastrad RMX_FULL, 59 1.1 riastrad RMX_CENTER, 60 1.1 riastrad RMX_ASPECT 61 1.1 riastrad }; 62 1.1 riastrad 63 1.1 riastrad enum radeon_tv_std { 64 1.1 riastrad TV_STD_NTSC, 65 1.1 riastrad TV_STD_PAL, 66 1.1 riastrad TV_STD_PAL_M, 67 1.1 riastrad TV_STD_PAL_60, 68 1.1 riastrad TV_STD_NTSC_J, 69 1.1 riastrad TV_STD_SCART_PAL, 70 1.1 riastrad TV_STD_SECAM, 71 1.1 riastrad TV_STD_PAL_CN, 72 1.1 riastrad TV_STD_PAL_N, 73 1.1 riastrad }; 74 1.1 riastrad 75 1.1 riastrad enum radeon_underscan_type { 76 1.1 riastrad UNDERSCAN_OFF, 77 1.1 riastrad UNDERSCAN_ON, 78 1.1 riastrad UNDERSCAN_AUTO, 79 1.1 riastrad }; 80 1.1 riastrad 81 1.1 riastrad enum radeon_hpd_id { 82 1.1 riastrad RADEON_HPD_1 = 0, 83 1.1 riastrad RADEON_HPD_2, 84 1.1 riastrad RADEON_HPD_3, 85 1.1 riastrad RADEON_HPD_4, 86 1.1 riastrad RADEON_HPD_5, 87 1.1 riastrad RADEON_HPD_6, 88 1.1 riastrad RADEON_HPD_NONE = 0xff, 89 1.1 riastrad }; 90 1.1 riastrad 91 1.3 riastrad enum radeon_output_csc { 92 1.3 riastrad RADEON_OUTPUT_CSC_BYPASS = 0, 93 1.3 riastrad RADEON_OUTPUT_CSC_TVRGB = 1, 94 1.3 riastrad RADEON_OUTPUT_CSC_YCBCR601 = 2, 95 1.3 riastrad RADEON_OUTPUT_CSC_YCBCR709 = 3, 96 1.3 riastrad }; 97 1.3 riastrad 98 1.1 riastrad #define RADEON_MAX_I2C_BUS 16 99 1.1 riastrad 100 1.1 riastrad /* radeon gpio-based i2c 101 1.1 riastrad * 1. "mask" reg and bits 102 1.1 riastrad * grabs the gpio pins for software use 103 1.1 riastrad * 0=not held 1=held 104 1.1 riastrad * 2. "a" reg and bits 105 1.1 riastrad * output pin value 106 1.1 riastrad * 0=low 1=high 107 1.1 riastrad * 3. "en" reg and bits 108 1.1 riastrad * sets the pin direction 109 1.1 riastrad * 0=input 1=output 110 1.1 riastrad * 4. "y" reg and bits 111 1.1 riastrad * input pin value 112 1.1 riastrad * 0=low 1=high 113 1.1 riastrad */ 114 1.1 riastrad struct radeon_i2c_bus_rec { 115 1.1 riastrad bool valid; 116 1.1 riastrad /* id used by atom */ 117 1.1 riastrad uint8_t i2c_id; 118 1.1 riastrad /* id used by atom */ 119 1.1 riastrad enum radeon_hpd_id hpd; 120 1.1 riastrad /* can be used with hw i2c engine */ 121 1.1 riastrad bool hw_capable; 122 1.1 riastrad /* uses multi-media i2c engine */ 123 1.1 riastrad bool mm_i2c; 124 1.1 riastrad /* regs and bits */ 125 1.1 riastrad uint32_t mask_clk_reg; 126 1.1 riastrad uint32_t mask_data_reg; 127 1.1 riastrad uint32_t a_clk_reg; 128 1.1 riastrad uint32_t a_data_reg; 129 1.1 riastrad uint32_t en_clk_reg; 130 1.1 riastrad uint32_t en_data_reg; 131 1.1 riastrad uint32_t y_clk_reg; 132 1.1 riastrad uint32_t y_data_reg; 133 1.1 riastrad uint32_t mask_clk_mask; 134 1.1 riastrad uint32_t mask_data_mask; 135 1.1 riastrad uint32_t a_clk_mask; 136 1.1 riastrad uint32_t a_data_mask; 137 1.1 riastrad uint32_t en_clk_mask; 138 1.1 riastrad uint32_t en_data_mask; 139 1.1 riastrad uint32_t y_clk_mask; 140 1.1 riastrad uint32_t y_data_mask; 141 1.1 riastrad }; 142 1.1 riastrad 143 1.1 riastrad struct radeon_tmds_pll { 144 1.1 riastrad uint32_t freq; 145 1.1 riastrad uint32_t value; 146 1.1 riastrad }; 147 1.1 riastrad 148 1.1 riastrad #define RADEON_MAX_BIOS_CONNECTOR 16 149 1.1 riastrad 150 1.1 riastrad /* pll flags */ 151 1.1 riastrad #define RADEON_PLL_USE_BIOS_DIVS (1 << 0) 152 1.1 riastrad #define RADEON_PLL_NO_ODD_POST_DIV (1 << 1) 153 1.1 riastrad #define RADEON_PLL_USE_REF_DIV (1 << 2) 154 1.1 riastrad #define RADEON_PLL_LEGACY (1 << 3) 155 1.1 riastrad #define RADEON_PLL_PREFER_LOW_REF_DIV (1 << 4) 156 1.1 riastrad #define RADEON_PLL_PREFER_HIGH_REF_DIV (1 << 5) 157 1.1 riastrad #define RADEON_PLL_PREFER_LOW_FB_DIV (1 << 6) 158 1.1 riastrad #define RADEON_PLL_PREFER_HIGH_FB_DIV (1 << 7) 159 1.1 riastrad #define RADEON_PLL_PREFER_LOW_POST_DIV (1 << 8) 160 1.1 riastrad #define RADEON_PLL_PREFER_HIGH_POST_DIV (1 << 9) 161 1.1 riastrad #define RADEON_PLL_USE_FRAC_FB_DIV (1 << 10) 162 1.1 riastrad #define RADEON_PLL_PREFER_CLOSEST_LOWER (1 << 11) 163 1.1 riastrad #define RADEON_PLL_USE_POST_DIV (1 << 12) 164 1.1 riastrad #define RADEON_PLL_IS_LCD (1 << 13) 165 1.1 riastrad #define RADEON_PLL_PREFER_MINM_OVER_MAXP (1 << 14) 166 1.1 riastrad 167 1.1 riastrad struct radeon_pll { 168 1.1 riastrad /* reference frequency */ 169 1.1 riastrad uint32_t reference_freq; 170 1.1 riastrad 171 1.1 riastrad /* fixed dividers */ 172 1.1 riastrad uint32_t reference_div; 173 1.1 riastrad uint32_t post_div; 174 1.1 riastrad 175 1.1 riastrad /* pll in/out limits */ 176 1.1 riastrad uint32_t pll_in_min; 177 1.1 riastrad uint32_t pll_in_max; 178 1.1 riastrad uint32_t pll_out_min; 179 1.1 riastrad uint32_t pll_out_max; 180 1.1 riastrad uint32_t lcd_pll_out_min; 181 1.1 riastrad uint32_t lcd_pll_out_max; 182 1.1 riastrad uint32_t best_vco; 183 1.1 riastrad 184 1.1 riastrad /* divider limits */ 185 1.1 riastrad uint32_t min_ref_div; 186 1.1 riastrad uint32_t max_ref_div; 187 1.1 riastrad uint32_t min_post_div; 188 1.1 riastrad uint32_t max_post_div; 189 1.1 riastrad uint32_t min_feedback_div; 190 1.1 riastrad uint32_t max_feedback_div; 191 1.1 riastrad uint32_t min_frac_feedback_div; 192 1.1 riastrad uint32_t max_frac_feedback_div; 193 1.1 riastrad 194 1.1 riastrad /* flags for the current clock */ 195 1.1 riastrad uint32_t flags; 196 1.1 riastrad 197 1.1 riastrad /* pll id */ 198 1.1 riastrad uint32_t id; 199 1.1 riastrad }; 200 1.1 riastrad 201 1.1 riastrad struct radeon_i2c_chan { 202 1.1 riastrad struct i2c_adapter adapter; 203 1.1 riastrad struct drm_device *dev; 204 1.1 riastrad struct i2c_algo_bit_data bit; 205 1.1 riastrad struct radeon_i2c_bus_rec rec; 206 1.1 riastrad struct drm_dp_aux aux; 207 1.1 riastrad bool has_aux; 208 1.3 riastrad struct mutex mutex; 209 1.1 riastrad }; 210 1.1 riastrad 211 1.1 riastrad /* mostly for macs, but really any system without connector tables */ 212 1.1 riastrad enum radeon_connector_table { 213 1.1 riastrad CT_NONE = 0, 214 1.1 riastrad CT_GENERIC, 215 1.1 riastrad CT_IBOOK, 216 1.1 riastrad CT_POWERBOOK_EXTERNAL, 217 1.1 riastrad CT_POWERBOOK_INTERNAL, 218 1.1 riastrad CT_POWERBOOK_VGA, 219 1.1 riastrad CT_MINI_EXTERNAL, 220 1.1 riastrad CT_MINI_INTERNAL, 221 1.1 riastrad CT_IMAC_G5_ISIGHT, 222 1.1 riastrad CT_EMAC, 223 1.1 riastrad CT_RN50_POWER, 224 1.1 riastrad CT_MAC_X800, 225 1.1 riastrad CT_MAC_G5_9600, 226 1.1 riastrad CT_SAM440EP, 227 1.1 riastrad CT_MAC_G4_SILVER 228 1.1 riastrad }; 229 1.1 riastrad 230 1.1 riastrad enum radeon_dvo_chip { 231 1.1 riastrad DVO_SIL164, 232 1.1 riastrad DVO_SIL1178, 233 1.1 riastrad }; 234 1.1 riastrad 235 1.1 riastrad struct radeon_fbdev; 236 1.1 riastrad 237 1.1 riastrad struct radeon_afmt { 238 1.1 riastrad bool enabled; 239 1.1 riastrad int offset; 240 1.1 riastrad bool last_buffer_filled_status; 241 1.1 riastrad int id; 242 1.1 riastrad }; 243 1.1 riastrad 244 1.1 riastrad struct radeon_mode_info { 245 1.1 riastrad struct atom_context *atom_context; 246 1.1 riastrad struct card_info *atom_card_info; 247 1.1 riastrad enum radeon_connector_table connector_table; 248 1.1 riastrad bool mode_config_initialized; 249 1.3 riastrad struct radeon_crtc *crtcs[RADEON_MAX_CRTCS]; 250 1.3 riastrad struct radeon_afmt *afmt[RADEON_MAX_AFMT_BLOCKS]; 251 1.1 riastrad /* DVI-I properties */ 252 1.1 riastrad struct drm_property *coherent_mode_property; 253 1.1 riastrad /* DAC enable load detect */ 254 1.1 riastrad struct drm_property *load_detect_property; 255 1.1 riastrad /* TV standard */ 256 1.1 riastrad struct drm_property *tv_std_property; 257 1.1 riastrad /* legacy TMDS PLL detect */ 258 1.1 riastrad struct drm_property *tmds_pll_property; 259 1.1 riastrad /* underscan */ 260 1.1 riastrad struct drm_property *underscan_property; 261 1.1 riastrad struct drm_property *underscan_hborder_property; 262 1.1 riastrad struct drm_property *underscan_vborder_property; 263 1.1 riastrad /* audio */ 264 1.1 riastrad struct drm_property *audio_property; 265 1.1 riastrad /* FMT dithering */ 266 1.1 riastrad struct drm_property *dither_property; 267 1.3 riastrad /* Output CSC */ 268 1.3 riastrad struct drm_property *output_csc_property; 269 1.1 riastrad /* hardcoded DFP edid from BIOS */ 270 1.1 riastrad struct edid *bios_hardcoded_edid; 271 1.1 riastrad int bios_hardcoded_edid_size; 272 1.1 riastrad 273 1.1 riastrad /* pointer to fbdev info structure */ 274 1.1 riastrad struct radeon_fbdev *rfbdev; 275 1.1 riastrad /* firmware flags */ 276 1.1 riastrad u16 firmware_flags; 277 1.1 riastrad /* pointer to backlight encoder */ 278 1.1 riastrad struct radeon_encoder *bl_encoder; 279 1.3 riastrad 280 1.3 riastrad /* bitmask for active encoder frontends */ 281 1.3 riastrad uint32_t active_encoders; 282 1.1 riastrad }; 283 1.1 riastrad 284 1.1 riastrad #define RADEON_MAX_BL_LEVEL 0xFF 285 1.1 riastrad 286 1.1 riastrad #if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) || defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE) 287 1.1 riastrad 288 1.1 riastrad struct radeon_backlight_privdata { 289 1.1 riastrad struct radeon_encoder *encoder; 290 1.1 riastrad uint8_t negative; 291 1.1 riastrad }; 292 1.1 riastrad 293 1.1 riastrad #endif 294 1.1 riastrad 295 1.1 riastrad #define MAX_H_CODE_TIMING_LEN 32 296 1.1 riastrad #define MAX_V_CODE_TIMING_LEN 32 297 1.1 riastrad 298 1.1 riastrad /* need to store these as reading 299 1.1 riastrad back code tables is excessive */ 300 1.1 riastrad struct radeon_tv_regs { 301 1.1 riastrad uint32_t tv_uv_adr; 302 1.1 riastrad uint32_t timing_cntl; 303 1.1 riastrad uint32_t hrestart; 304 1.1 riastrad uint32_t vrestart; 305 1.1 riastrad uint32_t frestart; 306 1.1 riastrad uint16_t h_code_timing[MAX_H_CODE_TIMING_LEN]; 307 1.1 riastrad uint16_t v_code_timing[MAX_V_CODE_TIMING_LEN]; 308 1.1 riastrad }; 309 1.1 riastrad 310 1.1 riastrad struct radeon_atom_ss { 311 1.1 riastrad uint16_t percentage; 312 1.1 riastrad uint16_t percentage_divider; 313 1.1 riastrad uint8_t type; 314 1.1 riastrad uint16_t step; 315 1.1 riastrad uint8_t delay; 316 1.1 riastrad uint8_t range; 317 1.1 riastrad uint8_t refdiv; 318 1.1 riastrad /* asic_ss */ 319 1.1 riastrad uint16_t rate; 320 1.1 riastrad uint16_t amount; 321 1.1 riastrad }; 322 1.1 riastrad 323 1.3 riastrad enum radeon_flip_status { 324 1.3 riastrad RADEON_FLIP_NONE, 325 1.3 riastrad RADEON_FLIP_PENDING, 326 1.3 riastrad RADEON_FLIP_SUBMITTED 327 1.3 riastrad }; 328 1.3 riastrad 329 1.1 riastrad struct radeon_crtc { 330 1.1 riastrad struct drm_crtc base; 331 1.1 riastrad int crtc_id; 332 1.1 riastrad bool enabled; 333 1.1 riastrad bool can_tile; 334 1.3 riastrad bool cursor_out_of_bounds; 335 1.1 riastrad uint32_t crtc_offset; 336 1.1 riastrad struct drm_gem_object *cursor_bo; 337 1.1 riastrad uint64_t cursor_addr; 338 1.3 riastrad int cursor_x; 339 1.3 riastrad int cursor_y; 340 1.3 riastrad int cursor_hot_x; 341 1.3 riastrad int cursor_hot_y; 342 1.1 riastrad int cursor_width; 343 1.1 riastrad int cursor_height; 344 1.1 riastrad int max_cursor_width; 345 1.1 riastrad int max_cursor_height; 346 1.1 riastrad uint32_t legacy_display_base_addr; 347 1.1 riastrad enum radeon_rmx_type rmx_type; 348 1.1 riastrad u8 h_border; 349 1.1 riastrad u8 v_border; 350 1.1 riastrad fixed20_12 vsc; 351 1.1 riastrad fixed20_12 hsc; 352 1.1 riastrad struct drm_display_mode native_mode; 353 1.1 riastrad int pll_id; 354 1.1 riastrad /* page flipping */ 355 1.3 riastrad struct workqueue_struct *flip_queue; 356 1.3 riastrad struct radeon_flip_work *flip_work; 357 1.3 riastrad enum radeon_flip_status flip_status; 358 1.1 riastrad /* pll sharing */ 359 1.1 riastrad struct radeon_atom_ss ss; 360 1.1 riastrad bool ss_enabled; 361 1.1 riastrad u32 adjusted_clock; 362 1.1 riastrad int bpc; 363 1.1 riastrad u32 pll_reference_div; 364 1.1 riastrad u32 pll_post_div; 365 1.1 riastrad u32 pll_flags; 366 1.1 riastrad struct drm_encoder *encoder; 367 1.1 riastrad struct drm_connector *connector; 368 1.1 riastrad /* for dpm */ 369 1.1 riastrad u32 line_time; 370 1.1 riastrad u32 wm_low; 371 1.1 riastrad u32 wm_high; 372 1.3 riastrad u32 lb_vblank_lead_lines; 373 1.1 riastrad struct drm_display_mode hw_mode; 374 1.3 riastrad enum radeon_output_csc output_csc; 375 1.1 riastrad }; 376 1.1 riastrad 377 1.1 riastrad struct radeon_encoder_primary_dac { 378 1.1 riastrad /* legacy primary dac */ 379 1.1 riastrad uint32_t ps2_pdac_adj; 380 1.1 riastrad }; 381 1.1 riastrad 382 1.1 riastrad struct radeon_encoder_lvds { 383 1.1 riastrad /* legacy lvds */ 384 1.1 riastrad uint16_t panel_vcc_delay; 385 1.1 riastrad uint8_t panel_pwr_delay; 386 1.1 riastrad uint8_t panel_digon_delay; 387 1.1 riastrad uint8_t panel_blon_delay; 388 1.1 riastrad uint16_t panel_ref_divider; 389 1.1 riastrad uint8_t panel_post_divider; 390 1.1 riastrad uint16_t panel_fb_divider; 391 1.1 riastrad bool use_bios_dividers; 392 1.1 riastrad uint32_t lvds_gen_cntl; 393 1.1 riastrad /* panel mode */ 394 1.1 riastrad struct drm_display_mode native_mode; 395 1.1 riastrad struct backlight_device *bl_dev; 396 1.1 riastrad int dpms_mode; 397 1.1 riastrad uint8_t backlight_level; 398 1.1 riastrad }; 399 1.1 riastrad 400 1.1 riastrad struct radeon_encoder_tv_dac { 401 1.1 riastrad /* legacy tv dac */ 402 1.1 riastrad uint32_t ps2_tvdac_adj; 403 1.1 riastrad uint32_t ntsc_tvdac_adj; 404 1.1 riastrad uint32_t pal_tvdac_adj; 405 1.1 riastrad 406 1.1 riastrad int h_pos; 407 1.1 riastrad int v_pos; 408 1.1 riastrad int h_size; 409 1.1 riastrad int supported_tv_stds; 410 1.1 riastrad bool tv_on; 411 1.1 riastrad enum radeon_tv_std tv_std; 412 1.1 riastrad struct radeon_tv_regs tv; 413 1.1 riastrad }; 414 1.1 riastrad 415 1.1 riastrad struct radeon_encoder_int_tmds { 416 1.1 riastrad /* legacy int tmds */ 417 1.1 riastrad struct radeon_tmds_pll tmds_pll[4]; 418 1.1 riastrad }; 419 1.1 riastrad 420 1.1 riastrad struct radeon_encoder_ext_tmds { 421 1.1 riastrad /* tmds over dvo */ 422 1.1 riastrad struct radeon_i2c_chan *i2c_bus; 423 1.1 riastrad uint8_t slave_addr; 424 1.1 riastrad enum radeon_dvo_chip dvo_chip; 425 1.1 riastrad }; 426 1.1 riastrad 427 1.1 riastrad /* spread spectrum */ 428 1.1 riastrad struct radeon_encoder_atom_dig { 429 1.1 riastrad bool linkb; 430 1.1 riastrad /* atom dig */ 431 1.1 riastrad bool coherent_mode; 432 1.1 riastrad int dig_encoder; /* -1 disabled, 0 DIGA, 1 DIGB, etc. */ 433 1.1 riastrad /* atom lvds/edp */ 434 1.1 riastrad uint32_t lcd_misc; 435 1.1 riastrad uint16_t panel_pwr_delay; 436 1.1 riastrad uint32_t lcd_ss_id; 437 1.1 riastrad /* panel mode */ 438 1.1 riastrad struct drm_display_mode native_mode; 439 1.1 riastrad struct backlight_device *bl_dev; 440 1.1 riastrad int dpms_mode; 441 1.1 riastrad uint8_t backlight_level; 442 1.1 riastrad int panel_mode; 443 1.1 riastrad struct radeon_afmt *afmt; 444 1.3 riastrad struct r600_audio_pin *pin; 445 1.3 riastrad int active_mst_links; 446 1.1 riastrad }; 447 1.1 riastrad 448 1.1 riastrad struct radeon_encoder_atom_dac { 449 1.1 riastrad enum radeon_tv_std tv_std; 450 1.1 riastrad }; 451 1.1 riastrad 452 1.3 riastrad struct radeon_encoder_mst { 453 1.3 riastrad int crtc; 454 1.3 riastrad struct radeon_encoder *primary; 455 1.3 riastrad struct radeon_connector *connector; 456 1.3 riastrad struct drm_dp_mst_port *port; 457 1.3 riastrad int pbn; 458 1.3 riastrad int fe; 459 1.3 riastrad bool fe_from_be; 460 1.3 riastrad bool enc_active; 461 1.3 riastrad }; 462 1.3 riastrad 463 1.1 riastrad struct radeon_encoder { 464 1.1 riastrad struct drm_encoder base; 465 1.1 riastrad uint32_t encoder_enum; 466 1.1 riastrad uint32_t encoder_id; 467 1.1 riastrad uint32_t devices; 468 1.1 riastrad uint32_t active_device; 469 1.1 riastrad uint32_t flags; 470 1.1 riastrad uint32_t pixel_clock; 471 1.1 riastrad enum radeon_rmx_type rmx_type; 472 1.1 riastrad enum radeon_underscan_type underscan_type; 473 1.1 riastrad uint32_t underscan_hborder; 474 1.1 riastrad uint32_t underscan_vborder; 475 1.1 riastrad struct drm_display_mode native_mode; 476 1.1 riastrad void *enc_priv; 477 1.1 riastrad int audio_polling_active; 478 1.1 riastrad bool is_ext_encoder; 479 1.1 riastrad u16 caps; 480 1.3 riastrad struct radeon_audio_funcs *audio; 481 1.3 riastrad enum radeon_output_csc output_csc; 482 1.3 riastrad bool can_mst; 483 1.3 riastrad uint32_t offset; 484 1.3 riastrad bool is_mst_encoder; 485 1.3 riastrad /* front end for this mst encoder */ 486 1.1 riastrad }; 487 1.1 riastrad 488 1.1 riastrad struct radeon_connector_atom_dig { 489 1.1 riastrad uint32_t igp_lane_info; 490 1.1 riastrad /* displayport */ 491 1.1 riastrad u8 dpcd[DP_RECEIVER_CAP_SIZE]; 492 1.1 riastrad u8 dp_sink_type; 493 1.1 riastrad int dp_clock; 494 1.1 riastrad int dp_lane_count; 495 1.1 riastrad bool edp_on; 496 1.3 riastrad bool is_mst; 497 1.1 riastrad }; 498 1.1 riastrad 499 1.1 riastrad struct radeon_gpio_rec { 500 1.1 riastrad bool valid; 501 1.1 riastrad u8 id; 502 1.1 riastrad u32 reg; 503 1.1 riastrad u32 mask; 504 1.3 riastrad u32 shift; 505 1.1 riastrad }; 506 1.1 riastrad 507 1.1 riastrad struct radeon_hpd { 508 1.1 riastrad enum radeon_hpd_id hpd; 509 1.1 riastrad u8 plugged_state; 510 1.1 riastrad struct radeon_gpio_rec gpio; 511 1.1 riastrad }; 512 1.1 riastrad 513 1.1 riastrad struct radeon_router { 514 1.1 riastrad u32 router_id; 515 1.1 riastrad struct radeon_i2c_bus_rec i2c_info; 516 1.1 riastrad u8 i2c_addr; 517 1.1 riastrad /* i2c mux */ 518 1.1 riastrad bool ddc_valid; 519 1.1 riastrad u8 ddc_mux_type; 520 1.1 riastrad u8 ddc_mux_control_pin; 521 1.1 riastrad u8 ddc_mux_state; 522 1.1 riastrad /* clock/data mux */ 523 1.1 riastrad bool cd_valid; 524 1.1 riastrad u8 cd_mux_type; 525 1.1 riastrad u8 cd_mux_control_pin; 526 1.1 riastrad u8 cd_mux_state; 527 1.1 riastrad }; 528 1.1 riastrad 529 1.1 riastrad enum radeon_connector_audio { 530 1.1 riastrad RADEON_AUDIO_DISABLE = 0, 531 1.1 riastrad RADEON_AUDIO_ENABLE = 1, 532 1.1 riastrad RADEON_AUDIO_AUTO = 2 533 1.1 riastrad }; 534 1.1 riastrad 535 1.1 riastrad enum radeon_connector_dither { 536 1.1 riastrad RADEON_FMT_DITHER_DISABLE = 0, 537 1.1 riastrad RADEON_FMT_DITHER_ENABLE = 1, 538 1.1 riastrad }; 539 1.1 riastrad 540 1.3 riastrad struct stream_attribs { 541 1.3 riastrad uint16_t fe; 542 1.3 riastrad uint16_t slots; 543 1.3 riastrad }; 544 1.3 riastrad 545 1.1 riastrad struct radeon_connector { 546 1.1 riastrad struct drm_connector base; 547 1.1 riastrad uint32_t connector_id; 548 1.1 riastrad uint32_t devices; 549 1.1 riastrad struct radeon_i2c_chan *ddc_bus; 550 1.1 riastrad /* some systems have an hdmi and vga port with a shared ddc line */ 551 1.1 riastrad bool shared_ddc; 552 1.1 riastrad bool use_digital; 553 1.1 riastrad /* we need to mind the EDID between detect 554 1.1 riastrad and get modes due to analog/digital/tvencoder */ 555 1.1 riastrad struct edid *edid; 556 1.1 riastrad void *con_priv; 557 1.1 riastrad bool dac_load_detect; 558 1.1 riastrad bool detected_by_load; /* if the connection status was determined by load */ 559 1.3 riastrad bool detected_hpd_without_ddc; /* if an HPD signal was detected on DVI, but ddc probing failed */ 560 1.1 riastrad uint16_t connector_object_id; 561 1.1 riastrad struct radeon_hpd hpd; 562 1.1 riastrad struct radeon_router router; 563 1.1 riastrad struct radeon_i2c_chan *router_bus; 564 1.1 riastrad enum radeon_connector_audio audio; 565 1.1 riastrad enum radeon_connector_dither dither; 566 1.3 riastrad int pixelclock_for_modeset; 567 1.3 riastrad bool is_mst_connector; 568 1.3 riastrad struct radeon_connector *mst_port; 569 1.3 riastrad struct drm_dp_mst_port *port; 570 1.3 riastrad struct drm_dp_mst_topology_mgr mst_mgr; 571 1.3 riastrad 572 1.3 riastrad struct radeon_encoder *mst_encoder; 573 1.3 riastrad struct stream_attribs cur_stream_attribs[6]; 574 1.3 riastrad int enabled_attribs; 575 1.1 riastrad }; 576 1.1 riastrad 577 1.1 riastrad #define ENCODER_MODE_IS_DP(em) (((em) == ATOM_ENCODER_MODE_DP) || \ 578 1.1 riastrad ((em) == ATOM_ENCODER_MODE_DP_MST)) 579 1.1 riastrad 580 1.1 riastrad struct atom_clock_dividers { 581 1.1 riastrad u32 post_div; 582 1.1 riastrad union { 583 1.1 riastrad struct { 584 1.1 riastrad #ifdef __BIG_ENDIAN 585 1.1 riastrad u32 reserved : 6; 586 1.1 riastrad u32 whole_fb_div : 12; 587 1.1 riastrad u32 frac_fb_div : 14; 588 1.1 riastrad #else 589 1.1 riastrad u32 frac_fb_div : 14; 590 1.1 riastrad u32 whole_fb_div : 12; 591 1.1 riastrad u32 reserved : 6; 592 1.1 riastrad #endif 593 1.1 riastrad }; 594 1.1 riastrad u32 fb_div; 595 1.1 riastrad }; 596 1.1 riastrad u32 ref_div; 597 1.1 riastrad bool enable_post_div; 598 1.1 riastrad bool enable_dithen; 599 1.1 riastrad u32 vco_mode; 600 1.1 riastrad u32 real_clock; 601 1.1 riastrad /* added for CI */ 602 1.1 riastrad u32 post_divider; 603 1.1 riastrad u32 flags; 604 1.1 riastrad }; 605 1.1 riastrad 606 1.1 riastrad struct atom_mpll_param { 607 1.1 riastrad union { 608 1.1 riastrad struct { 609 1.1 riastrad #ifdef __BIG_ENDIAN 610 1.1 riastrad u32 reserved : 8; 611 1.1 riastrad u32 clkfrac : 12; 612 1.1 riastrad u32 clkf : 12; 613 1.1 riastrad #else 614 1.1 riastrad u32 clkf : 12; 615 1.1 riastrad u32 clkfrac : 12; 616 1.1 riastrad u32 reserved : 8; 617 1.1 riastrad #endif 618 1.1 riastrad }; 619 1.1 riastrad u32 fb_div; 620 1.1 riastrad }; 621 1.1 riastrad u32 post_div; 622 1.1 riastrad u32 bwcntl; 623 1.1 riastrad u32 dll_speed; 624 1.1 riastrad u32 vco_mode; 625 1.1 riastrad u32 yclk_sel; 626 1.1 riastrad u32 qdr; 627 1.1 riastrad u32 half_rate; 628 1.1 riastrad }; 629 1.1 riastrad 630 1.1 riastrad #define MEM_TYPE_GDDR5 0x50 631 1.1 riastrad #define MEM_TYPE_GDDR4 0x40 632 1.1 riastrad #define MEM_TYPE_GDDR3 0x30 633 1.1 riastrad #define MEM_TYPE_DDR2 0x20 634 1.1 riastrad #define MEM_TYPE_GDDR1 0x10 635 1.1 riastrad #define MEM_TYPE_DDR3 0xb0 636 1.1 riastrad #define MEM_TYPE_MASK 0xf0 637 1.1 riastrad 638 1.1 riastrad struct atom_memory_info { 639 1.1 riastrad u8 mem_vendor; 640 1.1 riastrad u8 mem_type; 641 1.1 riastrad }; 642 1.1 riastrad 643 1.1 riastrad #define MAX_AC_TIMING_ENTRIES 16 644 1.1 riastrad 645 1.1 riastrad struct atom_memory_clock_range_table 646 1.1 riastrad { 647 1.1 riastrad u8 num_entries; 648 1.1 riastrad u8 rsv[3]; 649 1.1 riastrad u32 mclk[MAX_AC_TIMING_ENTRIES]; 650 1.1 riastrad }; 651 1.1 riastrad 652 1.1 riastrad #define VBIOS_MC_REGISTER_ARRAY_SIZE 32 653 1.1 riastrad #define VBIOS_MAX_AC_TIMING_ENTRIES 20 654 1.1 riastrad 655 1.1 riastrad struct atom_mc_reg_entry { 656 1.1 riastrad u32 mclk_max; 657 1.1 riastrad u32 mc_data[VBIOS_MC_REGISTER_ARRAY_SIZE]; 658 1.1 riastrad }; 659 1.1 riastrad 660 1.1 riastrad struct atom_mc_register_address { 661 1.1 riastrad u16 s1; 662 1.1 riastrad u8 pre_reg_data; 663 1.1 riastrad }; 664 1.1 riastrad 665 1.1 riastrad struct atom_mc_reg_table { 666 1.1 riastrad u8 last; 667 1.1 riastrad u8 num_entries; 668 1.1 riastrad struct atom_mc_reg_entry mc_reg_table_entry[VBIOS_MAX_AC_TIMING_ENTRIES]; 669 1.1 riastrad struct atom_mc_register_address mc_reg_address[VBIOS_MC_REGISTER_ARRAY_SIZE]; 670 1.1 riastrad }; 671 1.1 riastrad 672 1.1 riastrad #define MAX_VOLTAGE_ENTRIES 32 673 1.1 riastrad 674 1.1 riastrad struct atom_voltage_table_entry 675 1.1 riastrad { 676 1.1 riastrad u16 value; 677 1.1 riastrad u32 smio_low; 678 1.1 riastrad }; 679 1.1 riastrad 680 1.1 riastrad struct atom_voltage_table 681 1.1 riastrad { 682 1.1 riastrad u32 count; 683 1.1 riastrad u32 mask_low; 684 1.1 riastrad u32 phase_delay; 685 1.1 riastrad struct atom_voltage_table_entry entries[MAX_VOLTAGE_ENTRIES]; 686 1.1 riastrad }; 687 1.1 riastrad 688 1.3 riastrad /* Driver internal use only flags of radeon_get_crtc_scanoutpos() */ 689 1.6 riastrad #define DRM_SCANOUTPOS_VALID (1 << 0) 690 1.6 riastrad #define DRM_SCANOUTPOS_IN_VBLANK (1 << 1) 691 1.6 riastrad #define DRM_SCANOUTPOS_ACCURATE (1 << 2) 692 1.3 riastrad #define USE_REAL_VBLANKSTART (1 << 30) 693 1.5 msaitoh #define GET_DISTANCE_TO_VBLANKSTART (1U << 31) 694 1.1 riastrad 695 1.1 riastrad extern void 696 1.1 riastrad radeon_add_atom_connector(struct drm_device *dev, 697 1.1 riastrad uint32_t connector_id, 698 1.1 riastrad uint32_t supported_device, 699 1.1 riastrad int connector_type, 700 1.1 riastrad struct radeon_i2c_bus_rec *i2c_bus, 701 1.1 riastrad uint32_t igp_lane_info, 702 1.1 riastrad uint16_t connector_object_id, 703 1.1 riastrad struct radeon_hpd *hpd, 704 1.1 riastrad struct radeon_router *router); 705 1.1 riastrad extern void 706 1.1 riastrad radeon_add_legacy_connector(struct drm_device *dev, 707 1.1 riastrad uint32_t connector_id, 708 1.1 riastrad uint32_t supported_device, 709 1.1 riastrad int connector_type, 710 1.1 riastrad struct radeon_i2c_bus_rec *i2c_bus, 711 1.1 riastrad uint16_t connector_object_id, 712 1.1 riastrad struct radeon_hpd *hpd); 713 1.1 riastrad extern uint32_t 714 1.1 riastrad radeon_get_encoder_enum(struct drm_device *dev, uint32_t supported_device, 715 1.1 riastrad uint8_t dac); 716 1.1 riastrad extern void radeon_link_encoder_connector(struct drm_device *dev); 717 1.1 riastrad 718 1.1 riastrad extern enum radeon_tv_std 719 1.1 riastrad radeon_combios_get_tv_info(struct radeon_device *rdev); 720 1.1 riastrad extern enum radeon_tv_std 721 1.1 riastrad radeon_atombios_get_tv_info(struct radeon_device *rdev); 722 1.1 riastrad extern void radeon_atombios_get_default_voltages(struct radeon_device *rdev, 723 1.1 riastrad u16 *vddc, u16 *vddci, u16 *mvdd); 724 1.1 riastrad 725 1.1 riastrad extern void 726 1.1 riastrad radeon_combios_connected_scratch_regs(struct drm_connector *connector, 727 1.1 riastrad struct drm_encoder *encoder, 728 1.1 riastrad bool connected); 729 1.1 riastrad extern void 730 1.1 riastrad radeon_atombios_connected_scratch_regs(struct drm_connector *connector, 731 1.1 riastrad struct drm_encoder *encoder, 732 1.1 riastrad bool connected); 733 1.1 riastrad 734 1.1 riastrad extern struct drm_connector * 735 1.1 riastrad radeon_get_connector_for_encoder(struct drm_encoder *encoder); 736 1.1 riastrad extern struct drm_connector * 737 1.1 riastrad radeon_get_connector_for_encoder_init(struct drm_encoder *encoder); 738 1.1 riastrad extern bool radeon_dig_monitor_is_duallink(struct drm_encoder *encoder, 739 1.1 riastrad u32 pixel_clock); 740 1.1 riastrad 741 1.1 riastrad extern u16 radeon_encoder_get_dp_bridge_encoder_id(struct drm_encoder *encoder); 742 1.1 riastrad extern u16 radeon_connector_encoder_get_dp_bridge_encoder_id(struct drm_connector *connector); 743 1.1 riastrad extern bool radeon_connector_is_dp12_capable(struct drm_connector *connector); 744 1.1 riastrad extern int radeon_get_monitor_bpc(struct drm_connector *connector); 745 1.1 riastrad 746 1.3 riastrad extern struct edid *radeon_connector_edid(struct drm_connector *connector); 747 1.3 riastrad 748 1.1 riastrad extern void radeon_connector_hotplug(struct drm_connector *connector); 749 1.1 riastrad extern int radeon_dp_mode_valid_helper(struct drm_connector *connector, 750 1.1 riastrad struct drm_display_mode *mode); 751 1.1 riastrad extern void radeon_dp_set_link_config(struct drm_connector *connector, 752 1.1 riastrad const struct drm_display_mode *mode); 753 1.1 riastrad extern void radeon_dp_link_train(struct drm_encoder *encoder, 754 1.1 riastrad struct drm_connector *connector); 755 1.1 riastrad extern bool radeon_dp_needs_link_train(struct radeon_connector *radeon_connector); 756 1.1 riastrad extern u8 radeon_dp_getsinktype(struct radeon_connector *radeon_connector); 757 1.1 riastrad extern bool radeon_dp_getdpcd(struct radeon_connector *radeon_connector); 758 1.1 riastrad extern int radeon_dp_get_panel_mode(struct drm_encoder *encoder, 759 1.1 riastrad struct drm_connector *connector); 760 1.1 riastrad extern void radeon_dp_set_rx_power_state(struct drm_connector *connector, 761 1.1 riastrad u8 power_state); 762 1.1 riastrad extern void radeon_dp_aux_init(struct radeon_connector *radeon_connector); 763 1.3 riastrad extern ssize_t 764 1.3 riastrad radeon_dp_aux_transfer_native(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg); 765 1.3 riastrad 766 1.1 riastrad extern void atombios_dig_encoder_setup(struct drm_encoder *encoder, int action, int panel_mode); 767 1.3 riastrad extern void atombios_dig_encoder_setup2(struct drm_encoder *encoder, int action, int panel_mode, int enc_override); 768 1.1 riastrad extern void radeon_atom_encoder_init(struct radeon_device *rdev); 769 1.1 riastrad extern void radeon_atom_disp_eng_pll_init(struct radeon_device *rdev); 770 1.1 riastrad extern void atombios_dig_transmitter_setup(struct drm_encoder *encoder, 771 1.1 riastrad int action, uint8_t lane_num, 772 1.1 riastrad uint8_t lane_set); 773 1.3 riastrad extern void atombios_dig_transmitter_setup2(struct drm_encoder *encoder, 774 1.3 riastrad int action, uint8_t lane_num, 775 1.3 riastrad uint8_t lane_set, int fe); 776 1.3 riastrad extern void atombios_set_mst_encoder_crtc_source(struct drm_encoder *encoder, 777 1.3 riastrad int fe); 778 1.1 riastrad extern void radeon_atom_ext_encoder_setup_ddc(struct drm_encoder *encoder); 779 1.1 riastrad extern struct drm_encoder *radeon_get_external_encoder(struct drm_encoder *encoder); 780 1.1 riastrad void radeon_atom_copy_swap(u8 *dst, u8 *src, u8 num_bytes, bool to_le); 781 1.1 riastrad 782 1.1 riastrad extern void radeon_i2c_init(struct radeon_device *rdev); 783 1.1 riastrad extern void radeon_i2c_fini(struct radeon_device *rdev); 784 1.1 riastrad extern void radeon_combios_i2c_init(struct radeon_device *rdev); 785 1.1 riastrad extern void radeon_atombios_i2c_init(struct radeon_device *rdev); 786 1.1 riastrad extern void radeon_i2c_add(struct radeon_device *rdev, 787 1.1 riastrad struct radeon_i2c_bus_rec *rec, 788 1.1 riastrad const char *name); 789 1.1 riastrad extern struct radeon_i2c_chan *radeon_i2c_lookup(struct radeon_device *rdev, 790 1.1 riastrad struct radeon_i2c_bus_rec *i2c_bus); 791 1.1 riastrad extern struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev, 792 1.1 riastrad struct radeon_i2c_bus_rec *rec, 793 1.1 riastrad const char *name); 794 1.1 riastrad extern void radeon_i2c_destroy(struct radeon_i2c_chan *i2c); 795 1.1 riastrad extern void radeon_i2c_get_byte(struct radeon_i2c_chan *i2c_bus, 796 1.1 riastrad u8 slave_addr, 797 1.1 riastrad u8 addr, 798 1.1 riastrad u8 *val); 799 1.1 riastrad extern void radeon_i2c_put_byte(struct radeon_i2c_chan *i2c, 800 1.1 riastrad u8 slave_addr, 801 1.1 riastrad u8 addr, 802 1.1 riastrad u8 val); 803 1.1 riastrad extern void radeon_router_select_ddc_port(struct radeon_connector *radeon_connector); 804 1.1 riastrad extern void radeon_router_select_cd_port(struct radeon_connector *radeon_connector); 805 1.1 riastrad extern bool radeon_ddc_probe(struct radeon_connector *radeon_connector, bool use_aux); 806 1.1 riastrad 807 1.1 riastrad extern bool radeon_atombios_get_ppll_ss_info(struct radeon_device *rdev, 808 1.1 riastrad struct radeon_atom_ss *ss, 809 1.1 riastrad int id); 810 1.1 riastrad extern bool radeon_atombios_get_asic_ss_info(struct radeon_device *rdev, 811 1.1 riastrad struct radeon_atom_ss *ss, 812 1.1 riastrad int id, u32 clock); 813 1.3 riastrad extern struct radeon_gpio_rec radeon_atombios_lookup_gpio(struct radeon_device *rdev, 814 1.3 riastrad u8 id); 815 1.1 riastrad 816 1.1 riastrad extern void radeon_compute_pll_legacy(struct radeon_pll *pll, 817 1.1 riastrad uint64_t freq, 818 1.1 riastrad uint32_t *dot_clock_p, 819 1.1 riastrad uint32_t *fb_div_p, 820 1.1 riastrad uint32_t *frac_fb_div_p, 821 1.1 riastrad uint32_t *ref_div_p, 822 1.1 riastrad uint32_t *post_div_p); 823 1.1 riastrad 824 1.1 riastrad extern void radeon_compute_pll_avivo(struct radeon_pll *pll, 825 1.1 riastrad u32 freq, 826 1.1 riastrad u32 *dot_clock_p, 827 1.1 riastrad u32 *fb_div_p, 828 1.1 riastrad u32 *frac_fb_div_p, 829 1.1 riastrad u32 *ref_div_p, 830 1.1 riastrad u32 *post_div_p); 831 1.1 riastrad 832 1.1 riastrad extern void radeon_setup_encoder_clones(struct drm_device *dev); 833 1.1 riastrad 834 1.1 riastrad struct drm_encoder *radeon_encoder_legacy_lvds_add(struct drm_device *dev, int bios_index); 835 1.1 riastrad struct drm_encoder *radeon_encoder_legacy_primary_dac_add(struct drm_device *dev, int bios_index, int with_tv); 836 1.1 riastrad struct drm_encoder *radeon_encoder_legacy_tv_dac_add(struct drm_device *dev, int bios_index, int with_tv); 837 1.1 riastrad struct drm_encoder *radeon_encoder_legacy_tmds_int_add(struct drm_device *dev, int bios_index); 838 1.1 riastrad struct drm_encoder *radeon_encoder_legacy_tmds_ext_add(struct drm_device *dev, int bios_index); 839 1.1 riastrad extern void atombios_dvo_setup(struct drm_encoder *encoder, int action); 840 1.1 riastrad extern void atombios_digital_setup(struct drm_encoder *encoder, int action); 841 1.1 riastrad extern int atombios_get_encoder_mode(struct drm_encoder *encoder); 842 1.1 riastrad extern bool atombios_set_edp_panel_power(struct drm_connector *connector, int action); 843 1.1 riastrad extern void radeon_encoder_set_active_device(struct drm_encoder *encoder); 844 1.3 riastrad extern bool radeon_encoder_is_digital(struct drm_encoder *encoder); 845 1.1 riastrad 846 1.1 riastrad extern void radeon_crtc_load_lut(struct drm_crtc *crtc); 847 1.1 riastrad extern int atombios_crtc_set_base(struct drm_crtc *crtc, int x, int y, 848 1.1 riastrad struct drm_framebuffer *old_fb); 849 1.1 riastrad extern int atombios_crtc_set_base_atomic(struct drm_crtc *crtc, 850 1.1 riastrad struct drm_framebuffer *fb, 851 1.1 riastrad int x, int y, 852 1.1 riastrad enum mode_set_atomic state); 853 1.1 riastrad extern int atombios_crtc_mode_set(struct drm_crtc *crtc, 854 1.1 riastrad struct drm_display_mode *mode, 855 1.1 riastrad struct drm_display_mode *adjusted_mode, 856 1.1 riastrad int x, int y, 857 1.1 riastrad struct drm_framebuffer *old_fb); 858 1.1 riastrad extern void atombios_crtc_dpms(struct drm_crtc *crtc, int mode); 859 1.1 riastrad 860 1.1 riastrad extern int radeon_crtc_set_base(struct drm_crtc *crtc, int x, int y, 861 1.1 riastrad struct drm_framebuffer *old_fb); 862 1.1 riastrad extern int radeon_crtc_set_base_atomic(struct drm_crtc *crtc, 863 1.1 riastrad struct drm_framebuffer *fb, 864 1.1 riastrad int x, int y, 865 1.1 riastrad enum mode_set_atomic state); 866 1.1 riastrad extern int radeon_crtc_do_set_base(struct drm_crtc *crtc, 867 1.1 riastrad struct drm_framebuffer *fb, 868 1.1 riastrad int x, int y, int atomic); 869 1.3 riastrad extern int radeon_crtc_cursor_set2(struct drm_crtc *crtc, 870 1.3 riastrad struct drm_file *file_priv, 871 1.3 riastrad uint32_t handle, 872 1.3 riastrad uint32_t width, 873 1.3 riastrad uint32_t height, 874 1.3 riastrad int32_t hot_x, 875 1.3 riastrad int32_t hot_y); 876 1.1 riastrad extern int radeon_crtc_cursor_move(struct drm_crtc *crtc, 877 1.1 riastrad int x, int y); 878 1.3 riastrad extern void radeon_cursor_reset(struct drm_crtc *crtc); 879 1.1 riastrad 880 1.3 riastrad extern int radeon_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe, 881 1.3 riastrad unsigned int flags, int *vpos, int *hpos, 882 1.3 riastrad ktime_t *stime, ktime_t *etime, 883 1.3 riastrad const struct drm_display_mode *mode); 884 1.1 riastrad 885 1.1 riastrad extern bool radeon_combios_check_hardcoded_edid(struct radeon_device *rdev); 886 1.1 riastrad extern struct edid * 887 1.1 riastrad radeon_bios_get_hardcoded_edid(struct radeon_device *rdev); 888 1.1 riastrad extern bool radeon_atom_get_clock_info(struct drm_device *dev); 889 1.1 riastrad extern bool radeon_combios_get_clock_info(struct drm_device *dev); 890 1.1 riastrad extern struct radeon_encoder_atom_dig * 891 1.1 riastrad radeon_atombios_get_lvds_info(struct radeon_encoder *encoder); 892 1.1 riastrad extern bool radeon_atombios_get_tmds_info(struct radeon_encoder *encoder, 893 1.1 riastrad struct radeon_encoder_int_tmds *tmds); 894 1.1 riastrad extern bool radeon_legacy_get_tmds_info_from_combios(struct radeon_encoder *encoder, 895 1.1 riastrad struct radeon_encoder_int_tmds *tmds); 896 1.1 riastrad extern bool radeon_legacy_get_tmds_info_from_table(struct radeon_encoder *encoder, 897 1.1 riastrad struct radeon_encoder_int_tmds *tmds); 898 1.1 riastrad extern bool radeon_legacy_get_ext_tmds_info_from_combios(struct radeon_encoder *encoder, 899 1.1 riastrad struct radeon_encoder_ext_tmds *tmds); 900 1.1 riastrad extern bool radeon_legacy_get_ext_tmds_info_from_table(struct radeon_encoder *encoder, 901 1.1 riastrad struct radeon_encoder_ext_tmds *tmds); 902 1.1 riastrad extern struct radeon_encoder_primary_dac * 903 1.1 riastrad radeon_atombios_get_primary_dac_info(struct radeon_encoder *encoder); 904 1.1 riastrad extern struct radeon_encoder_tv_dac * 905 1.1 riastrad radeon_atombios_get_tv_dac_info(struct radeon_encoder *encoder); 906 1.1 riastrad extern struct radeon_encoder_lvds * 907 1.1 riastrad radeon_combios_get_lvds_info(struct radeon_encoder *encoder); 908 1.1 riastrad extern void radeon_combios_get_ext_tmds_info(struct radeon_encoder *encoder); 909 1.1 riastrad extern struct radeon_encoder_tv_dac * 910 1.1 riastrad radeon_combios_get_tv_dac_info(struct radeon_encoder *encoder); 911 1.1 riastrad extern struct radeon_encoder_primary_dac * 912 1.1 riastrad radeon_combios_get_primary_dac_info(struct radeon_encoder *encoder); 913 1.1 riastrad extern bool radeon_combios_external_tmds_setup(struct drm_encoder *encoder); 914 1.1 riastrad extern void radeon_external_tmds_setup(struct drm_encoder *encoder); 915 1.1 riastrad extern void radeon_combios_output_lock(struct drm_encoder *encoder, bool lock); 916 1.1 riastrad extern void radeon_combios_initialize_bios_scratch_regs(struct drm_device *dev); 917 1.1 riastrad extern void radeon_atom_output_lock(struct drm_encoder *encoder, bool lock); 918 1.1 riastrad extern void radeon_atom_initialize_bios_scratch_regs(struct drm_device *dev); 919 1.1 riastrad extern void radeon_save_bios_scratch_regs(struct radeon_device *rdev); 920 1.1 riastrad extern void radeon_restore_bios_scratch_regs(struct radeon_device *rdev); 921 1.1 riastrad extern void 922 1.1 riastrad radeon_atombios_encoder_crtc_scratch_regs(struct drm_encoder *encoder, int crtc); 923 1.1 riastrad extern void 924 1.1 riastrad radeon_atombios_encoder_dpms_scratch_regs(struct drm_encoder *encoder, bool on); 925 1.1 riastrad extern void 926 1.1 riastrad radeon_combios_encoder_crtc_scratch_regs(struct drm_encoder *encoder, int crtc); 927 1.1 riastrad extern void 928 1.1 riastrad radeon_combios_encoder_dpms_scratch_regs(struct drm_encoder *encoder, bool on); 929 1.1 riastrad int radeon_framebuffer_init(struct drm_device *dev, 930 1.6 riastrad struct drm_framebuffer *rfb, 931 1.6 riastrad const struct drm_mode_fb_cmd2 *mode_cmd, 932 1.1 riastrad struct drm_gem_object *obj); 933 1.1 riastrad 934 1.1 riastrad int radeonfb_remove(struct drm_device *dev, struct drm_framebuffer *fb); 935 1.1 riastrad bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev); 936 1.1 riastrad bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev); 937 1.1 riastrad void radeon_atombios_init_crtc(struct drm_device *dev, 938 1.1 riastrad struct radeon_crtc *radeon_crtc); 939 1.1 riastrad void radeon_legacy_init_crtc(struct drm_device *dev, 940 1.1 riastrad struct radeon_crtc *radeon_crtc); 941 1.1 riastrad 942 1.1 riastrad void radeon_get_clock_info(struct drm_device *dev); 943 1.1 riastrad 944 1.1 riastrad extern bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev); 945 1.1 riastrad extern bool radeon_get_atom_connector_info_from_supported_devices_table(struct drm_device *dev); 946 1.1 riastrad 947 1.1 riastrad void radeon_enc_destroy(struct drm_encoder *encoder); 948 1.1 riastrad void radeon_copy_fb(struct drm_device *dev, struct drm_gem_object *dst_obj); 949 1.1 riastrad void radeon_combios_asic_init(struct drm_device *dev); 950 1.1 riastrad bool radeon_crtc_scaling_mode_fixup(struct drm_crtc *crtc, 951 1.1 riastrad const struct drm_display_mode *mode, 952 1.1 riastrad struct drm_display_mode *adjusted_mode); 953 1.1 riastrad void radeon_panel_mode_fixup(struct drm_encoder *encoder, 954 1.1 riastrad struct drm_display_mode *adjusted_mode); 955 1.1 riastrad void atom_rv515_force_tv_scaler(struct radeon_device *rdev, struct radeon_crtc *radeon_crtc); 956 1.1 riastrad 957 1.1 riastrad /* legacy tv */ 958 1.1 riastrad void radeon_legacy_tv_adjust_crtc_reg(struct drm_encoder *encoder, 959 1.1 riastrad uint32_t *h_total_disp, uint32_t *h_sync_strt_wid, 960 1.1 riastrad uint32_t *v_total_disp, uint32_t *v_sync_strt_wid); 961 1.1 riastrad void radeon_legacy_tv_adjust_pll1(struct drm_encoder *encoder, 962 1.1 riastrad uint32_t *htotal_cntl, uint32_t *ppll_ref_div, 963 1.1 riastrad uint32_t *ppll_div_3, uint32_t *pixclks_cntl); 964 1.1 riastrad void radeon_legacy_tv_adjust_pll2(struct drm_encoder *encoder, 965 1.1 riastrad uint32_t *htotal2_cntl, uint32_t *p2pll_ref_div, 966 1.1 riastrad uint32_t *p2pll_div_0, uint32_t *pixclks_cntl); 967 1.1 riastrad void radeon_legacy_tv_mode_set(struct drm_encoder *encoder, 968 1.1 riastrad struct drm_display_mode *mode, 969 1.1 riastrad struct drm_display_mode *adjusted_mode); 970 1.1 riastrad 971 1.1 riastrad /* fmt blocks */ 972 1.1 riastrad void avivo_program_fmt(struct drm_encoder *encoder); 973 1.1 riastrad void dce3_program_fmt(struct drm_encoder *encoder); 974 1.1 riastrad void dce4_program_fmt(struct drm_encoder *encoder); 975 1.1 riastrad void dce8_program_fmt(struct drm_encoder *encoder); 976 1.1 riastrad 977 1.1 riastrad /* fbdev layer */ 978 1.1 riastrad int radeon_fbdev_init(struct radeon_device *rdev); 979 1.1 riastrad void radeon_fbdev_fini(struct radeon_device *rdev); 980 1.1 riastrad void radeon_fbdev_set_suspend(struct radeon_device *rdev, int state); 981 1.1 riastrad bool radeon_fbdev_robj_is_fb(struct radeon_device *rdev, struct radeon_bo *robj); 982 1.1 riastrad 983 1.3 riastrad void radeon_crtc_handle_vblank(struct radeon_device *rdev, int crtc_id); 984 1.3 riastrad 985 1.3 riastrad void radeon_fb_add_connector(struct radeon_device *rdev, struct drm_connector *connector); 986 1.3 riastrad void radeon_fb_remove_connector(struct radeon_device *rdev, struct drm_connector *connector); 987 1.3 riastrad 988 1.1 riastrad void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id); 989 1.1 riastrad 990 1.1 riastrad int radeon_align_pitch(struct radeon_device *rdev, int width, int bpp, bool tiled); 991 1.2 riastrad 992 1.3 riastrad /* mst */ 993 1.3 riastrad int radeon_dp_mst_init(struct radeon_connector *radeon_connector); 994 1.3 riastrad int radeon_dp_mst_probe(struct radeon_connector *radeon_connector); 995 1.3 riastrad int radeon_dp_mst_check_status(struct radeon_connector *radeon_connector); 996 1.3 riastrad int radeon_mst_debugfs_init(struct radeon_device *rdev); 997 1.3 riastrad void radeon_dp_mst_prepare_pll(struct drm_crtc *crtc, struct drm_display_mode *mode); 998 1.3 riastrad 999 1.3 riastrad void radeon_setup_mst_connector(struct drm_device *dev); 1000 1.3 riastrad 1001 1.3 riastrad int radeon_atom_pick_dig_encoder(struct drm_encoder *encoder, int fe_idx); 1002 1.3 riastrad void radeon_atom_release_dig_encoder(struct radeon_device *rdev, int enc_idx); 1003 1.1 riastrad #endif 1004