summaryrefslogtreecommitdiff
path: root/drivers/video/fbdev/nvidia/nv_of.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-04-17 10:48:08 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-17 10:48:08 -0700
commit09df694a65895aa27cd12456ad5e45553e2520f6 (patch)
tree833e8f9a742e8f5117ac8c0ac4717a554b07c7c2 /drivers/video/fbdev/nvidia/nv_of.c
parent6ca2a88ad820af56535ed1e6936e0490cb6ec6dc (diff)
parent776bbb97e0a37fe67bd0870e5aa4845af856b872 (diff)
Merge tag 'fbdev-reorder-3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux
Pull fbdev renaming patches from Tomi Valkeinen: "Reorder drivers/video/ directory so that all fbdev drivers are now located in drivers/video/fbdev/ and the fbdev framework core files are located in drivers/video/fbdev/core/ The drivers/video/Kconfig is modified so that the DRM and the fbdev menu options are in separate submenus, instead of both being mixed in the same 'Graphics support' menu level" * tag 'fbdev-reorder-3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux: video: Kconfig: move drm and fb into separate menus fbdev: move fbdev core files to separate directory video: move fbdev to drivers/video/fbdev
Diffstat (limited to 'drivers/video/fbdev/nvidia/nv_of.c')
-rw-r--r--drivers/video/fbdev/nvidia/nv_of.c82
1 files changed, 82 insertions, 0 deletions
diff --git a/drivers/video/fbdev/nvidia/nv_of.c b/drivers/video/fbdev/nvidia/nv_of.c
new file mode 100644
index 000000000000..3bc13df4b120
--- /dev/null
+++ b/drivers/video/fbdev/nvidia/nv_of.c
@@ -0,0 +1,82 @@
+/*
+ * linux/drivers/video/nvidia/nv_of.c
+ *
+ * Copyright 2004 Antonino A. Daplas <adaplas @pol.net>
+ *
+ * Based on rivafb-i2c.c
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file COPYING in the main directory of this archive
+ * for more details.
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/delay.h>
+#include <linux/gfp.h>
+#include <linux/pci.h>
+#include <linux/fb.h>
+
+#include <asm/io.h>
+
+#include <asm/prom.h>
+#include <asm/pci-bridge.h>
+
+#include "nv_type.h"
+#include "nv_local.h"
+#include "nv_proto.h"
+
+#include "../edid.h"
+
+int nvidia_probe_of_connector(struct fb_info *info, int conn, u8 **out_edid)
+{
+ struct nvidia_par *par = info->par;
+ struct device_node *parent, *dp;
+ const unsigned char *pedid = NULL;
+ static char *propnames[] = {
+ "DFP,EDID", "LCD,EDID", "EDID", "EDID1",
+ "EDID,B", "EDID,A", NULL };
+ int i;
+
+ parent = pci_device_to_OF_node(par->pci_dev);
+ if (parent == NULL)
+ return -1;
+ if (par->twoHeads) {
+ const char *pname;
+ int len;
+
+ for (dp = NULL;
+ (dp = of_get_next_child(parent, dp)) != NULL;) {
+ pname = of_get_property(dp, "name", NULL);
+ if (!pname)
+ continue;
+ len = strlen(pname);
+ if ((pname[len-1] == 'A' && conn == 1) ||
+ (pname[len-1] == 'B' && conn == 2)) {
+ for (i = 0; propnames[i] != NULL; ++i) {
+ pedid = of_get_property(dp,
+ propnames[i], NULL);
+ if (pedid != NULL)
+ break;
+ }
+ of_node_put(dp);
+ break;
+ }
+ }
+ }
+ if (pedid == NULL) {
+ for (i = 0; propnames[i] != NULL; ++i) {
+ pedid = of_get_property(parent, propnames[i], NULL);
+ if (pedid != NULL)
+ break;
+ }
+ }
+ if (pedid) {
+ *out_edid = kmemdup(pedid, EDID_LENGTH, GFP_KERNEL);
+ if (*out_edid == NULL)
+ return -1;
+ printk(KERN_DEBUG "nvidiafb: Found OF EDID for head %d\n", conn);
+ return 0;
+ }
+ return -1;
+}