aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/radeon_mode.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_mode.h')
-rw-r--r--drivers/gpu/drm/radeon/radeon_mode.h149
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 */
92struct radeon_i2c_bus_rec { 107struct 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
112struct radeon_tmds_pll { 134struct radeon_tmds_pll {
@@ -150,9 +172,12 @@ struct radeon_pll {
150}; 172};
151 173
152struct radeon_i2c_chan { 174struct 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
198enum radeon_dvo_chip {
199 DVO_SIL164,
200 DVO_SIL1178,
201};
202
173struct radeon_mode_info { 203struct 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
294struct 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 */
265struct radeon_atom_ss { 302struct radeon_atom_ss {
266 uint16_t percentage; 303 uint16_t percentage;
@@ -302,6 +339,35 @@ struct radeon_encoder {
302struct radeon_connector_atom_dig { 339struct 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
350struct radeon_gpio_rec {
351 bool valid;
352 u8 id;
353 u32 reg;
354 u32 mask;
355};
356
357enum 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
367struct radeon_hpd {
368 enum radeon_hpd_id hpd;
369 u8 plugged_state;
370 struct radeon_gpio_rec gpio;
305}; 371};
306 372
307struct radeon_connector { 373struct 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
323struct radeon_framebuffer { 390struct 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
395extern void radeon_connector_hotplug(struct drm_connector *connector);
396extern bool radeon_dp_needs_link_train(struct radeon_connector *radeon_connector);
397extern int radeon_dp_mode_valid_helper(struct radeon_connector *radeon_connector,
398 struct drm_display_mode *mode);
399extern void radeon_dp_set_link_config(struct drm_connector *connector,
400 struct drm_display_mode *mode);
401extern void dp_link_train(struct drm_encoder *encoder,
402 struct drm_connector *connector);
403extern u8 radeon_dp_getsinktype(struct radeon_connector *radeon_connector);
404extern bool radeon_dp_getdpcd(struct radeon_connector *radeon_connector);
405extern void atombios_dig_transmitter_setup(struct drm_encoder *encoder,
406 int action, uint8_t lane_num,
407 uint8_t lane_set);
408extern int radeon_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,
409 uint8_t write_byte, uint8_t *read_byte);
410
411extern struct radeon_i2c_chan *radeon_i2c_create_dp(struct drm_device *dev,
412 struct radeon_i2c_bus_rec *rec,
413 const char *name);
328extern struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev, 414extern 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);
331extern void radeon_i2c_destroy(struct radeon_i2c_chan *i2c); 417extern void radeon_i2c_destroy(struct radeon_i2c_chan *i2c);
418extern void radeon_i2c_sw_get_byte(struct radeon_i2c_chan *i2c_bus,
419 u8 slave_addr,
420 u8 addr,
421 u8 *val);
422extern void radeon_i2c_sw_put_byte(struct radeon_i2c_chan *i2c,
423 u8 slave_addr,
424 u8 addr,
425 u8 val);
332extern bool radeon_ddc_probe(struct radeon_connector *radeon_connector); 426extern bool radeon_ddc_probe(struct radeon_connector *radeon_connector);
333extern int radeon_ddc_get_modes(struct radeon_connector *radeon_connector); 427extern 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
440extern 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
449extern void radeon_setup_encoder_clones(struct drm_device *dev);
450
346struct drm_encoder *radeon_encoder_legacy_lvds_add(struct drm_device *dev, int bios_index); 451struct drm_encoder *radeon_encoder_legacy_lvds_add(struct drm_device *dev, int bios_index);
347struct drm_encoder *radeon_encoder_legacy_primary_dac_add(struct drm_device *dev, int bios_index, int with_tv); 452struct drm_encoder *radeon_encoder_legacy_primary_dac_add(struct drm_device *dev, int bios_index, int with_tv);
348struct drm_encoder *radeon_encoder_legacy_tv_dac_add(struct drm_device *dev, int bios_index, int with_tv); 453struct drm_encoder *radeon_encoder_legacy_tv_dac_add(struct drm_device *dev, int bios_index, int with_tv);
349struct drm_encoder *radeon_encoder_legacy_tmds_int_add(struct drm_device *dev, int bios_index); 454struct drm_encoder *radeon_encoder_legacy_tmds_int_add(struct drm_device *dev, int bios_index);
350struct drm_encoder *radeon_encoder_legacy_tmds_ext_add(struct drm_device *dev, int bios_index); 455struct drm_encoder *radeon_encoder_legacy_tmds_ext_add(struct drm_device *dev, int bios_index);
351extern void atombios_external_tmds_setup(struct drm_encoder *encoder, int action); 456extern void atombios_external_tmds_setup(struct drm_encoder *encoder, int action);
457extern void atombios_digital_setup(struct drm_encoder *encoder, int action);
352extern int atombios_get_encoder_mode(struct drm_encoder *encoder); 458extern int atombios_get_encoder_mode(struct drm_encoder *encoder);
353extern void radeon_encoder_set_active_device(struct drm_encoder *encoder); 459extern 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);
378extern bool radeon_combios_get_clock_info(struct drm_device *dev); 484extern bool radeon_combios_get_clock_info(struct drm_device *dev);
379extern struct radeon_encoder_atom_dig * 485extern struct radeon_encoder_atom_dig *
380radeon_atombios_get_lvds_info(struct radeon_encoder *encoder); 486radeon_atombios_get_lvds_info(struct radeon_encoder *encoder);
381bool radeon_atombios_get_tmds_info(struct radeon_encoder *encoder, 487extern bool radeon_atombios_get_tmds_info(struct radeon_encoder *encoder,
382 struct radeon_encoder_int_tmds *tmds); 488 struct radeon_encoder_int_tmds *tmds);
383bool radeon_legacy_get_tmds_info_from_combios(struct radeon_encoder *encoder, 489extern 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);
385bool radeon_legacy_get_tmds_info_from_table(struct radeon_encoder *encoder, 491extern 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);
493extern bool radeon_legacy_get_ext_tmds_info_from_combios(struct radeon_encoder *encoder,
494 struct radeon_encoder_ext_tmds *tmds);
495extern bool radeon_legacy_get_ext_tmds_info_from_table(struct radeon_encoder *encoder,
496 struct radeon_encoder_ext_tmds *tmds);
387extern struct radeon_encoder_primary_dac * 497extern struct radeon_encoder_primary_dac *
388radeon_atombios_get_primary_dac_info(struct radeon_encoder *encoder); 498radeon_atombios_get_primary_dac_info(struct radeon_encoder *encoder);
389extern struct radeon_encoder_tv_dac * 499extern struct radeon_encoder_tv_dac *
@@ -395,6 +505,8 @@ extern struct radeon_encoder_tv_dac *
395radeon_combios_get_tv_dac_info(struct radeon_encoder *encoder); 505radeon_combios_get_tv_dac_info(struct radeon_encoder *encoder);
396extern struct radeon_encoder_primary_dac * 506extern struct radeon_encoder_primary_dac *
397radeon_combios_get_primary_dac_info(struct radeon_encoder *encoder); 507radeon_combios_get_primary_dac_info(struct radeon_encoder *encoder);
508extern bool radeon_combios_external_tmds_setup(struct drm_encoder *encoder);
509extern void radeon_external_tmds_setup(struct drm_encoder *encoder);
398extern void radeon_combios_output_lock(struct drm_encoder *encoder, bool lock); 510extern void radeon_combios_output_lock(struct drm_encoder *encoder, bool lock);
399extern void radeon_combios_initialize_bios_scratch_regs(struct drm_device *dev); 511extern void radeon_combios_initialize_bios_scratch_regs(struct drm_device *dev);
400extern void radeon_atom_output_lock(struct drm_encoder *encoder, bool lock); 512extern 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);
427void radeon_legacy_init_crtc(struct drm_device *dev, 539void radeon_legacy_init_crtc(struct drm_device *dev,
428 struct radeon_crtc *radeon_crtc); 540 struct radeon_crtc *radeon_crtc);
429void radeon_i2c_do_lock(struct radeon_connector *radeon_connector, int lock_state); 541extern void radeon_i2c_do_lock(struct radeon_i2c_chan *i2c, int lock_state);
430 542
431void radeon_get_clock_info(struct drm_device *dev); 543void radeon_get_clock_info(struct drm_device *dev);
432 544
433extern bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev); 545extern bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev);
434extern bool radeon_get_atom_connector_info_from_supported_devices_table(struct drm_device *dev); 546extern bool radeon_get_atom_connector_info_from_supported_devices_table(struct drm_device *dev);
435 547
436void radeon_rmx_mode_fixup(struct drm_encoder *encoder,
437 struct drm_display_mode *mode,
438 struct drm_display_mode *adjusted_mode);
439void radeon_enc_destroy(struct drm_encoder *encoder); 548void radeon_enc_destroy(struct drm_encoder *encoder);
440void radeon_copy_fb(struct drm_device *dev, struct drm_gem_object *dst_obj); 549void radeon_copy_fb(struct drm_device *dev, struct drm_gem_object *dst_obj);
441void radeon_combios_asic_init(struct drm_device *dev); 550void radeon_combios_asic_init(struct drm_device *dev);