2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* 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/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"
|
|
|
|
|
2005-11-07 17:00:30 +08:00
|
|
|
#include "../edid.h"
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-11-07 17:00:30 +08:00
|
|
|
int nvidia_probe_of_connector(struct fb_info *info, int conn, u8 **out_edid)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2005-09-11 08:01:09 +08:00
|
|
|
struct nvidia_par *par = info->par;
|
2005-11-07 17:00:30 +08:00
|
|
|
struct device_node *parent, *dp;
|
2006-07-12 13:40:40 +08:00
|
|
|
const unsigned char *pedid = NULL;
|
2005-04-17 06:20:36 +08:00
|
|
|
static char *propnames[] = {
|
2005-11-07 17:00:30 +08:00
|
|
|
"DFP,EDID", "LCD,EDID", "EDID", "EDID1",
|
|
|
|
"EDID,B", "EDID,A", NULL };
|
2005-04-17 06:20:36 +08:00
|
|
|
int i;
|
|
|
|
|
2005-11-07 17:00:30 +08:00
|
|
|
parent = pci_device_to_OF_node(par->pci_dev);
|
|
|
|
if (parent == NULL)
|
|
|
|
return -1;
|
|
|
|
if (par->twoHeads) {
|
2006-07-12 13:40:40 +08:00
|
|
|
const char *pname;
|
2005-11-07 17:00:30 +08:00
|
|
|
int len;
|
|
|
|
|
|
|
|
for (dp = NULL;
|
|
|
|
(dp = of_get_next_child(parent, dp)) != NULL;) {
|
2006-07-12 13:40:40 +08:00
|
|
|
pname = get_property(dp, "name", NULL);
|
2005-11-07 17:00:30 +08:00
|
|
|
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) {
|
2006-07-12 13:40:40 +08:00
|
|
|
pedid = get_property(dp, propnames[i],
|
2005-11-07 17:00:30 +08:00
|
|
|
NULL);
|
|
|
|
if (pedid != NULL)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
of_node_put(dp);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (pedid == NULL) {
|
2005-04-17 06:20:36 +08:00
|
|
|
for (i = 0; propnames[i] != NULL; ++i) {
|
2006-07-12 13:40:40 +08:00
|
|
|
pedid = get_property(parent, propnames[i], NULL);
|
2005-11-07 17:00:30 +08:00
|
|
|
if (pedid != NULL)
|
|
|
|
break;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
}
|
2005-11-07 17:00:30 +08:00
|
|
|
if (pedid) {
|
2006-12-08 18:40:46 +08:00
|
|
|
*out_edid = kmemdup(pedid, EDID_LENGTH, GFP_KERNEL);
|
2005-11-07 17:00:30 +08:00
|
|
|
if (*out_edid == NULL)
|
|
|
|
return -1;
|
|
|
|
printk(KERN_DEBUG "nvidiafb: Found OF EDID for head %d\n", conn);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return -1;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|