ASoC: omap: McBSP: fix build breakage on OMAP1

After commits d13586574d ("OMAP: McBSP:
implement functional clock switching via clock framework") and
cf4c87abe2 ("OMAP: McBSP: implement
McBSP CLKR and FSR signal muxing via mach-omap2/mcbsp.c"), any OMAP1
board (such as the AMS Delta) that uses the ASoC McBSP driver will no
longer build:

sound/built-in.o: In function `omap_mcbsp_dai_set_dai_sysclk':
last.c:(.text+0x24ff8): undefined reference to `omap2_mcbsp1_mux_clkr_src'
last.c:(.text+0x2500c): undefined reference to `omap2_mcbsp1_mux_fsr_src'
make: *** [vmlinux] Error 1

Fix by defining three OMAP1-only dummy functions for
omap2_mcbsp1_mux_clkr_src(), omap2_mcbsp1_mux_fsr_src(), and
omap2_mcbsp_set_clks_src().

Normally, code that is OMAP SoC-revision-specific like this should go
under the arch/arm/*omap* directories, and get abstracted away from
drivers via struct platform_data function pointers.  This doesn't work
in this case since there doesn't appear to be any convenient way to access
struct platform_data (or something like it) in the current design of
the sound/soc/omap/omap-mcbsp.c driver.

Reported by Janusz Krzysztofik <[email protected]> and Tony Lindgren
<[email protected]>.  Janusz also posted a patch to fix this at:

   http://www.spinics.net/lists/linux-omap/msg39560.html

(among other places), but the following approach seems less dependent
on compiler behavior.

This patch passes build tests for ams_delta_defconfig and omap2plus_defconfig,
but since I don't have an AMS Delta here, I can't boot test it on that
platform.

Signed-off-by: Paul Walmsley <[email protected]>
Cc: Janusz Krzysztofik <[email protected]>
Cc: Tony Lindgren <[email protected]>
Cc: Jarkko Nikula <[email protected]>
Cc: Peter Ujfalusi <[email protected]>
Cc: Mark Brown <[email protected]>
Cc: Liam Girdwood <[email protected]>
Signed-off-by: Tony Lindgren <[email protected]>
This commit is contained in:
Paul Walmsley 2011-07-01 08:52:25 +00:00 • committed by Tony Lindgren
commit 69d042d168

View file

@ -966,6 +966,33 @@ void omap_mcbsp_stop(unsigned int id, int tx, int rx)
}
EXPORT_SYMBOL(omap_mcbsp_stop);
/*
* The following functions are only required on an OMAP1-only build.
* mach-omap2/mcbsp.c contains the real functions
*/
#ifndef CONFIG_ARCH_OMAP2PLUS
int omap2_mcbsp_set_clks_src(u8 id, u8 fck_src_id)
{
WARN(1, "%s: should never be called on an OMAP1-only kernel\n",
__func__);
return -EINVAL;
}
void omap2_mcbsp1_mux_clkr_src(u8 mux)
{
WARN(1, "%s: should never be called on an OMAP1-only kernel\n",
__func__);
return;
}
void omap2_mcbsp1_mux_fsr_src(u8 mux)
{
WARN(1, "%s: should never be called on an OMAP1-only kernel\n",
__func__);
return;
}
#endif
#ifdef CONFIG_ARCH_OMAP3
#define max_thres(m) (mcbsp->pdata->buffer_size)
#define valid_threshold(m, val) ((val) <= max_thres(m))