blob: 3dcbe130c422fcb7cb2efc5a00ff6b003974f1ff [file] [log] [blame]
Jerome Glisse771fe6b2009-06-05 14:42:42 +02001/*
2 * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and
3 * VA Linux Systems Inc., Fremont, California.
4 * Copyright 2008 Red Hat Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
23 *
24 * Original Authors:
25 * Kevin E. Martin, Rickard E. Faith, Alan Hourihane
26 *
27 * Kernel port Author: Dave Airlie
28 */
29
30#ifndef RADEON_MODE_H
31#define RADEON_MODE_H
32
33#include <drm_crtc.h>
34#include <drm_mode.h>
35#include <drm_edid.h>
Dave Airlie746c1aa2009-12-08 07:07:28 +100036#include <drm_dp_helper.h>
Jerome Glisse771fe6b2009-06-05 14:42:42 +020037#include <linux/i2c.h>
38#include <linux/i2c-id.h>
39#include <linux/i2c-algo-bit.h>
Jerome Glissec93bb852009-07-13 21:04:08 +020040#include "radeon_fixed.h"
41
42struct radeon_device;
Jerome Glisse771fe6b2009-06-05 14:42:42 +020043
44#define to_radeon_crtc(x) container_of(x, struct radeon_crtc, base)
45#define to_radeon_connector(x) container_of(x, struct radeon_connector, base)
46#define to_radeon_encoder(x) container_of(x, struct radeon_encoder, base)
47#define to_radeon_framebuffer(x) container_of(x, struct radeon_framebuffer, base)
48
49enum radeon_connector_type {
50 CONNECTOR_NONE,
51 CONNECTOR_VGA,
52 CONNECTOR_DVI_I,
53 CONNECTOR_DVI_D,
54 CONNECTOR_DVI_A,
55 CONNECTOR_STV,
56 CONNECTOR_CTV,
57 CONNECTOR_LVDS,
58 CONNECTOR_DIGITAL,
59 CONNECTOR_SCART,
60 CONNECTOR_HDMI_TYPE_A,
61 CONNECTOR_HDMI_TYPE_B,
62 CONNECTOR_0XC,
63 CONNECTOR_0XD,
64 CONNECTOR_DIN,
65 CONNECTOR_DISPLAY_PORT,
66 CONNECTOR_UNSUPPORTED
67};
68
69enum radeon_dvi_type {
70 DVI_AUTO,
71 DVI_DIGITAL,
72 DVI_ANALOG
73};
74
75enum radeon_rmx_type {
76 RMX_OFF,
77 RMX_FULL,
78 RMX_CENTER,
79 RMX_ASPECT
80};
81
82enum radeon_tv_std {
83 TV_STD_NTSC,
84 TV_STD_PAL,
85 TV_STD_PAL_M,
86 TV_STD_PAL_60,
87 TV_STD_NTSC_J,
88 TV_STD_SCART_PAL,
89 TV_STD_SECAM,
90 TV_STD_PAL_CN,
91};
92
Alex Deucher9b9fe722009-11-10 15:59:44 -050093/* 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 */
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200107struct radeon_i2c_bus_rec {
108 bool valid;
Alex Deucher6a93cb22009-11-23 17:39:28 -0500109 /* 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 */
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200116 uint32_t mask_clk_reg;
117 uint32_t mask_data_reg;
118 uint32_t a_clk_reg;
119 uint32_t a_data_reg;
Alex Deucher9b9fe722009-11-10 15:59:44 -0500120 uint32_t en_clk_reg;
121 uint32_t en_data_reg;
122 uint32_t y_clk_reg;
123 uint32_t y_data_reg;
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200124 uint32_t mask_clk_mask;
125 uint32_t mask_data_mask;
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200126 uint32_t a_clk_mask;
127 uint32_t a_data_mask;
Alex Deucher9b9fe722009-11-10 15:59:44 -0500128 uint32_t en_clk_mask;
129 uint32_t en_data_mask;
130 uint32_t y_clk_mask;
131 uint32_t y_data_mask;
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200132};
133
134struct radeon_tmds_pll {
135 uint32_t freq;
136 uint32_t value;
137};
138
139#define RADEON_MAX_BIOS_CONNECTOR 16
140
141#define RADEON_PLL_USE_BIOS_DIVS (1 << 0)
142#define RADEON_PLL_NO_ODD_POST_DIV (1 << 1)
143#define RADEON_PLL_USE_REF_DIV (1 << 2)
144#define RADEON_PLL_LEGACY (1 << 3)
145#define RADEON_PLL_PREFER_LOW_REF_DIV (1 << 4)
146#define RADEON_PLL_PREFER_HIGH_REF_DIV (1 << 5)
147#define RADEON_PLL_PREFER_LOW_FB_DIV (1 << 6)
148#define RADEON_PLL_PREFER_HIGH_FB_DIV (1 << 7)
149#define RADEON_PLL_PREFER_LOW_POST_DIV (1 << 8)
150#define RADEON_PLL_PREFER_HIGH_POST_DIV (1 << 9)
151#define RADEON_PLL_USE_FRAC_FB_DIV (1 << 10)
Alex Deucherd0e275a2009-07-13 11:08:18 -0400152#define RADEON_PLL_PREFER_CLOSEST_LOWER (1 << 11)
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200153
154struct radeon_pll {
155 uint16_t reference_freq;
156 uint16_t reference_div;
157 uint32_t pll_in_min;
158 uint32_t pll_in_max;
159 uint32_t pll_out_min;
160 uint32_t pll_out_max;
161 uint16_t xclk;
162
163 uint32_t min_ref_div;
164 uint32_t max_ref_div;
165 uint32_t min_post_div;
166 uint32_t max_post_div;
167 uint32_t min_feedback_div;
168 uint32_t max_feedback_div;
169 uint32_t min_frac_feedback_div;
170 uint32_t max_frac_feedback_div;
171 uint32_t best_vco;
172};
173
174struct radeon_i2c_chan {
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200175 struct i2c_adapter adapter;
Dave Airlie746c1aa2009-12-08 07:07:28 +1000176 struct drm_device *dev;
177 union {
178 struct i2c_algo_dp_aux_data dp;
179 struct i2c_algo_bit_data bit;
180 } algo;
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200181 struct radeon_i2c_bus_rec rec;
182};
183
184/* mostly for macs, but really any system without connector tables */
185enum radeon_connector_table {
186 CT_NONE,
187 CT_GENERIC,
188 CT_IBOOK,
189 CT_POWERBOOK_EXTERNAL,
190 CT_POWERBOOK_INTERNAL,
191 CT_POWERBOOK_VGA,
192 CT_MINI_EXTERNAL,
193 CT_MINI_INTERNAL,
194 CT_IMAC_G5_ISIGHT,
195 CT_EMAC,
196};
197
Alex Deucherfcec5702009-11-10 21:25:07 -0500198enum radeon_dvo_chip {
199 DVO_SIL164,
200 DVO_SIL1178,
201};
202
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200203struct radeon_mode_info {
204 struct atom_context *atom_context;
Mathias Fröhlich61c4b242009-10-27 15:08:01 -0400205 struct card_info *atom_card_info;
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200206 enum radeon_connector_table connector_table;
207 bool mode_config_initialized;
Jerome Glissec93bb852009-07-13 21:04:08 +0200208 struct radeon_crtc *crtcs[2];
Dave Airlie445282d2009-09-09 17:40:54 +1000209 /* DVI-I properties */
210 struct drm_property *coherent_mode_property;
211 /* DAC enable load detect */
212 struct drm_property *load_detect_property;
213 /* TV standard load detect */
214 struct drm_property *tv_std_property;
215 /* legacy TMDS PLL detect */
216 struct drm_property *tmds_pll_property;
217
Jerome Glissec93bb852009-07-13 21:04:08 +0200218};
219
Dave Airlie4ce001a2009-08-13 16:32:14 +1000220#define MAX_H_CODE_TIMING_LEN 32
221#define MAX_V_CODE_TIMING_LEN 32
222
223/* need to store these as reading
224 back code tables is excessive */
225struct radeon_tv_regs {
226 uint32_t tv_uv_adr;
227 uint32_t timing_cntl;
228 uint32_t hrestart;
229 uint32_t vrestart;
230 uint32_t frestart;
231 uint16_t h_code_timing[MAX_H_CODE_TIMING_LEN];
232 uint16_t v_code_timing[MAX_V_CODE_TIMING_LEN];
233};
234
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200235struct radeon_crtc {
236 struct drm_crtc base;
237 int crtc_id;
238 u16 lut_r[256], lut_g[256], lut_b[256];
239 bool enabled;
240 bool can_tile;
241 uint32_t crtc_offset;
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200242 struct drm_gem_object *cursor_bo;
243 uint64_t cursor_addr;
244 int cursor_width;
245 int cursor_height;
Dave Airlie41623382009-07-09 15:04:19 +1000246 uint32_t legacy_display_base_addr;
Alex Deucherc836e862009-07-13 13:51:03 -0400247 uint32_t legacy_cursor_offset;
Jerome Glissec93bb852009-07-13 21:04:08 +0200248 enum radeon_rmx_type rmx_type;
Jerome Glissec93bb852009-07-13 21:04:08 +0200249 fixed20_12 vsc;
250 fixed20_12 hsc;
Alex Deucherde2103e2009-10-09 15:14:30 -0400251 struct drm_display_mode native_mode;
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200252};
253
254struct radeon_encoder_primary_dac {
255 /* legacy primary dac */
256 uint32_t ps2_pdac_adj;
257};
258
259struct radeon_encoder_lvds {
260 /* legacy lvds */
261 uint16_t panel_vcc_delay;
262 uint8_t panel_pwr_delay;
263 uint8_t panel_digon_delay;
264 uint8_t panel_blon_delay;
265 uint16_t panel_ref_divider;
266 uint8_t panel_post_divider;
267 uint16_t panel_fb_divider;
268 bool use_bios_dividers;
269 uint32_t lvds_gen_cntl;
270 /* panel mode */
Alex Deucherde2103e2009-10-09 15:14:30 -0400271 struct drm_display_mode native_mode;
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200272};
273
274struct radeon_encoder_tv_dac {
275 /* legacy tv dac */
276 uint32_t ps2_tvdac_adj;
277 uint32_t ntsc_tvdac_adj;
278 uint32_t pal_tvdac_adj;
279
Dave Airlie4ce001a2009-08-13 16:32:14 +1000280 int h_pos;
281 int v_pos;
282 int h_size;
283 int supported_tv_stds;
284 bool tv_on;
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200285 enum radeon_tv_std tv_std;
Dave Airlie4ce001a2009-08-13 16:32:14 +1000286 struct radeon_tv_regs tv;
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200287};
288
289struct radeon_encoder_int_tmds {
290 /* legacy int tmds */
291 struct radeon_tmds_pll tmds_pll[4];
292};
293
Alex Deucherfcec5702009-11-10 21:25:07 -0500294struct 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
Alex Deucherebbe1cb2009-10-16 11:15:25 -0400301/* spread spectrum */
302struct radeon_atom_ss {
303 uint16_t percentage;
304 uint8_t type;
305 uint8_t step;
306 uint8_t delay;
307 uint8_t range;
308 uint8_t refdiv;
309};
310
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200311struct radeon_encoder_atom_dig {
312 /* atom dig */
313 bool coherent_mode;
314 int dig_block;
315 /* atom lvds */
316 uint32_t lvds_misc;
317 uint16_t panel_pwr_delay;
Alex Deucherebbe1cb2009-10-16 11:15:25 -0400318 struct radeon_atom_ss *ss;
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200319 /* panel mode */
Alex Deucherde2103e2009-10-09 15:14:30 -0400320 struct drm_display_mode native_mode;
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200321};
322
Dave Airlie4ce001a2009-08-13 16:32:14 +1000323struct radeon_encoder_atom_dac {
324 enum radeon_tv_std tv_std;
325};
326
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200327struct radeon_encoder {
328 struct drm_encoder base;
329 uint32_t encoder_id;
330 uint32_t devices;
Dave Airlie4ce001a2009-08-13 16:32:14 +1000331 uint32_t active_device;
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200332 uint32_t flags;
333 uint32_t pixel_clock;
334 enum radeon_rmx_type rmx_type;
Alex Deucherde2103e2009-10-09 15:14:30 -0400335 struct drm_display_mode native_mode;
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200336 void *enc_priv;
Christian Koenigdafc3bd2009-10-11 23:49:13 +0200337 int hdmi_offset;
338 int hdmi_audio_workaround;
339 int hdmi_buffer_status;
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200340};
341
342struct radeon_connector_atom_dig {
343 uint32_t igp_lane_info;
344 bool linkb;
Alex Deucher4143e912009-11-23 18:02:35 -0500345 /* displayport */
Dave Airlie746c1aa2009-12-08 07:07:28 +1000346 struct radeon_i2c_chan *dp_i2c_bus;
Alex Deucher1a66c952009-11-20 19:40:13 -0500347 u8 dpcd[8];
Alex Deucher4143e912009-11-23 18:02:35 -0500348 u8 dp_sink_type;
Alex Deucher5801ead2009-11-24 13:32:59 -0500349 int dp_clock;
350 int dp_lane_count;
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200351};
352
Alex Deuchereed45b32009-12-04 14:45:27 -0500353struct radeon_gpio_rec {
354 bool valid;
355 u8 id;
356 u32 reg;
357 u32 mask;
358};
359
360enum radeon_hpd_id {
361 RADEON_HPD_NONE = 0,
362 RADEON_HPD_1,
363 RADEON_HPD_2,
364 RADEON_HPD_3,
365 RADEON_HPD_4,
366 RADEON_HPD_5,
367 RADEON_HPD_6,
368};
369
370struct radeon_hpd {
371 enum radeon_hpd_id hpd;
372 u8 plugged_state;
373 struct radeon_gpio_rec gpio;
374};
375
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200376struct radeon_connector {
377 struct drm_connector base;
378 uint32_t connector_id;
379 uint32_t devices;
380 struct radeon_i2c_chan *ddc_bus;
Alex Deucher0294cf4f2009-10-15 16:16:35 -0400381 /* some systems have a an hdmi and vga port with a shared ddc line */
382 bool shared_ddc;
Dave Airlie4ce001a2009-08-13 16:32:14 +1000383 bool use_digital;
384 /* we need to mind the EDID between detect
385 and get modes due to analog/digital/tvencoder */
386 struct edid *edid;
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200387 void *con_priv;
Dave Airlie445282d2009-09-09 17:40:54 +1000388 bool dac_load_detect;
Alex Deucherb75fad02009-11-05 13:16:01 -0500389 uint16_t connector_object_id;
Alex Deuchereed45b32009-12-04 14:45:27 -0500390 struct radeon_hpd hpd;
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200391};
392
393struct radeon_framebuffer {
394 struct drm_framebuffer base;
395 struct drm_gem_object *obj;
396};
397
Alex Deucherd4877cf2009-12-04 16:56:37 -0500398extern void radeon_connector_hotplug(struct drm_connector *connector);
399extern bool radeon_dp_needs_link_train(struct radeon_connector *radeon_connector);
Alex Deucher5801ead2009-11-24 13:32:59 -0500400extern int radeon_dp_mode_valid_helper(struct radeon_connector *radeon_connector,
401 struct drm_display_mode *mode);
402extern void radeon_dp_set_link_config(struct drm_connector *connector,
403 struct drm_display_mode *mode);
404extern void dp_link_train(struct drm_encoder *encoder,
405 struct drm_connector *connector);
Alex Deucher4143e912009-11-23 18:02:35 -0500406extern u8 radeon_dp_getsinktype(struct radeon_connector *radeon_connector);
Alex Deucher9fa05c92009-11-27 13:01:46 -0500407extern bool radeon_dp_getdpcd(struct radeon_connector *radeon_connector);
Alex Deucher5801ead2009-11-24 13:32:59 -0500408extern void atombios_dig_transmitter_setup(struct drm_encoder *encoder,
409 int action, uint8_t lane_num,
410 uint8_t lane_set);
Dave Airlie746c1aa2009-12-08 07:07:28 +1000411extern int radeon_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,
412 uint8_t write_byte, uint8_t *read_byte);
413
414extern struct radeon_i2c_chan *radeon_i2c_create_dp(struct drm_device *dev,
Alex Deucher6a93cb22009-11-23 17:39:28 -0500415 struct radeon_i2c_bus_rec *rec,
416 const char *name);
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200417extern struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev,
418 struct radeon_i2c_bus_rec *rec,
419 const char *name);
420extern void radeon_i2c_destroy(struct radeon_i2c_chan *i2c);
Alex Deucherfcec5702009-11-10 21:25:07 -0500421extern void radeon_i2c_sw_get_byte(struct radeon_i2c_chan *i2c_bus,
422 u8 slave_addr,
423 u8 addr,
424 u8 *val);
425extern void radeon_i2c_sw_put_byte(struct radeon_i2c_chan *i2c,
426 u8 slave_addr,
427 u8 addr,
428 u8 val);
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200429extern bool radeon_ddc_probe(struct radeon_connector *radeon_connector);
430extern int radeon_ddc_get_modes(struct radeon_connector *radeon_connector);
431
432extern struct drm_encoder *radeon_best_encoder(struct drm_connector *connector);
433
434extern void radeon_compute_pll(struct radeon_pll *pll,
435 uint64_t freq,
436 uint32_t *dot_clock_p,
437 uint32_t *fb_div_p,
438 uint32_t *frac_fb_div_p,
439 uint32_t *ref_div_p,
440 uint32_t *post_div_p,
441 int flags);
442
Alex Deucherb27b6372009-12-09 17:44:25 -0500443extern void radeon_compute_pll_avivo(struct radeon_pll *pll,
444 uint64_t freq,
445 uint32_t *dot_clock_p,
446 uint32_t *fb_div_p,
447 uint32_t *frac_fb_div_p,
448 uint32_t *ref_div_p,
449 uint32_t *post_div_p,
450 int flags);
451
Dave Airlie1f3b6a42009-10-13 14:10:37 +1000452extern void radeon_setup_encoder_clones(struct drm_device *dev);
453
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200454struct drm_encoder *radeon_encoder_legacy_lvds_add(struct drm_device *dev, int bios_index);
455struct drm_encoder *radeon_encoder_legacy_primary_dac_add(struct drm_device *dev, int bios_index, int with_tv);
456struct drm_encoder *radeon_encoder_legacy_tv_dac_add(struct drm_device *dev, int bios_index, int with_tv);
457struct drm_encoder *radeon_encoder_legacy_tmds_int_add(struct drm_device *dev, int bios_index);
458struct drm_encoder *radeon_encoder_legacy_tmds_ext_add(struct drm_device *dev, int bios_index);
459extern void atombios_external_tmds_setup(struct drm_encoder *encoder, int action);
Alex Deucher32f48ff2009-11-30 01:54:16 -0500460extern void atombios_digital_setup(struct drm_encoder *encoder, int action);
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200461extern int atombios_get_encoder_mode(struct drm_encoder *encoder);
Dave Airlie4ce001a2009-08-13 16:32:14 +1000462extern void radeon_encoder_set_active_device(struct drm_encoder *encoder);
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200463
464extern void radeon_crtc_load_lut(struct drm_crtc *crtc);
465extern int atombios_crtc_set_base(struct drm_crtc *crtc, int x, int y,
466 struct drm_framebuffer *old_fb);
467extern int atombios_crtc_mode_set(struct drm_crtc *crtc,
468 struct drm_display_mode *mode,
469 struct drm_display_mode *adjusted_mode,
470 int x, int y,
471 struct drm_framebuffer *old_fb);
472extern void atombios_crtc_dpms(struct drm_crtc *crtc, int mode);
473
474extern int radeon_crtc_set_base(struct drm_crtc *crtc, int x, int y,
475 struct drm_framebuffer *old_fb);
476extern void radeon_legacy_atom_set_surface(struct drm_crtc *crtc);
477
478extern int radeon_crtc_cursor_set(struct drm_crtc *crtc,
479 struct drm_file *file_priv,
480 uint32_t handle,
481 uint32_t width,
482 uint32_t height);
483extern int radeon_crtc_cursor_move(struct drm_crtc *crtc,
484 int x, int y);
485
486extern bool radeon_atom_get_clock_info(struct drm_device *dev);
487extern bool radeon_combios_get_clock_info(struct drm_device *dev);
488extern struct radeon_encoder_atom_dig *
489radeon_atombios_get_lvds_info(struct radeon_encoder *encoder);
Alex Deucherfcec5702009-11-10 21:25:07 -0500490extern bool radeon_atombios_get_tmds_info(struct radeon_encoder *encoder,
491 struct radeon_encoder_int_tmds *tmds);
492extern bool radeon_legacy_get_tmds_info_from_combios(struct radeon_encoder *encoder,
493 struct radeon_encoder_int_tmds *tmds);
494extern bool radeon_legacy_get_tmds_info_from_table(struct radeon_encoder *encoder,
495 struct radeon_encoder_int_tmds *tmds);
496extern bool radeon_legacy_get_ext_tmds_info_from_combios(struct radeon_encoder *encoder,
497 struct radeon_encoder_ext_tmds *tmds);
498extern bool radeon_legacy_get_ext_tmds_info_from_table(struct radeon_encoder *encoder,
499 struct radeon_encoder_ext_tmds *tmds);
Alex Deucher6fe7ac32009-06-12 17:26:08 +0000500extern struct radeon_encoder_primary_dac *
501radeon_atombios_get_primary_dac_info(struct radeon_encoder *encoder);
502extern struct radeon_encoder_tv_dac *
503radeon_atombios_get_tv_dac_info(struct radeon_encoder *encoder);
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200504extern struct radeon_encoder_lvds *
505radeon_combios_get_lvds_info(struct radeon_encoder *encoder);
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200506extern void radeon_combios_get_ext_tmds_info(struct radeon_encoder *encoder);
507extern struct radeon_encoder_tv_dac *
508radeon_combios_get_tv_dac_info(struct radeon_encoder *encoder);
509extern struct radeon_encoder_primary_dac *
510radeon_combios_get_primary_dac_info(struct radeon_encoder *encoder);
Alex Deucherfcec5702009-11-10 21:25:07 -0500511extern bool radeon_combios_external_tmds_setup(struct drm_encoder *encoder);
512extern void radeon_external_tmds_setup(struct drm_encoder *encoder);
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200513extern void radeon_combios_output_lock(struct drm_encoder *encoder, bool lock);
514extern void radeon_combios_initialize_bios_scratch_regs(struct drm_device *dev);
515extern void radeon_atom_output_lock(struct drm_encoder *encoder, bool lock);
516extern void radeon_atom_initialize_bios_scratch_regs(struct drm_device *dev);
Yang Zhaof657c2a2009-09-15 12:21:01 +1000517extern void radeon_save_bios_scratch_regs(struct radeon_device *rdev);
518extern void radeon_restore_bios_scratch_regs(struct radeon_device *rdev);
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200519extern void
520radeon_atombios_encoder_crtc_scratch_regs(struct drm_encoder *encoder, int crtc);
521extern void
522radeon_atombios_encoder_dpms_scratch_regs(struct drm_encoder *encoder, bool on);
523extern void
524radeon_combios_encoder_crtc_scratch_regs(struct drm_encoder *encoder, int crtc);
525extern void
526radeon_combios_encoder_dpms_scratch_regs(struct drm_encoder *encoder, bool on);
527extern void radeon_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
528 u16 blue, int regno);
Dave Airlieb8c00ac2009-10-06 13:54:01 +1000529extern void radeon_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green,
530 u16 *blue, int regno);
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200531struct drm_framebuffer *radeon_framebuffer_create(struct drm_device *dev,
532 struct drm_mode_fb_cmd *mode_cmd,
533 struct drm_gem_object *obj);
534
535int radeonfb_probe(struct drm_device *dev);
536
537int radeonfb_remove(struct drm_device *dev, struct drm_framebuffer *fb);
538bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev);
539bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev);
540void radeon_atombios_init_crtc(struct drm_device *dev,
541 struct radeon_crtc *radeon_crtc);
542void radeon_legacy_init_crtc(struct drm_device *dev,
543 struct radeon_crtc *radeon_crtc);
Alex Deucherab1e9ea2009-11-05 18:27:30 -0500544extern void radeon_i2c_do_lock(struct radeon_i2c_chan *i2c, int lock_state);
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200545
546void radeon_get_clock_info(struct drm_device *dev);
547
548extern bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev);
549extern bool radeon_get_atom_connector_info_from_supported_devices_table(struct drm_device *dev);
550
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200551void radeon_enc_destroy(struct drm_encoder *encoder);
552void radeon_copy_fb(struct drm_device *dev, struct drm_gem_object *dst_obj);
553void radeon_combios_asic_init(struct drm_device *dev);
554extern int radeon_static_clocks_init(struct drm_device *dev);
Jerome Glissec93bb852009-07-13 21:04:08 +0200555bool radeon_crtc_scaling_mode_fixup(struct drm_crtc *crtc,
556 struct drm_display_mode *mode,
557 struct drm_display_mode *adjusted_mode);
Dave Airlie4ce001a2009-08-13 16:32:14 +1000558void atom_rv515_force_tv_scaler(struct radeon_device *rdev, struct radeon_crtc *radeon_crtc);
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200559
Dave Airlie4ce001a2009-08-13 16:32:14 +1000560/* legacy tv */
561void radeon_legacy_tv_adjust_crtc_reg(struct drm_encoder *encoder,
562 uint32_t *h_total_disp, uint32_t *h_sync_strt_wid,
563 uint32_t *v_total_disp, uint32_t *v_sync_strt_wid);
564void radeon_legacy_tv_adjust_pll1(struct drm_encoder *encoder,
565 uint32_t *htotal_cntl, uint32_t *ppll_ref_div,
566 uint32_t *ppll_div_3, uint32_t *pixclks_cntl);
567void radeon_legacy_tv_adjust_pll2(struct drm_encoder *encoder,
568 uint32_t *htotal2_cntl, uint32_t *p2pll_ref_div,
569 uint32_t *p2pll_div_0, uint32_t *pixclks_cntl);
570void radeon_legacy_tv_mode_set(struct drm_encoder *encoder,
571 struct drm_display_mode *mode,
572 struct drm_display_mode *adjusted_mode);
Jerome Glisse771fe6b2009-06-05 14:42:42 +0200573#endif