xref: /linux/arch/arm/mach-omap2/mcbsp.c (revision 75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37)
1*d2912cb1SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
278673bc8SEduardo Valentin /*
378673bc8SEduardo Valentin  * linux/arch/arm/mach-omap2/mcbsp.c
478673bc8SEduardo Valentin  *
578673bc8SEduardo Valentin  * Copyright (C) 2008 Instituto Nokia de Tecnologia
678673bc8SEduardo Valentin  * Contact: Eduardo Valentin <eduardo.valentin@indt.org.br>
778673bc8SEduardo Valentin  *
878673bc8SEduardo Valentin  * Multichannel mode not supported.
978673bc8SEduardo Valentin  */
1078673bc8SEduardo Valentin #include <linux/module.h>
1178673bc8SEduardo Valentin #include <linux/init.h>
1278673bc8SEduardo Valentin #include <linux/clk.h>
1378673bc8SEduardo Valentin #include <linux/err.h>
1478673bc8SEduardo Valentin #include <linux/io.h>
15e586e955SPeter Ujfalusi #include <linux/of.h>
1678673bc8SEduardo Valentin #include <linux/platform_device.h>
175a0e3ad6STejun Heo #include <linux/slab.h>
182203747cSArnd Bergmann #include <linux/platform_data/asoc-ti-mcbsp.h>
1925c7d49eSTony Lindgren #include <linux/pm_runtime.h>
2078673bc8SEduardo Valentin 
2145c3eb7dSTony Lindgren #include <linux/omap-dma.h>
2225c7d49eSTony Lindgren 
23b76c8b19STony Lindgren #include "soc.h"
2425c7d49eSTony Lindgren #include "omap_device.h"
257a90da2aSTero Kristo #include "clock.h"
264814ced5SPaul Walmsley 
271743d14fSJarkko Nikula /*
281743d14fSJarkko Nikula  * FIXME: Find a mechanism to enable/disable runtime the McBSP ICLK autoidle.
291743d14fSJarkko Nikula  * Sidetone needs non-gated ICLK and sidetone autoidle is broken.
301743d14fSJarkko Nikula  */
31d9a16f9aSPaul Walmsley #include "cm3xxx.h"
321743d14fSJarkko Nikula #include "cm-regbits-34xx.h"
331743d14fSJarkko Nikula 
omap3_mcbsp_force_ick_on(struct clk * clk,bool force_on)3453ae95f6SPeter Ujfalusi static int omap3_mcbsp_force_ick_on(struct clk *clk, bool force_on)
3553ae95f6SPeter Ujfalusi {
3653ae95f6SPeter Ujfalusi 	if (!clk)
3753ae95f6SPeter Ujfalusi 		return 0;
3853ae95f6SPeter Ujfalusi 
3953ae95f6SPeter Ujfalusi 	if (force_on)
4053ae95f6SPeter Ujfalusi 		return omap2_clk_deny_idle(clk);
4153ae95f6SPeter Ujfalusi 	else
4253ae95f6SPeter Ujfalusi 		return omap2_clk_allow_idle(clk);
4353ae95f6SPeter Ujfalusi }
4453ae95f6SPeter Ujfalusi 
omap3_mcbsp_init_pdata_callback(struct omap_mcbsp_platform_data * pdata)45c26c84c9SPeter Ujfalusi void __init omap3_mcbsp_init_pdata_callback(
46c26c84c9SPeter Ujfalusi 					struct omap_mcbsp_platform_data *pdata)
47c26c84c9SPeter Ujfalusi {
48c26c84c9SPeter Ujfalusi 	if (!pdata)
49c26c84c9SPeter Ujfalusi 		return;
50c26c84c9SPeter Ujfalusi 
51c26c84c9SPeter Ujfalusi 	pdata->force_ick_on = omap3_mcbsp_force_ick_on;
52c26c84c9SPeter Ujfalusi }
53