Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(728)

Unified Diff: sound/soc/tegra/seaboard.c

Issue 6624032: CHROMIUM: ASoC: tegra: Seaboard: Add SPDIF/HDMI support (Closed)
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sound/soc/tegra/seaboard.c
diff --git a/sound/soc/tegra/seaboard.c b/sound/soc/tegra/seaboard.c
index 264e3158560f87b455d6d4da24bfa7deaf5dee27..98b8b81336fe745bb281db0136fb1dd6f4a9fb41 100644
--- a/sound/soc/tegra/seaboard.c
+++ b/sound/soc/tegra/seaboard.c
@@ -128,6 +128,49 @@ static struct snd_soc_ops seaboard_asoc_ops = {
.hw_params = seaboard_asoc_hw_params,
};
+static int seaboard_spdif_hw_params(struct snd_pcm_substream *substream,
+ struct snd_pcm_hw_params *params)
+{
+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
+ struct snd_soc_codec *codec = rtd->codec;
+ struct snd_soc_card *card = codec->card;
+ struct tegra_seaboard *seaboard = snd_soc_card_get_drvdata(card);
+ int srate, mclk, mclk_change;
+ int err;
+
+ /*
+ * FIXME: Refactor mclk into PCM-specific function; SPDIF doesn't
+ * need it
+ */
+ srate = params_rate(params);
+ switch (srate) {
+ case 64000:
+ case 88200:
+ case 96000:
+ mclk = 128 * srate;
+ break;
+ default:
+ mclk = 256 * srate;
+ break;
+ }
+ /* FIXME: Codec only requires >= 3MHz if OSR==0 */
+ while (mclk < 6000000)
+ mclk *= 2;
+
+ err = tegra_asoc_utils_set_rate(&seaboard->util_data, srate, mclk,
+ &mclk_change);
+ if (err < 0) {
+ dev_err(card->dev, "Can't configure clocks\n");
+ return err;
+ }
+
+ return 0;
+}
+
+static struct snd_soc_ops seaboard_spdif_ops = {
+ .hw_params = seaboard_spdif_hw_params,
+};
+
static struct snd_soc_jack seaboard_hp_jack;
static struct snd_soc_jack_pin seaboard_hp_jack_pins[] = {
@@ -248,21 +291,32 @@ static int seaboard_asoc_init(struct snd_soc_pcm_runtime *rtd)
return 0;
}
-static struct snd_soc_dai_link seaboard_wm8903_dai = {
- .name = "WM8903",
- .stream_name = "WM8903 PCM",
- .codec_name = "wm8903.0-001a",
- .platform_name = "tegra-pcm-audio",
- .cpu_dai_name = "tegra-i2s.0",
- .codec_dai_name = "wm8903-hifi",
- .init = seaboard_asoc_init,
- .ops = &seaboard_asoc_ops,
+static struct snd_soc_dai_link seaboard_links[] = {
+ {
+ .name = "WM8903",
+ .stream_name = "WM8903 PCM",
+ .codec_name = "wm8903.0-001a",
+ .platform_name = "tegra-pcm-audio",
+ .cpu_dai_name = "tegra-i2s.0",
+ .codec_dai_name = "wm8903-hifi",
+ .init = seaboard_asoc_init,
+ .ops = &seaboard_asoc_ops,
+ },
+ {
+ .name = "SPDIF",
+ .stream_name = "spdif",
+ .codec_name = "spdif-dit",
+ .platform_name = "tegra-pcm-audio",
+ .cpu_dai_name = "tegra-spdif",
+ .codec_dai_name = "dit-hifi",
+ .ops = &seaboard_spdif_ops,
+ },
};
static struct snd_soc_card snd_soc_seaboard = {
.name = "tegra-seaboard",
- .dai_link = &seaboard_wm8903_dai,
- .num_links = 1,
+ .dai_link = seaboard_links,
+ .num_links = ARRAY_SIZE(seaboard_links),
};
static __devinit int tegra_snd_seaboard_probe(struct platform_device *pdev)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698