diff options
author | Jonathan Corbet <corbet@lwn.net> | 2008-07-14 17:29:34 -0400 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2008-07-14 17:29:34 -0400 |
commit | 2fceef397f9880b212a74c418290ce69e7ac00eb (patch) | |
tree | d9cc09ab992825ef7fede4a688103503e3caf655 /drivers/video/pxafb.c | |
parent | feae1ef116ed381625d3731c5ae4f4ebcb3fa302 (diff) | |
parent | bce7f793daec3e65ec5c5705d2457b81fe7b5725 (diff) |
Merge commit 'v2.6.26' into bkl-removal
Diffstat (limited to 'drivers/video/pxafb.c')
-rw-r--r-- | drivers/video/pxafb.c | 59 |
1 files changed, 37 insertions, 22 deletions
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index 3ee314beacc1..fafe7db20d6d 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c | |||
@@ -573,8 +573,8 @@ static int setup_frame_dma(struct pxafb_info *fbi, int dma, int pal, | |||
573 | dma_desc->fdadr = fbi->dma_buff_phys + dma_desc_off; | 573 | dma_desc->fdadr = fbi->dma_buff_phys + dma_desc_off; |
574 | fbi->fdadr[dma] = fbi->dma_buff_phys + dma_desc_off; | 574 | fbi->fdadr[dma] = fbi->dma_buff_phys + dma_desc_off; |
575 | } else { | 575 | } else { |
576 | pal_desc = &fbi->dma_buff->pal_desc[dma]; | 576 | pal_desc = &fbi->dma_buff->pal_desc[pal]; |
577 | pal_desc_off = offsetof(struct pxafb_dma_buff, dma_desc[pal]); | 577 | pal_desc_off = offsetof(struct pxafb_dma_buff, pal_desc[pal]); |
578 | 578 | ||
579 | pal_desc->fsadr = fbi->dma_buff_phys + pal * PALETTE_SIZE; | 579 | pal_desc->fsadr = fbi->dma_buff_phys + pal * PALETTE_SIZE; |
580 | pal_desc->fidr = 0; | 580 | pal_desc->fidr = 0; |
@@ -1246,7 +1246,7 @@ static int pxafb_resume(struct platform_device *dev) | |||
1246 | * cache. Once this area is remapped, all virtual memory | 1246 | * cache. Once this area is remapped, all virtual memory |
1247 | * access to the video memory should occur at the new region. | 1247 | * access to the video memory should occur at the new region. |
1248 | */ | 1248 | */ |
1249 | static int __init pxafb_map_video_memory(struct pxafb_info *fbi) | 1249 | static int __devinit pxafb_map_video_memory(struct pxafb_info *fbi) |
1250 | { | 1250 | { |
1251 | /* | 1251 | /* |
1252 | * We reserve one page for the palette, plus the size | 1252 | * We reserve one page for the palette, plus the size |
@@ -1276,6 +1276,8 @@ static int __init pxafb_map_video_memory(struct pxafb_info *fbi) | |||
1276 | fbi->dma_buff_phys = fbi->map_dma; | 1276 | fbi->dma_buff_phys = fbi->map_dma; |
1277 | fbi->palette_cpu = (u16 *) fbi->dma_buff->palette; | 1277 | fbi->palette_cpu = (u16 *) fbi->dma_buff->palette; |
1278 | 1278 | ||
1279 | pr_debug("pxafb: palette_mem_size = 0x%08lx\n", fbi->palette_size*sizeof(u16)); | ||
1280 | |||
1279 | #ifdef CONFIG_FB_PXA_SMARTPANEL | 1281 | #ifdef CONFIG_FB_PXA_SMARTPANEL |
1280 | fbi->smart_cmds = (uint16_t *) fbi->dma_buff->cmd_buff; | 1282 | fbi->smart_cmds = (uint16_t *) fbi->dma_buff->cmd_buff; |
1281 | fbi->n_smart_cmds = 0; | 1283 | fbi->n_smart_cmds = 0; |
@@ -1346,12 +1348,11 @@ decode_mode: | |||
1346 | pxafb_decode_mode_info(fbi, inf->modes, inf->num_modes); | 1348 | pxafb_decode_mode_info(fbi, inf->modes, inf->num_modes); |
1347 | } | 1349 | } |
1348 | 1350 | ||
1349 | static struct pxafb_info * __init pxafb_init_fbinfo(struct device *dev) | 1351 | static struct pxafb_info * __devinit pxafb_init_fbinfo(struct device *dev) |
1350 | { | 1352 | { |
1351 | struct pxafb_info *fbi; | 1353 | struct pxafb_info *fbi; |
1352 | void *addr; | 1354 | void *addr; |
1353 | struct pxafb_mach_info *inf = dev->platform_data; | 1355 | struct pxafb_mach_info *inf = dev->platform_data; |
1354 | struct pxafb_mode_info *mode = inf->modes; | ||
1355 | 1356 | ||
1356 | /* Alloc the pxafb_info and pseudo_palette in one step */ | 1357 | /* Alloc the pxafb_info and pseudo_palette in one step */ |
1357 | fbi = kmalloc(sizeof(struct pxafb_info) + sizeof(u32) * 16, GFP_KERNEL); | 1358 | fbi = kmalloc(sizeof(struct pxafb_info) + sizeof(u32) * 16, GFP_KERNEL); |
@@ -1409,7 +1410,7 @@ static struct pxafb_info * __init pxafb_init_fbinfo(struct device *dev) | |||
1409 | } | 1410 | } |
1410 | 1411 | ||
1411 | #ifdef CONFIG_FB_PXA_PARAMETERS | 1412 | #ifdef CONFIG_FB_PXA_PARAMETERS |
1412 | static int __init parse_opt_mode(struct device *dev, const char *this_opt) | 1413 | static int __devinit parse_opt_mode(struct device *dev, const char *this_opt) |
1413 | { | 1414 | { |
1414 | struct pxafb_mach_info *inf = dev->platform_data; | 1415 | struct pxafb_mach_info *inf = dev->platform_data; |
1415 | 1416 | ||
@@ -1468,7 +1469,7 @@ done: | |||
1468 | return 0; | 1469 | return 0; |
1469 | } | 1470 | } |
1470 | 1471 | ||
1471 | static int __init parse_opt(struct device *dev, char *this_opt) | 1472 | static int __devinit parse_opt(struct device *dev, char *this_opt) |
1472 | { | 1473 | { |
1473 | struct pxafb_mach_info *inf = dev->platform_data; | 1474 | struct pxafb_mach_info *inf = dev->platform_data; |
1474 | struct pxafb_mode_info *mode = &inf->modes[0]; | 1475 | struct pxafb_mode_info *mode = &inf->modes[0]; |
@@ -1566,7 +1567,7 @@ static int __init parse_opt(struct device *dev, char *this_opt) | |||
1566 | return 0; | 1567 | return 0; |
1567 | } | 1568 | } |
1568 | 1569 | ||
1569 | static int __init pxafb_parse_options(struct device *dev, char *options) | 1570 | static int __devinit pxafb_parse_options(struct device *dev, char *options) |
1570 | { | 1571 | { |
1571 | char *this_opt; | 1572 | char *this_opt; |
1572 | int ret; | 1573 | int ret; |
@@ -1587,8 +1588,8 @@ static int __init pxafb_parse_options(struct device *dev, char *options) | |||
1587 | 1588 | ||
1588 | static char g_options[256] __devinitdata = ""; | 1589 | static char g_options[256] __devinitdata = ""; |
1589 | 1590 | ||
1590 | #ifndef CONFIG_MODULES | 1591 | #ifndef MODULE |
1591 | static int __devinit pxafb_setup_options(void) | 1592 | static int __init pxafb_setup_options(void) |
1592 | { | 1593 | { |
1593 | char *options = NULL; | 1594 | char *options = NULL; |
1594 | 1595 | ||
@@ -1612,7 +1613,7 @@ MODULE_PARM_DESC(options, "LCD parameters (see Documentation/fb/pxafb.txt)"); | |||
1612 | #define pxafb_setup_options() (0) | 1613 | #define pxafb_setup_options() (0) |
1613 | #endif | 1614 | #endif |
1614 | 1615 | ||
1615 | static int __init pxafb_probe(struct platform_device *dev) | 1616 | static int __devinit pxafb_probe(struct platform_device *dev) |
1616 | { | 1617 | { |
1617 | struct pxafb_info *fbi; | 1618 | struct pxafb_info *fbi; |
1618 | struct pxafb_mach_info *inf; | 1619 | struct pxafb_mach_info *inf; |
@@ -1684,14 +1685,14 @@ static int __init pxafb_probe(struct platform_device *dev) | |||
1684 | if (r == NULL) { | 1685 | if (r == NULL) { |
1685 | dev_err(&dev->dev, "no I/O memory resource defined\n"); | 1686 | dev_err(&dev->dev, "no I/O memory resource defined\n"); |
1686 | ret = -ENODEV; | 1687 | ret = -ENODEV; |
1687 | goto failed; | 1688 | goto failed_fbi; |
1688 | } | 1689 | } |
1689 | 1690 | ||
1690 | r = request_mem_region(r->start, r->end - r->start + 1, dev->name); | 1691 | r = request_mem_region(r->start, r->end - r->start + 1, dev->name); |
1691 | if (r == NULL) { | 1692 | if (r == NULL) { |
1692 | dev_err(&dev->dev, "failed to request I/O memory\n"); | 1693 | dev_err(&dev->dev, "failed to request I/O memory\n"); |
1693 | ret = -EBUSY; | 1694 | ret = -EBUSY; |
1694 | goto failed; | 1695 | goto failed_fbi; |
1695 | } | 1696 | } |
1696 | 1697 | ||
1697 | fbi->mmio_base = ioremap(r->start, r->end - r->start + 1); | 1698 | fbi->mmio_base = ioremap(r->start, r->end - r->start + 1); |
@@ -1734,8 +1735,17 @@ static int __init pxafb_probe(struct platform_device *dev) | |||
1734 | * This makes sure that our colour bitfield | 1735 | * This makes sure that our colour bitfield |
1735 | * descriptors are correctly initialised. | 1736 | * descriptors are correctly initialised. |
1736 | */ | 1737 | */ |
1737 | pxafb_check_var(&fbi->fb.var, &fbi->fb); | 1738 | ret = pxafb_check_var(&fbi->fb.var, &fbi->fb); |
1738 | pxafb_set_par(&fbi->fb); | 1739 | if (ret) { |
1740 | dev_err(&dev->dev, "failed to get suitable mode\n"); | ||
1741 | goto failed_free_irq; | ||
1742 | } | ||
1743 | |||
1744 | ret = pxafb_set_par(&fbi->fb); | ||
1745 | if (ret) { | ||
1746 | dev_err(&dev->dev, "Failed to set parameters\n"); | ||
1747 | goto failed_free_irq; | ||
1748 | } | ||
1739 | 1749 | ||
1740 | platform_set_drvdata(dev, fbi); | 1750 | platform_set_drvdata(dev, fbi); |
1741 | 1751 | ||
@@ -1743,7 +1753,7 @@ static int __init pxafb_probe(struct platform_device *dev) | |||
1743 | if (ret < 0) { | 1753 | if (ret < 0) { |
1744 | dev_err(&dev->dev, | 1754 | dev_err(&dev->dev, |
1745 | "Failed to register framebuffer device: %d\n", ret); | 1755 | "Failed to register framebuffer device: %d\n", ret); |
1746 | goto failed_free_irq; | 1756 | goto failed_free_cmap; |
1747 | } | 1757 | } |
1748 | 1758 | ||
1749 | #ifdef CONFIG_CPU_FREQ | 1759 | #ifdef CONFIG_CPU_FREQ |
@@ -1762,18 +1772,23 @@ static int __init pxafb_probe(struct platform_device *dev) | |||
1762 | 1772 | ||
1763 | return 0; | 1773 | return 0; |
1764 | 1774 | ||
1775 | failed_free_cmap: | ||
1776 | if (fbi->fb.cmap.len) | ||
1777 | fb_dealloc_cmap(&fbi->fb.cmap); | ||
1765 | failed_free_irq: | 1778 | failed_free_irq: |
1766 | free_irq(irq, fbi); | 1779 | free_irq(irq, fbi); |
1767 | failed_free_res: | ||
1768 | release_mem_region(r->start, r->end - r->start + 1); | ||
1769 | failed_free_io: | ||
1770 | iounmap(fbi->mmio_base); | ||
1771 | failed_free_mem: | 1780 | failed_free_mem: |
1772 | dma_free_writecombine(&dev->dev, fbi->map_size, | 1781 | dma_free_writecombine(&dev->dev, fbi->map_size, |
1773 | fbi->map_cpu, fbi->map_dma); | 1782 | fbi->map_cpu, fbi->map_dma); |
1774 | failed: | 1783 | failed_free_io: |
1784 | iounmap(fbi->mmio_base); | ||
1785 | failed_free_res: | ||
1786 | release_mem_region(r->start, r->end - r->start + 1); | ||
1787 | failed_fbi: | ||
1788 | clk_put(fbi->clk); | ||
1775 | platform_set_drvdata(dev, NULL); | 1789 | platform_set_drvdata(dev, NULL); |
1776 | kfree(fbi); | 1790 | kfree(fbi); |
1791 | failed: | ||
1777 | return ret; | 1792 | return ret; |
1778 | } | 1793 | } |
1779 | 1794 | ||
@@ -1786,7 +1801,7 @@ static struct platform_driver pxafb_driver = { | |||
1786 | }, | 1801 | }, |
1787 | }; | 1802 | }; |
1788 | 1803 | ||
1789 | static int __devinit pxafb_init(void) | 1804 | static int __init pxafb_init(void) |
1790 | { | 1805 | { |
1791 | if (pxafb_setup_options()) | 1806 | if (pxafb_setup_options()) |
1792 | return -EINVAL; | 1807 | return -EINVAL; |