[alsa-devel] [PATCH 3/4] ASoC: pxa add Marvell Littleton platform audio support

Mark Brown broonie at opensource.wolfsonmicro.com
Thu Jun 4 14:42:49 CEST 2009


On Wed, Jun 03, 2009 at 08:35:23PM +0800, Eric Miao wrote:

Sorry, missed a couple of things earlier:

> +static const char *hifi_mode_select[] = {
> +	"HIFI 64FS LEFT_J, SSP CLK Master FRM Master",
> +	"HIFI 64FS I2S ,   SSP CLK Master FRM Master",
> +	"HIFI 32FS LEFT_J, SSP CLK Master FRM Master",
> +	"HIFI 32FS I2S ,   SSP CLK Master FRM Master",
> +};
> +
> +static const struct soc_enum littleton_enum[] = {
> +	SOC_ENUM_SINGLE_EXT(4, hifi_mode_select),
> +};

BTW, for this control you really should add a comment explaining that
this is for test purposes only and that normal systems would not wish to
expose this control to applications but should just pick a suitable
configuration.

> +static int littleton_hifi_hw_params(struct snd_pcm_substream *substream,
> +				    struct snd_pcm_hw_params *params)
> +{
> +	struct snd_soc_pcm_runtime *rtd = substream->private_data;
> +	struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
> +	struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
> +	struct ssp_clk_div *clkdiv;
> +	struct clk *clk_pout;
> +	int format;
> +
> +	clk_pout = clk_get(NULL, "CLK_POUT");
> +	if (IS_ERR(clk_pout)) {
> +		pr_err("failed to get POUT clock\n");
> +		return PTR_ERR(clk_pout);
> +	}
> +
> +	clk_enable(clk_pout);

At the minute clk_put is never released.

hw_params() can be repeatedly called while the stream is open,
especially by OSS emulation.  You should acquire the clock once at
driver startup time and probably move the enable and disable to
startup() and shutdown().


More information about the Alsa-devel mailing list