Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: eric miao <eric.miao@marvell.com>,
	Russell King <rmk@arm.linux.org.uk>, Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	linux-arm-kernel@lists.arm.linux.org.uk
Subject: [PATCH] Support AC97CLK on PXA3xx via the clock API
Date: Tue, 19 Feb 2008 16:04:16 +0000	[thread overview]
Message-ID: <1203437058-7288-2-git-send-email-broonie@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1203437058-7288-1-git-send-email-broonie@opensource.wolfsonmicro.com>

The AC97 clock rate on PXA3xx is generated with a configurable divider
from sys_pll.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 arch/arm/mach-pxa/pxa3xx.c |   30 ++++++++++++++++++++++++++++--
 1 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index 696f606..df568e5 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -110,6 +110,25 @@ unsigned int pxa3xx_get_memclk_frequency_10khz(void)
 }
 
 /*
+ * Return the current AC97 clock frequency.
+ */
+static unsigned long clk_pxa3xx_ac97_getrate(struct clk *clk)
+{
+	unsigned long rate = 312000000;
+	unsigned long ac97_div;
+
+	ac97_div = AC97_DIV;
+
+	/* This may loose precision for some rates but won't for the 
+	 * standard 24.576MHz.
+	 */
+	rate /= (ac97_div >> 12) & 0x7fff;
+	rate *= (ac97_div & 0xfff);
+
+	return rate;
+}
+
+/*
  * Return the current HSIO bus clock frequency
  */
 static unsigned long clk_pxa3xx_hsio_getrate(struct clk *clk)
@@ -164,6 +183,12 @@ static const struct clkops clk_pxa3xx_hsio_ops = {
 	.getrate	= clk_pxa3xx_hsio_getrate,
 };
 
+static const struct clkops clk_pxa3xx_ac97_ops = {
+	.enable		= clk_pxa3xx_cken_enable,
+	.disable	= clk_pxa3xx_cken_disable,
+	.getrate	= clk_pxa3xx_ac97_getrate,
+};
+
 static void clk_pout_enable(struct clk *clk)
 {
 	OSCC |= OSCC_PEN;
@@ -205,8 +230,9 @@ static struct clk pxa3xx_clks[] = {
 		.delay          = 70,
 	},
 
-	PXA3xx_CK("LCDCLK", LCD,    &clk_pxa3xx_hsio_ops, &pxa_device_fb.dev),
-	PXA3xx_CK("CAMCLK", CAMERA, &clk_pxa3xx_hsio_ops, NULL),
+	PXA3xx_CK("LCDCLK",  LCD,    &clk_pxa3xx_hsio_ops, &pxa_device_fb.dev),
+	PXA3xx_CK("CAMCLK",  CAMERA, &clk_pxa3xx_hsio_ops, NULL),
+	PXA3xx_CK("AC97CLK", AC97,   &clk_pxa3xx_ac97_ops, NULL),
 
 	PXA3xx_CKEN("UARTCLK", FFUART, 14857000, 1, &pxa_device_ffuart.dev),
 	PXA3xx_CKEN("UARTCLK", BTUART, 14857000, 1, &pxa_device_btuart.dev),
-- 
1.5.4.2

  reply	other threads:[~2008-02-19 16:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-19 16:03 [0/4] Convert PXA AC97 to use clock API Mark Brown
2008-02-19 16:04 ` [PATCH] Add PXA2xx AC97 clocks to " Mark Brown
2008-02-19 16:04   ` Mark Brown [this message]
2008-02-19 16:04     ` [PATCH] Convert ASoC pxa2xx-ac97 driver to use the " Mark Brown
2008-02-19 16:04       ` [PATCH] Convert non-SoC PXA2xx AC97 driver to " Mark Brown
2008-02-19 16:40         ` Takashi Iwai
2008-02-21 15:27         ` Russell King - ARM Linux
2008-02-21 15:53           ` Mark Brown
2008-02-21 16:00           ` Mark Brown
2008-02-19 16:39       ` [PATCH] Convert ASoC pxa2xx-ac97 driver to use the " Takashi Iwai
2008-02-20  0:59         ` Eric Miao
2008-02-20 11:08           ` Mark Brown
2008-02-21 15:26       ` Russell King - ARM Linux
2008-02-21 15:43         ` Mark Brown
2008-02-21 15:59           ` Mark Brown
2008-02-19 16:39 ` [0/4] Convert PXA AC97 to use " Takashi Iwai

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=1203437058-7288-2-git-send-email-broonie@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=eric.miao@marvell.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=rmk@arm.linux.org.uk \
    --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