[alsa-devel] [PATCH] ASoC - Add support for upto 16 channels on OMAP MCBSP

Graeme Gregory gg at slimlogic.co.uk
Wed Nov 4 19:55:34 CET 2009


On Wed, Nov 04, 2009 at 05:53:55PM +0000, Liam Girdwood wrote:
> From: Graeme Gregory <gg at slimlogic.co.uk>
> 
> This patch increases the number of supported audio channels from 4
> to 16 and was sponsored by Shotspotter inc.
> 
> Signed-off-by: Graeme Gregory <gg at slimlogic.co.uk>
> Signed-off-by: Liam Girdwood <lrg at slimlogic.co.uk>
> +	/* Default div to 1 if it wasn't set by machine driver, otherwise
> +	 * use set div as the maximum clock value
> +	 */
> +	div = mcbsp_data->clk_div ? mcbsp_data->clk_div : 1;
> +
> +	/* calc best frame size for rate and clock divider */
> +	do {
> +		frame_size = (mcbsp_data->in_freq / div) / params_rate(params);
> +		pr_debug("freq %d, rate %d, frame size %d, div %d\n",
> +				mcbsp_data->in_freq, params_rate(params), frame_size, div);
> +
> +		if (frame_size > 256)
> +			div++;
> +	} while (frame_size > 256);
> +
> +	/* Check we can fit the requested number of channels into our
> +	 * calculated frame size
> +	 */
> +	if ((channels * wlen) > frame_size) {
> +		printk(KERN_ERR
> +			"OMAP-MCBSP: cannot fit channels in frame size\n");
> +		return -EINVAL;
> +	}
> +
> +	/* Set the actual clkdiv to use for this samplerate */
> +	regs->srgr1 &= ~CLKGDV(0xFF);
> +	regs->srgr1 |= CLKGDV(div - 1);
> +

This chunk changes the semantics of other devices which I have never tested.

I also dont know how much damage it does if it does to slave mode. In fact
I think it might break it in cases which are actually allowable as it uses
the omap as its clock constraint and not the clock source.

Graeme



More information about the Alsa-devel mailing list