public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Daniel Matuschek <daniel@matuschek.net>
Cc: alsa-devel@alsa-project.org, Liam Girdwood <lgirdwood@gmail.com>,
	Dimitris.Papastamos@Wolfsonmicro.com,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.de>,
	Grant Likely <grant.likely@linaro.org>,
	Rob Herring <rob.herring@calxeda.com>,
	patches@opensource.wolfsonmicro.com,
	linux-kernel@vger.kernel.org,
	devicetree-discuss@lists.ozlabs.org
Subject: Re: [PATCH] ASoC: wm8804: Allow fine-grained control of the PLL generation
Date: Thu, 9 Jan 2014 14:20:03 +0000	[thread overview]
Message-ID: <20140109142003.GV31886@sirena.org.uk> (raw)
In-Reply-To: <alpine.DEB.2.02.1401082231260.4025@parallels-Parallels-Virtual-Platform>

[-- Attachment #1: Type: text/plain, Size: 3005 bytes --]

On Wed, Jan 08, 2014 at 10:36:53PM +0100, Daniel Matuschek wrote:
> Signed-off-by: Daniel Matuschek <daniel@matuschek.net>
> 
>  WM8804 can run
>  with PLL frequencies of 256xfs and 128xfs for most sample
>  rates. At 192kHz only 128xfs is supported. The existing
>  driver selects 128xfs automatically for some lower samples
>  rates. By using the "pllid" argument of the "set_pll"
>  function is is now possible to control the behaviour. This
>  allows using 256xfs PLL frequency on all sample rates up to
>  96kHz. It should allow lower jitter and better signal
>  quality. When pllid=0, the behaviour of the driver does not
>  change.

Please put the signoff at the end of the commit log like
SubmittingPatches says.  The formatting of the log message is also
*very* odd, the first line is really short for some reason and
everything is indented by a space.  In general your commit message
shouldn't stand out from others when viewed with git log.

>   * wm8804.c  --  WM8804 S/PDIF transceiver driver
>   *
>   * Copyright 2010-11 Wolfson Microelectronics plc
> + * patched by Daniel Matuschek <info@crazyaudio.com> to allow
> + * fine-grained control of PLL

We have git history, we don't need changelogs in the driver too.  Adding
a copyright statement would be OK (though most people don't bother).

>  static int pll_factors(struct pll_div *pll_div, unsigned int target,
> -		       unsigned int source)
> +		       unsigned int source, int mclk_div)

Here you call this mclk_div...

> -			pll_div->mclkdiv = post_table[i].mclkdiv;
> -			target *= post_table[i].div;
> -			break;
> +			if ((mclk_div == WM8804_MCLKDIV_DONTCARE) ||
> +			    ((post_table[i].mclkdiv == 1) &&
> +				(mclk_div == WM8804_MCLKDIV_1)) ||
> +			    ((post_table[i].mclkdiv == 0) &&
> +				(mclk_div == WM8804_MCLKDIV_0))) {
> +				pll_div->mclkdiv = post_table[i].mclkdiv;
> +				target *= post_table[i].div;
> +				break;
> +			}

This logic is really hard to read, it's five lines of if statement with
multiple levels of brackets indented to the same level as the following
statements.  I'd suggest either a series of if statements with continues
or something like

	if (mclk_div == WM8804_MCLKDIV_DONTCARE ||
	    mclk_div - 1 == post_table[i].mclkdiv) {

instead.

> @@ -388,7 +396,7 @@ static int wm8804_set_pll(struct snd_soc_dai *dai, int pll_id,
>  		int ret;
>  		struct pll_div pll_div;
> 
> -		ret = pll_factors(&pll_div, freq_out, freq_in);
> +		ret = pll_factors(&pll_div, freq_out, freq_in, pll_id);

...but here it's pll_id.

> +#define WM8804_MCLKDIV_DONTCARE			0
> +#define WM8804_MCLKDIV_0			1
> +#define WM8804_MCLKDIV_1			2
> +#define WM8804_PLL_MCLKDIV_DONTCARE		WM8804_MCLKDIV_DONTCARE
> +#define WM8804_PLL_MCLKDIV_0			WM8804_MCLKDIV_0
> +#define WM8804_PLL_MCLKDIV_1			WM8804_MCLKDIV_1

Why are there two different sets of constants with the same values being
added here, the _PLL versions don't seem to be referenced?

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2014-01-09 14:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-08 21:36 [PATCH] ASoC: wm8804: Allow fine-grained control of the PLL generation Daniel Matuschek
2014-01-09 14:20 ` Mark Brown [this message]
2014-01-09 14:27 ` [alsa-devel] " Charles Keepax
2014-01-09 15:29   ` Daniel Matuschek
2014-01-09 17:14     ` Trent Piepho
2014-01-09 17:23       ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140109142003.GV31886@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=Dimitris.Papastamos@Wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=daniel@matuschek.net \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@opensource.wolfsonmicro.com \
    --cc=perex@perex.cz \
    --cc=rob.herring@calxeda.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox