Commit e7b42718 authored by Timur Tabi's avatar Timur Tabi

drivers/video: fsl-diu-fb: store EDID data in the global object

Although the DIU driver creates five framebuffer devices, only the first
one controls the physical display.  The remaining four are virtual "AOIs".
Therefore, the EDID data should be stored in the global fsl_diu_data
object, instead of the per-framebuffer object.
Signed-off-by: default avatarTimur Tabi <timur@freescale.com>
parent ceb001b0
...@@ -342,7 +342,6 @@ struct mfb_info { ...@@ -342,7 +342,6 @@ struct mfb_info {
int x_aoi_d; /* aoi display x offset to physical screen */ int x_aoi_d; /* aoi display x offset to physical screen */
int y_aoi_d; /* aoi display y offset to physical screen */ int y_aoi_d; /* aoi display y offset to physical screen */
struct fsl_diu_data *parent; struct fsl_diu_data *parent;
u8 *edid_data;
}; };
/** /**
...@@ -377,6 +376,8 @@ struct fsl_diu_data { ...@@ -377,6 +376,8 @@ struct fsl_diu_data {
struct diu_ad ad[NUM_AOIS] __aligned(8); struct diu_ad ad[NUM_AOIS] __aligned(8);
u8 gamma[256 * 3] __aligned(32); u8 gamma[256 * 3] __aligned(32);
u8 cursor[MAX_CURS * MAX_CURS * 2] __aligned(32); u8 cursor[MAX_CURS * MAX_CURS * 2] __aligned(32);
uint8_t edid_data[EDID_LENGTH];
bool has_edid;
} __aligned(32); } __aligned(32);
/* Determine the DMA address of a member of the fsl_diu_data structure */ /* Determine the DMA address of a member of the fsl_diu_data structure */
...@@ -1310,6 +1311,7 @@ static int __devinit install_fb(struct fb_info *info) ...@@ -1310,6 +1311,7 @@ static int __devinit install_fb(struct fb_info *info)
{ {
int rc; int rc;
struct mfb_info *mfbi = info->par; struct mfb_info *mfbi = info->par;
struct fsl_diu_data *data = mfbi->parent;
const char *aoi_mode, *init_aoi_mode = "320x240"; const char *aoi_mode, *init_aoi_mode = "320x240";
struct fb_videomode *db = fsl_diu_mode_db; struct fb_videomode *db = fsl_diu_mode_db;
unsigned int dbsize = ARRAY_SIZE(fsl_diu_mode_db); unsigned int dbsize = ARRAY_SIZE(fsl_diu_mode_db);
...@@ -1326,9 +1328,9 @@ static int __devinit install_fb(struct fb_info *info) ...@@ -1326,9 +1328,9 @@ static int __devinit install_fb(struct fb_info *info)
return rc; return rc;
if (mfbi->index == PLANE0) { if (mfbi->index == PLANE0) {
if (mfbi->edid_data) { if (data->has_edid) {
/* Now build modedb from EDID */ /* Now build modedb from EDID */
fb_edid_to_monspecs(mfbi->edid_data, &info->monspecs); fb_edid_to_monspecs(data->edid_data, &info->monspecs);
fb_videomode_to_modelist(info->monspecs.modedb, fb_videomode_to_modelist(info->monspecs.modedb,
info->monspecs.modedb_len, info->monspecs.modedb_len,
&info->modelist); &info->modelist);
...@@ -1346,7 +1348,7 @@ static int __devinit install_fb(struct fb_info *info) ...@@ -1346,7 +1348,7 @@ static int __devinit install_fb(struct fb_info *info)
* For plane 0 we continue and look into * For plane 0 we continue and look into
* driver's internal modedb. * driver's internal modedb.
*/ */
if ((mfbi->index == PLANE0) && mfbi->edid_data) if ((mfbi->index == PLANE0) && data->has_edid)
has_default_mode = 0; has_default_mode = 0;
else else
return -EINVAL; return -EINVAL;
...@@ -1410,9 +1412,6 @@ static void uninstall_fb(struct fb_info *info) ...@@ -1410,9 +1412,6 @@ static void uninstall_fb(struct fb_info *info)
if (!mfbi->registered) if (!mfbi->registered)
return; return;
if (mfbi->index == PLANE0)
kfree(mfbi->edid_data);
unregister_framebuffer(info); unregister_framebuffer(info);
unmap_video_memory(info); unmap_video_memory(info);
if (&info->cmap) if (&info->cmap)
...@@ -1525,6 +1524,7 @@ static int __devinit fsl_diu_probe(struct platform_device *pdev) ...@@ -1525,6 +1524,7 @@ static int __devinit fsl_diu_probe(struct platform_device *pdev)
struct mfb_info *mfbi; struct mfb_info *mfbi;
struct fsl_diu_data *data; struct fsl_diu_data *data;
dma_addr_t dma_addr; /* DMA addr of fsl_diu_data struct */ dma_addr_t dma_addr; /* DMA addr of fsl_diu_data struct */
const void *prop;
unsigned int i; unsigned int i;
int ret; int ret;
...@@ -1568,17 +1568,13 @@ static int __devinit fsl_diu_probe(struct platform_device *pdev) ...@@ -1568,17 +1568,13 @@ static int __devinit fsl_diu_probe(struct platform_device *pdev)
memcpy(mfbi, &mfb_template[i], sizeof(struct mfb_info)); memcpy(mfbi, &mfb_template[i], sizeof(struct mfb_info));
mfbi->parent = data; mfbi->parent = data;
mfbi->ad = &data->ad[i]; mfbi->ad = &data->ad[i];
}
if (mfbi->index == PLANE0) { /* Get the EDID data from the device tree, if present */
const u8 *prop; prop = of_get_property(np, "edid", &ret);
int len; if (prop && ret == EDID_LENGTH) {
memcpy(data->edid_data, prop, EDID_LENGTH);
/* Get EDID */ data->has_edid = true;
prop = of_get_property(np, "edid", &len);
if (prop && len == EDID_LENGTH)
mfbi->edid_data = kmemdup(prop, EDID_LENGTH,
GFP_KERNEL);
}
} }
data->diu_reg = of_iomap(np, 0); data->diu_reg = of_iomap(np, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment