diff options
Diffstat (limited to 'drivers/video/nvidia/nv_of.c')
-rw-r--r-- | drivers/video/nvidia/nv_of.c | 64 |
1 files changed, 45 insertions, 19 deletions
diff --git a/drivers/video/nvidia/nv_of.c b/drivers/video/nvidia/nv_of.c index 4fa2cf9a8af2..7a03d040b1a3 100644 --- a/drivers/video/nvidia/nv_of.c +++ b/drivers/video/nvidia/nv_of.c | |||
@@ -27,34 +27,60 @@ | |||
27 | #include "nv_local.h" | 27 | #include "nv_local.h" |
28 | #include "nv_proto.h" | 28 | #include "nv_proto.h" |
29 | 29 | ||
30 | void nvidia_create_i2c_busses(struct nvidia_par *par) {} | 30 | #include "../edid.h" |
31 | void nvidia_delete_i2c_busses(struct nvidia_par *par) {} | ||
32 | 31 | ||
33 | int nvidia_probe_i2c_connector(struct fb_info *info, int conn, u8 **out_edid) | 32 | int nvidia_probe_of_connector(struct fb_info *info, int conn, u8 **out_edid) |
34 | { | 33 | { |
35 | struct nvidia_par *par = info->par; | 34 | struct nvidia_par *par = info->par; |
36 | struct device_node *dp; | 35 | struct device_node *parent, *dp; |
37 | unsigned char *pedid = NULL; | 36 | unsigned char *pedid = NULL; |
38 | unsigned char *disptype = NULL; | ||
39 | static char *propnames[] = { | 37 | static char *propnames[] = { |
40 | "DFP,EDID", "LCD,EDID", "EDID", "EDID1", "EDID,B", "EDID,A", NULL }; | 38 | "DFP,EDID", "LCD,EDID", "EDID", "EDID1", |
39 | "EDID,B", "EDID,A", NULL }; | ||
41 | int i; | 40 | int i; |
42 | 41 | ||
43 | dp = pci_device_to_OF_node(par->pci_dev); | 42 | parent = pci_device_to_OF_node(par->pci_dev); |
44 | for (; dp != NULL; dp = dp->child) { | 43 | if (parent == NULL) |
45 | disptype = (unsigned char *)get_property(dp, "display-type", NULL); | 44 | return -1; |
46 | if (disptype == NULL) | 45 | if (par->twoHeads) { |
47 | continue; | 46 | char *pname; |
48 | if (strncmp(disptype, "LCD", 3) != 0) | 47 | int len; |
49 | continue; | 48 | |
49 | for (dp = NULL; | ||
50 | (dp = of_get_next_child(parent, dp)) != NULL;) { | ||
51 | pname = (char *)get_property(dp, "name", NULL); | ||
52 | if (!pname) | ||
53 | continue; | ||
54 | len = strlen(pname); | ||
55 | if ((pname[len-1] == 'A' && conn == 1) || | ||
56 | (pname[len-1] == 'B' && conn == 2)) { | ||
57 | for (i = 0; propnames[i] != NULL; ++i) { | ||
58 | pedid = (unsigned char *) | ||
59 | get_property(dp, propnames[i], | ||
60 | NULL); | ||
61 | if (pedid != NULL) | ||
62 | break; | ||
63 | } | ||
64 | of_node_put(dp); | ||
65 | break; | ||
66 | } | ||
67 | } | ||
68 | } | ||
69 | if (pedid == NULL) { | ||
50 | for (i = 0; propnames[i] != NULL; ++i) { | 70 | for (i = 0; propnames[i] != NULL; ++i) { |
51 | pedid = (unsigned char *) | 71 | pedid = (unsigned char *) |
52 | get_property(dp, propnames[i], NULL); | 72 | get_property(parent, propnames[i], NULL); |
53 | if (pedid != NULL) { | 73 | if (pedid != NULL) |
54 | *out_edid = pedid; | 74 | break; |
55 | return 0; | ||
56 | } | ||
57 | } | 75 | } |
58 | } | 76 | } |
59 | return 1; | 77 | if (pedid) { |
78 | *out_edid = kmalloc(EDID_LENGTH, GFP_KERNEL); | ||
79 | if (*out_edid == NULL) | ||
80 | return -1; | ||
81 | memcpy(*out_edid, pedid, EDID_LENGTH); | ||
82 | printk(KERN_DEBUG "nvidiafb: Found OF EDID for head %d\n", conn); | ||
83 | return 0; | ||
84 | } | ||
85 | return -1; | ||
60 | } | 86 | } |