diff options
Diffstat (limited to 'arch/arm/plat-omap/mcbsp.c')
-rw-r--r-- | arch/arm/plat-omap/mcbsp.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c index 67ec74ea2532..6d230164b4f9 100644 --- a/arch/arm/plat-omap/mcbsp.c +++ b/arch/arm/plat-omap/mcbsp.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <plat/dma.h> | 28 | #include <plat/dma.h> |
29 | #include <plat/mcbsp.h> | 29 | #include <plat/mcbsp.h> |
30 | #include <plat/omap_device.h> | 30 | #include <plat/omap_device.h> |
31 | #include <linux/pm_runtime.h> | ||
31 | 32 | ||
32 | /* XXX These "sideways" includes are a sign that something is wrong */ | 33 | /* XXX These "sideways" includes are a sign that something is wrong */ |
33 | #include "../mach-omap2/cm2xxx_3xxx.h" | 34 | #include "../mach-omap2/cm2xxx_3xxx.h" |
@@ -757,8 +758,7 @@ int omap_mcbsp_request(unsigned int id) | |||
757 | if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->request) | 758 | if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->request) |
758 | mcbsp->pdata->ops->request(id); | 759 | mcbsp->pdata->ops->request(id); |
759 | 760 | ||
760 | clk_enable(mcbsp->iclk); | 761 | pm_runtime_get_sync(mcbsp->dev); |
761 | clk_enable(mcbsp->fclk); | ||
762 | 762 | ||
763 | /* Do procedure specific to omap34xx arch, if applicable */ | 763 | /* Do procedure specific to omap34xx arch, if applicable */ |
764 | omap34xx_mcbsp_request(mcbsp); | 764 | omap34xx_mcbsp_request(mcbsp); |
@@ -806,8 +806,7 @@ err_clk_disable: | |||
806 | /* Do procedure specific to omap34xx arch, if applicable */ | 806 | /* Do procedure specific to omap34xx arch, if applicable */ |
807 | omap34xx_mcbsp_free(mcbsp); | 807 | omap34xx_mcbsp_free(mcbsp); |
808 | 808 | ||
809 | clk_disable(mcbsp->fclk); | 809 | pm_runtime_put_sync(mcbsp->dev); |
810 | clk_disable(mcbsp->iclk); | ||
811 | 810 | ||
812 | spin_lock(&mcbsp->lock); | 811 | spin_lock(&mcbsp->lock); |
813 | mcbsp->free = true; | 812 | mcbsp->free = true; |
@@ -837,8 +836,7 @@ void omap_mcbsp_free(unsigned int id) | |||
837 | /* Do procedure specific to omap34xx arch, if applicable */ | 836 | /* Do procedure specific to omap34xx arch, if applicable */ |
838 | omap34xx_mcbsp_free(mcbsp); | 837 | omap34xx_mcbsp_free(mcbsp); |
839 | 838 | ||
840 | clk_disable(mcbsp->fclk); | 839 | pm_runtime_put_sync(mcbsp->dev); |
841 | clk_disable(mcbsp->iclk); | ||
842 | 840 | ||
843 | if (mcbsp->io_type == OMAP_MCBSP_IRQ_IO) { | 841 | if (mcbsp->io_type == OMAP_MCBSP_IRQ_IO) { |
844 | /* Free IRQs */ | 842 | /* Free IRQs */ |
@@ -1827,32 +1825,24 @@ static int __devinit omap_mcbsp_probe(struct platform_device *pdev) | |||
1827 | } | 1825 | } |
1828 | mcbsp->dma_tx_sync = res->start; | 1826 | mcbsp->dma_tx_sync = res->start; |
1829 | 1827 | ||
1830 | mcbsp->iclk = clk_get(&pdev->dev, "ick"); | ||
1831 | if (IS_ERR(mcbsp->iclk)) { | ||
1832 | ret = PTR_ERR(mcbsp->iclk); | ||
1833 | dev_err(&pdev->dev, "unable to get ick: %d\n", ret); | ||
1834 | goto err_res; | ||
1835 | } | ||
1836 | |||
1837 | mcbsp->fclk = clk_get(&pdev->dev, "fck"); | 1828 | mcbsp->fclk = clk_get(&pdev->dev, "fck"); |
1838 | if (IS_ERR(mcbsp->fclk)) { | 1829 | if (IS_ERR(mcbsp->fclk)) { |
1839 | ret = PTR_ERR(mcbsp->fclk); | 1830 | ret = PTR_ERR(mcbsp->fclk); |
1840 | dev_err(&pdev->dev, "unable to get fck: %d\n", ret); | 1831 | dev_err(&pdev->dev, "unable to get fck: %d\n", ret); |
1841 | goto err_fclk; | 1832 | goto err_res; |
1842 | } | 1833 | } |
1843 | 1834 | ||
1844 | mcbsp->pdata = pdata; | 1835 | mcbsp->pdata = pdata; |
1845 | mcbsp->dev = &pdev->dev; | 1836 | mcbsp->dev = &pdev->dev; |
1846 | mcbsp_ptr[id] = mcbsp; | 1837 | mcbsp_ptr[id] = mcbsp; |
1847 | platform_set_drvdata(pdev, mcbsp); | 1838 | platform_set_drvdata(pdev, mcbsp); |
1839 | pm_runtime_enable(mcbsp->dev); | ||
1848 | 1840 | ||
1849 | /* Initialize mcbsp properties for OMAP34XX if needed / applicable */ | 1841 | /* Initialize mcbsp properties for OMAP34XX if needed / applicable */ |
1850 | omap34xx_device_init(mcbsp); | 1842 | omap34xx_device_init(mcbsp); |
1851 | 1843 | ||
1852 | return 0; | 1844 | return 0; |
1853 | 1845 | ||
1854 | err_fclk: | ||
1855 | clk_put(mcbsp->iclk); | ||
1856 | err_res: | 1846 | err_res: |
1857 | iounmap(mcbsp->io_base); | 1847 | iounmap(mcbsp->io_base); |
1858 | err_ioremap: | 1848 | err_ioremap: |
@@ -1875,7 +1865,6 @@ static int __devexit omap_mcbsp_remove(struct platform_device *pdev) | |||
1875 | omap34xx_device_exit(mcbsp); | 1865 | omap34xx_device_exit(mcbsp); |
1876 | 1866 | ||
1877 | clk_put(mcbsp->fclk); | 1867 | clk_put(mcbsp->fclk); |
1878 | clk_put(mcbsp->iclk); | ||
1879 | 1868 | ||
1880 | iounmap(mcbsp->io_base); | 1869 | iounmap(mcbsp->io_base); |
1881 | kfree(mcbsp); | 1870 | kfree(mcbsp); |