#include "radeonfb.h"
#include <linux/slab.h>
#include "../edid.h"
static const struct fb_var_screeninfo radeonfb_default_var = …;
static char *radeon_get_mon_name(int type)
{ … }
#if defined(CONFIG_PPC) || defined(CONFIG_SPARC)
static int radeon_parse_montype_prop(struct device_node *dp, u8 **out_EDID,
int hdno)
{
static char *propnames[] = { "DFP,EDID", "LCD,EDID", "EDID",
"EDID1", "EDID2", NULL };
const u8 *pedid = NULL;
const u8 *pmt = NULL;
u8 *tmp;
int i, mt = MT_NONE;
pr_debug("analyzing OF properties...\n");
pmt = of_get_property(dp, "display-type", NULL);
if (!pmt)
return MT_NONE;
pr_debug("display-type: %s\n", pmt);
if (!strcmp(pmt, "LCD") || !strcmp(pmt, "DFP"))
mt = MT_DFP;
else if (!strcmp(pmt, "CRT"))
mt = MT_CRT;
else {
if (strcmp(pmt, "NONE") != 0)
printk(KERN_WARNING "radeonfb: Unknown OF display-type: %s\n",
pmt);
return MT_NONE;
}
for (i = 0; propnames[i] != NULL; ++i) {
pedid = of_get_property(dp, propnames[i], NULL);
if (pedid != NULL)
break;
}
if (pedid == NULL && dp->parent && (hdno != -1))
pedid = of_get_property(dp->parent,
(hdno == 0) ? "EDID1" : "EDID2", NULL);
if (pedid == NULL && dp->parent && (hdno == 0))
pedid = of_get_property(dp->parent, "EDID", NULL);
if (pedid == NULL)
return mt;
tmp = kmemdup(pedid, EDID_LENGTH, GFP_KERNEL);
if (!tmp)
return mt;
*out_EDID = tmp;
return mt;
}
static int radeon_probe_OF_head(struct radeonfb_info *rinfo, int head_no,
u8 **out_EDID)
{
struct device_node *dp;
pr_debug("radeon_probe_OF_head\n");
dp = rinfo->of_node;
while (dp == NULL)
return MT_NONE;
if (rinfo->has_CRTC2) {
const char *pname;
int len, second = 0;
dp = dp->child;
do {
if (!dp)
return MT_NONE;
pname = of_get_property(dp, "name", NULL);
if (!pname)
return MT_NONE;
len = strlen(pname);
pr_debug("head: %s (letter: %c, head_no: %d)\n",
pname, pname[len-1], head_no);
if (pname[len-1] == 'A' && head_no == 0) {
int mt = radeon_parse_montype_prop(dp, out_EDID, 0);
if (mt == MT_DFP && rinfo->is_mobility)
mt = MT_LCD;
return mt;
} else if (pname[len-1] == 'B' && head_no == 1)
return radeon_parse_montype_prop(dp, out_EDID, 1);
second = 1;
dp = dp->sibling;
} while(!second);
} else {
if (head_no > 0)
return MT_NONE;
return radeon_parse_montype_prop(dp, out_EDID, -1);
}
return MT_NONE;
}
#endif
static int radeon_get_panel_info_BIOS(struct radeonfb_info *rinfo)
{ … }
static void radeon_parse_connector_info(struct radeonfb_info *rinfo)
{ … }
static int radeon_crt_is_connected(struct radeonfb_info *rinfo, int is_crt_dac)
{ … }
static int radeon_parse_monitor_layout(struct radeonfb_info *rinfo,
const char *monitor_layout)
{ … }
void radeon_probe_screens(struct radeonfb_info *rinfo,
const char *monitor_layout, int ignore_edid)
{ … }
static void radeon_fixup_panel_info(struct radeonfb_info *rinfo)
{ … }
static void radeon_var_to_panel_info(struct radeonfb_info *rinfo, struct fb_var_screeninfo *var)
{ … }
static void radeon_videomode_to_var(struct fb_var_screeninfo *var,
const struct fb_videomode *mode)
{ … }
#ifdef CONFIG_PPC_PSERIES
static int is_powerblade(const char *model)
{
struct device_node *root;
const char* cp;
int len, l, rc = 0;
root = of_find_node_by_path("/");
if (root && model) {
l = strlen(model);
cp = of_get_property(root, "model", &len);
if (cp)
rc = memcmp(model, cp, min(len, l)) == 0;
of_node_put(root);
}
return rc;
}
#endif
void radeon_check_modes(struct radeonfb_info *rinfo, const char *mode_option)
{ … }
static int radeon_compare_modes(const struct fb_var_screeninfo *var,
const struct fb_videomode *mode)
{ … }
int radeon_match_mode(struct radeonfb_info *rinfo,
struct fb_var_screeninfo *dest,
const struct fb_var_screeninfo *src)
{ … }