alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Lucas Stach <dev-8ppwABl0HbeELgA04lAiVw@public.gmane.org>
To: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org
Cc: patches-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org,
	Liam Girdwood <lrg-l0cyMroinI0@public.gmane.org>,
	Mark Brown
	<broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>,
	Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH 4/7] ASoC: tegra: add function to set ac97 rate
Date: Thu, 20 Dec 2012 00:17:33 +0100	[thread overview]
Message-ID: <1355959056-6009-4-git-send-email-dev@lynxeye.de> (raw)
In-Reply-To: <1355959056-6009-1-git-send-email-dev-8ppwABl0HbeELgA04lAiVw@public.gmane.org>

AC97 uses a fixed rate, unrelated to the sample rate. Add a function to
make the setup more trivial.

Signed-off-by: Lucas Stach <dev-8ppwABl0HbeELgA04lAiVw@public.gmane.org>
---
 sound/soc/tegra/tegra_asoc_utils.c | 53 ++++++++++++++++++++++++++++++++++++++
 sound/soc/tegra/tegra_asoc_utils.h |  1 +
 2 Dateien geändert, 54 Zeilen hinzugefügt(+)

diff --git a/sound/soc/tegra/tegra_asoc_utils.c b/sound/soc/tegra/tegra_asoc_utils.c
index 6872c77..ba419f8 100644
--- a/sound/soc/tegra/tegra_asoc_utils.c
+++ b/sound/soc/tegra/tegra_asoc_utils.c
@@ -112,6 +112,59 @@ int tegra_asoc_utils_set_rate(struct tegra_asoc_utils_data *data, int srate,
 }
 EXPORT_SYMBOL_GPL(tegra_asoc_utils_set_rate);
 
+int tegra_asoc_utils_set_ac97_rate(struct tegra_asoc_utils_data *data)
+{
+	const int pll_rate = 73728000;
+	const int ac97_rate = 24576000;
+	int err;
+
+	clk_disable_unprepare(data->clk_cdev1);
+	clk_disable_unprepare(data->clk_pll_a_out0);
+	clk_disable_unprepare(data->clk_pll_a);
+
+	/*
+	 * AC97 rate is fixed at 24.576MHz and is used for both the host
+	 * controller and the external codec
+	 */
+	err = clk_set_rate(data->clk_pll_a, pll_rate);
+	if (err) {
+		dev_err(data->dev, "Can't set pll_a rate: %d\n", err);
+		return err;
+	}
+
+	err = clk_set_rate(data->clk_pll_a_out0, ac97_rate);
+	if (err) {
+		dev_err(data->dev, "Can't set pll_a_out0 rate: %d\n", err);
+		return err;
+	}
+
+	/* Don't set cdev1/extern1 rate; it's locked to pll_a_out0 */
+
+	err = clk_prepare_enable(data->clk_pll_a);
+	if (err) {
+		dev_err(data->dev, "Can't enable pll_a: %d\n", err);
+		return err;
+	}
+
+	err = clk_prepare_enable(data->clk_pll_a_out0);
+	if (err) {
+		dev_err(data->dev, "Can't enable pll_a_out0: %d\n", err);
+		return err;
+	}
+
+	err = clk_prepare_enable(data->clk_cdev1);
+	if (err) {
+		dev_err(data->dev, "Can't enable cdev1: %d\n", err);
+		return err;
+	}
+
+	data->set_baseclock = pll_rate;
+	data->set_mclk = ac97_rate;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(tegra_asoc_utils_set_ac97_rate);
+
 int tegra_asoc_utils_init(struct tegra_asoc_utils_data *data,
 			  struct device *dev)
 {
diff --git a/sound/soc/tegra/tegra_asoc_utils.h b/sound/soc/tegra/tegra_asoc_utils.h
index 44db1db..974c9f8 100644
--- a/sound/soc/tegra/tegra_asoc_utils.h
+++ b/sound/soc/tegra/tegra_asoc_utils.h
@@ -43,6 +43,7 @@ struct tegra_asoc_utils_data {
 
 int tegra_asoc_utils_set_rate(struct tegra_asoc_utils_data *data, int srate,
 			      int mclk);
+int tegra_asoc_utils_set_ac97_rate(struct tegra_asoc_utils_data *data);
 int tegra_asoc_utils_init(struct tegra_asoc_utils_data *data,
 			  struct device *dev);
 void tegra_asoc_utils_fini(struct tegra_asoc_utils_data *data);
-- 
1.7.11.7

  parent reply	other threads:[~2012-12-19 23:17 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-19 23:17 [PATCH 1/7] ARM: tegra: add ac97 clock Lucas Stach
     [not found] ` <1355959056-6009-1-git-send-email-dev-8ppwABl0HbeELgA04lAiVw@public.gmane.org>
2012-12-19 23:17   ` [PATCH 2/7] ASoC: allow wolfson wm9712 codec to be instantiated using device tree Lucas Stach
     [not found]     ` <1355959056-6009-2-git-send-email-dev-8ppwABl0HbeELgA04lAiVw@public.gmane.org>
2012-12-20  9:32       ` Mark Brown
2012-12-19 23:17   ` [PATCH 3/7] ASoC: tegra: setup DAP3<->DAC3 connection by default Lucas Stach
     [not found]     ` <1355959056-6009-3-git-send-email-dev-8ppwABl0HbeELgA04lAiVw@public.gmane.org>
2012-12-20 19:20       ` Stephen Warren
2012-12-24 16:01       ` Mark Brown
2012-12-19 23:17   ` Lucas Stach [this message]
     [not found]     ` <1355959056-6009-4-git-send-email-dev-8ppwABl0HbeELgA04lAiVw@public.gmane.org>
2012-12-20 19:22       ` [PATCH 4/7] ASoC: tegra: add function to set ac97 rate Stephen Warren
2012-12-24 16:00       ` Mark Brown
2012-12-19 23:17   ` [PATCH 5/7] ASoC: tegra: add ac97 host driver Lucas Stach
     [not found]     ` <1355959056-6009-5-git-send-email-dev-8ppwABl0HbeELgA04lAiVw@public.gmane.org>
2012-12-20 19:44       ` Stephen Warren
     [not found]         ` <50D36A98.7090204-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-12-20 20:10           ` Lucas Stach
2012-12-20 20:19             ` Stephen Warren
     [not found]               ` <50D372DF.2080600-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-12-20 20:32                 ` Lucas Stach
2012-12-20 20:23           ` Mark Brown
2012-12-19 23:17   ` [PATCH 6/7] ASoC: tegra: add ac97 host controller to device tree Lucas Stach
     [not found]     ` <1355959056-6009-6-git-send-email-dev-8ppwABl0HbeELgA04lAiVw@public.gmane.org>
2012-12-20 19:47       ` Stephen Warren
2012-12-19 23:17   ` [PATCH 7/7] ASoC: tegra: add machine driver using wm9712 codec Lucas Stach
     [not found]     ` <1355959056-6009-7-git-send-email-dev-8ppwABl0HbeELgA04lAiVw@public.gmane.org>
2012-12-20 19:55       ` Stephen Warren
     [not found]         ` <50D36D3B.7080309-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-12-20 20:16           ` Mark Brown
2012-12-20 19:24   ` [PATCH 1/7] ARM: tegra: add ac97 clock Stephen Warren

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=1355959056-6009-4-git-send-email-dev@lynxeye.de \
    --to=dev-8ppwabl0hbeelga04laivw@public.gmane.org \
    --cc=alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org \
    --cc=broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=lrg-l0cyMroinI0@public.gmane.org \
    --cc=patches-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org \
    --cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
    /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;
as well as URLs for NNTP newsgroup(s).