diff options
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_mode.h')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_mode.h | 149 |
1 files changed, 129 insertions, 20 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index ace726aa0d76..44d4b652ea12 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <drm_crtc.h> | 33 | #include <drm_crtc.h> |
34 | #include <drm_mode.h> | 34 | #include <drm_mode.h> |
35 | #include <drm_edid.h> | 35 | #include <drm_edid.h> |
36 | #include <drm_dp_helper.h> | ||
36 | #include <linux/i2c.h> | 37 | #include <linux/i2c.h> |
37 | #include <linux/i2c-id.h> | 38 | #include <linux/i2c-id.h> |
38 | #include <linux/i2c-algo-bit.h> | 39 | #include <linux/i2c-algo-bit.h> |
@@ -89,24 +90,45 @@ enum radeon_tv_std { | |||
89 | TV_STD_PAL_CN, | 90 | TV_STD_PAL_CN, |
90 | }; | 91 | }; |
91 | 92 | ||
93 | /* radeon gpio-based i2c | ||
94 | * 1. "mask" reg and bits | ||
95 | * grabs the gpio pins for software use | ||
96 | * 0=not held 1=held | ||
97 | * 2. "a" reg and bits | ||
98 | * output pin value | ||
99 | * 0=low 1=high | ||
100 | * 3. "en" reg and bits | ||
101 | * sets the pin direction | ||
102 | * 0=input 1=output | ||
103 | * 4. "y" reg and bits | ||
104 | * input pin value | ||
105 | * 0=low 1=high | ||
106 | */ | ||
92 | struct radeon_i2c_bus_rec { | 107 | struct radeon_i2c_bus_rec { |
93 | bool valid; | 108 | bool valid; |
109 | /* id used by atom */ | ||
110 | uint8_t i2c_id; | ||
111 | /* can be used with hw i2c engine */ | ||
112 | bool hw_capable; | ||
113 | /* uses multi-media i2c engine */ | ||
114 | bool mm_i2c; | ||
115 | /* regs and bits */ | ||
94 | uint32_t mask_clk_reg; | 116 | uint32_t mask_clk_reg; |
95 | uint32_t mask_data_reg; | 117 | uint32_t mask_data_reg; |
96 | uint32_t a_clk_reg; | 118 | uint32_t a_clk_reg; |
97 | uint32_t a_data_reg; | 119 | uint32_t a_data_reg; |
98 | uint32_t put_clk_reg; | 120 | uint32_t en_clk_reg; |
99 | uint32_t put_data_reg; | 121 | uint32_t en_data_reg; |
100 | uint32_t get_clk_reg; | 122 | uint32_t y_clk_reg; |
101 | uint32_t get_data_reg; | 123 | uint32_t y_data_reg; |
102 | uint32_t mask_clk_mask; | 124 | uint32_t mask_clk_mask; |
103 | uint32_t mask_data_mask; | 125 | uint32_t mask_data_mask; |
104 | uint32_t put_clk_mask; | ||
105 | uint32_t put_data_mask; | ||
106 | uint32_t get_clk_mask; | ||
107 | uint32_t get_data_mask; | ||
108 | uint32_t a_clk_mask; | 126 | uint32_t a_clk_mask; |
109 | uint32_t a_data_mask; | 127 | uint32_t a_data_mask; |
128 | uint32_t en_clk_mask; | ||
129 | uint32_t en_data_mask; | ||
130 | uint32_t y_clk_mask; | ||
131 | uint32_t y_data_mask; | ||
110 | }; | 132 | }; |
111 | 133 | ||
112 | struct radeon_tmds_pll { | 134 | struct radeon_tmds_pll { |
@@ -150,9 +172,12 @@ struct radeon_pll { | |||
150 | }; | 172 | }; |
151 | 173 | ||
152 | struct radeon_i2c_chan { | 174 | struct radeon_i2c_chan { |
153 | struct drm_device *dev; | ||
154 | struct i2c_adapter adapter; | 175 | struct i2c_adapter adapter; |
155 | struct i2c_algo_bit_data algo; | 176 | struct drm_device *dev; |
177 | union { | ||
178 | struct i2c_algo_dp_aux_data dp; | ||
179 | struct i2c_algo_bit_data bit; | ||
180 | } algo; | ||
156 | struct radeon_i2c_bus_rec rec; | 181 | struct radeon_i2c_bus_rec rec; |
157 | }; | 182 | }; |
158 | 183 | ||
@@ -170,6 +195,11 @@ enum radeon_connector_table { | |||
170 | CT_EMAC, | 195 | CT_EMAC, |
171 | }; | 196 | }; |
172 | 197 | ||
198 | enum radeon_dvo_chip { | ||
199 | DVO_SIL164, | ||
200 | DVO_SIL1178, | ||
201 | }; | ||
202 | |||
173 | struct radeon_mode_info { | 203 | struct radeon_mode_info { |
174 | struct atom_context *atom_context; | 204 | struct atom_context *atom_context; |
175 | struct card_info *atom_card_info; | 205 | struct card_info *atom_card_info; |
@@ -261,6 +291,13 @@ struct radeon_encoder_int_tmds { | |||
261 | struct radeon_tmds_pll tmds_pll[4]; | 291 | struct radeon_tmds_pll tmds_pll[4]; |
262 | }; | 292 | }; |
263 | 293 | ||
294 | struct radeon_encoder_ext_tmds { | ||
295 | /* tmds over dvo */ | ||
296 | struct radeon_i2c_chan *i2c_bus; | ||
297 | uint8_t slave_addr; | ||
298 | enum radeon_dvo_chip dvo_chip; | ||
299 | }; | ||
300 | |||
264 | /* spread spectrum */ | 301 | /* spread spectrum */ |
265 | struct radeon_atom_ss { | 302 | struct radeon_atom_ss { |
266 | uint16_t percentage; | 303 | uint16_t percentage; |
@@ -302,6 +339,35 @@ struct radeon_encoder { | |||
302 | struct radeon_connector_atom_dig { | 339 | struct radeon_connector_atom_dig { |
303 | uint32_t igp_lane_info; | 340 | uint32_t igp_lane_info; |
304 | bool linkb; | 341 | bool linkb; |
342 | /* displayport */ | ||
343 | struct radeon_i2c_chan *dp_i2c_bus; | ||
344 | u8 dpcd[8]; | ||
345 | u8 dp_sink_type; | ||
346 | int dp_clock; | ||
347 | int dp_lane_count; | ||
348 | }; | ||
349 | |||
350 | struct radeon_gpio_rec { | ||
351 | bool valid; | ||
352 | u8 id; | ||
353 | u32 reg; | ||
354 | u32 mask; | ||
355 | }; | ||
356 | |||
357 | enum radeon_hpd_id { | ||
358 | RADEON_HPD_NONE = 0, | ||
359 | RADEON_HPD_1, | ||
360 | RADEON_HPD_2, | ||
361 | RADEON_HPD_3, | ||
362 | RADEON_HPD_4, | ||
363 | RADEON_HPD_5, | ||
364 | RADEON_HPD_6, | ||
365 | }; | ||
366 | |||
367 | struct radeon_hpd { | ||
368 | enum radeon_hpd_id hpd; | ||
369 | u8 plugged_state; | ||
370 | struct radeon_gpio_rec gpio; | ||
305 | }; | 371 | }; |
306 | 372 | ||
307 | struct radeon_connector { | 373 | struct radeon_connector { |
@@ -318,6 +384,7 @@ struct radeon_connector { | |||
318 | void *con_priv; | 384 | void *con_priv; |
319 | bool dac_load_detect; | 385 | bool dac_load_detect; |
320 | uint16_t connector_object_id; | 386 | uint16_t connector_object_id; |
387 | struct radeon_hpd hpd; | ||
321 | }; | 388 | }; |
322 | 389 | ||
323 | struct radeon_framebuffer { | 390 | struct radeon_framebuffer { |
@@ -325,10 +392,37 @@ struct radeon_framebuffer { | |||
325 | struct drm_gem_object *obj; | 392 | struct drm_gem_object *obj; |
326 | }; | 393 | }; |
327 | 394 | ||
395 | extern void radeon_connector_hotplug(struct drm_connector *connector); | ||
396 | extern bool radeon_dp_needs_link_train(struct radeon_connector *radeon_connector); | ||
397 | extern int radeon_dp_mode_valid_helper(struct radeon_connector *radeon_connector, | ||
398 | struct drm_display_mode *mode); | ||
399 | extern void radeon_dp_set_link_config(struct drm_connector *connector, | ||
400 | struct drm_display_mode *mode); | ||
401 | extern void dp_link_train(struct drm_encoder *encoder, | ||
402 | struct drm_connector *connector); | ||
403 | extern u8 radeon_dp_getsinktype(struct radeon_connector *radeon_connector); | ||
404 | extern bool radeon_dp_getdpcd(struct radeon_connector *radeon_connector); | ||
405 | extern void atombios_dig_transmitter_setup(struct drm_encoder *encoder, | ||
406 | int action, uint8_t lane_num, | ||
407 | uint8_t lane_set); | ||
408 | extern int radeon_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode, | ||
409 | uint8_t write_byte, uint8_t *read_byte); | ||
410 | |||
411 | extern struct radeon_i2c_chan *radeon_i2c_create_dp(struct drm_device *dev, | ||
412 | struct radeon_i2c_bus_rec *rec, | ||
413 | const char *name); | ||
328 | extern struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev, | 414 | extern struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev, |
329 | struct radeon_i2c_bus_rec *rec, | 415 | struct radeon_i2c_bus_rec *rec, |
330 | const char *name); | 416 | const char *name); |
331 | extern void radeon_i2c_destroy(struct radeon_i2c_chan *i2c); | 417 | extern void radeon_i2c_destroy(struct radeon_i2c_chan *i2c); |
418 | extern void radeon_i2c_sw_get_byte(struct radeon_i2c_chan *i2c_bus, | ||
419 | u8 slave_addr, | ||
420 | u8 addr, | ||
421 | u8 *val); | ||
422 | extern void radeon_i2c_sw_put_byte(struct radeon_i2c_chan *i2c, | ||
423 | u8 slave_addr, | ||
424 | u8 addr, | ||
425 | u8 val); | ||
332 | extern bool radeon_ddc_probe(struct radeon_connector *radeon_connector); | 426 | extern bool radeon_ddc_probe(struct radeon_connector *radeon_connector); |
333 | extern int radeon_ddc_get_modes(struct radeon_connector *radeon_connector); | 427 | extern int radeon_ddc_get_modes(struct radeon_connector *radeon_connector); |
334 | 428 | ||
@@ -343,12 +437,24 @@ extern void radeon_compute_pll(struct radeon_pll *pll, | |||
343 | uint32_t *post_div_p, | 437 | uint32_t *post_div_p, |
344 | int flags); | 438 | int flags); |
345 | 439 | ||
440 | extern void radeon_compute_pll_avivo(struct radeon_pll *pll, | ||
441 | uint64_t freq, | ||
442 | uint32_t *dot_clock_p, | ||
443 | uint32_t *fb_div_p, | ||
444 | uint32_t *frac_fb_div_p, | ||
445 | uint32_t *ref_div_p, | ||
446 | uint32_t *post_div_p, | ||
447 | int flags); | ||
448 | |||
449 | extern void radeon_setup_encoder_clones(struct drm_device *dev); | ||
450 | |||
346 | struct drm_encoder *radeon_encoder_legacy_lvds_add(struct drm_device *dev, int bios_index); | 451 | struct drm_encoder *radeon_encoder_legacy_lvds_add(struct drm_device *dev, int bios_index); |
347 | struct drm_encoder *radeon_encoder_legacy_primary_dac_add(struct drm_device *dev, int bios_index, int with_tv); | 452 | struct drm_encoder *radeon_encoder_legacy_primary_dac_add(struct drm_device *dev, int bios_index, int with_tv); |
348 | struct drm_encoder *radeon_encoder_legacy_tv_dac_add(struct drm_device *dev, int bios_index, int with_tv); | 453 | struct drm_encoder *radeon_encoder_legacy_tv_dac_add(struct drm_device *dev, int bios_index, int with_tv); |
349 | struct drm_encoder *radeon_encoder_legacy_tmds_int_add(struct drm_device *dev, int bios_index); | 454 | struct drm_encoder *radeon_encoder_legacy_tmds_int_add(struct drm_device *dev, int bios_index); |
350 | struct drm_encoder *radeon_encoder_legacy_tmds_ext_add(struct drm_device *dev, int bios_index); | 455 | struct drm_encoder *radeon_encoder_legacy_tmds_ext_add(struct drm_device *dev, int bios_index); |
351 | extern void atombios_external_tmds_setup(struct drm_encoder *encoder, int action); | 456 | extern void atombios_external_tmds_setup(struct drm_encoder *encoder, int action); |
457 | extern void atombios_digital_setup(struct drm_encoder *encoder, int action); | ||
352 | extern int atombios_get_encoder_mode(struct drm_encoder *encoder); | 458 | extern int atombios_get_encoder_mode(struct drm_encoder *encoder); |
353 | extern void radeon_encoder_set_active_device(struct drm_encoder *encoder); | 459 | extern void radeon_encoder_set_active_device(struct drm_encoder *encoder); |
354 | 460 | ||
@@ -378,12 +484,16 @@ extern bool radeon_atom_get_clock_info(struct drm_device *dev); | |||
378 | extern bool radeon_combios_get_clock_info(struct drm_device *dev); | 484 | extern bool radeon_combios_get_clock_info(struct drm_device *dev); |
379 | extern struct radeon_encoder_atom_dig * | 485 | extern struct radeon_encoder_atom_dig * |
380 | radeon_atombios_get_lvds_info(struct radeon_encoder *encoder); | 486 | radeon_atombios_get_lvds_info(struct radeon_encoder *encoder); |
381 | bool radeon_atombios_get_tmds_info(struct radeon_encoder *encoder, | 487 | extern bool radeon_atombios_get_tmds_info(struct radeon_encoder *encoder, |
382 | struct radeon_encoder_int_tmds *tmds); | 488 | struct radeon_encoder_int_tmds *tmds); |
383 | bool radeon_legacy_get_tmds_info_from_combios(struct radeon_encoder *encoder, | 489 | extern bool radeon_legacy_get_tmds_info_from_combios(struct radeon_encoder *encoder, |
384 | struct radeon_encoder_int_tmds *tmds); | 490 | struct radeon_encoder_int_tmds *tmds); |
385 | bool radeon_legacy_get_tmds_info_from_table(struct radeon_encoder *encoder, | 491 | extern bool radeon_legacy_get_tmds_info_from_table(struct radeon_encoder *encoder, |
386 | struct radeon_encoder_int_tmds *tmds); | 492 | struct radeon_encoder_int_tmds *tmds); |
493 | extern bool radeon_legacy_get_ext_tmds_info_from_combios(struct radeon_encoder *encoder, | ||
494 | struct radeon_encoder_ext_tmds *tmds); | ||
495 | extern bool radeon_legacy_get_ext_tmds_info_from_table(struct radeon_encoder *encoder, | ||
496 | struct radeon_encoder_ext_tmds *tmds); | ||
387 | extern struct radeon_encoder_primary_dac * | 497 | extern struct radeon_encoder_primary_dac * |
388 | radeon_atombios_get_primary_dac_info(struct radeon_encoder *encoder); | 498 | radeon_atombios_get_primary_dac_info(struct radeon_encoder *encoder); |
389 | extern struct radeon_encoder_tv_dac * | 499 | extern struct radeon_encoder_tv_dac * |
@@ -395,6 +505,8 @@ extern struct radeon_encoder_tv_dac * | |||
395 | radeon_combios_get_tv_dac_info(struct radeon_encoder *encoder); | 505 | radeon_combios_get_tv_dac_info(struct radeon_encoder *encoder); |
396 | extern struct radeon_encoder_primary_dac * | 506 | extern struct radeon_encoder_primary_dac * |
397 | radeon_combios_get_primary_dac_info(struct radeon_encoder *encoder); | 507 | radeon_combios_get_primary_dac_info(struct radeon_encoder *encoder); |
508 | extern bool radeon_combios_external_tmds_setup(struct drm_encoder *encoder); | ||
509 | extern void radeon_external_tmds_setup(struct drm_encoder *encoder); | ||
398 | extern void radeon_combios_output_lock(struct drm_encoder *encoder, bool lock); | 510 | extern void radeon_combios_output_lock(struct drm_encoder *encoder, bool lock); |
399 | extern void radeon_combios_initialize_bios_scratch_regs(struct drm_device *dev); | 511 | extern void radeon_combios_initialize_bios_scratch_regs(struct drm_device *dev); |
400 | extern void radeon_atom_output_lock(struct drm_encoder *encoder, bool lock); | 512 | extern void radeon_atom_output_lock(struct drm_encoder *encoder, bool lock); |
@@ -426,16 +538,13 @@ void radeon_atombios_init_crtc(struct drm_device *dev, | |||
426 | struct radeon_crtc *radeon_crtc); | 538 | struct radeon_crtc *radeon_crtc); |
427 | void radeon_legacy_init_crtc(struct drm_device *dev, | 539 | void radeon_legacy_init_crtc(struct drm_device *dev, |
428 | struct radeon_crtc *radeon_crtc); | 540 | struct radeon_crtc *radeon_crtc); |
429 | void radeon_i2c_do_lock(struct radeon_connector *radeon_connector, int lock_state); | 541 | extern void radeon_i2c_do_lock(struct radeon_i2c_chan *i2c, int lock_state); |
430 | 542 | ||
431 | void radeon_get_clock_info(struct drm_device *dev); | 543 | void radeon_get_clock_info(struct drm_device *dev); |
432 | 544 | ||
433 | extern bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev); | 545 | extern bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev); |
434 | extern bool radeon_get_atom_connector_info_from_supported_devices_table(struct drm_device *dev); | 546 | extern bool radeon_get_atom_connector_info_from_supported_devices_table(struct drm_device *dev); |
435 | 547 | ||
436 | void radeon_rmx_mode_fixup(struct drm_encoder *encoder, | ||
437 | struct drm_display_mode *mode, | ||
438 | struct drm_display_mode *adjusted_mode); | ||
439 | void radeon_enc_destroy(struct drm_encoder *encoder); | 548 | void radeon_enc_destroy(struct drm_encoder *encoder); |
440 | void radeon_copy_fb(struct drm_device *dev, struct drm_gem_object *dst_obj); | 549 | void radeon_copy_fb(struct drm_device *dev, struct drm_gem_object *dst_obj); |
441 | void radeon_combios_asic_init(struct drm_device *dev); | 550 | void radeon_combios_asic_init(struct drm_device *dev); |