[alsa-devel] [PATCH 3/5] SOUND: SOC: CODECS: Add support for the TWL4030 audio codec

Jarkko Nikula jarkko.nikula at nokia.com
Thu Sep 4 12:26:32 CEST 2008


On Wed,  3 Sep 2008 22:01:58 -0700
"ext sakoman at gmail.com" <sakoman at gmail.com> wrote:

> From: Steve Sakoman <steve at sakoman.com>
> 
> ---
>  sound/soc/codecs/Kconfig   |    5 +
>  sound/soc/codecs/Makefile  |    2 +
>  sound/soc/codecs/twl4030.c |  628 +++++++++++++++++++++++++++++++++++
...
> +static void twl4030_dump_registers(void)
> +{
This is not needed since there is already nice function
for it: sound/soc/soc-core.c: codec_reg_show.

> +static void twl4030_power_up(struct snd_soc_codec *codec)
> +{
> +	u8 mode, byte, popn, hsgain;
> +
...
> +	/* wait for offset cancellation to complete */
> +	twl4030_i2c_read_u8(TWL4030_MODULE_AUDIO_VOICE, &byte,
> REG_ANAMICL);
> +	while ((byte & CNCL_OFFSET_START) == CNCL_OFFSET_START)
> +		twl4030_i2c_read_u8(TWL4030_MODULE_AUDIO_VOICE,
> +					&byte, REG_ANAMICL);
> +
Probably some timeout escape here.

> +static void twl4030_power_down(struct snd_soc_codec *codec)
> +{
...
> +	udelay(10);
> +}
REVISIT comment for these kind of magic delays if doesn't work without.

> +static int twl4030_hw_params(struct snd_pcm_substream *substream,
> +			   struct snd_pcm_hw_params *params)
> +{
...
> +	switch (params_rate(params)) {
> +	case 44100:
> +		mode |= APLL_RATE_44100;
> +		break;
> +	case 48000:
> +		mode |= APLL_RATE_48000;
> +		break;
> +	default:
> +		printk(KERN_ERR "TWL4030 hw params: unknown rate %d
> \n",
> +			params_rate(params));
> +		return -EINVAL;
> +	}
I checked that chip supports also other standard rates from 8 kHz,
11.025 kHz, etc. However I didn't find from quick look how this relates
to interface rate. I would say that small TODO comment to whom who has
platform to try these combinations would be nice.

> +static int twl4030_set_dai_sysclk(struct snd_soc_dai *codec_dai,
> +		int clk_id, unsigned int freq, int dir)
> +{
...
> +
> +	infreq |= APLL_EN;
> +	twl4030_write(codec, REG_APLL_CTL, infreq);
> +
> +	return 0;
> +}
If this actually place for set_pll callback if one wants to manage PLL
(APLL_EN bit) dynamically?


Jarkko


More information about the Alsa-devel mailing list