diff options
author | Timur Tabi <timur@freescale.com> | 2012-10-16 18:33:50 -0400 |
---|---|---|
committer | Timur Tabi <timur@freescale.com> | 2012-11-26 14:41:20 -0500 |
commit | e7b427187547bff5b845f3a7137312c6d1ae8153 (patch) | |
tree | 85a824fecefe7b208690ca5bb20e8ead446965b0 /drivers/video/fsl-diu-fb.c | |
parent | ceb001b077af64b20a8027132cfe015c80f4319d (diff) |
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: Timur Tabi <timur@freescale.com>
Diffstat (limited to 'drivers/video/fsl-diu-fb.c')
-rw-r--r-- | drivers/video/fsl-diu-fb.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c index 0883bc42cd5a..d3fc92eaee89 100644 --- a/drivers/video/fsl-diu-fb.c +++ b/drivers/video/fsl-diu-fb.c | |||
@@ -342,7 +342,6 @@ struct mfb_info { | |||
342 | int x_aoi_d; /* aoi display x offset to physical screen */ | 342 | int x_aoi_d; /* aoi display x offset to physical screen */ |
343 | int y_aoi_d; /* aoi display y offset to physical screen */ | 343 | int y_aoi_d; /* aoi display y offset to physical screen */ |
344 | struct fsl_diu_data *parent; | 344 | struct fsl_diu_data *parent; |
345 | u8 *edid_data; | ||
346 | }; | 345 | }; |
347 | 346 | ||
348 | /** | 347 | /** |
@@ -377,6 +376,8 @@ struct fsl_diu_data { | |||
377 | struct diu_ad ad[NUM_AOIS] __aligned(8); | 376 | struct diu_ad ad[NUM_AOIS] __aligned(8); |
378 | u8 gamma[256 * 3] __aligned(32); | 377 | u8 gamma[256 * 3] __aligned(32); |
379 | u8 cursor[MAX_CURS * MAX_CURS * 2] __aligned(32); | 378 | u8 cursor[MAX_CURS * MAX_CURS * 2] __aligned(32); |
379 | uint8_t edid_data[EDID_LENGTH]; | ||
380 | bool has_edid; | ||
380 | } __aligned(32); | 381 | } __aligned(32); |
381 | 382 | ||
382 | /* Determine the DMA address of a member of the fsl_diu_data structure */ | 383 | /* 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 | { | 1311 | { |
1311 | int rc; | 1312 | int rc; |
1312 | struct mfb_info *mfbi = info->par; | 1313 | struct mfb_info *mfbi = info->par; |
1314 | struct fsl_diu_data *data = mfbi->parent; | ||
1313 | const char *aoi_mode, *init_aoi_mode = "320x240"; | 1315 | const char *aoi_mode, *init_aoi_mode = "320x240"; |
1314 | struct fb_videomode *db = fsl_diu_mode_db; | 1316 | struct fb_videomode *db = fsl_diu_mode_db; |
1315 | unsigned int dbsize = ARRAY_SIZE(fsl_diu_mode_db); | 1317 | unsigned int dbsize = ARRAY_SIZE(fsl_diu_mode_db); |
@@ -1326,9 +1328,9 @@ static int __devinit install_fb(struct fb_info *info) | |||
1326 | return rc; | 1328 | return rc; |
1327 | 1329 | ||
1328 | if (mfbi->index == PLANE0) { | 1330 | if (mfbi->index == PLANE0) { |
1329 | if (mfbi->edid_data) { | 1331 | if (data->has_edid) { |
1330 | /* Now build modedb from EDID */ | 1332 | /* Now build modedb from EDID */ |
1331 | fb_edid_to_monspecs(mfbi->edid_data, &info->monspecs); | 1333 | fb_edid_to_monspecs(data->edid_data, &info->monspecs); |
1332 | fb_videomode_to_modelist(info->monspecs.modedb, | 1334 | fb_videomode_to_modelist(info->monspecs.modedb, |
1333 | info->monspecs.modedb_len, | 1335 | info->monspecs.modedb_len, |
1334 | &info->modelist); | 1336 | &info->modelist); |
@@ -1346,7 +1348,7 @@ static int __devinit install_fb(struct fb_info *info) | |||
1346 | * For plane 0 we continue and look into | 1348 | * For plane 0 we continue and look into |
1347 | * driver's internal modedb. | 1349 | * driver's internal modedb. |
1348 | */ | 1350 | */ |
1349 | if ((mfbi->index == PLANE0) && mfbi->edid_data) | 1351 | if ((mfbi->index == PLANE0) && data->has_edid) |
1350 | has_default_mode = 0; | 1352 | has_default_mode = 0; |
1351 | else | 1353 | else |
1352 | return -EINVAL; | 1354 | return -EINVAL; |
@@ -1410,9 +1412,6 @@ static void uninstall_fb(struct fb_info *info) | |||
1410 | if (!mfbi->registered) | 1412 | if (!mfbi->registered) |
1411 | return; | 1413 | return; |
1412 | 1414 | ||
1413 | if (mfbi->index == PLANE0) | ||
1414 | kfree(mfbi->edid_data); | ||
1415 | |||
1416 | unregister_framebuffer(info); | 1415 | unregister_framebuffer(info); |
1417 | unmap_video_memory(info); | 1416 | unmap_video_memory(info); |
1418 | if (&info->cmap) | 1417 | if (&info->cmap) |
@@ -1525,6 +1524,7 @@ static int __devinit fsl_diu_probe(struct platform_device *pdev) | |||
1525 | struct mfb_info *mfbi; | 1524 | struct mfb_info *mfbi; |
1526 | struct fsl_diu_data *data; | 1525 | struct fsl_diu_data *data; |
1527 | dma_addr_t dma_addr; /* DMA addr of fsl_diu_data struct */ | 1526 | dma_addr_t dma_addr; /* DMA addr of fsl_diu_data struct */ |
1527 | const void *prop; | ||
1528 | unsigned int i; | 1528 | unsigned int i; |
1529 | int ret; | 1529 | int ret; |
1530 | 1530 | ||
@@ -1568,17 +1568,13 @@ static int __devinit fsl_diu_probe(struct platform_device *pdev) | |||
1568 | memcpy(mfbi, &mfb_template[i], sizeof(struct mfb_info)); | 1568 | memcpy(mfbi, &mfb_template[i], sizeof(struct mfb_info)); |
1569 | mfbi->parent = data; | 1569 | mfbi->parent = data; |
1570 | mfbi->ad = &data->ad[i]; | 1570 | mfbi->ad = &data->ad[i]; |
1571 | } | ||
1571 | 1572 | ||
1572 | if (mfbi->index == PLANE0) { | 1573 | /* Get the EDID data from the device tree, if present */ |
1573 | const u8 *prop; | 1574 | prop = of_get_property(np, "edid", &ret); |
1574 | int len; | 1575 | if (prop && ret == EDID_LENGTH) { |
1575 | 1576 | memcpy(data->edid_data, prop, EDID_LENGTH); | |
1576 | /* Get EDID */ | 1577 | data->has_edid = true; |
1577 | prop = of_get_property(np, "edid", &len); | ||
1578 | if (prop && len == EDID_LENGTH) | ||
1579 | mfbi->edid_data = kmemdup(prop, EDID_LENGTH, | ||
1580 | GFP_KERNEL); | ||
1581 | } | ||
1582 | } | 1578 | } |
1583 | 1579 | ||
1584 | data->diu_reg = of_iomap(np, 0); | 1580 | data->diu_reg = of_iomap(np, 0); |