3 #include <linux/slab.h>
13 .red = { .length = 8 },
14 .green = { .length = 8 },
15 .blue = { .length = 8 },
29 static char *radeon_get_mon_name(
int type)
58 #if defined(CONFIG_PPC_OF) || defined(CONFIG_SPARC)
68 static char *propnames[] = {
"DFP,EDID",
"LCD,EDID",
"EDID",
69 "EDID1",
"EDID2",
NULL };
75 pr_debug(
"analyzing OF properties...\n");
85 else if (!
strcmp(pmt,
"CRT"))
88 if (
strcmp(pmt,
"NONE") != 0)
94 for (i = 0; propnames[
i] !=
NULL; ++
i) {
103 if (pedid ==
NULL && dp->
parent && (hdno != -1))
105 (hdno == 0) ?
"EDID1" :
"EDID2",
NULL);
106 if (pedid ==
NULL && dp->
parent && (hdno == 0))
141 pr_debug(
"head: %s (letter: %c, head_no: %d)\n",
142 pname, pname[len-1], head_no);
143 if (pname[len-1] ==
'A' && head_no == 0) {
144 int mt = radeon_parse_montype_prop(dp, out_EDID, 0);
151 }
else if (pname[len-1] ==
'B' && head_no == 1)
152 return radeon_parse_montype_prop(dp, out_EDID, 1);
159 return radeon_parse_montype_prop(dp, out_EDID, -1);
168 unsigned long tmp, tmp0;
176 printk(
KERN_ERR "radeonfb: Failed to detect DFP panel info using BIOS\n");
184 printk(
"radeonfb: panel ID string: %s\n", stmp);
187 printk(
"radeonfb: detected LVDS panel size from BIOS: %dx%d\n",
209 pr_debug(
"Scanning BIOS table ...\n");
210 for(i=0; i<32; i++) {
233 pr_debug(
"Found panel in BIOS table:\n");
245 pr_debug(
"Didn't find panel in BIOS table !\n");
258 static char* __conn_type_table[16] = {
259 "NONE",
"Proprietary",
"CRT",
"DVI-I",
"DVI-D",
"Unknown",
"Unknown",
260 "Unknown",
"Unknown",
"Unknown",
"Unknown",
"Unknown",
"Unknown",
261 "Unknown",
"Unknown",
"Unknown"
277 pr_debug(
"%d chips in connector info\n", chips);
278 for (i = 0; i <
chips; i++) {
280 connectors = tmp & 0x0f;
281 pr_debug(
" - chip %d has %d connectors\n", tmp >> 4, connectors);
282 for (conn = 0; ; conn++) {
287 type = (tmp >> 12) & 0x0f;
288 pr_debug(
" * connector %d of type %d (%s) : %04x\n",
289 conn, type, __conn_type_table[type], tmp);
308 unsigned long ulOrigVCLK_ECP_CNTL;
309 unsigned long ulOrigDAC_CNTL;
310 unsigned long ulOrigDAC_EXT_CNTL;
311 unsigned long ulOrigCRTC_EXT_CNTL;
312 unsigned long ulData;
313 unsigned long ulMask;
317 ulData = ulOrigVCLK_ECP_CNTL;
325 ulData = ulOrigCRTC_EXT_CNTL;
330 ulData = ulOrigDAC_EXT_CNTL;
344 ulData = ulOrigDAC_CNTL;
356 ulData = ulOrigVCLK_ECP_CNTL;
357 ulMask = 0xFFFFFFFF
L;
373 const char *monitor_layout)
376 int i = 0, second = 0;
413 if (
strcmp(s1,
"CRT") == 0)
415 else if (
strcmp(s1,
"TMDS") == 0)
417 else if (
strcmp(s1,
"LVDS") == 0)
420 if (
strcmp(s2,
"CRT") == 0)
422 else if (
strcmp(s2,
"TMDS") == 0)
424 else if (
strcmp(s2,
"LVDS") == 0)
437 const char *monitor_layout,
int ignore_edid)
439 #ifdef CONFIG_FB_RADEON_I2C
440 int ddc_crt2_used = 0;
444 radeon_parse_connector_info(rinfo);
446 if (radeon_parse_monitor_layout(rinfo, monitor_layout)) {
455 pr_debug(
"Using specified monitor layout: %s", monitor_layout);
456 #ifdef CONFIG_FB_RADEON_I2C
475 printk(
KERN_INFO "radeonfb: No valid monitor, assuming CRT on first port\n");
485 pr_debug(
"Starting monitor auto detection...\n");
487 #if defined(DEBUG) && defined(CONFIG_FB_RADEON_I2C)
493 for (i = 0; i < 4; i++)
502 #if defined(CONFIG_PPC_OF) || defined(CONFIG_SPARC)
504 rinfo->
mon1_type = radeon_probe_OF_head(rinfo, 0,
507 #ifdef CONFIG_FB_RADEON_I2C
531 for (i = 1; i < 4; i++) {
537 if ((!(tmp0 & 0x01)) && (((tmp0 >> 8) & 0x0f) ==
ddc_dvi)) {
541 if ((((tmp0 >> 8) & 0x0f) ==
ddc_dvi) && ((tmp0 >> 4) & 0x01)) {
551 #if defined(CONFIG_PPC_OF) || defined(CONFIG_SPARC)
553 rinfo->
mon1_type = radeon_probe_OF_head(rinfo, 0,
556 #ifdef CONFIG_FB_RADEON_I2C
571 printk(
"Non-DDC laptop panel detected\n");
579 #if defined(CONFIG_PPC_OF) || defined(CONFIG_SPARC)
581 rinfo->
mon2_type = radeon_probe_OF_head(rinfo, 1,
584 #ifdef CONFIG_FB_RADEON_I2C
654 static void radeon_fixup_panel_info(
struct radeonfb_info *rinfo)
666 radeon_pll_errata_after_index(rinfo);
669 rinfo->
panel_info.fbk_divider = ppll_divn & 0x7ff;
670 rinfo->
panel_info.post_divider = (ppll_divn >> 16) & 0x7;
733 #ifdef CONFIG_PPC_PSERIES
734 static int is_powerblade(
const char *model)
745 rc =
memcmp(model, cp,
min(len, l)) == 0;
759 int has_default_mode = 0;
764 info->
var = radeonfb_default_var;
771 radeon_get_panel_info_BIOS(rinfo);
781 pr_debug(
"Parsing EDID data for panel info\n");
785 radeon_var_to_panel_info(rinfo, &var);
792 radeon_fixup_panel_info(rinfo);
801 pr_debug(
"Setting up default mode based on panel info\n");
823 has_default_mode = 1;
849 pr_debug(
"Guessing panel info...\n");
867 modedb, dbsize,
NULL, 8) == 0) {
872 has_default_mode = 1;
873 radeon_var_to_panel_info(rinfo, &info->
var);
884 has_default_mode = 1;
887 #ifdef CONFIG_PPC_PSERIES
888 if (!has_default_mode && (
889 is_powerblade(
"IBM,8842") ||
890 is_powerblade(
"IBM,8844") ||
891 is_powerblade(
"IBM,7998") ||
892 is_powerblade(
"IBM,0792") ||
893 is_powerblade(
"IBM,0793")
895 printk(
"Falling back to 800x600 on JSxx hardware\n");
899 has_default_mode = 1;
906 if (!has_default_mode && info->
monspecs.modedb !=
NULL) {
922 modedb = &specs->
modedb[0];
924 if (modedb !=
NULL) {
925 info->
var.bits_per_pixel = 8;
926 radeon_videomode_to_var(&info->
var, modedb);
927 has_default_mode = 1;
958 distance += (mode->
xres - var->
xres)/2;
980 int has_rmx, native_db = 0;
1016 for (i = 0; i < dbsize; i++) {
1019 if (db[i].yres < src->
yres)
1021 if (db[i].xres < src->
xres)
1023 d = radeon_compare_modes(src, &db[i]);
1034 if (native_db && has_rmx) {
1042 if (candidate !=
NULL) {
1043 radeon_videomode_to_var(dest, candidate);