aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/omap2/dss
diff options
context:
space:
mode:
authorArchit Taneja <archit@ti.com>2013-04-08 04:55:00 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2013-04-10 08:02:54 -0400
commitb2c9c8ee7cec4c7d8fa90375f9de92ecf3045ebb (patch)
tree33b24a8d65318bcbaa6036410a7715af283f39d1 /drivers/video/omap2/dss
parent3aff5b122b7e01945ba787df306c182bae9f6762 (diff)
omapdss: use devm_clk_get()
Use devm_clk_get() instead of clk_get() for dss, and for outputs hdmi and venc. This reduces code and simplifies error handling. Signed-off-by: Archit Taneja <archit@ti.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video/omap2/dss')
-rw-r--r--drivers/video/omap2/dss/dss.c18
-rw-r--r--drivers/video/omap2/dss/hdmi.c16
-rw-r--r--drivers/video/omap2/dss/venc.c10
3 files changed, 6 insertions, 38 deletions
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 054c2a22b3f1..645b3bc12ede 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -767,13 +767,11 @@ int dss_dpi_select_source(enum omap_channel channel)
767static int dss_get_clocks(void) 767static int dss_get_clocks(void)
768{ 768{
769 struct clk *clk; 769 struct clk *clk;
770 int r;
771 770
772 clk = clk_get(&dss.pdev->dev, "fck"); 771 clk = devm_clk_get(&dss.pdev->dev, "fck");
773 if (IS_ERR(clk)) { 772 if (IS_ERR(clk)) {
774 DSSERR("can't get clock fck\n"); 773 DSSERR("can't get clock fck\n");
775 r = PTR_ERR(clk); 774 return PTR_ERR(clk);
776 goto err;
777 } 775 }
778 776
779 dss.dss_clk = clk; 777 dss.dss_clk = clk;
@@ -782,8 +780,7 @@ static int dss_get_clocks(void)
782 clk = clk_get(NULL, dss.feat->clk_name); 780 clk = clk_get(NULL, dss.feat->clk_name);
783 if (IS_ERR(clk)) { 781 if (IS_ERR(clk)) {
784 DSSERR("Failed to get %s\n", dss.feat->clk_name); 782 DSSERR("Failed to get %s\n", dss.feat->clk_name);
785 r = PTR_ERR(clk); 783 return PTR_ERR(clk);
786 goto err;
787 } 784 }
788 } else { 785 } else {
789 clk = NULL; 786 clk = NULL;
@@ -792,21 +789,12 @@ static int dss_get_clocks(void)
792 dss.dpll4_m4_ck = clk; 789 dss.dpll4_m4_ck = clk;
793 790
794 return 0; 791 return 0;
795
796err:
797 if (dss.dss_clk)
798 clk_put(dss.dss_clk);
799 if (dss.dpll4_m4_ck)
800 clk_put(dss.dpll4_m4_ck);
801
802 return r;
803} 792}
804 793
805static void dss_put_clocks(void) 794static void dss_put_clocks(void)
806{ 795{
807 if (dss.dpll4_m4_ck) 796 if (dss.dpll4_m4_ck)
808 clk_put(dss.dpll4_m4_ck); 797 clk_put(dss.dpll4_m4_ck);
809 clk_put(dss.dss_clk);
810} 798}
811 799
812static int dss_runtime_get(void) 800static int dss_runtime_get(void)
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 72923645dcce..c7e0bf748a6d 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -804,7 +804,7 @@ static int hdmi_get_clocks(struct platform_device *pdev)
804{ 804{
805 struct clk *clk; 805 struct clk *clk;
806 806
807 clk = clk_get(&pdev->dev, "sys_clk"); 807 clk = devm_clk_get(&pdev->dev, "sys_clk");
808 if (IS_ERR(clk)) { 808 if (IS_ERR(clk)) {
809 DSSERR("can't get sys_clk\n"); 809 DSSERR("can't get sys_clk\n");
810 return PTR_ERR(clk); 810 return PTR_ERR(clk);
@@ -815,12 +815,6 @@ static int hdmi_get_clocks(struct platform_device *pdev)
815 return 0; 815 return 0;
816} 816}
817 817
818static void hdmi_put_clocks(void)
819{
820 if (hdmi.sys_clk)
821 clk_put(hdmi.sys_clk);
822}
823
824#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) 818#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
825int hdmi_compute_acr(u32 sample_freq, u32 *n, u32 *cts) 819int hdmi_compute_acr(u32 sample_freq, u32 *n, u32 *cts)
826{ 820{
@@ -1100,7 +1094,7 @@ static int __init omapdss_hdmihw_probe(struct platform_device *pdev)
1100 r = hdmi_panel_init(); 1094 r = hdmi_panel_init();
1101 if (r) { 1095 if (r) {
1102 DSSERR("can't init panel\n"); 1096 DSSERR("can't init panel\n");
1103 goto err_panel_init; 1097 return r;
1104 } 1098 }
1105 1099
1106 dss_debugfs_create_file("hdmi", hdmi_dump_regs); 1100 dss_debugfs_create_file("hdmi", hdmi_dump_regs);
@@ -1110,10 +1104,6 @@ static int __init omapdss_hdmihw_probe(struct platform_device *pdev)
1110 hdmi_probe_pdata(pdev); 1104 hdmi_probe_pdata(pdev);
1111 1105
1112 return 0; 1106 return 0;
1113
1114err_panel_init:
1115 hdmi_put_clocks();
1116 return r;
1117} 1107}
1118 1108
1119static int __exit hdmi_remove_child(struct device *dev, void *data) 1109static int __exit hdmi_remove_child(struct device *dev, void *data)
@@ -1135,8 +1125,6 @@ static int __exit omapdss_hdmihw_remove(struct platform_device *pdev)
1135 1125
1136 pm_runtime_disable(&pdev->dev); 1126 pm_runtime_disable(&pdev->dev);
1137 1127
1138 hdmi_put_clocks();
1139
1140 return 0; 1128 return 0;
1141} 1129}
1142 1130
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index 006caf3cb509..c27ab6ff5a37 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -721,7 +721,7 @@ static int venc_get_clocks(struct platform_device *pdev)
721 struct clk *clk; 721 struct clk *clk;
722 722
723 if (dss_has_feature(FEAT_VENC_REQUIRES_TV_DAC_CLK)) { 723 if (dss_has_feature(FEAT_VENC_REQUIRES_TV_DAC_CLK)) {
724 clk = clk_get(&pdev->dev, "tv_dac_clk"); 724 clk = devm_clk_get(&pdev->dev, "tv_dac_clk");
725 if (IS_ERR(clk)) { 725 if (IS_ERR(clk)) {
726 DSSERR("can't get tv_dac_clk\n"); 726 DSSERR("can't get tv_dac_clk\n");
727 return PTR_ERR(clk); 727 return PTR_ERR(clk);
@@ -735,12 +735,6 @@ static int venc_get_clocks(struct platform_device *pdev)
735 return 0; 735 return 0;
736} 736}
737 737
738static void venc_put_clocks(void)
739{
740 if (venc.tv_dac_clk)
741 clk_put(venc.tv_dac_clk);
742}
743
744static struct omap_dss_device * __init venc_find_dssdev(struct platform_device *pdev) 738static struct omap_dss_device * __init venc_find_dssdev(struct platform_device *pdev)
745{ 739{
746 struct omap_dss_board_info *pdata = pdev->dev.platform_data; 740 struct omap_dss_board_info *pdata = pdev->dev.platform_data;
@@ -886,7 +880,6 @@ static int __init omap_venchw_probe(struct platform_device *pdev)
886err_panel_init: 880err_panel_init:
887err_runtime_get: 881err_runtime_get:
888 pm_runtime_disable(&pdev->dev); 882 pm_runtime_disable(&pdev->dev);
889 venc_put_clocks();
890 return r; 883 return r;
891} 884}
892 885
@@ -904,7 +897,6 @@ static int __exit omap_venchw_remove(struct platform_device *pdev)
904 venc_uninit_output(pdev); 897 venc_uninit_output(pdev);
905 898
906 pm_runtime_disable(&pdev->dev); 899 pm_runtime_disable(&pdev->dev);
907 venc_put_clocks();
908 900
909 return 0; 901 return 0;
910} 902}