--- radeonfb.h.orig 2007-03-21 22:53:31.000000000 +0100 +++ radeonfb.h 2007-03-25 21:36:19.000000000 +0200 @@ -26,6 +26,8 @@ * Most of the definitions here are adapted right from XFree86 * ***************************************************************/ +/* Sorry, we have to limit video ram to 128M */ +#define MAX_VRAM (128*1024*1024) /* * Chip families. Must fit in the low 16 bits of a long word @@ -47,7 +49,8 @@ CHIP_FAMILY_R350, CHIP_FAMILY_RV350, CHIP_FAMILY_RV380, /* RV370/RV380/M22/M24 */ - CHIP_FAMILY_R420, /* R420/R423/M18 */ + CHIP_FAMILY_RV410, /* RV410/M26 */ + CHIP_FAMILY_R420, /* R420/R423/R480/M18 */ CHIP_FAMILY_LAST, }; @@ -64,6 +67,7 @@ ((rinfo)->family == CHIP_FAMILY_RV350) || \ ((rinfo)->family == CHIP_FAMILY_R350) || \ ((rinfo)->family == CHIP_FAMILY_RV380) || \ + ((rinfo)->family == CHIP_FAMILY_RV410) || \ ((rinfo)->family == CHIP_FAMILY_R420)) /* @@ -86,11 +90,50 @@ CHIP_ERRATA_PLL_DELAY = 0x00000004, }; +/* + * DDC i2c ports + */ +enum radeon_ddc_type { + ddc_none = -1, + ddc_monid = 0, + ddc_dvi, + ddc_vga, + ddc_crt2, +}; + +/* + * Connector types + */ +enum radeon_legacy_conn_type { + legacy_conn_none = 0, + legacy_conn_proprietary, + legacy_conn_crt, + legacy_conn_dvi_i, + legacy_conn_dvi_d, + legacy_conn_ctv, + legacy_conn_stv, + legacy_conn_unsupported, +}; + +enum radeon_conn_type { + conn_none = 0, + conn_vga, + conn_dvi_i, + conn_dvi_d, + conn_dvi_a, + conn_stv, + conn_ctv, + conn_lvds, + conn_digital, + conn_unsupported, + conn_proprietary, +}; /* * Monitor types */ -enum radeon_montype { +enum radeon_mon_type { + MT_UNKNOWN = -1, MT_NONE = 0, MT_CRT, /* CRT */ MT_LCD, /* LCD */ @@ -100,27 +143,45 @@ }; /* - * DDC i2c ports + * DAC types */ -enum ddc_type { - ddc_none, - ddc_monid, - ddc_dvi, - ddc_vga, - ddc_crt2, +enum radeon_dac_type { + dac_unknown = -1, + dac_primary = 0, + dac_tvdac = 1, }; /* - * Connector types + * TMDS types */ -enum conn_type { - conn_none, - conn_proprietary, - conn_crt, - conn_DVI_I, - conn_DVI_D, +enum radeon_tmds_type { + tmds_unknown = -1, + tmds_internal = 0, + tmds_external = 1, }; +/* + * Each connector gets this structure associated with it, + * containing infos about the connector wiring and about + * whatever has been detected on it + */ +struct radeon_connector { + enum radeon_conn_type conn_type; + enum radeon_ddc_type ddc_type; + enum radeon_dac_type dac_type; + enum radeon_tmds_type tmds_type; + enum radeon_mon_type mon_type; + u8 *edid; + struct fb_videomode *modedb; + unsigned int modedb_size; + + int head; +}; + +/* + * Currently, the driver deals with at most 4 connectors + */ +#define RADEON_MAX_CONNECTORS 4 /* * PLL infos @@ -128,11 +189,19 @@ struct pll_info { int ppll_max; int ppll_min; - int sclk, mclk; + int sclk; + int mclk; int ref_div; int ref_clk; }; +/* + * TMDS PLL infos + */ +struct radeon_tmds_pll_info { + long freq; + u32 value; +}; /* * This structure contains the various registers manipulated by this @@ -299,6 +368,20 @@ void __iomem *bios_seg; int fp_bios_start; + int is_atom_bios; + int atom_data_start; + + /* BIOS Functions */ + int (*radeon_get_pll_info)(struct radeonfb_info *rinfo); + int (*radeon_get_lvds_info)(struct radeonfb_info *rinfo); + int (*radeon_get_conn_info)(struct radeonfb_info *rinfo); + int (*radeon_get_tmds_info)(struct radeonfb_info *rinfo); + + /* Connector infos */ + struct radeon_connector connectors[RADEON_MAX_CONNECTORS]; + int heads[RADEON_MAX_CONNECTORS]; // index into connectors. + int num_heads; // number of heads. + u32 pseudo_palette[17]; struct { u8 red, green, blue, pad; } palette[256]; @@ -317,15 +400,8 @@ int has_CRTC2; int is_mobility; int is_IGP; - int reversed_DAC; - int reversed_TMDS; struct panel_info panel_info; - int mon1_type; - u8 *mon1_EDID; - struct fb_videomode *mon1_modedb; - int mon1_dbsize; - int mon2_type; - u8 *mon2_EDID; + struct radeon_tmds_pll_info tmds_pll[4]; u32 dp_gui_master_cntl; @@ -357,24 +433,19 @@ }; -#define PRIMARY_MONITOR(rinfo) (rinfo->mon1_type) +#define PRIMARY_HEAD(rinfo) (rinfo->connectors[rinfo->heads[0]]) +#define SECONDARY_HEAD(rinfo) (rinfo->connectors[rinfo->heads[1]]) +#define SECONDARY_HEAD_PRESENT(rinfo) (rinfo->heads[1] != -1) + +#define PRIMARY_MONITOR(rinfo) (rinfo->connectors[rinfo->heads[0]].mon_type) +#define SECONDARY_MONITOR(rinfo) ((SECONDARY_HEAD_PRESENT(rinfo) ? (rinfo->connectors[rinfo->heads[1]].mon_type) : MT_NONE)) /* * Debugging stuffs */ -#ifdef CONFIG_FB_RADEON_DEBUG -#define DEBUG 1 -#else -#define DEBUG 0 -#endif - -#if DEBUG -#define RTRACE printk -#else -#define RTRACE if(0) printk -#endif - +extern int radeonfb_debug; +#define RTRACE if(radeonfb_debug) printk /* * IO macros @@ -597,7 +668,7 @@ /* I2C Functions */ extern void radeon_create_i2c_busses(struct radeonfb_info *rinfo); extern void radeon_delete_i2c_busses(struct radeonfb_info *rinfo); -extern int radeon_probe_i2c_connector(struct radeonfb_info *rinfo, int conn, u8 **out_edid); +extern int radeon_probe_i2c_connector(struct radeonfb_info *rinfo, struct radeon_connector *conn); /* PM Functions */ extern int radeonfb_pci_suspend(struct pci_dev *pdev, pm_message_t state); @@ -635,4 +706,18 @@ static inline void radeonfb_bl_exit(struct radeonfb_info *rinfo) {} #endif +/* Bios functions. Fix this. */ +extern void __devinit radeon_get_conn_info(struct radeonfb_info *rinfo, int ignore_conntable); +extern void __devinit radeon_get_tmds_info(struct radeonfb_info *rinfo); + +extern int __devinit radeon_get_lvds_info_atom(struct radeonfb_info *rinfo); +extern int __devinit radeon_get_lvds_info_legacy(struct radeonfb_info *rinfo); +extern int __devinit radeon_get_conn_info_atom(struct radeonfb_info *rinfo); +extern int __devinit radeon_get_conn_info_legacy(struct radeonfb_info *rinfo); +extern int __devinit radeon_get_tmds_info_legacy(struct radeonfb_info *rinfo); +extern int __devinit radeon_get_tmds_info_atom(struct radeonfb_info *rinfo); +#ifdef CONFIG_PPC_OF +extern int __devinit radeon_get_lvds_info_openfirmware(struct radeonfb_info *rinfo); +extern int __devinit radeon_get_conn_info_openfirmware(struct radeonfb_info *rinfo); +#endif #endif /* __RADEONFB_H__ */