Lines Matching refs:rinfo

119 static int radeon_probe_OF_head(struct radeonfb_info *rinfo, int head_no,  in radeon_probe_OF_head()  argument
126 dp = rinfo->of_node; in radeon_probe_OF_head()
130 if (rinfo->has_CRTC2) { in radeon_probe_OF_head()
149 if (mt == MT_DFP && rinfo->is_mobility) in radeon_probe_OF_head()
167 static int radeon_get_panel_info_BIOS(struct radeonfb_info *rinfo) in radeon_get_panel_info_BIOS() argument
173 if (!rinfo->bios_seg) in radeon_get_panel_info_BIOS()
176 if (!(tmp = BIOS_IN16(rinfo->fp_bios_start + 0x40))) { in radeon_get_panel_info_BIOS()
178 rinfo->panel_info.pwr_delay = 200; in radeon_get_panel_info_BIOS()
186 rinfo->panel_info.xres = BIOS_IN16(tmp + 25); in radeon_get_panel_info_BIOS()
187 rinfo->panel_info.yres = BIOS_IN16(tmp + 27); in radeon_get_panel_info_BIOS()
189 rinfo->panel_info.xres, rinfo->panel_info.yres); in radeon_get_panel_info_BIOS()
191 rinfo->panel_info.pwr_delay = BIOS_IN16(tmp + 44); in radeon_get_panel_info_BIOS()
192 pr_debug("BIOS provided panel power delay: %d\n", rinfo->panel_info.pwr_delay); in radeon_get_panel_info_BIOS()
193 if (rinfo->panel_info.pwr_delay > 2000 || rinfo->panel_info.pwr_delay <= 0) in radeon_get_panel_info_BIOS()
194 rinfo->panel_info.pwr_delay = 2000; in radeon_get_panel_info_BIOS()
199 rinfo->panel_info.ref_divider = BIOS_IN16(tmp + 46); in radeon_get_panel_info_BIOS()
200 rinfo->panel_info.post_divider = BIOS_IN8(tmp + 48); in radeon_get_panel_info_BIOS()
201 rinfo->panel_info.fbk_divider = BIOS_IN16(tmp + 49); in radeon_get_panel_info_BIOS()
202 if (rinfo->panel_info.ref_divider != 0 && in radeon_get_panel_info_BIOS()
203 rinfo->panel_info.fbk_divider > 3) { in radeon_get_panel_info_BIOS()
204 rinfo->panel_info.use_bios_dividers = 1; in radeon_get_panel_info_BIOS()
206 pr_debug("ref_divider = %x\n", rinfo->panel_info.ref_divider); in radeon_get_panel_info_BIOS()
207 pr_debug("post_divider = %x\n", rinfo->panel_info.post_divider); in radeon_get_panel_info_BIOS()
208 pr_debug("fbk_divider = %x\n", rinfo->panel_info.fbk_divider); in radeon_get_panel_info_BIOS()
216 if ((BIOS_IN16(tmp0) == rinfo->panel_info.xres) && in radeon_get_panel_info_BIOS()
217 (BIOS_IN16(tmp0+2) == rinfo->panel_info.yres)) { in radeon_get_panel_info_BIOS()
218 rinfo->panel_info.hblank = (BIOS_IN16(tmp0+17) - BIOS_IN16(tmp0+19)) * 8; in radeon_get_panel_info_BIOS()
219 rinfo->panel_info.hOver_plus = ((BIOS_IN16(tmp0+21) - in radeon_get_panel_info_BIOS()
221 rinfo->panel_info.hSync_width = BIOS_IN8(tmp0+23) * 8; in radeon_get_panel_info_BIOS()
222 rinfo->panel_info.vblank = BIOS_IN16(tmp0+24) - BIOS_IN16(tmp0+26); in radeon_get_panel_info_BIOS()
223 rinfo->panel_info.vOver_plus = (BIOS_IN16(tmp0+28) & 0x7ff) - BIOS_IN16(tmp0+26); in radeon_get_panel_info_BIOS()
224 rinfo->panel_info.vSync_width = (BIOS_IN16(tmp0+28) & 0xf800) >> 11; in radeon_get_panel_info_BIOS()
225 rinfo->panel_info.clock = BIOS_IN16(tmp0+9); in radeon_get_panel_info_BIOS()
229 rinfo->panel_info.hAct_high = 1; in radeon_get_panel_info_BIOS()
230 rinfo->panel_info.vAct_high = 1; in radeon_get_panel_info_BIOS()
232 rinfo->panel_info.valid = 1; in radeon_get_panel_info_BIOS()
235 pr_debug(" hblank: %d\n", rinfo->panel_info.hblank); in radeon_get_panel_info_BIOS()
236 pr_debug(" hOver_plus: %d\n", rinfo->panel_info.hOver_plus); in radeon_get_panel_info_BIOS()
237 pr_debug(" hSync_width: %d\n", rinfo->panel_info.hSync_width); in radeon_get_panel_info_BIOS()
238 pr_debug(" vblank: %d\n", rinfo->panel_info.vblank); in radeon_get_panel_info_BIOS()
239 pr_debug(" vOver_plus: %d\n", rinfo->panel_info.vOver_plus); in radeon_get_panel_info_BIOS()
240 pr_debug(" vSync_width: %d\n", rinfo->panel_info.vSync_width); in radeon_get_panel_info_BIOS()
241 pr_debug(" clock: %d\n", rinfo->panel_info.clock); in radeon_get_panel_info_BIOS()
255 static void radeon_parse_connector_info(struct radeonfb_info *rinfo) in radeon_parse_connector_info() argument
265 if (!rinfo->bios_seg) in radeon_parse_connector_info()
268 offset = BIOS_IN16(rinfo->fp_bios_start + 0x50); in radeon_parse_connector_info()
301 static int radeon_crt_is_connected(struct radeonfb_info *rinfo, int is_crt_dac) in radeon_crt_is_connected() argument
336 if ((rinfo->family == CHIP_FAMILY_RV250) || in radeon_crt_is_connected()
337 (rinfo->family == CHIP_FAMILY_RV280)) in radeon_crt_is_connected()
373 static int radeon_parse_monitor_layout(struct radeonfb_info *rinfo, in radeon_parse_monitor_layout() argument
415 rinfo->mon1_type = MT_CRT; in radeon_parse_monitor_layout()
417 rinfo->mon1_type = MT_DFP; in radeon_parse_monitor_layout()
419 rinfo->mon1_type = MT_LCD; in radeon_parse_monitor_layout()
422 rinfo->mon2_type = MT_CRT; in radeon_parse_monitor_layout()
424 rinfo->mon2_type = MT_DFP; in radeon_parse_monitor_layout()
426 rinfo->mon2_type = MT_LCD; in radeon_parse_monitor_layout()
437 void radeon_probe_screens(struct radeonfb_info *rinfo, in radeon_probe_screens() argument
445 radeon_parse_connector_info(rinfo); in radeon_probe_screens()
447 if (radeon_parse_monitor_layout(rinfo, monitor_layout)) { in radeon_probe_screens()
459 if (rinfo->mon1_type != MT_NONE) in radeon_probe_screens()
460 if (!radeon_probe_i2c_connector(rinfo, ddc_dvi, &rinfo->mon1_EDID)) { in radeon_probe_screens()
461 radeon_probe_i2c_connector(rinfo, ddc_crt2, &rinfo->mon1_EDID); in radeon_probe_screens()
464 if (rinfo->mon2_type != MT_NONE) in radeon_probe_screens()
465 if (!radeon_probe_i2c_connector(rinfo, ddc_vga, &rinfo->mon2_EDID) && in radeon_probe_screens()
467 radeon_probe_i2c_connector(rinfo, ddc_crt2, &rinfo->mon2_EDID); in radeon_probe_screens()
470 if (rinfo->mon1_type == MT_NONE) { in radeon_probe_screens()
471 if (rinfo->mon2_type != MT_NONE) { in radeon_probe_screens()
472 rinfo->mon1_type = rinfo->mon2_type; in radeon_probe_screens()
473 rinfo->mon1_EDID = rinfo->mon2_EDID; in radeon_probe_screens()
475 rinfo->mon1_type = MT_CRT; in radeon_probe_screens()
478 rinfo->mon2_type = MT_NONE; in radeon_probe_screens()
479 rinfo->mon2_EDID = NULL; in radeon_probe_screens()
494 radeon_probe_i2c_connector(rinfo, i + 1, &EDIDs[i]); in radeon_probe_screens()
500 if (!rinfo->has_CRTC2) { in radeon_probe_screens()
502 if (rinfo->mon1_type == MT_NONE) in radeon_probe_screens()
503 rinfo->mon1_type = radeon_probe_OF_head(rinfo, 0, in radeon_probe_screens()
504 &rinfo->mon1_EDID); in radeon_probe_screens()
507 if (rinfo->mon1_type == MT_NONE) in radeon_probe_screens()
508 rinfo->mon1_type = in radeon_probe_screens()
509 radeon_probe_i2c_connector(rinfo, ddc_dvi, in radeon_probe_screens()
510 &rinfo->mon1_EDID); in radeon_probe_screens()
511 if (rinfo->mon1_type == MT_NONE) in radeon_probe_screens()
512 rinfo->mon1_type = in radeon_probe_screens()
513 radeon_probe_i2c_connector(rinfo, ddc_vga, in radeon_probe_screens()
514 &rinfo->mon1_EDID); in radeon_probe_screens()
515 if (rinfo->mon1_type == MT_NONE) in radeon_probe_screens()
516 rinfo->mon1_type = in radeon_probe_screens()
517 radeon_probe_i2c_connector(rinfo, ddc_crt2, in radeon_probe_screens()
518 &rinfo->mon1_EDID); in radeon_probe_screens()
520 if (rinfo->mon1_type == MT_NONE) in radeon_probe_screens()
521 rinfo->mon1_type = MT_CRT; in radeon_probe_screens()
528 if (rinfo->bios_seg && in radeon_probe_screens()
529 (tmp = BIOS_IN16(rinfo->fp_bios_start + 0x50))) { in radeon_probe_screens()
537 rinfo->reversed_DAC = 1; in radeon_probe_screens()
541 rinfo->reversed_TMDS = 1; in radeon_probe_screens()
551 if (rinfo->mon1_type == MT_NONE) in radeon_probe_screens()
552 rinfo->mon1_type = radeon_probe_OF_head(rinfo, 0, in radeon_probe_screens()
553 &rinfo->mon1_EDID); in radeon_probe_screens()
556 if (rinfo->mon1_type == MT_NONE) in radeon_probe_screens()
557 rinfo->mon1_type = radeon_probe_i2c_connector(rinfo, ddc_dvi, in radeon_probe_screens()
558 &rinfo->mon1_EDID); in radeon_probe_screens()
559 if (rinfo->mon1_type == MT_NONE) { in radeon_probe_screens()
560 rinfo->mon1_type = radeon_probe_i2c_connector(rinfo, ddc_crt2, in radeon_probe_screens()
561 &rinfo->mon1_EDID); in radeon_probe_screens()
562 if (rinfo->mon1_type != MT_NONE) in radeon_probe_screens()
566 if (rinfo->mon1_type == MT_NONE && rinfo->is_mobility && in radeon_probe_screens()
567 ((rinfo->bios_seg && (INREG(BIOS_4_SCRATCH) & 4)) in radeon_probe_screens()
569 rinfo->mon1_type = MT_LCD; in radeon_probe_screens()
572 if (rinfo->mon1_type == MT_NONE) in radeon_probe_screens()
573 rinfo->mon1_type = radeon_crt_is_connected(rinfo, rinfo->reversed_DAC); in radeon_probe_screens()
579 if (rinfo->mon2_type == MT_NONE) in radeon_probe_screens()
580 rinfo->mon2_type = radeon_probe_OF_head(rinfo, 1, in radeon_probe_screens()
581 &rinfo->mon2_EDID); in radeon_probe_screens()
584 if (rinfo->mon2_type == MT_NONE) in radeon_probe_screens()
585 rinfo->mon2_type = radeon_probe_i2c_connector(rinfo, ddc_vga, in radeon_probe_screens()
586 &rinfo->mon2_EDID); in radeon_probe_screens()
587 if (rinfo->mon2_type == MT_NONE && !ddc_crt2_used) in radeon_probe_screens()
588 rinfo->mon2_type = radeon_probe_i2c_connector(rinfo, ddc_crt2, in radeon_probe_screens()
589 &rinfo->mon2_EDID); in radeon_probe_screens()
591 if (rinfo->mon2_type == MT_NONE) in radeon_probe_screens()
592 rinfo->mon2_type = radeon_crt_is_connected(rinfo, !rinfo->reversed_DAC); in radeon_probe_screens()
599 if (rinfo->mon1_type == MT_NONE) { in radeon_probe_screens()
600 if (rinfo->mon2_type != MT_NONE) { in radeon_probe_screens()
601 rinfo->mon1_type = rinfo->mon2_type; in radeon_probe_screens()
602 rinfo->mon1_EDID = rinfo->mon2_EDID; in radeon_probe_screens()
604 rinfo->mon1_type = MT_CRT; in radeon_probe_screens()
605 rinfo->mon2_type = MT_NONE; in radeon_probe_screens()
606 rinfo->mon2_EDID = NULL; in radeon_probe_screens()
612 if (rinfo->reversed_TMDS) { in radeon_probe_screens()
614 if (rinfo->mon1_type == MT_DFP || rinfo->mon2_type == MT_DFP) { in radeon_probe_screens()
615 int tmp_type = rinfo->mon1_type; in radeon_probe_screens()
616 u8 *tmp_EDID = rinfo->mon1_EDID; in radeon_probe_screens()
617 rinfo->mon1_type = rinfo->mon2_type; in radeon_probe_screens()
618 rinfo->mon1_EDID = rinfo->mon2_EDID; in radeon_probe_screens()
619 rinfo->mon2_type = tmp_type; in radeon_probe_screens()
620 rinfo->mon2_EDID = tmp_EDID; in radeon_probe_screens()
621 if (rinfo->mon1_type == MT_CRT || rinfo->mon2_type == MT_CRT) in radeon_probe_screens()
622 rinfo->reversed_DAC ^= 1; in radeon_probe_screens()
627 kfree(rinfo->mon1_EDID); in radeon_probe_screens()
628 rinfo->mon1_EDID = NULL; in radeon_probe_screens()
629 kfree(rinfo->mon2_EDID); in radeon_probe_screens()
630 rinfo->mon2_EDID = NULL; in radeon_probe_screens()
635 radeon_get_mon_name(rinfo->mon1_type)); in radeon_probe_screens()
636 if (rinfo->mon1_EDID) in radeon_probe_screens()
638 if (!rinfo->has_CRTC2) in radeon_probe_screens()
641 radeon_get_mon_name(rinfo->mon2_type)); in radeon_probe_screens()
642 if (rinfo->mon2_EDID) in radeon_probe_screens()
653 static void radeon_fixup_panel_info(struct radeonfb_info *rinfo) in radeon_fixup_panel_info() argument
660 if (!rinfo->panel_info.use_bios_dividers && rinfo->mon1_type == MT_LCD in radeon_fixup_panel_info()
661 && rinfo->is_mobility) { in radeon_fixup_panel_info()
665 radeon_pll_errata_after_index(rinfo); in radeon_fixup_panel_info()
667 rinfo->panel_info.ref_divider = rinfo->pll.ref_div; in radeon_fixup_panel_info()
668 rinfo->panel_info.fbk_divider = ppll_divn & 0x7ff; in radeon_fixup_panel_info()
669 rinfo->panel_info.post_divider = (ppll_divn >> 16) & 0x7; in radeon_fixup_panel_info()
670 rinfo->panel_info.use_bios_dividers = 1; in radeon_fixup_panel_info()
674 rinfo->panel_info.fbk_divider | in radeon_fixup_panel_info()
675 (rinfo->panel_info.post_divider << 16), in radeon_fixup_panel_info()
686 static void radeon_var_to_panel_info(struct radeonfb_info *rinfo, struct fb_var_screeninfo *var) in radeon_var_to_panel_info() argument
688 rinfo->panel_info.xres = var->xres; in radeon_var_to_panel_info()
689 rinfo->panel_info.yres = var->yres; in radeon_var_to_panel_info()
690 rinfo->panel_info.clock = 100000000 / var->pixclock; in radeon_var_to_panel_info()
691 rinfo->panel_info.hOver_plus = var->right_margin; in radeon_var_to_panel_info()
692 rinfo->panel_info.hSync_width = var->hsync_len; in radeon_var_to_panel_info()
693 rinfo->panel_info.hblank = var->left_margin + in radeon_var_to_panel_info()
695 rinfo->panel_info.vOver_plus = var->lower_margin; in radeon_var_to_panel_info()
696 rinfo->panel_info.vSync_width = var->vsync_len; in radeon_var_to_panel_info()
697 rinfo->panel_info.vblank = var->upper_margin + in radeon_var_to_panel_info()
699 rinfo->panel_info.hAct_high = in radeon_var_to_panel_info()
701 rinfo->panel_info.vAct_high = in radeon_var_to_panel_info()
703 rinfo->panel_info.valid = 1; in radeon_var_to_panel_info()
709 rinfo->panel_info.pwr_delay = 200; in radeon_var_to_panel_info()
755 void radeon_check_modes(struct radeonfb_info *rinfo, const char *mode_option) in radeon_check_modes() argument
757 struct fb_info * info = rinfo->info; in radeon_check_modes()
769 if (rinfo->mon1_type == MT_LCD) in radeon_check_modes()
770 radeon_get_panel_info_BIOS(rinfo); in radeon_check_modes()
777 if (!rinfo->panel_info.use_bios_dividers && rinfo->mon1_type != MT_CRT in radeon_check_modes()
778 && rinfo->mon1_EDID) { in radeon_check_modes()
781 if (fb_parse_edid(rinfo->mon1_EDID, &var) == 0) { in radeon_check_modes()
782 if (var.xres >= rinfo->panel_info.xres && in radeon_check_modes()
783 var.yres >= rinfo->panel_info.yres) in radeon_check_modes()
784 radeon_var_to_panel_info(rinfo, &var); in radeon_check_modes()
791 radeon_fixup_panel_info(rinfo); in radeon_check_modes()
797 if (rinfo->mon1_type != MT_CRT && rinfo->panel_info.valid) { in radeon_check_modes()
801 var->xres = rinfo->panel_info.xres; in radeon_check_modes()
802 var->yres = rinfo->panel_info.yres; in radeon_check_modes()
803 var->xres_virtual = rinfo->panel_info.xres; in radeon_check_modes()
804 var->yres_virtual = rinfo->panel_info.yres; in radeon_check_modes()
807 var->pixclock = 100000000 / rinfo->panel_info.clock; in radeon_check_modes()
808 var->left_margin = (rinfo->panel_info.hblank - rinfo->panel_info.hOver_plus in radeon_check_modes()
809 - rinfo->panel_info.hSync_width); in radeon_check_modes()
810 var->right_margin = rinfo->panel_info.hOver_plus; in radeon_check_modes()
811 var->upper_margin = (rinfo->panel_info.vblank - rinfo->panel_info.vOver_plus in radeon_check_modes()
812 - rinfo->panel_info.vSync_width); in radeon_check_modes()
813 var->lower_margin = rinfo->panel_info.vOver_plus; in radeon_check_modes()
814 var->hsync_len = rinfo->panel_info.hSync_width; in radeon_check_modes()
815 var->vsync_len = rinfo->panel_info.vSync_width; in radeon_check_modes()
817 if (rinfo->panel_info.hAct_high) in radeon_check_modes()
819 if (rinfo->panel_info.vAct_high) in radeon_check_modes()
828 if (rinfo->mon1_EDID) { in radeon_check_modes()
829 fb_edid_to_monspecs(rinfo->mon1_EDID, &info->monspecs); in radeon_check_modes()
833 rinfo->mon1_modedb = info->monspecs.modedb; in radeon_check_modes()
834 rinfo->mon1_dbsize = info->monspecs.modedb_len; in radeon_check_modes()
843 if (rinfo->mon1_type != MT_CRT && !rinfo->panel_info.valid) { in radeon_check_modes()
849 if (rinfo->panel_info.xres == 0 || rinfo->panel_info.yres == 0) { in radeon_check_modes()
851 rinfo->panel_info.xres = ((tmp >> HORZ_PANEL_SHIFT) + 1) * 8; in radeon_check_modes()
853 rinfo->panel_info.yres = (tmp >> VERT_PANEL_SHIFT) + 1; in radeon_check_modes()
855 if (rinfo->panel_info.xres == 0 || rinfo->panel_info.yres == 0) { in radeon_check_modes()
857 rinfo->mon1_type = MT_CRT; in radeon_check_modes()
861 rinfo->panel_info.xres, rinfo->panel_info.yres); in radeon_check_modes()
862 modedb = rinfo->mon1_modedb; in radeon_check_modes()
863 dbsize = rinfo->mon1_dbsize; in radeon_check_modes()
864 snprintf(modename, 31, "%dx%d", rinfo->panel_info.xres, rinfo->panel_info.yres); in radeon_check_modes()
868 rinfo->mon1_type = MT_CRT; in radeon_check_modes()
872 radeon_var_to_panel_info(rinfo, &info->var); in radeon_check_modes()
973 int radeon_match_mode(struct radeonfb_info *rinfo, in radeon_match_mode() argument
987 if (rinfo->mon1_modedb) { in radeon_match_mode()
988 db = rinfo->mon1_modedb; in radeon_match_mode()
989 dbsize = rinfo->mon1_dbsize; in radeon_match_mode()
994 has_rmx = rinfo->mon1_type == MT_LCD || rinfo->mon1_type == MT_DFP; in radeon_match_mode()
1007 if (has_rmx == 0 && rinfo->mon1_modedb) in radeon_match_mode()
1008 if (fb_validate_mode((struct fb_var_screeninfo *)src, rinfo->info)) in radeon_match_mode()