Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Mac Mini WIP:



details:   https://anonhg.NetBSD.org/src/rev/4ac6d0b78ba7
branches:  trunk
changeset: 826251:4ac6d0b78ba7
user:      macallan <macallan%NetBSD.org@localhost>
date:      Wed Aug 23 19:47:39 2017 +0000

description:
Mac Mini WIP:
- plug the external TMDS into the right CRTC when in use
- use the right output types for Mini configs
now VGA works properly ( and not just by accident ) on my Mini 2. DVI is still
garbled but at least produces output.

diffstat:

 sys/dev/pci/radeonfb.c |  61 +++++++++++++++++++++++++++++++++++++------------
 1 files changed, 46 insertions(+), 15 deletions(-)

diffs (141 lines):

diff -r 78e872ff7def -r 4ac6d0b78ba7 sys/dev/pci/radeonfb.c
--- a/sys/dev/pci/radeonfb.c    Wed Aug 23 19:21:14 2017 +0000
+++ b/sys/dev/pci/radeonfb.c    Wed Aug 23 19:47:39 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: radeonfb.c,v 1.90 2017/08/11 22:59:05 macallan Exp $ */
+/*     $NetBSD: radeonfb.c,v 1.91 2017/08/23 19:47:39 macallan Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.90 2017/08/11 22:59:05 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.91 2017/08/23 19:47:39 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -416,7 +416,7 @@
        { RADEON_R200,  {{15000, 0xa1b}, {-1, 0xa3f}}},
        { RADEON_RV250, {{15500, 0x81b}, {-1, 0x83f}}},
        { RADEON_RS300, {{0, 0}}},
-       { RADEON_RV280, {{13000, 0x400f4}, {15000, 0x400f7}}},
+       { RADEON_RV280, {{13000, 0x400f4}, {15000, 0x400f7}, {-1, 0x40111}}},
        { RADEON_R300,  {{-1, 0xb01cb}}},
        { RADEON_R350,  {{-1, 0xb01cb}}},
        { RADEON_RV350, {{15000, 0xb0155}, {-1, 0xb01cb}}},
@@ -572,9 +572,6 @@
        PRINTREG(RADEON_CRTC2_GEN_CNTL);
        PRINTREG(RADEON_DISP_OUTPUT_CNTL);
        PRINTREG(RADEON_DAC_CNTL2);
-       PRINTREG(RADEON_FP_GEN_CNTL);
-       PRINTREG(RADEON_FP2_GEN_CNTL);
-
        PRINTREG(RADEON_BIOS_4_SCRATCH);
        PRINTREG(RADEON_FP_GEN_CNTL);
        sc->sc_fp_gen_cntl = GET32(sc, RADEON_FP_GEN_CNTL);
@@ -585,7 +582,7 @@
        PRINTREG(RADEON_LVDS_GEN_CNTL);
        PRINTREG(RADEON_FP_HORZ_STRETCH);
        PRINTREG(RADEON_FP_VERT_STRETCH);
-
+       PRINTREG(RADEON_DISP_HW_DEBUG);
        if (IS_RV100(sc))
                PUT32(sc, RADEON_TMDS_PLL_CNTL, 0xa27);
 
@@ -707,11 +704,29 @@
                                      RADEON_FP_SEL_CRTC1,
                                    ~RADEON_FP_SEL_MASK);
                        }
+               case RADEON_TMDS_EXT:
+                       /* point FP2 at the CRTC this port uses */
+                       DPRINTF(("%s: plugging external TMDS into CRTC %d\n",
+                           __func__, sc->sc_ports[i].rp_number));
+                       if (IS_R300(sc)) {
+                               PATCH32(sc, RADEON_FP2_GEN_CNTL,
+                                   sc->sc_ports[i].rp_number ?
+                                     R200_FP2_SOURCE_SEL_CRTC2 :
+                                     R200_FP2_SOURCE_SEL_CRTC1,
+                                   ~R200_FP2_SOURCE_SEL_CRTC2);
+                       } else {
+                               PATCH32(sc, RADEON_FP2_GEN_CNTL,
+                                   sc->sc_ports[i].rp_number ?
+                                     RADEON_FP2_SRC_SEL_CRTC2 :
+                                     RADEON_FP2_SRC_SEL_CRTC1,
+                                   ~RADEON_FP2_SRC_SEL_CRTC2);
+                       }
                }
        }
        PRINTREG(RADEON_DAC_CNTL2);
        PRINTREG(RADEON_DISP_HW_DEBUG);
 
+       PRINTREG(RADEON_DAC_CNTL);
        /* other DAC programming */
        v = GET32(sc, RADEON_DAC_CNTL);
        v &= (RADEON_DAC_RANGE_CNTL_MASK | RADEON_DAC_BLANKING);
@@ -1023,6 +1038,9 @@
        PRINTREG(RADEON_DAC_CNTL2);
        PRINTREG(RADEON_FP_GEN_CNTL);
        PRINTREG(RADEON_FP2_GEN_CNTL);
+       PRINTREG(RADEON_TMDS_CNTL);
+       PRINTREG(RADEON_TMDS_TRANSMITTER_CNTL);
+       PRINTREG(RADEON_TMDS_PLL_CNTL);
 
        return;
 
@@ -1739,6 +1757,13 @@
                        if (conn == RADEON_CONN_NONE)
                                continue;       /* no connector */
 
+
+
+                       /* 
+                        * XXX
+                        * both Mac Mini variants have both outputs wired to 
+                        * the same connector and share the DDC lines
+                        */ 
                        if ((found > 0) &&
                            (sc->sc_ports[port].rp_ddc_type == ddc)) {
                                /* duplicate entry for same connector */
@@ -1780,18 +1805,24 @@
                    "dvi-external", &dvi_ext);
                if (dvi_ext) {
                        sc->sc_ports[0].rp_mon_type = RADEON_MT_UNKNOWN;
-                       sc->sc_ports[0].rp_ddc_type = RADEON_DDC_DVI;
-                       sc->sc_ports[0].rp_dac_type = RADEON_DAC_TVDAC;
+                       sc->sc_ports[0].rp_ddc_type = RADEON_DDC_CRT2;
+                       sc->sc_ports[0].rp_dac_type = RADEON_DAC_PRIMARY;
                        sc->sc_ports[0].rp_conn_type = RADEON_CONN_DVI_I;
-                       sc->sc_ports[0].rp_tmds_type = RADEON_TMDS_EXT;
-                       sc->sc_ports[0].rp_number = 1;
+                       sc->sc_ports[0].rp_tmds_type = RADEON_TMDS_EXT; /* output to fp2 */
+                       sc->sc_ports[0].rp_number = 0;
+                       sc->sc_ports[1].rp_mon_type = RADEON_MT_UNKNOWN;
+                       sc->sc_ports[1].rp_ddc_type = RADEON_DDC_NONE;
+                       sc->sc_ports[1].rp_dac_type = RADEON_DAC_UNKNOWN;
+                       sc->sc_ports[1].rp_conn_type = RADEON_CONN_NONE;
+                       sc->sc_ports[1].rp_tmds_type = RADEON_TMDS_UNKNOWN;
+                       sc->sc_ports[1].rp_number = 1;
                } else  if (dvi_int) {
                        sc->sc_ports[0].rp_mon_type = RADEON_MT_UNKNOWN;
-                       sc->sc_ports[0].rp_ddc_type = RADEON_DDC_DVI;
-                       sc->sc_ports[0].rp_dac_type = RADEON_DAC_TVDAC;
+                       sc->sc_ports[0].rp_ddc_type = RADEON_DDC_CRT2;
+                       sc->sc_ports[0].rp_dac_type = RADEON_DAC_PRIMARY;
                        sc->sc_ports[0].rp_conn_type = RADEON_CONN_DVI_I;
                        sc->sc_ports[0].rp_tmds_type = RADEON_TMDS_INT;
-                       sc->sc_ports[0].rp_number = 1;
+                       sc->sc_ports[0].rp_number = 0;
                } else if IS_MOBILITY(sc) {
                        /* default, port 0 = internal TMDS, port 1 = CRT */
                        sc->sc_ports[0].rp_mon_type = RADEON_MT_UNKNOWN;
@@ -2613,7 +2644,7 @@
        /* initialize the palette for every CRTC used by this display */
        for (cc = 0; cc < dp->rd_ncrtcs; cc++) {
                crtc = dp->rd_crtcs[cc].rc_number;
-               //DPRINTF(("%s: doing crtc %d %d\n", __func__, cc, crtc));
+               DPRINTF(("%s: doing crtc %d %d\n", __func__, cc, crtc));
 
                if (crtc)
                        SET32(sc, RADEON_DAC_CNTL2, RADEON_DAC2_PALETTE_ACC_CTL);



Home | Main Index | Thread Index | Old Index