aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2012-08-16 09:41:00 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-08-22 15:16:55 -0400
commitf199131a8f1dde3309c8520b663aa7a3daf5995e (patch)
tree740c254a0c47c5917be81080bd221521d1f0e9c2
parent152c6e56f6a8577bd291f6f4ca897e5758332a1b (diff)
ARM/ASoC: omap-mcbsp: Move OMAP2+ clock parenting code to ASoC driver
Move the McBSP CLKS re-parenting code to ASoC driver from arch/arm/mach-omap2. The call fort the re-parenting has been already limited to OMAP2+ SoC in the ASoC driver. There is no longer need to have callback function for it. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Acked-by: Jarkko Nikula <jarkko.nikula@bitmer.com> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r--arch/arm/mach-omap2/mcbsp.c40
-rw-r--r--arch/arm/plat-omap/include/plat/mcbsp.h1
-rw-r--r--sound/soc/omap/mcbsp.c31
3 files changed, 26 insertions, 46 deletions
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
index 577cb77db26c..ebc801ea5be9 100644
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -101,45 +101,6 @@ static int omap4_mcbsp4_mux_rx_clk(struct device *dev, const char *signal,
101 return 0; 101 return 0;
102} 102}
103 103
104/* McBSP CLKS source switching function */
105static int omap2_mcbsp_set_clk_src(struct device *dev, struct clk *clk,
106 const char *src)
107{
108 struct clk *fck_src;
109 char *fck_src_name;
110 int r;
111
112 if (!strcmp(src, "clks_ext"))
113 fck_src_name = "pad_fck";
114 else if (!strcmp(src, "clks_fclk"))
115 fck_src_name = "prcm_fck";
116 else
117 return -EINVAL;
118
119 fck_src = clk_get(dev, fck_src_name);
120 if (IS_ERR_OR_NULL(fck_src)) {
121 pr_err("omap-mcbsp: %s: could not clk_get() %s\n", "clks",
122 fck_src_name);
123 return -EINVAL;
124 }
125
126 pm_runtime_put_sync(dev);
127
128 r = clk_set_parent(clk, fck_src);
129 if (IS_ERR_VALUE(r)) {
130 pr_err("omap-mcbsp: %s: could not clk_set_parent() to %s\n",
131 "clks", fck_src_name);
132 clk_put(fck_src);
133 return -EINVAL;
134 }
135
136 pm_runtime_get_sync(dev);
137
138 clk_put(fck_src);
139
140 return 0;
141}
142
143static int omap3_enable_st_clock(unsigned int id, bool enable) 104static int omap3_enable_st_clock(unsigned int id, bool enable)
144{ 105{
145 unsigned int w; 106 unsigned int w;
@@ -181,7 +142,6 @@ static int __init omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
181 pdata->reg_size = 4; 142 pdata->reg_size = 4;
182 pdata->has_ccr = true; 143 pdata->has_ccr = true;
183 } 144 }
184 pdata->set_clk_src = omap2_mcbsp_set_clk_src;
185 145
186 /* On OMAP2/3 the McBSP1 port has 6 pin configuration */ 146 /* On OMAP2/3 the McBSP1 port has 6 pin configuration */
187 if (id == 1 && oh->class->rev < MCBSP_CONFIG_TYPE4) 147 if (id == 1 && oh->class->rev < MCBSP_CONFIG_TYPE4)
diff --git a/arch/arm/plat-omap/include/plat/mcbsp.h b/arch/arm/plat-omap/include/plat/mcbsp.h
index 18814127809a..0a7d5ca471e0 100644
--- a/arch/arm/plat-omap/include/plat/mcbsp.h
+++ b/arch/arm/plat-omap/include/plat/mcbsp.h
@@ -47,7 +47,6 @@ struct omap_mcbsp_platform_data {
47 bool has_wakeup; /* Wakeup capability */ 47 bool has_wakeup; /* Wakeup capability */
48 bool has_ccr; /* Transceiver has configuration control registers */ 48 bool has_ccr; /* Transceiver has configuration control registers */
49 int (*enable_st_clock)(unsigned int, bool); 49 int (*enable_st_clock)(unsigned int, bool);
50 int (*set_clk_src)(struct device *dev, struct clk *clk, const char *src);
51 int (*mux_signal)(struct device *dev, const char *signal, const char *src); 50 int (*mux_signal)(struct device *dev, const char *signal, const char *src);
52}; 51};
53 52
diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
index 34835e8a9160..6afbc26cef70 100644
--- a/sound/soc/omap/mcbsp.c
+++ b/sound/soc/omap/mcbsp.c
@@ -24,6 +24,7 @@
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/io.h> 25#include <linux/io.h>
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/pm_runtime.h>
27 28
28#include <plat/mcbsp.h> 29#include <plat/mcbsp.h>
29 30
@@ -726,19 +727,39 @@ void omap_mcbsp_stop(struct omap_mcbsp *mcbsp, int tx, int rx)
726 727
727int omap2_mcbsp_set_clks_src(struct omap_mcbsp *mcbsp, u8 fck_src_id) 728int omap2_mcbsp_set_clks_src(struct omap_mcbsp *mcbsp, u8 fck_src_id)
728{ 729{
730 struct clk *fck_src;
729 const char *src; 731 const char *src;
732 int r;
730 733
731 if (fck_src_id == MCBSP_CLKS_PAD_SRC) 734 if (fck_src_id == MCBSP_CLKS_PAD_SRC)
732 src = "clks_ext"; 735 src = "pad_fck";
733 else if (fck_src_id == MCBSP_CLKS_PRCM_SRC) 736 else if (fck_src_id == MCBSP_CLKS_PRCM_SRC)
734 src = "clks_fclk"; 737 src = "prcm_fck";
735 else 738 else
736 return -EINVAL; 739 return -EINVAL;
737 740
738 if (mcbsp->pdata->set_clk_src) 741 fck_src = clk_get(mcbsp->dev, src);
739 return mcbsp->pdata->set_clk_src(mcbsp->dev, mcbsp->fclk, src); 742 if (IS_ERR(fck_src)) {
740 else 743 dev_err(mcbsp->dev, "CLKS: could not clk_get() %s\n", src);
741 return -EINVAL; 744 return -EINVAL;
745 }
746
747 pm_runtime_put_sync(mcbsp->dev);
748
749 r = clk_set_parent(mcbsp->fclk, fck_src);
750 if (r) {
751 dev_err(mcbsp->dev, "CLKS: could not clk_set_parent() to %s\n",
752 src);
753 clk_put(fck_src);
754 return r;
755 }
756
757 pm_runtime_get_sync(mcbsp->dev);
758
759 clk_put(fck_src);
760
761 return 0;
762
742} 763}
743 764
744int omap_mcbsp_6pin_src_mux(struct omap_mcbsp *mcbsp, u8 mux) 765int omap_mcbsp_6pin_src_mux(struct omap_mcbsp *mcbsp, u8 mux)