lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.02.1401082231260.4025@parallels-Parallels-Virtual-Platform>
Date:	Wed, 8 Jan 2014 22:36:53 +0100 (CET)
From:	Daniel Matuschek <daniel@...uschek.net>
To:	alsa-devel@...a-project.org, Liam Girdwood <lgirdwood@...il.com>,
	Dimitris.Papastamos@...fsonmicro.com,
	Mark Brown <broonie@...nel.org>,
	Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.de>,
	Grant Likely <grant.likely@...aro.org>,
	Rob Herring <rob.herring@...xeda.com>,
	patches@...nsource.wolfsonmicro.com, linux-kernel@...r.kernel.org,
	devicetree-discuss@...ts.ozlabs.org
Subject: [PATCH] ASoC: wm8804: Allow fine-grained control of the PLL
 generation

Signed-off-by: Daniel Matuschek <daniel@...uschek.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.

---
  sound/soc/codecs/wm8804.c |   18 +++++++++++++-----
  sound/soc/codecs/wm8804.h |    7 +++++++
  2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/sound/soc/codecs/wm8804.c b/sound/soc/codecs/wm8804.c
index 1704b1e..e79c408 100644
--- a/sound/soc/codecs/wm8804.c
+++ b/sound/soc/codecs/wm8804.c
@@ -2,6 +2,8 @@
   * wm8804.c  --  WM8804 S/PDIF transceiver driver
   *
   * Copyright 2010-11 Wolfson Microelectronics plc
+ * patched by Daniel Matuschek <info@...zyaudio.com> to allow
+ * fine-grained control of PLL
   *
   * Author: Dimitris Papastamos <dp@...nsource.wolfsonmicro.com>
   *
@@ -318,7 +320,7 @@ static struct {

  #define FIXED_PLL_SIZE ((1ULL << 22) * 10)
  static int pll_factors(struct pll_div *pll_div, unsigned int target,
-		       unsigned int source)
+		       unsigned int source, int mclk_div)
  {
  	u64 Kpart;
  	unsigned long int K, Ndiv, Nmod, tmp;
@@ -332,9 +334,15 @@ static int pll_factors(struct pll_div *pll_div, unsigned int target,
  		tmp = target * post_table[i].div;
  		if (tmp >= 90000000 && tmp <= 100000000) {
  			pll_div->freqmode = post_table[i].freqmode;
-			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;
+			}
  		}
  	}

@@ -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);
  		if (ret)
  			return ret;

diff --git a/sound/soc/codecs/wm8804.h b/sound/soc/codecs/wm8804.h
index 8ec14f5..0365177 100644
--- a/sound/soc/codecs/wm8804.h
+++ b/sound/soc/codecs/wm8804.h
@@ -58,4 +58,11 @@

  #define WM8804_CLKOUT_DIV			1

+#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
+
  #endif  /* _WM8804_H */
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ