[alsa-devel] [PATCH 1/3 v5] sound/soc/codecs: add LAPIS Semiconductor ML26124

Mark Brown broonie at opensource.wolfsonmicro.com
Tue Dec 20 11:40:47 CET 2011


On Tue, Dec 20, 2011 at 11:45:42AM +0900, Tomoya MORINAGA wrote:

> +	switch (level) {
> +	case SND_SOC_BIAS_ON:
> +		/* VMID ON */
> +		snd_soc_update_bits(codec, ML26124_PW_REF_PW_MNG,
> +				    ML26124_VMID, ML26124_VMID);
> +		msleep(500);
> +	case SND_SOC_BIAS_PREPARE:

You're missing a break here.

> +static int ml26124_pcm_trigger(struct snd_pcm_substream *substream,
> +			      int cmd, struct snd_soc_dai *codec_dai)
> +{
> +	struct snd_soc_codec *codec = codec_dai->codec;
> +
> +	if (cmd == SNDRV_PCM_TRIGGER_STOP) {
> +		snd_soc_update_bits(codec, ML26124_REC_PLYBAK_RUN, 0x3, 0);
> +		return 0;
> +	} else if (cmd == SNDRV_PCM_TRIGGER_START) {
> +		if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)

Use switch statements, though frankly I'd be astonished if this code
actually runs as the trigger() callback is called in atomic context and
the register I/O functionality needs interrupts.  How have you tested
this code?

> +	.reg_cache_size = ML26134_CACHESIZE,
> +	.reg_word_size = sizeof(u8),
> +	.reg_cache_default = ml26124_reg,

New drivers really should use regmap rather than the ASoC cache code.


More information about the Alsa-devel mailing list