radeon_mode.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710
  1. /*
  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. #ifndef RADEON_MODE_H
  30. #define RADEON_MODE_H
  31. #include <drm_crtc.h>
  32. #include <drm_mode.h>
  33. #include <drm_edid.h>
  34. #include <drm_dp_helper.h>
  35. #include <drm_fixed.h>
  36. #include <drm_crtc_helper.h>
  37. #include <linux/i2c.h>
  38. #include <linux/i2c-algo-bit.h>
  39. struct radeon_bo;
  40. struct radeon_device;
  41. #define to_radeon_crtc(x) container_of(x, struct radeon_crtc, base)
  42. #define to_radeon_connector(x) container_of(x, struct radeon_connector, base)
  43. #define to_radeon_encoder(x) container_of(x, struct radeon_encoder, base)
  44. #define to_radeon_framebuffer(x) container_of(x, struct radeon_framebuffer, base)
  45. enum radeon_rmx_type {
  46. RMX_OFF,
  47. RMX_FULL,
  48. RMX_CENTER,
  49. RMX_ASPECT
  50. };
  51. enum radeon_tv_std {
  52. TV_STD_NTSC,
  53. TV_STD_PAL,
  54. TV_STD_PAL_M,
  55. TV_STD_PAL_60,
  56. TV_STD_NTSC_J,
  57. TV_STD_SCART_PAL,
  58. TV_STD_SECAM,
  59. TV_STD_PAL_CN,
  60. TV_STD_PAL_N,
  61. };
  62. enum radeon_underscan_type {
  63. UNDERSCAN_OFF,
  64. UNDERSCAN_ON,
  65. UNDERSCAN_AUTO,
  66. };
  67. enum radeon_hpd_id {
  68. RADEON_HPD_1 = 0,
  69. RADEON_HPD_2,
  70. RADEON_HPD_3,
  71. RADEON_HPD_4,
  72. RADEON_HPD_5,
  73. RADEON_HPD_6,
  74. RADEON_HPD_NONE = 0xff,
  75. };
  76. #define RADEON_MAX_I2C_BUS 16
  77. /* radeon gpio-based i2c
  78. * 1. "mask" reg and bits
  79. * grabs the gpio pins for software use
  80. * 0=not held 1=held
  81. * 2. "a" reg and bits
  82. * output pin value
  83. * 0=low 1=high
  84. * 3. "en" reg and bits
  85. * sets the pin direction
  86. * 0=input 1=output
  87. * 4. "y" reg and bits
  88. * input pin value
  89. * 0=low 1=high
  90. */
  91. struct radeon_i2c_bus_rec {
  92. bool valid;
  93. /* id used by atom */
  94. uint8_t i2c_id;
  95. /* id used by atom */
  96. enum radeon_hpd_id hpd;
  97. /* can be used with hw i2c engine */
  98. bool hw_capable;
  99. /* uses multi-media i2c engine */
  100. bool mm_i2c;
  101. /* regs and bits */
  102. uint32_t mask_clk_reg;
  103. uint32_t mask_data_reg;
  104. uint32_t a_clk_reg;
  105. uint32_t a_data_reg;
  106. uint32_t en_clk_reg;
  107. uint32_t en_data_reg;
  108. uint32_t y_clk_reg;
  109. uint32_t y_data_reg;
  110. uint32_t mask_clk_mask;
  111. uint32_t mask_data_mask;
  112. uint32_t a_clk_mask;
  113. uint32_t a_data_mask;
  114. uint32_t en_clk_mask;
  115. uint32_t en_data_mask;
  116. uint32_t y_clk_mask;
  117. uint32_t y_data_mask;
  118. };
  119. struct radeon_tmds_pll {
  120. uint32_t freq;
  121. uint32_t value;
  122. };
  123. #define RADEON_MAX_BIOS_CONNECTOR 16
  124. /* pll flags */
  125. #define RADEON_PLL_USE_BIOS_DIVS (1 << 0)
  126. #define RADEON_PLL_NO_ODD_POST_DIV (1 << 1)
  127. #define RADEON_PLL_USE_REF_DIV (1 << 2)
  128. #define RADEON_PLL_LEGACY (1 << 3)
  129. #define RADEON_PLL_PREFER_LOW_REF_DIV (1 << 4)
  130. #define RADEON_PLL_PREFER_HIGH_REF_DIV (1 << 5)
  131. #define RADEON_PLL_PREFER_LOW_FB_DIV (1 << 6)
  132. #define RADEON_PLL_PREFER_HIGH_FB_DIV (1 << 7)
  133. #define RADEON_PLL_PREFER_LOW_POST_DIV (1 << 8)
  134. #define RADEON_PLL_PREFER_HIGH_POST_DIV (1 << 9)
  135. #define RADEON_PLL_USE_FRAC_FB_DIV (1 << 10)
  136. #define RADEON_PLL_PREFER_CLOSEST_LOWER (1 << 11)
  137. #define RADEON_PLL_USE_POST_DIV (1 << 12)
  138. #define RADEON_PLL_IS_LCD (1 << 13)
  139. #define RADEON_PLL_PREFER_MINM_OVER_MAXP (1 << 14)
  140. struct radeon_pll {
  141. /* reference frequency */
  142. uint32_t reference_freq;
  143. /* fixed dividers */
  144. uint32_t reference_div;
  145. uint32_t post_div;
  146. /* pll in/out limits */
  147. uint32_t pll_in_min;
  148. uint32_t pll_in_max;
  149. uint32_t pll_out_min;
  150. uint32_t pll_out_max;
  151. uint32_t lcd_pll_out_min;
  152. uint32_t lcd_pll_out_max;
  153. uint32_t best_vco;
  154. /* divider limits */
  155. uint32_t min_ref_div;
  156. uint32_t max_ref_div;
  157. uint32_t min_post_div;
  158. uint32_t max_post_div;
  159. uint32_t min_feedback_div;
  160. uint32_t max_feedback_div;
  161. uint32_t min_frac_feedback_div;
  162. uint32_t max_frac_feedback_div;
  163. /* flags for the current clock */
  164. uint32_t flags;
  165. /* pll id */
  166. uint32_t id;
  167. };
  168. struct radeon_i2c_chan {
  169. struct i2c_adapter adapter;
  170. struct drm_device *dev;
  171. union {
  172. struct i2c_algo_bit_data bit;
  173. struct i2c_algo_dp_aux_data dp;
  174. } algo;
  175. struct radeon_i2c_bus_rec rec;
  176. };
  177. /* mostly for macs, but really any system without connector tables */
  178. enum radeon_connector_table {
  179. CT_NONE = 0,
  180. CT_GENERIC,
  181. CT_IBOOK,
  182. CT_POWERBOOK_EXTERNAL,
  183. CT_POWERBOOK_INTERNAL,
  184. CT_POWERBOOK_VGA,
  185. CT_MINI_EXTERNAL,
  186. CT_MINI_INTERNAL,
  187. CT_IMAC_G5_ISIGHT,
  188. CT_EMAC,
  189. CT_RN50_POWER,
  190. CT_MAC_X800,
  191. CT_MAC_G5_9600,
  192. CT_SAM440EP,
  193. CT_MAC_G4_SILVER
  194. };
  195. enum radeon_dvo_chip {
  196. DVO_SIL164,
  197. DVO_SIL1178,
  198. };
  199. struct radeon_fbdev;
  200. struct radeon_mode_info {
  201. struct atom_context *atom_context;
  202. struct card_info *atom_card_info;
  203. enum radeon_connector_table connector_table;
  204. bool mode_config_initialized;
  205. struct radeon_crtc *crtcs[6];
  206. /* DVI-I properties */
  207. struct drm_property *coherent_mode_property;
  208. /* DAC enable load detect */
  209. struct drm_property *load_detect_property;
  210. /* TV standard */
  211. struct drm_property *tv_std_property;
  212. /* legacy TMDS PLL detect */
  213. struct drm_property *tmds_pll_property;
  214. /* underscan */
  215. struct drm_property *underscan_property;
  216. struct drm_property *underscan_hborder_property;
  217. struct drm_property *underscan_vborder_property;
  218. /* hardcoded DFP edid from BIOS */
  219. struct edid *bios_hardcoded_edid;
  220. int bios_hardcoded_edid_size;
  221. /* pointer to fbdev info structure */
  222. struct radeon_fbdev *rfbdev;
  223. };
  224. #define MAX_H_CODE_TIMING_LEN 32
  225. #define MAX_V_CODE_TIMING_LEN 32
  226. /* need to store these as reading
  227. back code tables is excessive */
  228. struct radeon_tv_regs {
  229. uint32_t tv_uv_adr;
  230. uint32_t timing_cntl;
  231. uint32_t hrestart;
  232. uint32_t vrestart;
  233. uint32_t frestart;
  234. uint16_t h_code_timing[MAX_H_CODE_TIMING_LEN];
  235. uint16_t v_code_timing[MAX_V_CODE_TIMING_LEN];
  236. };
  237. struct radeon_crtc {
  238. struct drm_crtc base;
  239. int crtc_id;
  240. u16 lut_r[256], lut_g[256], lut_b[256];
  241. bool enabled;
  242. bool can_tile;
  243. bool in_mode_set;
  244. uint32_t crtc_offset;
  245. struct drm_gem_object *cursor_bo;
  246. uint64_t cursor_addr;
  247. int cursor_width;
  248. int cursor_height;
  249. uint32_t legacy_display_base_addr;
  250. uint32_t legacy_cursor_offset;
  251. enum radeon_rmx_type rmx_type;
  252. u8 h_border;
  253. u8 v_border;
  254. fixed20_12 vsc;
  255. fixed20_12 hsc;
  256. struct drm_display_mode native_mode;
  257. int pll_id;
  258. /* page flipping */
  259. struct radeon_unpin_work *unpin_work;
  260. int deferred_flip_completion;
  261. };
  262. struct radeon_encoder_primary_dac {
  263. /* legacy primary dac */
  264. uint32_t ps2_pdac_adj;
  265. };
  266. struct radeon_encoder_lvds {
  267. /* legacy lvds */
  268. uint16_t panel_vcc_delay;
  269. uint8_t panel_pwr_delay;
  270. uint8_t panel_digon_delay;
  271. uint8_t panel_blon_delay;
  272. uint16_t panel_ref_divider;
  273. uint8_t panel_post_divider;
  274. uint16_t panel_fb_divider;
  275. bool use_bios_dividers;
  276. uint32_t lvds_gen_cntl;
  277. /* panel mode */
  278. struct drm_display_mode native_mode;
  279. struct backlight_device *bl_dev;
  280. int dpms_mode;
  281. uint8_t backlight_level;
  282. };
  283. struct radeon_encoder_tv_dac {
  284. /* legacy tv dac */
  285. uint32_t ps2_tvdac_adj;
  286. uint32_t ntsc_tvdac_adj;
  287. uint32_t pal_tvdac_adj;
  288. int h_pos;
  289. int v_pos;
  290. int h_size;
  291. int supported_tv_stds;
  292. bool tv_on;
  293. enum radeon_tv_std tv_std;
  294. struct radeon_tv_regs tv;
  295. };
  296. struct radeon_encoder_int_tmds {
  297. /* legacy int tmds */
  298. struct radeon_tmds_pll tmds_pll[4];
  299. };
  300. struct radeon_encoder_ext_tmds {
  301. /* tmds over dvo */
  302. struct radeon_i2c_chan *i2c_bus;
  303. uint8_t slave_addr;
  304. enum radeon_dvo_chip dvo_chip;
  305. };
  306. /* spread spectrum */
  307. struct radeon_atom_ss {
  308. uint16_t percentage;
  309. uint8_t type;
  310. uint16_t step;
  311. uint8_t delay;
  312. uint8_t range;
  313. uint8_t refdiv;
  314. /* asic_ss */
  315. uint16_t rate;
  316. uint16_t amount;
  317. };
  318. struct radeon_encoder_atom_dig {
  319. bool linkb;
  320. /* atom dig */
  321. bool coherent_mode;
  322. int dig_encoder; /* -1 disabled, 0 DIGA, 1 DIGB, etc. */
  323. /* atom lvds/edp */
  324. uint32_t lcd_misc;
  325. uint16_t panel_pwr_delay;
  326. uint32_t lcd_ss_id;
  327. /* panel mode */
  328. struct drm_display_mode native_mode;
  329. struct backlight_device *bl_dev;
  330. int dpms_mode;
  331. uint8_t backlight_level;
  332. int panel_mode;
  333. };
  334. struct radeon_encoder_atom_dac {
  335. enum radeon_tv_std tv_std;
  336. };
  337. struct radeon_encoder {
  338. struct drm_encoder base;
  339. uint32_t encoder_enum;
  340. uint32_t encoder_id;
  341. uint32_t devices;
  342. uint32_t active_device;
  343. uint32_t flags;
  344. uint32_t pixel_clock;
  345. enum radeon_rmx_type rmx_type;
  346. enum radeon_underscan_type underscan_type;
  347. uint32_t underscan_hborder;
  348. uint32_t underscan_vborder;
  349. struct drm_display_mode native_mode;
  350. void *enc_priv;
  351. int audio_polling_active;
  352. int hdmi_offset;
  353. int hdmi_config_offset;
  354. int hdmi_audio_workaround;
  355. int hdmi_buffer_status;
  356. bool is_ext_encoder;
  357. u16 caps;
  358. };
  359. struct radeon_connector_atom_dig {
  360. uint32_t igp_lane_info;
  361. /* displayport */
  362. struct radeon_i2c_chan *dp_i2c_bus;
  363. u8 dpcd[8];
  364. u8 dp_sink_type;
  365. int dp_clock;
  366. int dp_lane_count;
  367. bool edp_on;
  368. };
  369. struct radeon_gpio_rec {
  370. bool valid;
  371. u8 id;
  372. u32 reg;
  373. u32 mask;
  374. };
  375. struct radeon_hpd {
  376. enum radeon_hpd_id hpd;
  377. u8 plugged_state;
  378. struct radeon_gpio_rec gpio;
  379. };
  380. struct radeon_router {
  381. u32 router_id;
  382. struct radeon_i2c_bus_rec i2c_info;
  383. u8 i2c_addr;
  384. /* i2c mux */
  385. bool ddc_valid;
  386. u8 ddc_mux_type;
  387. u8 ddc_mux_control_pin;
  388. u8 ddc_mux_state;
  389. /* clock/data mux */
  390. bool cd_valid;
  391. u8 cd_mux_type;
  392. u8 cd_mux_control_pin;
  393. u8 cd_mux_state;
  394. };
  395. struct radeon_connector {
  396. struct drm_connector base;
  397. uint32_t connector_id;
  398. uint32_t devices;
  399. struct radeon_i2c_chan *ddc_bus;
  400. /* some systems have an hdmi and vga port with a shared ddc line */
  401. bool shared_ddc;
  402. bool use_digital;
  403. /* we need to mind the EDID between detect
  404. and get modes due to analog/digital/tvencoder */
  405. struct edid *edid;
  406. void *con_priv;
  407. bool dac_load_detect;
  408. bool detected_by_load; /* if the connection status was determined by load */
  409. uint16_t connector_object_id;
  410. struct radeon_hpd hpd;
  411. struct radeon_router router;
  412. struct radeon_i2c_chan *router_bus;
  413. };
  414. struct radeon_framebuffer {
  415. struct drm_framebuffer base;
  416. struct drm_gem_object *obj;
  417. };
  418. #define ENCODER_MODE_IS_DP(em) (((em) == ATOM_ENCODER_MODE_DP) || \
  419. ((em) == ATOM_ENCODER_MODE_DP_MST))
  420. extern enum radeon_tv_std
  421. radeon_combios_get_tv_info(struct radeon_device *rdev);
  422. extern enum radeon_tv_std
  423. radeon_atombios_get_tv_info(struct radeon_device *rdev);
  424. extern struct drm_connector *
  425. radeon_get_connector_for_encoder(struct drm_encoder *encoder);
  426. extern struct drm_connector *
  427. radeon_get_connector_for_encoder_init(struct drm_encoder *encoder);
  428. extern bool radeon_dig_monitor_is_duallink(struct drm_encoder *encoder,
  429. u32 pixel_clock);
  430. extern u16 radeon_encoder_get_dp_bridge_encoder_id(struct drm_encoder *encoder);
  431. extern u16 radeon_connector_encoder_get_dp_bridge_encoder_id(struct drm_connector *connector);
  432. extern bool radeon_connector_encoder_is_hbr2(struct drm_connector *connector);
  433. extern bool radeon_connector_is_dp12_capable(struct drm_connector *connector);
  434. extern void radeon_connector_hotplug(struct drm_connector *connector);
  435. extern int radeon_dp_mode_valid_helper(struct drm_connector *connector,
  436. struct drm_display_mode *mode);
  437. extern void radeon_dp_set_link_config(struct drm_connector *connector,
  438. struct drm_display_mode *mode);
  439. extern void radeon_dp_link_train(struct drm_encoder *encoder,
  440. struct drm_connector *connector);
  441. extern bool radeon_dp_needs_link_train(struct radeon_connector *radeon_connector);
  442. extern u8 radeon_dp_getsinktype(struct radeon_connector *radeon_connector);
  443. extern bool radeon_dp_getdpcd(struct radeon_connector *radeon_connector);
  444. extern int radeon_dp_get_panel_mode(struct drm_encoder *encoder,
  445. struct drm_connector *connector);
  446. extern void atombios_dig_encoder_setup(struct drm_encoder *encoder, int action, int panel_mode);
  447. extern void radeon_atom_encoder_init(struct radeon_device *rdev);
  448. extern void radeon_atom_disp_eng_pll_init(struct radeon_device *rdev);
  449. extern void atombios_dig_transmitter_setup(struct drm_encoder *encoder,
  450. int action, uint8_t lane_num,
  451. uint8_t lane_set);
  452. extern void radeon_atom_ext_encoder_setup_ddc(struct drm_encoder *encoder);
  453. extern struct drm_encoder *radeon_get_external_encoder(struct drm_encoder *encoder);
  454. extern int radeon_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,
  455. u8 write_byte, u8 *read_byte);
  456. extern void radeon_i2c_init(struct radeon_device *rdev);
  457. extern void radeon_i2c_fini(struct radeon_device *rdev);
  458. extern void radeon_combios_i2c_init(struct radeon_device *rdev);
  459. extern void radeon_atombios_i2c_init(struct radeon_device *rdev);
  460. extern void radeon_i2c_add(struct radeon_device *rdev,
  461. struct radeon_i2c_bus_rec *rec,
  462. const char *name);
  463. extern struct radeon_i2c_chan *radeon_i2c_lookup(struct radeon_device *rdev,
  464. struct radeon_i2c_bus_rec *i2c_bus);
  465. extern struct radeon_i2c_chan *radeon_i2c_create_dp(struct drm_device *dev,
  466. struct radeon_i2c_bus_rec *rec,
  467. const char *name);
  468. extern struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev,
  469. struct radeon_i2c_bus_rec *rec,
  470. const char *name);
  471. extern void radeon_i2c_destroy(struct radeon_i2c_chan *i2c);
  472. extern void radeon_i2c_get_byte(struct radeon_i2c_chan *i2c_bus,
  473. u8 slave_addr,
  474. u8 addr,
  475. u8 *val);
  476. extern void radeon_i2c_put_byte(struct radeon_i2c_chan *i2c,
  477. u8 slave_addr,
  478. u8 addr,
  479. u8 val);
  480. extern void radeon_router_select_ddc_port(struct radeon_connector *radeon_connector);
  481. extern void radeon_router_select_cd_port(struct radeon_connector *radeon_connector);
  482. extern bool radeon_ddc_probe(struct radeon_connector *radeon_connector, bool use_aux);
  483. extern int radeon_ddc_get_modes(struct radeon_connector *radeon_connector);
  484. extern struct drm_encoder *radeon_best_encoder(struct drm_connector *connector);
  485. extern bool radeon_atombios_get_ppll_ss_info(struct radeon_device *rdev,
  486. struct radeon_atom_ss *ss,
  487. int id);
  488. extern bool radeon_atombios_get_asic_ss_info(struct radeon_device *rdev,
  489. struct radeon_atom_ss *ss,
  490. int id, u32 clock);
  491. extern void radeon_compute_pll_legacy(struct radeon_pll *pll,
  492. uint64_t freq,
  493. uint32_t *dot_clock_p,
  494. uint32_t *fb_div_p,
  495. uint32_t *frac_fb_div_p,
  496. uint32_t *ref_div_p,
  497. uint32_t *post_div_p);
  498. extern void radeon_compute_pll_avivo(struct radeon_pll *pll,
  499. u32 freq,
  500. u32 *dot_clock_p,
  501. u32 *fb_div_p,
  502. u32 *frac_fb_div_p,
  503. u32 *ref_div_p,
  504. u32 *post_div_p);
  505. extern void radeon_setup_encoder_clones(struct drm_device *dev);
  506. struct drm_encoder *radeon_encoder_legacy_lvds_add(struct drm_device *dev, int bios_index);
  507. struct drm_encoder *radeon_encoder_legacy_primary_dac_add(struct drm_device *dev, int bios_index, int with_tv);
  508. struct drm_encoder *radeon_encoder_legacy_tv_dac_add(struct drm_device *dev, int bios_index, int with_tv);
  509. struct drm_encoder *radeon_encoder_legacy_tmds_int_add(struct drm_device *dev, int bios_index);
  510. struct drm_encoder *radeon_encoder_legacy_tmds_ext_add(struct drm_device *dev, int bios_index);
  511. extern void atombios_dvo_setup(struct drm_encoder *encoder, int action);
  512. extern void atombios_digital_setup(struct drm_encoder *encoder, int action);
  513. extern int atombios_get_encoder_mode(struct drm_encoder *encoder);
  514. extern bool atombios_set_edp_panel_power(struct drm_connector *connector, int action);
  515. extern void radeon_encoder_set_active_device(struct drm_encoder *encoder);
  516. extern void radeon_crtc_load_lut(struct drm_crtc *crtc);
  517. extern int atombios_crtc_set_base(struct drm_crtc *crtc, int x, int y,
  518. struct drm_framebuffer *old_fb);
  519. extern int atombios_crtc_set_base_atomic(struct drm_crtc *crtc,
  520. struct drm_framebuffer *fb,
  521. int x, int y,
  522. enum mode_set_atomic state);
  523. extern int atombios_crtc_mode_set(struct drm_crtc *crtc,
  524. struct drm_display_mode *mode,
  525. struct drm_display_mode *adjusted_mode,
  526. int x, int y,
  527. struct drm_framebuffer *old_fb);
  528. extern void atombios_crtc_dpms(struct drm_crtc *crtc, int mode);
  529. extern int radeon_crtc_set_base(struct drm_crtc *crtc, int x, int y,
  530. struct drm_framebuffer *old_fb);
  531. extern int radeon_crtc_set_base_atomic(struct drm_crtc *crtc,
  532. struct drm_framebuffer *fb,
  533. int x, int y,
  534. enum mode_set_atomic state);
  535. extern int radeon_crtc_do_set_base(struct drm_crtc *crtc,
  536. struct drm_framebuffer *fb,
  537. int x, int y, int atomic);
  538. extern int radeon_crtc_cursor_set(struct drm_crtc *crtc,
  539. struct drm_file *file_priv,
  540. uint32_t handle,
  541. uint32_t width,
  542. uint32_t height);
  543. extern int radeon_crtc_cursor_move(struct drm_crtc *crtc,
  544. int x, int y);
  545. extern int radeon_get_crtc_scanoutpos(struct drm_device *dev, int crtc,
  546. int *vpos, int *hpos);
  547. extern bool radeon_combios_check_hardcoded_edid(struct radeon_device *rdev);
  548. extern struct edid *
  549. radeon_bios_get_hardcoded_edid(struct radeon_device *rdev);
  550. extern bool radeon_atom_get_clock_info(struct drm_device *dev);
  551. extern bool radeon_combios_get_clock_info(struct drm_device *dev);
  552. extern struct radeon_encoder_atom_dig *
  553. radeon_atombios_get_lvds_info(struct radeon_encoder *encoder);
  554. extern bool radeon_atombios_get_tmds_info(struct radeon_encoder *encoder,
  555. struct radeon_encoder_int_tmds *tmds);
  556. extern bool radeon_legacy_get_tmds_info_from_combios(struct radeon_encoder *encoder,
  557. struct radeon_encoder_int_tmds *tmds);
  558. extern bool radeon_legacy_get_tmds_info_from_table(struct radeon_encoder *encoder,
  559. struct radeon_encoder_int_tmds *tmds);
  560. extern bool radeon_legacy_get_ext_tmds_info_from_combios(struct radeon_encoder *encoder,
  561. struct radeon_encoder_ext_tmds *tmds);
  562. extern bool radeon_legacy_get_ext_tmds_info_from_table(struct radeon_encoder *encoder,
  563. struct radeon_encoder_ext_tmds *tmds);
  564. extern struct radeon_encoder_primary_dac *
  565. radeon_atombios_get_primary_dac_info(struct radeon_encoder *encoder);
  566. extern struct radeon_encoder_tv_dac *
  567. radeon_atombios_get_tv_dac_info(struct radeon_encoder *encoder);
  568. extern struct radeon_encoder_lvds *
  569. radeon_combios_get_lvds_info(struct radeon_encoder *encoder);
  570. extern void radeon_combios_get_ext_tmds_info(struct radeon_encoder *encoder);
  571. extern struct radeon_encoder_tv_dac *
  572. radeon_combios_get_tv_dac_info(struct radeon_encoder *encoder);
  573. extern struct radeon_encoder_primary_dac *
  574. radeon_combios_get_primary_dac_info(struct radeon_encoder *encoder);
  575. extern bool radeon_combios_external_tmds_setup(struct drm_encoder *encoder);
  576. extern void radeon_external_tmds_setup(struct drm_encoder *encoder);
  577. extern void radeon_combios_output_lock(struct drm_encoder *encoder, bool lock);
  578. extern void radeon_combios_initialize_bios_scratch_regs(struct drm_device *dev);
  579. extern void radeon_atom_output_lock(struct drm_encoder *encoder, bool lock);
  580. extern void radeon_atom_initialize_bios_scratch_regs(struct drm_device *dev);
  581. extern void radeon_save_bios_scratch_regs(struct radeon_device *rdev);
  582. extern void radeon_restore_bios_scratch_regs(struct radeon_device *rdev);
  583. extern void
  584. radeon_atombios_encoder_crtc_scratch_regs(struct drm_encoder *encoder, int crtc);
  585. extern void
  586. radeon_atombios_encoder_dpms_scratch_regs(struct drm_encoder *encoder, bool on);
  587. extern void
  588. radeon_combios_encoder_crtc_scratch_regs(struct drm_encoder *encoder, int crtc);
  589. extern void
  590. radeon_combios_encoder_dpms_scratch_regs(struct drm_encoder *encoder, bool on);
  591. extern void radeon_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
  592. u16 blue, int regno);
  593. extern void radeon_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green,
  594. u16 *blue, int regno);
  595. int radeon_framebuffer_init(struct drm_device *dev,
  596. struct radeon_framebuffer *rfb,
  597. struct drm_mode_fb_cmd2 *mode_cmd,
  598. struct drm_gem_object *obj);
  599. int radeonfb_remove(struct drm_device *dev, struct drm_framebuffer *fb);
  600. bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev);
  601. bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev);
  602. void radeon_atombios_init_crtc(struct drm_device *dev,
  603. struct radeon_crtc *radeon_crtc);
  604. void radeon_legacy_init_crtc(struct drm_device *dev,
  605. struct radeon_crtc *radeon_crtc);
  606. void radeon_get_clock_info(struct drm_device *dev);
  607. extern bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev);
  608. extern bool radeon_get_atom_connector_info_from_supported_devices_table(struct drm_device *dev);
  609. void radeon_enc_destroy(struct drm_encoder *encoder);
  610. void radeon_copy_fb(struct drm_device *dev, struct drm_gem_object *dst_obj);
  611. void radeon_combios_asic_init(struct drm_device *dev);
  612. bool radeon_crtc_scaling_mode_fixup(struct drm_crtc *crtc,
  613. struct drm_display_mode *mode,
  614. struct drm_display_mode *adjusted_mode);
  615. void radeon_panel_mode_fixup(struct drm_encoder *encoder,
  616. struct drm_display_mode *adjusted_mode);
  617. void atom_rv515_force_tv_scaler(struct radeon_device *rdev, struct radeon_crtc *radeon_crtc);
  618. /* legacy tv */
  619. void radeon_legacy_tv_adjust_crtc_reg(struct drm_encoder *encoder,
  620. uint32_t *h_total_disp, uint32_t *h_sync_strt_wid,
  621. uint32_t *v_total_disp, uint32_t *v_sync_strt_wid);
  622. void radeon_legacy_tv_adjust_pll1(struct drm_encoder *encoder,
  623. uint32_t *htotal_cntl, uint32_t *ppll_ref_div,
  624. uint32_t *ppll_div_3, uint32_t *pixclks_cntl);
  625. void radeon_legacy_tv_adjust_pll2(struct drm_encoder *encoder,
  626. uint32_t *htotal2_cntl, uint32_t *p2pll_ref_div,
  627. uint32_t *p2pll_div_0, uint32_t *pixclks_cntl);
  628. void radeon_legacy_tv_mode_set(struct drm_encoder *encoder,
  629. struct drm_display_mode *mode,
  630. struct drm_display_mode *adjusted_mode);
  631. /* fbdev layer */
  632. int radeon_fbdev_init(struct radeon_device *rdev);
  633. void radeon_fbdev_fini(struct radeon_device *rdev);
  634. void radeon_fbdev_set_suspend(struct radeon_device *rdev, int state);
  635. int radeon_fbdev_total_size(struct radeon_device *rdev);
  636. bool radeon_fbdev_robj_is_fb(struct radeon_device *rdev, struct radeon_bo *robj);
  637. void radeon_fb_output_poll_changed(struct radeon_device *rdev);
  638. void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id);
  639. int radeon_align_pitch(struct radeon_device *rdev, int width, int bpp, bool tiled);
  640. #endif