sh_eth: fix EESIPR values for SH77{34|63}
[linux/fpc-iii.git] / sound / soc / cirrus / snappercl15.c
blob98089df08df62e6c738f95b08c204be10970598e
1 /*
2 * snappercl15.c -- SoC audio for Bluewater Systems Snapper CL15 module
4 * Copyright (C) 2008 Bluewater Systems Ltd
5 * Author: Ryan Mallon
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
14 #include <linux/platform_device.h>
15 #include <linux/module.h>
16 #include <sound/core.h>
17 #include <sound/pcm.h>
18 #include <sound/soc.h>
20 #include <asm/mach-types.h>
21 #include <mach/hardware.h>
23 #include "../codecs/tlv320aic23.h"
25 #define CODEC_CLOCK 5644800
27 static int snappercl15_hw_params(struct snd_pcm_substream *substream,
28 struct snd_pcm_hw_params *params)
30 struct snd_soc_pcm_runtime *rtd = substream->private_data;
31 struct snd_soc_dai *codec_dai = rtd->codec_dai;
32 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
33 int err;
35 err = snd_soc_dai_set_sysclk(codec_dai, 0, CODEC_CLOCK,
36 SND_SOC_CLOCK_IN);
37 if (err)
38 return err;
40 err = snd_soc_dai_set_sysclk(cpu_dai, 0, CODEC_CLOCK,
41 SND_SOC_CLOCK_OUT);
42 if (err)
43 return err;
45 return 0;
48 static struct snd_soc_ops snappercl15_ops = {
49 .hw_params = snappercl15_hw_params,
52 static const struct snd_soc_dapm_widget tlv320aic23_dapm_widgets[] = {
53 SND_SOC_DAPM_HP("Headphone Jack", NULL),
54 SND_SOC_DAPM_LINE("Line In", NULL),
55 SND_SOC_DAPM_MIC("Mic Jack", NULL),
58 static const struct snd_soc_dapm_route audio_map[] = {
59 {"Headphone Jack", NULL, "LHPOUT"},
60 {"Headphone Jack", NULL, "RHPOUT"},
62 {"LLINEIN", NULL, "Line In"},
63 {"RLINEIN", NULL, "Line In"},
65 {"MICIN", NULL, "Mic Jack"},
68 static struct snd_soc_dai_link snappercl15_dai = {
69 .name = "tlv320aic23",
70 .stream_name = "AIC23",
71 .cpu_dai_name = "ep93xx-i2s",
72 .codec_dai_name = "tlv320aic23-hifi",
73 .codec_name = "tlv320aic23-codec.0-001a",
74 .platform_name = "ep93xx-i2s",
75 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_IF |
76 SND_SOC_DAIFMT_CBS_CFS,
77 .ops = &snappercl15_ops,
80 static struct snd_soc_card snd_soc_snappercl15 = {
81 .name = "Snapper CL15",
82 .owner = THIS_MODULE,
83 .dai_link = &snappercl15_dai,
84 .num_links = 1,
86 .dapm_widgets = tlv320aic23_dapm_widgets,
87 .num_dapm_widgets = ARRAY_SIZE(tlv320aic23_dapm_widgets),
88 .dapm_routes = audio_map,
89 .num_dapm_routes = ARRAY_SIZE(audio_map),
92 static int snappercl15_probe(struct platform_device *pdev)
94 struct snd_soc_card *card = &snd_soc_snappercl15;
95 int ret;
97 ret = ep93xx_i2s_acquire();
98 if (ret)
99 return ret;
101 card->dev = &pdev->dev;
103 ret = snd_soc_register_card(card);
104 if (ret) {
105 dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
106 ret);
107 ep93xx_i2s_release();
110 return ret;
113 static int snappercl15_remove(struct platform_device *pdev)
115 struct snd_soc_card *card = platform_get_drvdata(pdev);
117 snd_soc_unregister_card(card);
118 ep93xx_i2s_release();
120 return 0;
123 static struct platform_driver snappercl15_driver = {
124 .driver = {
125 .name = "snappercl15-audio",
127 .probe = snappercl15_probe,
128 .remove = snappercl15_remove,
131 module_platform_driver(snappercl15_driver);
133 MODULE_AUTHOR("Ryan Mallon");
134 MODULE_DESCRIPTION("ALSA SoC Snapper CL15");
135 MODULE_LICENSE("GPL");
136 MODULE_ALIAS("platform:snappercl15-audio");