diff options
Diffstat (limited to 'drivers/video/fsl-diu-fb.c')
-rw-r--r-- | drivers/video/fsl-diu-fb.c | 72 |
1 files changed, 35 insertions, 37 deletions
diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c index f9a95ab28883..a16beeb5f548 100644 --- a/drivers/video/fsl-diu-fb.c +++ b/drivers/video/fsl-diu-fb.c | |||
@@ -55,13 +55,6 @@ struct diu_addr { | |||
55 | __u32 offset; | 55 | __u32 offset; |
56 | }; | 56 | }; |
57 | 57 | ||
58 | struct diu_pool { | ||
59 | struct diu_addr ad; | ||
60 | struct diu_addr gamma; | ||
61 | struct diu_addr pallete; | ||
62 | struct diu_addr cursor; | ||
63 | }; | ||
64 | |||
65 | /* | 58 | /* |
66 | * List of supported video modes | 59 | * List of supported video modes |
67 | * | 60 | * |
@@ -348,6 +341,10 @@ struct fsl_diu_data { | |||
348 | enum fsl_diu_monitor_port monitor_port; | 341 | enum fsl_diu_monitor_port monitor_port; |
349 | struct diu __iomem *diu_reg; | 342 | struct diu __iomem *diu_reg; |
350 | spinlock_t reg_lock; | 343 | spinlock_t reg_lock; |
344 | struct diu_addr ad; | ||
345 | struct diu_addr gamma; | ||
346 | struct diu_addr pallete; | ||
347 | struct diu_addr cursor; | ||
351 | }; | 348 | }; |
352 | 349 | ||
353 | enum mfb_index { | 350 | enum mfb_index { |
@@ -421,8 +418,6 @@ static struct mfb_info mfb_template[] = { | |||
421 | }, | 418 | }, |
422 | }; | 419 | }; |
423 | 420 | ||
424 | static struct diu_pool pool; | ||
425 | |||
426 | /** | 421 | /** |
427 | * fsl_diu_name_to_port - convert a port name to a monitor port enum | 422 | * fsl_diu_name_to_port - convert a port name to a monitor port enum |
428 | * | 423 | * |
@@ -824,22 +819,23 @@ static void update_lcdc(struct fb_info *info) | |||
824 | hw = machine_data->diu_reg; | 819 | hw = machine_data->diu_reg; |
825 | 820 | ||
826 | diu_ops.set_monitor_port(machine_data->monitor_port); | 821 | diu_ops.set_monitor_port(machine_data->monitor_port); |
827 | gamma_table_base = pool.gamma.vaddr; | 822 | gamma_table_base = machine_data->gamma.vaddr; |
828 | cursor_base = pool.cursor.vaddr; | 823 | cursor_base = machine_data->cursor.vaddr; |
829 | /* Prep for DIU init - gamma table, cursor table */ | 824 | /* Prep for DIU init - gamma table, cursor table */ |
830 | 825 | ||
831 | for (i = 0; i <= 2; i++) | 826 | for (i = 0; i <= 2; i++) |
832 | for (j = 0; j <= 255; j++) | 827 | for (j = 0; j <= 255; j++) |
833 | *gamma_table_base++ = j; | 828 | *gamma_table_base++ = j; |
834 | 829 | ||
835 | diu_ops.set_gamma_table(machine_data->monitor_port, pool.gamma.vaddr); | 830 | diu_ops.set_gamma_table(machine_data->monitor_port, |
831 | machine_data->gamma.vaddr); | ||
836 | 832 | ||
837 | disable_lcdc(info); | 833 | disable_lcdc(info); |
838 | 834 | ||
839 | /* Program DIU registers */ | 835 | /* Program DIU registers */ |
840 | 836 | ||
841 | out_be32(&hw->gamma, pool.gamma.paddr); | 837 | out_be32(&hw->gamma, machine_data->gamma.paddr); |
842 | out_be32(&hw->cursor, pool.cursor.paddr); | 838 | out_be32(&hw->cursor, machine_data->cursor.paddr); |
843 | 839 | ||
844 | out_be32(&hw->bgnd, 0x007F7F7F); /* BGND */ | 840 | out_be32(&hw->bgnd, 0x007F7F7F); /* BGND */ |
845 | out_be32(&hw->bgnd_wb, 0); /* BGND_WB */ | 841 | out_be32(&hw->bgnd_wb, 0); /* BGND_WB */ |
@@ -1560,27 +1556,27 @@ static int __devinit fsl_diu_probe(struct platform_device *pdev) | |||
1560 | machine_data->monitor_port = monitor_port; | 1556 | machine_data->monitor_port = monitor_port; |
1561 | 1557 | ||
1562 | /* Area descriptor memory pool aligns to 64-bit boundary */ | 1558 | /* Area descriptor memory pool aligns to 64-bit boundary */ |
1563 | if (allocate_buf(&pdev->dev, &pool.ad, | 1559 | if (allocate_buf(&pdev->dev, &machine_data->ad, |
1564 | sizeof(struct diu_ad) * FSL_AOI_NUM, 8)) | 1560 | sizeof(struct diu_ad) * FSL_AOI_NUM, 8)) |
1565 | return -ENOMEM; | 1561 | return -ENOMEM; |
1566 | 1562 | ||
1567 | /* Get memory for Gamma Table - 32-byte aligned memory */ | 1563 | /* Get memory for Gamma Table - 32-byte aligned memory */ |
1568 | if (allocate_buf(&pdev->dev, &pool.gamma, 768, 32)) { | 1564 | if (allocate_buf(&pdev->dev, &machine_data->gamma, 768, 32)) { |
1569 | ret = -ENOMEM; | 1565 | ret = -ENOMEM; |
1570 | goto error; | 1566 | goto error; |
1571 | } | 1567 | } |
1572 | 1568 | ||
1573 | /* For performance, cursor bitmap buffer aligns to 32-byte boundary */ | 1569 | /* For performance, cursor bitmap buffer aligns to 32-byte boundary */ |
1574 | if (allocate_buf(&pdev->dev, &pool.cursor, MAX_CURS * MAX_CURS * 2, | 1570 | if (allocate_buf(&pdev->dev, &machine_data->cursor, |
1575 | 32)) { | 1571 | MAX_CURS * MAX_CURS * 2, 32)) { |
1576 | ret = -ENOMEM; | 1572 | ret = -ENOMEM; |
1577 | goto error; | 1573 | goto error; |
1578 | } | 1574 | } |
1579 | 1575 | ||
1580 | i = ARRAY_SIZE(machine_data->fsl_diu_info); | 1576 | i = ARRAY_SIZE(machine_data->fsl_diu_info); |
1581 | machine_data->dummy_ad = (struct diu_ad *) | 1577 | machine_data->dummy_ad = (struct diu_ad *)((u32)machine_data->ad.vaddr + |
1582 | ((u32)pool.ad.vaddr + pool.ad.offset) + i; | 1578 | machine_data->ad.offset) + i; |
1583 | machine_data->dummy_ad->paddr = pool.ad.paddr + | 1579 | machine_data->dummy_ad->paddr = machine_data->ad.paddr + |
1584 | i * sizeof(struct diu_ad); | 1580 | i * sizeof(struct diu_ad); |
1585 | machine_data->dummy_aoi_virt = fsl_diu_alloc(64, &dummy_ad_addr); | 1581 | machine_data->dummy_aoi_virt = fsl_diu_alloc(64, &dummy_ad_addr); |
1586 | if (!machine_data->dummy_aoi_virt) { | 1582 | if (!machine_data->dummy_aoi_virt) { |
@@ -1609,9 +1605,10 @@ static int __devinit fsl_diu_probe(struct platform_device *pdev) | |||
1609 | for (i = 0; i < ARRAY_SIZE(machine_data->fsl_diu_info); i++) { | 1605 | for (i = 0; i < ARRAY_SIZE(machine_data->fsl_diu_info); i++) { |
1610 | machine_data->fsl_diu_info[i]->fix.smem_start = 0; | 1606 | machine_data->fsl_diu_info[i]->fix.smem_start = 0; |
1611 | mfbi = machine_data->fsl_diu_info[i]->par; | 1607 | mfbi = machine_data->fsl_diu_info[i]->par; |
1612 | mfbi->ad = (struct diu_ad *)((u32)pool.ad.vaddr | 1608 | mfbi->ad = (struct diu_ad *)((u32)machine_data->ad.vaddr |
1613 | + pool.ad.offset) + i; | 1609 | + machine_data->ad.offset) + i; |
1614 | mfbi->ad->paddr = pool.ad.paddr + i * sizeof(struct diu_ad); | 1610 | mfbi->ad->paddr = |
1611 | machine_data->ad.paddr + i * sizeof(struct diu_ad); | ||
1615 | ret = install_fb(machine_data->fsl_diu_info[i]); | 1612 | ret = install_fb(machine_data->fsl_diu_info[i]); |
1616 | if (ret) { | 1613 | if (ret) { |
1617 | dev_err(&pdev->dev, "could not register fb %d\n", i); | 1614 | dev_err(&pdev->dev, "could not register fb %d\n", i); |
@@ -1643,14 +1640,14 @@ error: | |||
1643 | for (i = 0; i < ARRAY_SIZE(machine_data->fsl_diu_info); i++) | 1640 | for (i = 0; i < ARRAY_SIZE(machine_data->fsl_diu_info); i++) |
1644 | uninstall_fb(machine_data->fsl_diu_info[i]); | 1641 | uninstall_fb(machine_data->fsl_diu_info[i]); |
1645 | 1642 | ||
1646 | if (pool.ad.vaddr) | 1643 | if (machine_data->ad.vaddr) |
1647 | free_buf(&pdev->dev, &pool.ad, | 1644 | free_buf(&pdev->dev, &machine_data->ad, |
1648 | sizeof(struct diu_ad) * FSL_AOI_NUM, 8); | 1645 | sizeof(struct diu_ad) * FSL_AOI_NUM, 8); |
1649 | if (pool.gamma.vaddr) | 1646 | if (machine_data->gamma.vaddr) |
1650 | free_buf(&pdev->dev, &pool.gamma, 768, 32); | 1647 | free_buf(&pdev->dev, &machine_data->gamma, 768, 32); |
1651 | if (pool.cursor.vaddr) | 1648 | if (machine_data->cursor.vaddr) |
1652 | free_buf(&pdev->dev, &pool.cursor, MAX_CURS * MAX_CURS * 2, | 1649 | free_buf(&pdev->dev, &machine_data->cursor, |
1653 | 32); | 1650 | MAX_CURS * MAX_CURS * 2, 32); |
1654 | if (machine_data->dummy_aoi_virt) | 1651 | if (machine_data->dummy_aoi_virt) |
1655 | fsl_diu_free(machine_data->dummy_aoi_virt, 64); | 1652 | fsl_diu_free(machine_data->dummy_aoi_virt, 64); |
1656 | iounmap(machine_data->diu_reg); | 1653 | iounmap(machine_data->diu_reg); |
@@ -1674,13 +1671,14 @@ static int fsl_diu_remove(struct platform_device *pdev) | |||
1674 | free_irq_local(machine_data); | 1671 | free_irq_local(machine_data); |
1675 | for (i = 0; i < ARRAY_SIZE(machine_data->fsl_diu_info); i++) | 1672 | for (i = 0; i < ARRAY_SIZE(machine_data->fsl_diu_info); i++) |
1676 | uninstall_fb(machine_data->fsl_diu_info[i]); | 1673 | uninstall_fb(machine_data->fsl_diu_info[i]); |
1677 | if (pool.ad.vaddr) | 1674 | if (machine_data->ad.vaddr) |
1678 | free_buf(&pdev->dev, &pool.ad, | 1675 | free_buf(&pdev->dev, &machine_data->ad, |
1679 | sizeof(struct diu_ad) * FSL_AOI_NUM, 8); | 1676 | sizeof(struct diu_ad) * FSL_AOI_NUM, 8); |
1680 | if (pool.gamma.vaddr) | 1677 | if (machine_data->gamma.vaddr) |
1681 | free_buf(&pdev->dev, &pool.gamma, 768, 32); | 1678 | free_buf(&pdev->dev, &machine_data->gamma, 768, 32); |
1682 | if (pool.cursor.vaddr) | 1679 | if (machine_data->cursor.vaddr) |
1683 | free_buf(&pdev->dev, &pool.cursor, MAX_CURS * MAX_CURS * 2, 32); | 1680 | free_buf(&pdev->dev, &machine_data->cursor, |
1681 | MAX_CURS * MAX_CURS * 2, 32); | ||
1684 | if (machine_data->dummy_aoi_virt) | 1682 | if (machine_data->dummy_aoi_virt) |
1685 | fsl_diu_free(machine_data->dummy_aoi_virt, 64); | 1683 | fsl_diu_free(machine_data->dummy_aoi_virt, 64); |
1686 | iounmap(machine_data->diu_reg); | 1684 | iounmap(machine_data->diu_reg); |