aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform
diff options
context:
space:
mode:
authorMurali Karicheri <m-karicheri2@ti.com>2012-10-22 10:41:36 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-11-21 12:06:57 -0500
commit1f5a5e62aed455a4004685b6ee65ea91cc5acb87 (patch)
treead6aeaed8d6d7c8c829306ed09329ecf063f0fcd /drivers/media/platform
parentd046628d2c81f64015c68cd14d5e09cbe99f56d8 (diff)
[media] media:davinci: clk - {prepare/unprepare} for common clk
As a first step towards migrating davinci platforms to use common clock framework, replace all instances of clk_enable() with clk_prepare_enable() and clk_disable() with clk_disable_unprepare(). Also fixes some issues related to clk clean up in the driver Signed-off-by: Murali Karicheri <m-karicheri2@ti.com> Acked-by: Lad, Prabhakar <prabhakar.lad@ti.com> Tested-by: Lad, Prabhakar <prabhakar.lad@ti.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/platform')
-rw-r--r--drivers/media/platform/davinci/dm355_ccdc.c8
-rw-r--r--drivers/media/platform/davinci/dm644x_ccdc.c16
-rw-r--r--drivers/media/platform/davinci/isif.c5
-rw-r--r--drivers/media/platform/davinci/vpbe.c10
-rw-r--r--drivers/media/platform/davinci/vpif.c8
5 files changed, 31 insertions, 16 deletions
diff --git a/drivers/media/platform/davinci/dm355_ccdc.c b/drivers/media/platform/davinci/dm355_ccdc.c
index ce0e4131c067..030950dcfb16 100644
--- a/drivers/media/platform/davinci/dm355_ccdc.c
+++ b/drivers/media/platform/davinci/dm355_ccdc.c
@@ -1003,7 +1003,7 @@ static int __devinit dm355_ccdc_probe(struct platform_device *pdev)
1003 status = PTR_ERR(ccdc_cfg.mclk); 1003 status = PTR_ERR(ccdc_cfg.mclk);
1004 goto fail_nomap; 1004 goto fail_nomap;
1005 } 1005 }
1006 if (clk_enable(ccdc_cfg.mclk)) { 1006 if (clk_prepare_enable(ccdc_cfg.mclk)) {
1007 status = -ENODEV; 1007 status = -ENODEV;
1008 goto fail_mclk; 1008 goto fail_mclk;
1009 } 1009 }
@@ -1014,7 +1014,7 @@ static int __devinit dm355_ccdc_probe(struct platform_device *pdev)
1014 status = PTR_ERR(ccdc_cfg.sclk); 1014 status = PTR_ERR(ccdc_cfg.sclk);
1015 goto fail_mclk; 1015 goto fail_mclk;
1016 } 1016 }
1017 if (clk_enable(ccdc_cfg.sclk)) { 1017 if (clk_prepare_enable(ccdc_cfg.sclk)) {
1018 status = -ENODEV; 1018 status = -ENODEV;
1019 goto fail_sclk; 1019 goto fail_sclk;
1020 } 1020 }
@@ -1034,8 +1034,10 @@ static int __devinit dm355_ccdc_probe(struct platform_device *pdev)
1034 printk(KERN_NOTICE "%s is registered with vpfe.\n", ccdc_hw_dev.name); 1034 printk(KERN_NOTICE "%s is registered with vpfe.\n", ccdc_hw_dev.name);
1035 return 0; 1035 return 0;
1036fail_sclk: 1036fail_sclk:
1037 clk_disable_unprepare(ccdc_cfg.sclk);
1037 clk_put(ccdc_cfg.sclk); 1038 clk_put(ccdc_cfg.sclk);
1038fail_mclk: 1039fail_mclk:
1040 clk_disable_unprepare(ccdc_cfg.mclk);
1039 clk_put(ccdc_cfg.mclk); 1041 clk_put(ccdc_cfg.mclk);
1040fail_nomap: 1042fail_nomap:
1041 iounmap(ccdc_cfg.base_addr); 1043 iounmap(ccdc_cfg.base_addr);
@@ -1050,6 +1052,8 @@ static int dm355_ccdc_remove(struct platform_device *pdev)
1050{ 1052{
1051 struct resource *res; 1053 struct resource *res;
1052 1054
1055 clk_disable_unprepare(ccdc_cfg.sclk);
1056 clk_disable_unprepare(ccdc_cfg.mclk);
1053 clk_put(ccdc_cfg.mclk); 1057 clk_put(ccdc_cfg.mclk);
1054 clk_put(ccdc_cfg.sclk); 1058 clk_put(ccdc_cfg.sclk);
1055 iounmap(ccdc_cfg.base_addr); 1059 iounmap(ccdc_cfg.base_addr);
diff --git a/drivers/media/platform/davinci/dm644x_ccdc.c b/drivers/media/platform/davinci/dm644x_ccdc.c
index ee7942b1996e..0215ab6ebc90 100644
--- a/drivers/media/platform/davinci/dm644x_ccdc.c
+++ b/drivers/media/platform/davinci/dm644x_ccdc.c
@@ -994,7 +994,7 @@ static int __devinit dm644x_ccdc_probe(struct platform_device *pdev)
994 status = PTR_ERR(ccdc_cfg.mclk); 994 status = PTR_ERR(ccdc_cfg.mclk);
995 goto fail_nomap; 995 goto fail_nomap;
996 } 996 }
997 if (clk_enable(ccdc_cfg.mclk)) { 997 if (clk_prepare_enable(ccdc_cfg.mclk)) {
998 status = -ENODEV; 998 status = -ENODEV;
999 goto fail_mclk; 999 goto fail_mclk;
1000 } 1000 }
@@ -1005,7 +1005,7 @@ static int __devinit dm644x_ccdc_probe(struct platform_device *pdev)
1005 status = PTR_ERR(ccdc_cfg.sclk); 1005 status = PTR_ERR(ccdc_cfg.sclk);
1006 goto fail_mclk; 1006 goto fail_mclk;
1007 } 1007 }
1008 if (clk_enable(ccdc_cfg.sclk)) { 1008 if (clk_prepare_enable(ccdc_cfg.sclk)) {
1009 status = -ENODEV; 1009 status = -ENODEV;
1010 goto fail_sclk; 1010 goto fail_sclk;
1011 } 1011 }
@@ -1013,8 +1013,10 @@ static int __devinit dm644x_ccdc_probe(struct platform_device *pdev)
1013 printk(KERN_NOTICE "%s is registered with vpfe.\n", ccdc_hw_dev.name); 1013 printk(KERN_NOTICE "%s is registered with vpfe.\n", ccdc_hw_dev.name);
1014 return 0; 1014 return 0;
1015fail_sclk: 1015fail_sclk:
1016 clk_disable_unprepare(ccdc_cfg.sclk);
1016 clk_put(ccdc_cfg.sclk); 1017 clk_put(ccdc_cfg.sclk);
1017fail_mclk: 1018fail_mclk:
1019 clk_disable_unprepare(ccdc_cfg.mclk);
1018 clk_put(ccdc_cfg.mclk); 1020 clk_put(ccdc_cfg.mclk);
1019fail_nomap: 1021fail_nomap:
1020 iounmap(ccdc_cfg.base_addr); 1022 iounmap(ccdc_cfg.base_addr);
@@ -1029,6 +1031,8 @@ static int dm644x_ccdc_remove(struct platform_device *pdev)
1029{ 1031{
1030 struct resource *res; 1032 struct resource *res;
1031 1033
1034 clk_disable_unprepare(ccdc_cfg.mclk);
1035 clk_disable_unprepare(ccdc_cfg.sclk);
1032 clk_put(ccdc_cfg.mclk); 1036 clk_put(ccdc_cfg.mclk);
1033 clk_put(ccdc_cfg.sclk); 1037 clk_put(ccdc_cfg.sclk);
1034 iounmap(ccdc_cfg.base_addr); 1038 iounmap(ccdc_cfg.base_addr);
@@ -1046,8 +1050,8 @@ static int dm644x_ccdc_suspend(struct device *dev)
1046 /* Disable CCDC */ 1050 /* Disable CCDC */
1047 ccdc_enable(0); 1051 ccdc_enable(0);
1048 /* Disable both master and slave clock */ 1052 /* Disable both master and slave clock */
1049 clk_disable(ccdc_cfg.mclk); 1053 clk_disable_unprepare(ccdc_cfg.mclk);
1050 clk_disable(ccdc_cfg.sclk); 1054 clk_disable_unprepare(ccdc_cfg.sclk);
1051 1055
1052 return 0; 1056 return 0;
1053} 1057}
@@ -1055,8 +1059,8 @@ static int dm644x_ccdc_suspend(struct device *dev)
1055static int dm644x_ccdc_resume(struct device *dev) 1059static int dm644x_ccdc_resume(struct device *dev)
1056{ 1060{
1057 /* Enable both master and slave clock */ 1061 /* Enable both master and slave clock */
1058 clk_enable(ccdc_cfg.mclk); 1062 clk_prepare_enable(ccdc_cfg.mclk);
1059 clk_enable(ccdc_cfg.sclk); 1063 clk_prepare_enable(ccdc_cfg.sclk);
1060 /* Restore CCDC context */ 1064 /* Restore CCDC context */
1061 ccdc_restore_context(); 1065 ccdc_restore_context();
1062 1066
diff --git a/drivers/media/platform/davinci/isif.c b/drivers/media/platform/davinci/isif.c
index b99d5423e3a8..2c26c3e1837e 100644
--- a/drivers/media/platform/davinci/isif.c
+++ b/drivers/media/platform/davinci/isif.c
@@ -1053,7 +1053,7 @@ static int __devinit isif_probe(struct platform_device *pdev)
1053 status = PTR_ERR(isif_cfg.mclk); 1053 status = PTR_ERR(isif_cfg.mclk);
1054 goto fail_mclk; 1054 goto fail_mclk;
1055 } 1055 }
1056 if (clk_enable(isif_cfg.mclk)) { 1056 if (clk_prepare_enable(isif_cfg.mclk)) {
1057 status = -ENODEV; 1057 status = -ENODEV;
1058 goto fail_mclk; 1058 goto fail_mclk;
1059 } 1059 }
@@ -1125,6 +1125,7 @@ fail_nobase_res:
1125 i--; 1125 i--;
1126 } 1126 }
1127fail_mclk: 1127fail_mclk:
1128 clk_disable_unprepare(isif_cfg.mclk);
1128 clk_put(isif_cfg.mclk); 1129 clk_put(isif_cfg.mclk);
1129 vpfe_unregister_ccdc_device(&isif_hw_dev); 1130 vpfe_unregister_ccdc_device(&isif_hw_dev);
1130 return status; 1131 return status;
@@ -1145,6 +1146,8 @@ static int isif_remove(struct platform_device *pdev)
1145 i++; 1146 i++;
1146 } 1147 }
1147 vpfe_unregister_ccdc_device(&isif_hw_dev); 1148 vpfe_unregister_ccdc_device(&isif_hw_dev);
1149 clk_disable_unprepare(isif_cfg.mclk);
1150 clk_put(isif_cfg.mclk);
1148 return 0; 1151 return 0;
1149} 1152}
1150 1153
diff --git a/drivers/media/platform/davinci/vpbe.c b/drivers/media/platform/davinci/vpbe.c
index 69d7a58c92c3..7f5cf9b347b2 100644
--- a/drivers/media/platform/davinci/vpbe.c
+++ b/drivers/media/platform/davinci/vpbe.c
@@ -612,7 +612,7 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev)
612 ret = PTR_ERR(vpbe_dev->dac_clk); 612 ret = PTR_ERR(vpbe_dev->dac_clk);
613 goto fail_mutex_unlock; 613 goto fail_mutex_unlock;
614 } 614 }
615 if (clk_enable(vpbe_dev->dac_clk)) { 615 if (clk_prepare_enable(vpbe_dev->dac_clk)) {
616 ret = -ENODEV; 616 ret = -ENODEV;
617 goto fail_mutex_unlock; 617 goto fail_mutex_unlock;
618 } 618 }
@@ -759,8 +759,10 @@ fail_kfree_encoders:
759fail_dev_unregister: 759fail_dev_unregister:
760 v4l2_device_unregister(&vpbe_dev->v4l2_dev); 760 v4l2_device_unregister(&vpbe_dev->v4l2_dev);
761fail_clk_put: 761fail_clk_put:
762 if (strcmp(vpbe_dev->cfg->module_name, "dm644x-vpbe-display") != 0) 762 if (strcmp(vpbe_dev->cfg->module_name, "dm644x-vpbe-display") != 0) {
763 clk_disable_unprepare(vpbe_dev->dac_clk);
763 clk_put(vpbe_dev->dac_clk); 764 clk_put(vpbe_dev->dac_clk);
765 }
764fail_mutex_unlock: 766fail_mutex_unlock:
765 mutex_unlock(&vpbe_dev->lock); 767 mutex_unlock(&vpbe_dev->lock);
766 return ret; 768 return ret;
@@ -777,8 +779,10 @@ fail_mutex_unlock:
777static void vpbe_deinitialize(struct device *dev, struct vpbe_device *vpbe_dev) 779static void vpbe_deinitialize(struct device *dev, struct vpbe_device *vpbe_dev)
778{ 780{
779 v4l2_device_unregister(&vpbe_dev->v4l2_dev); 781 v4l2_device_unregister(&vpbe_dev->v4l2_dev);
780 if (strcmp(vpbe_dev->cfg->module_name, "dm644x-vpbe-display") != 0) 782 if (strcmp(vpbe_dev->cfg->module_name, "dm644x-vpbe-display") != 0) {
783 clk_disable_unprepare(vpbe_dev->dac_clk);
781 clk_put(vpbe_dev->dac_clk); 784 clk_put(vpbe_dev->dac_clk);
785 }
782 786
783 kfree(vpbe_dev->amp); 787 kfree(vpbe_dev->amp);
784 kfree(vpbe_dev->encoders); 788 kfree(vpbe_dev->encoders);
diff --git a/drivers/media/platform/davinci/vpif.c b/drivers/media/platform/davinci/vpif.c
index cff3c0ab501f..0d6cc8e4deb2 100644
--- a/drivers/media/platform/davinci/vpif.c
+++ b/drivers/media/platform/davinci/vpif.c
@@ -444,7 +444,7 @@ static int __devinit vpif_probe(struct platform_device *pdev)
444 status = PTR_ERR(vpif_clk); 444 status = PTR_ERR(vpif_clk);
445 goto clk_fail; 445 goto clk_fail;
446 } 446 }
447 clk_enable(vpif_clk); 447 clk_prepare_enable(vpif_clk);
448 448
449 spin_lock_init(&vpif_lock); 449 spin_lock_init(&vpif_lock);
450 dev_info(&pdev->dev, "vpif probe success\n"); 450 dev_info(&pdev->dev, "vpif probe success\n");
@@ -460,7 +460,7 @@ fail:
460static int __devexit vpif_remove(struct platform_device *pdev) 460static int __devexit vpif_remove(struct platform_device *pdev)
461{ 461{
462 if (vpif_clk) { 462 if (vpif_clk) {
463 clk_disable(vpif_clk); 463 clk_disable_unprepare(vpif_clk);
464 clk_put(vpif_clk); 464 clk_put(vpif_clk);
465 } 465 }
466 466
@@ -472,13 +472,13 @@ static int __devexit vpif_remove(struct platform_device *pdev)
472#ifdef CONFIG_PM 472#ifdef CONFIG_PM
473static int vpif_suspend(struct device *dev) 473static int vpif_suspend(struct device *dev)
474{ 474{
475 clk_disable(vpif_clk); 475 clk_disable_unprepare(vpif_clk);
476 return 0; 476 return 0;
477} 477}
478 478
479static int vpif_resume(struct device *dev) 479static int vpif_resume(struct device *dev)
480{ 480{
481 clk_enable(vpif_clk); 481 clk_prepare_enable(vpif_clk);
482 return 0; 482 return 0;
483} 483}
484 484