Re: [PATCH] ASoC WM8753 codec driver.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At Fri, 02 Feb 2007 17:30:43 +0000,
Liam Girdwood wrote:

> +static int wm8753_add_widgets(struct snd_soc_codec *codec)
> +{
> +	int i;
> +
> +	for(i = 0; i < ARRAY_SIZE(wm8753_dapm_widgets); i++) {
> +		snd_soc_dapm_new_control(codec, &wm8753_dapm_widgets[i]);
> +	}

Put a space after 'for'.  No braces needed here.

> +
> +	/* set up the WM8753 audio map */
> +	for(i = 0; audio_map[i][0] != NULL; i++) {
> +		snd_soc_dapm_connect_input(codec, audio_map[i][0],
> +			audio_map[i][1], audio_map[i][2]);
> +	}

Ditto.

> +/* PLL divisors */
> +struct _pll_div {
> +	u32 div2:1;
> +	u32 n:4;
> +	u32 k:24;
> +};
> +
> +static struct _pll_div pll_div;

Is it OK to use a global static varible here?
Shouldn't be in codec_priv or something else locally?

> +static int wm8753_set_dai_pll(struct snd_soc_codec_dai *codec_dai,
> +		int pll_id, unsigned int freq_in, unsigned int freq_out)
> +{
> +	if (!freq_in || !freq_out) {
> +		/* disable PLL  */
> +		wm8753_write(codec, WM8753_PLL1CTL1 + offset, 0x0026);
> +		wm8753_write(codec, WM8753_CLOCK, reg);
> +		return 0;
> +	} else {
> +
> +        u16 value = 0;
> +
> +		pll_factors(freq_out * 8, freq_in);
> +
> +        /* set up N and K PLL divisor ratios */
> +        /* bits 8:5 = PLL_N, bits 3:0 = PLL_K[21:18] */
> +        value = (pll_div.n << 5) + ((pll_div.k & 0x3c0000) >> 18);
> +        wm8753_write(codec, WM8753_PLL1CTL2 + offset, value);
> +
> +        /* bits 8:0 = PLL_K[17:9] */
> +        value = (pll_div.k & 0x03fe00) >> 9;
> +        wm8753_write(codec, WM8753_PLL1CTL3 + offset, value);
> +
> +        /* bits 8:0 = PLL_K[8:0] */
> +        value = pll_div.k & 0x0001ff;
> +        wm8753_write(codec, WM8753_PLL1CTL4 + offset, value);
> +
> +        /* set PLL as input and enable */
> +        wm8753_write(codec, WM8753_PLL1CTL1 + offset, 0x0027 |
> +        	(pll_div.div2 << 3));
> +		wm8753_write(codec, WM8753_CLOCK, reg | enable);
> +    }
> +	return 0;

Broken indentation.

> +/*
> + * Clock after PLL and dividers
> + */
> +static int wm8753_set_dai_sysclk(struct snd_soc_codec_dai *codec_dai,
> +		int clk_id, unsigned int freq, int dir)
> +{
> +	struct snd_soc_codec *codec = codec_dai->codec;
> +	struct wm8753_priv *wm8753 = codec->private_data;
> +
> +	switch (freq) {
> +	case 11289600:
> +	case 12000000:
> +	case 12288000:
> +	case 16934400:
> +	case 18432000:
> +		if (clk_id == WM8753_MCLK) {
> +			wm8753->sysclk = freq;
> +			return 0;
> +		} else if (clk_id == WM8753_PCMCLK) {
> +			wm8753->pcmclk = freq;
> +			return 0;
> +		}

Put break here (just to be sure - so I leared).

> +	}
> +	return -EINVAL;
> +}
> +
(snip)
> diff -r 0f9c7c3b7657 soc/codecs/wm8753.h
> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
> +++ b/soc/codecs/wm8753.h	Wed Jan 31 16:43:17 2007 +0000
> @@ -0,0 +1,126 @@
> +/*
> + * wm8753.h  --  audio driver for WM8753
> + *
> + * Copyright 2003 Wolfson Microelectronics PLC.
> + * Author: Liam Girdwood
> + *         liam.girdwood@xxxxxxxxxxxxxxxx or linux@xxxxxxxxxxxxxxxx
> + *
> + *  This program is free software; you can redistribute  it and/or modify it
> + *  under  the terms of  the GNU General  Public License as published by the
> + *  Free Software Foundation;  either version 2 of the  License, or (at your
> + *  option) any later version.
> + *
> + */
> +
> +#ifndef _WM8753_H
> +#define _WM8753_H
> +
> +/* WM8753 register space */
> +
> +#define WM8753_DAC		0x01
> +#define WM8753_ADC		0x02
> +#define WM8753_PCM		0x03
> +#define WM8753_HIFI		0x04
> +#define WM8753_IOCTL	0x05

It'd be more beautiful if you use the same spaces there :)

I suppose the merge of this driver can be also postponed (until the
platform driver is submitted)?


Thanks,

Takashi

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux