aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-omap2/mcbsp.c26
-rw-r--r--arch/arm/plat-omap/include/plat/mcbsp.h1
-rw-r--r--arch/arm/plat-omap/mcbsp.c18
3 files changed, 31 insertions, 14 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,
diff --git a/arch/arm/plat-omap/include/plat/mcbsp.h b/arch/arm/plat-omap/include/plat/mcbsp.h
index 648344a89a94..e451a6e8b065 100644
--- a/arch/arm/plat-omap/include/plat/mcbsp.h
+++ b/arch/arm/plat-omap/include/plat/mcbsp.h
@@ -321,6 +321,7 @@ struct omap_mcbsp_platform_data {
321 /* McBSP platform and instance specific features */ 321 /* McBSP platform and instance specific features */
322 bool has_wakeup; /* Wakeup capability */ 322 bool has_wakeup; /* Wakeup capability */
323 bool has_ccr; /* Transceiver has configuration control registers */ 323 bool has_ccr; /* Transceiver has configuration control registers */
324 int (*enable_st_clock)(unsigned int, bool);
324}; 325};
325 326
326struct omap_mcbsp_st_data { 327struct omap_mcbsp_st_data {
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index 3ad536ea6c37..e96d747fbd80 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -26,10 +26,6 @@
26#include <plat/mcbsp.h> 26#include <plat/mcbsp.h>
27#include <linux/pm_runtime.h> 27#include <linux/pm_runtime.h>
28 28
29/* XXX These "sideways" includes are a sign that something is wrong */
30#include "../mach-omap2/cm2xxx_3xxx.h"
31#include "../mach-omap2/cm-regbits-34xx.h"
32
33struct omap_mcbsp **mcbsp_ptr; 29struct omap_mcbsp **mcbsp_ptr;
34int omap_mcbsp_count; 30int omap_mcbsp_count;
35 31
@@ -257,13 +253,8 @@ static void omap_st_on(struct omap_mcbsp *mcbsp)
257{ 253{
258 unsigned int w; 254 unsigned int w;
259 255
260 /* 256 if (mcbsp->pdata->enable_st_clock)
261 * Sidetone uses McBSP ICLK - which must not idle when sidetones 257 mcbsp->pdata->enable_st_clock(mcbsp->id, 1);
262 * are enabled or sidetones start sounding ugly.
263 */
264 w = omap2_cm_read_mod_reg(OMAP3430_PER_MOD, CM_AUTOIDLE);
265 w &= ~(1 << (mcbsp->id - 2));
266 omap2_cm_write_mod_reg(w, OMAP3430_PER_MOD, CM_AUTOIDLE);
267 258
268 /* Enable McBSP Sidetone */ 259 /* Enable McBSP Sidetone */
269 w = MCBSP_READ(mcbsp, SSELCR); 260 w = MCBSP_READ(mcbsp, SSELCR);
@@ -284,9 +275,8 @@ static void omap_st_off(struct omap_mcbsp *mcbsp)
284 w = MCBSP_READ(mcbsp, SSELCR); 275 w = MCBSP_READ(mcbsp, SSELCR);
285 MCBSP_WRITE(mcbsp, SSELCR, w & ~(SIDETONEEN)); 276 MCBSP_WRITE(mcbsp, SSELCR, w & ~(SIDETONEEN));
286 277
287 w = omap2_cm_read_mod_reg(OMAP3430_PER_MOD, CM_AUTOIDLE); 278 if (mcbsp->pdata->enable_st_clock)
288 w |= 1 << (mcbsp->id - 2); 279 mcbsp->pdata->enable_st_clock(mcbsp->id, 0);
289 omap2_cm_write_mod_reg(w, OMAP3430_PER_MOD, CM_AUTOIDLE);
290} 280}
291 281
292static void omap_st_fir_write(struct omap_mcbsp *mcbsp, s16 *fir) 282static void omap_st_fir_write(struct omap_mcbsp *mcbsp, s16 *fir)