Port-sparc64 archive

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

Adding static EDID data to autoconf



Hi,

I have a Naturetech Mesostation-999 with an XVR-100 clone and a 1440x900
screen.  It doesn't provide any EDID [*], so I'd like to add static EDID
in the same way that macppc does (thanks to Michael for the hint!).  The
patch is attached.  However, autoconf.c now has a number of places that
we're doing fixups for various machines and it seems better to move those
fixups somewhere else.  I wondered about moving them to a separate file or
(easier) to a new set of functions in autoconf.c.  Any thoughts on this,
or are the fixups fine as they are?

Regards,

Julian

PS.  The change to radeonfb.c is because we currently apply the same static
EDID to both ports.  This laptop has 2 ports, so the EDID should only be
applied to port 1.

[*] Or I can't work out how to get EDID data.  I've checked all the GPIO's
that we have code for in our driver and also the GPIO's that are in the
DRM code (and aren't in our driver).
Index: src/sys/arch/sparc64/conf/files.sparc64
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc64/conf/files.sparc64,v
retrieving revision 1.158
diff -u -r1.158 files.sparc64
--- src/sys/arch/sparc64/conf/files.sparc64	27 Jan 2019 02:08:38 -0000	1.158
+++ src/sys/arch/sparc64/conf/files.sparc64	15 Jul 2020 19:14:00 -0000
@@ -253,6 +253,7 @@
 file	arch/sparc64/sparc64/machdep.c
 file	arch/sparc64/sparc64/process_machdep.c
 file	arch/sparc64/sparc64/procfs_machdep.c	procfs
+file	arch/sparc64/sparc64/static_edid.c
 file	arch/sparc/sparc/openprom.c
 file	arch/sparc/sparc/openfirm.c
 file	arch/sparc64/sparc64/ofw_machdep.c
Index: src/sys/arch/sparc64/sparc64/autoconf.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc64/sparc64/autoconf.c,v
retrieving revision 1.215
diff -u -r1.215 autoconf.c
--- src/sys/arch/sparc64/sparc64/autoconf.c	5 Jan 2019 15:46:02 -0000	1.215
+++ src/sys/arch/sparc64/sparc64/autoconf.c	15 Jul 2020 19:14:00 -0000
@@ -93,6 +93,7 @@
 #include <machine/bootinfo.h>
 #include <sparc64/sparc64/cache.h>
 #include <sparc64/sparc64/timerreg.h>
+#include <sparc64/sparc64/static_edid.h>
 #include <sparc64/dev/cbusvar.h>
 
 #include <dev/ata/atavar.h>
@@ -1406,7 +1407,18 @@
 			if (OF_getprop(node, "width", &width, sizeof(width))
 			    != 4) {
 				instance = OF_open(name);
+			}
+		}
 #endif
+		if (!strcmp(machine_model, "NATE,Meso-999")) {
+			prop_data_t edid;
+
+			DPRINTF(ACDB_PROBE, ("\nAdding EDID for Meso-999 "));
+			edid = prop_data_create_data(edid_meso999,
+			    sizeof(edid_meso999));
+			prop_dictionary_set(dict, "EDID:1", edid);
+			prop_object_release(edid);
+		}
 	}
 
 	/* Hardware specific device properties */
Index: src/sys/dev/pci/radeonfb.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/radeonfb.c,v
retrieving revision 1.104.4.1
diff -u -r1.104.4.1 radeonfb.c
--- src/sys/dev/pci/radeonfb.c	18 Aug 2019 09:58:49 -0000	1.104.4.1
+++ src/sys/dev/pci/radeonfb.c	15 Jul 2020 19:14:00 -0000
@@ -1953,7 +1953,7 @@
 	}
 
 	for (i = 0; i < 2; i++) {
-		char	edid[128];
+		char	edid[128], edid_port_str[7] = "EDID:";
 		uint8_t	ddc;
 		struct edid_info *eip = &sc->sc_ports[i].rp_edid;
 		prop_data_t edid_data;
@@ -1966,10 +1966,17 @@
 		DPRINTF(("   crtc = %d\n", sc->sc_ports[i].rp_number));
 
 		sc->sc_ports[i].rp_edid_valid = 0;
-		/* first look for static EDID data */
-		if ((edid_data = prop_dictionary_get(device_properties(
-		      sc->sc_dev), "EDID")) != NULL) {
-
+		/*
+		 * First look for static EDID data
+		 * Try "EDID:port" then "EDID"
+		 */
+		snprintf(&edid_port_str[5], 2, "%d", i);
+		edid_data = prop_dictionary_get(device_properties(
+		    sc->sc_dev), edid_port_str);
+		if (edid_data == NULL)
+			edid_data = prop_dictionary_get(device_properties(
+			      sc->sc_dev), "EDID");
+		if (edid_data != NULL) {
 			aprint_debug_dev(sc->sc_dev, "using static EDID\n");
 			memcpy(edid, prop_data_data_nocopy(edid_data), 128);
 			if (edid_parse(edid, eip) == 0) {
--- /dev/null	2020-02-15 10:53:38.456000000 +0100
+++ src/sys/arch/sparc64/sparc64/static_edid.c	2020-07-15 21:11:23.949988864 +0200
@@ -0,0 +1,58 @@
+/*	$NetBSD$ */
+
+/*-
+ * Copyright (c) 2020 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Julian Coleman.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD$");
+#include <sys/param.h>
+
+/* EDID blocks for some known hardware that doesn't provide its own */
+
+/*
+ * Naturetech Mesostation 999
+ * Based on VESA DMT 1E, but with slight adjustment to the horizontal timing
+ */
+uint8_t edid_meso999[128] = {
+/* 00 */	0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
+/* 08 */	0x38, 0x34, 0x99, 0x09, 0x00, 0x00, 0x00, 0x00,
+/* 10 */	0xff, 0x0f, 0x01, 0x03, 0x68, 0x25, 0x17, 0x78,
+/* 18 */	0x2a, 0x3c, 0x40, 0x9c, 0x56, 0x4d, 0x98, 0x26,
+/* 20 */	0x16, 0x50, 0x54, 0xa5, 0x4a, 0x80, 0x81, 0x40,
+/* 28 */	0x81, 0x80, 0x81, 0x8f, 0x95, 0x00, 0x01, 0x01,
+/* 30 */	0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0xab, 0x22,
+/* 38 */	0xa0, 0xa0, 0x50, 0x84, 0x1a, 0x30, 0x38, 0x20,
+/* 40 */	0x36, 0x00, 0x9a, 0x01, 0x11, 0x00, 0x00, 0x1a,
+/* 48 */	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 50 */	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* 58 */	0x00, 0x01, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x4e,
+/* 60 */	0x41, 0x74, 0x75, 0x72, 0x65, 0x74, 0x65, 0x63,
+/* 68 */	0x68, 0x0a, 0x20, 0x20, 0x00, 0x00, 0x00, 0xfe,
+/* 70 */	0x00, 0x4d, 0x65, 0x73, 0x6f, 0x20, 0x39, 0x39,
+/* 78 */	0x39, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x00, 0xed
+};
--- /dev/null	2020-02-15 10:53:38.456000000 +0100
+++ src/sys/arch/sparc64/sparc64/static_edid.h	2020-07-15 21:11:53.329988846 +0200
@@ -0,0 +1,36 @@
+/*	$NetBSD$ */
+
+/*-
+ * Copyright (c) 2020 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Julian Coleman.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef STATIC_EDID_H
+#define STATIC_EDID_H
+
+extern uint8_t edid_meso999[128];
+
+#endif /* STATIC_EDID_H */


Home | Main Index | Thread Index | Old Index