aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/mx2_camera.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/mx2_camera.c')
-rw-r--r--drivers/media/video/mx2_camera.c47
1 files changed, 31 insertions, 16 deletions
diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c
index 637bde8aca28..ac175406e582 100644
--- a/drivers/media/video/mx2_camera.c
+++ b/drivers/media/video/mx2_camera.c
@@ -272,7 +272,7 @@ struct mx2_camera_dev {
272 struct device *dev; 272 struct device *dev;
273 struct soc_camera_host soc_host; 273 struct soc_camera_host soc_host;
274 struct soc_camera_device *icd; 274 struct soc_camera_device *icd;
275 struct clk *clk_csi, *clk_emma; 275 struct clk *clk_csi, *clk_emma_ahb, *clk_emma_ipg;
276 276
277 unsigned int irq_csi, irq_emma; 277 unsigned int irq_csi, irq_emma;
278 void __iomem *base_csi, *base_emma; 278 void __iomem *base_csi, *base_emma;
@@ -407,7 +407,7 @@ static void mx2_camera_deactivate(struct mx2_camera_dev *pcdev)
407{ 407{
408 unsigned long flags; 408 unsigned long flags;
409 409
410 clk_disable(pcdev->clk_csi); 410 clk_disable_unprepare(pcdev->clk_csi);
411 writel(0, pcdev->base_csi + CSICR1); 411 writel(0, pcdev->base_csi + CSICR1);
412 if (cpu_is_mx27()) { 412 if (cpu_is_mx27()) {
413 writel(0, pcdev->base_emma + PRP_CNTL); 413 writel(0, pcdev->base_emma + PRP_CNTL);
@@ -435,7 +435,7 @@ static int mx2_camera_add_device(struct soc_camera_device *icd)
435 if (pcdev->icd) 435 if (pcdev->icd)
436 return -EBUSY; 436 return -EBUSY;
437 437
438 ret = clk_enable(pcdev->clk_csi); 438 ret = clk_prepare_enable(pcdev->clk_csi);
439 if (ret < 0) 439 if (ret < 0)
440 return ret; 440 return ret;
441 441
@@ -1633,23 +1633,34 @@ static int __devinit mx27_camera_emma_init(struct mx2_camera_dev *pcdev)
1633 goto exit_iounmap; 1633 goto exit_iounmap;
1634 } 1634 }
1635 1635
1636 pcdev->clk_emma = clk_get(NULL, "emma"); 1636 pcdev->clk_emma_ipg = clk_get(pcdev->dev, "emma-ipg");
1637 if (IS_ERR(pcdev->clk_emma)) { 1637 if (IS_ERR(pcdev->clk_emma_ipg)) {
1638 err = PTR_ERR(pcdev->clk_emma); 1638 err = PTR_ERR(pcdev->clk_emma_ipg);
1639 goto exit_free_irq; 1639 goto exit_free_irq;
1640 } 1640 }
1641 1641
1642 clk_enable(pcdev->clk_emma); 1642 clk_prepare_enable(pcdev->clk_emma_ipg);
1643
1644 pcdev->clk_emma_ahb = clk_get(pcdev->dev, "emma-ahb");
1645 if (IS_ERR(pcdev->clk_emma_ahb)) {
1646 err = PTR_ERR(pcdev->clk_emma_ahb);
1647 goto exit_clk_emma_ipg_put;
1648 }
1649
1650 clk_prepare_enable(pcdev->clk_emma_ahb);
1643 1651
1644 err = mx27_camera_emma_prp_reset(pcdev); 1652 err = mx27_camera_emma_prp_reset(pcdev);
1645 if (err) 1653 if (err)
1646 goto exit_clk_emma_put; 1654 goto exit_clk_emma_ahb_put;
1647 1655
1648 return err; 1656 return err;
1649 1657
1650exit_clk_emma_put: 1658exit_clk_emma_ahb_put:
1651 clk_disable(pcdev->clk_emma); 1659 clk_disable_unprepare(pcdev->clk_emma_ahb);
1652 clk_put(pcdev->clk_emma); 1660 clk_put(pcdev->clk_emma_ahb);
1661exit_clk_emma_ipg_put:
1662 clk_disable_unprepare(pcdev->clk_emma_ipg);
1663 clk_put(pcdev->clk_emma_ipg);
1653exit_free_irq: 1664exit_free_irq:
1654 free_irq(pcdev->irq_emma, pcdev); 1665 free_irq(pcdev->irq_emma, pcdev);
1655exit_iounmap: 1666exit_iounmap:
@@ -1685,7 +1696,7 @@ static int __devinit mx2_camera_probe(struct platform_device *pdev)
1685 goto exit; 1696 goto exit;
1686 } 1697 }
1687 1698
1688 pcdev->clk_csi = clk_get(&pdev->dev, NULL); 1699 pcdev->clk_csi = clk_get(&pdev->dev, "ahb");
1689 if (IS_ERR(pcdev->clk_csi)) { 1700 if (IS_ERR(pcdev->clk_csi)) {
1690 dev_err(&pdev->dev, "Could not get csi clock\n"); 1701 dev_err(&pdev->dev, "Could not get csi clock\n");
1691 err = PTR_ERR(pcdev->clk_csi); 1702 err = PTR_ERR(pcdev->clk_csi);
@@ -1785,8 +1796,10 @@ exit_free_emma:
1785eallocctx: 1796eallocctx:
1786 if (cpu_is_mx27()) { 1797 if (cpu_is_mx27()) {
1787 free_irq(pcdev->irq_emma, pcdev); 1798 free_irq(pcdev->irq_emma, pcdev);
1788 clk_disable(pcdev->clk_emma); 1799 clk_disable_unprepare(pcdev->clk_emma_ipg);
1789 clk_put(pcdev->clk_emma); 1800 clk_put(pcdev->clk_emma_ipg);
1801 clk_disable_unprepare(pcdev->clk_emma_ahb);
1802 clk_put(pcdev->clk_emma_ahb);
1790 iounmap(pcdev->base_emma); 1803 iounmap(pcdev->base_emma);
1791 release_mem_region(pcdev->res_emma->start, resource_size(pcdev->res_emma)); 1804 release_mem_region(pcdev->res_emma->start, resource_size(pcdev->res_emma));
1792 } 1805 }
@@ -1825,8 +1838,10 @@ static int __devexit mx2_camera_remove(struct platform_device *pdev)
1825 iounmap(pcdev->base_csi); 1838 iounmap(pcdev->base_csi);
1826 1839
1827 if (cpu_is_mx27()) { 1840 if (cpu_is_mx27()) {
1828 clk_disable(pcdev->clk_emma); 1841 clk_disable_unprepare(pcdev->clk_emma_ipg);
1829 clk_put(pcdev->clk_emma); 1842 clk_put(pcdev->clk_emma_ipg);
1843 clk_disable_unprepare(pcdev->clk_emma_ahb);
1844 clk_put(pcdev->clk_emma_ahb);
1830 iounmap(pcdev->base_emma); 1845 iounmap(pcdev->base_emma);
1831 res = pcdev->res_emma; 1846 res = pcdev->res_emma;
1832 release_mem_region(res->start, resource_size(res)); 1847 release_mem_region(res->start, resource_size(res));