aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/mcbsp.c
diff options
context:
space:
mode:
authorJarkko Nikula <jhnikula@gmail.com>2011-09-26 03:45:44 -0400
committerTony Lindgren <tony@atomide.com>2011-09-26 20:48:27 -0400
commit1743d14fb6b428e52a9a0917d11d6eba9a110002 (patch)
tree88bdb1d289fff1da1dc6f1d4a76a971fa0db53c4 /arch/arm/mach-omap2/mcbsp.c
parentac6747ca0d2e01ed55281d1cc95b5dc646735a20 (diff)
ARM: OMAP: mcbsp: Move sidetone clock management to mach-omap2/mcbsp.c
Active sidetone requires that McBSP interface clock doesn't idle and there is no mechanism in hwmod to turn autoidling on/off in runtime. McBSP2 and 3 in OMAP34xx share their interface clock with McBSP sidetone module and that interface clock must be active when the sidetone is operating. Sidetone has its own autoidle bit which should keep the interface clock active but it is broken. Putting the McBSP core to no-idle mode when the sidetone is active is no good either since it results to higher power consumption when using the threshold based DMA transfers. For making the McBSP code more generic, move this sidetone clock management with fixme comments to mach-omap2/mcbsp.c and pass pointer to it via platform data. Signed-off-by: Jarkko Nikula <jhnikula@gmail.com> Cc: Paul Wamsley <paul@pwsan.com> Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Tested-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/mcbsp.c')
-rw-r--r--arch/arm/mach-omap2/mcbsp.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
index d6cce00a730b..92bd5e22a24e 100644
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -27,6 +27,13 @@
27 27
28#include "control.h" 28#include "control.h"
29 29
30/*
31 * FIXME: Find a mechanism to enable/disable runtime the McBSP ICLK autoidle.
32 * Sidetone needs non-gated ICLK and sidetone autoidle is broken.
33 */
34#include "cm2xxx_3xxx.h"
35#include "cm-regbits-34xx.h"
36
30/* McBSP internal signal muxing functions */ 37/* McBSP internal signal muxing functions */
31 38
32void omap2_mcbsp1_mux_clkr_src(u8 mux) 39void omap2_mcbsp1_mux_clkr_src(u8 mux)
@@ -102,6 +109,24 @@ int omap2_mcbsp_set_clks_src(u8 id, u8 fck_src_id)
102} 109}
103EXPORT_SYMBOL(omap2_mcbsp_set_clks_src); 110EXPORT_SYMBOL(omap2_mcbsp_set_clks_src);
104 111
112static int omap3_enable_st_clock(unsigned int id, bool enable)
113{
114 unsigned int w;
115
116 /*
117 * Sidetone uses McBSP ICLK - which must not idle when sidetones
118 * are enabled or sidetones start sounding ugly.
119 */
120 w = omap2_cm_read_mod_reg(OMAP3430_PER_MOD, CM_AUTOIDLE);
121 if (enable)
122 w &= ~(1 << (id - 2));
123 else
124 w |= 1 << (id - 2);
125 omap2_cm_write_mod_reg(w, OMAP3430_PER_MOD, CM_AUTOIDLE);
126
127 return 0;
128}
129
105struct omap_device_pm_latency omap2_mcbsp_latency[] = { 130struct omap_device_pm_latency omap2_mcbsp_latency[] = {
106 { 131 {
107 .deactivate_func = omap_device_idle_hwmods, 132 .deactivate_func = omap_device_idle_hwmods,
@@ -151,6 +176,7 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
151 if (oh->dev_attr) { 176 if (oh->dev_attr) {
152 oh_device[1] = omap_hwmod_lookup(( 177 oh_device[1] = omap_hwmod_lookup((
153 (struct omap_mcbsp_dev_attr *)(oh->dev_attr))->sidetone); 178 (struct omap_mcbsp_dev_attr *)(oh->dev_attr))->sidetone);
179 pdata->enable_st_clock = omap3_enable_st_clock;
154 count++; 180 count++;
155 } 181 }
156 pdev = omap_device_build_ss(name, id, oh_device, count, pdata, 182 pdev = omap_device_build_ss(name, id, oh_device, count, pdata,