ASoC: samsung: fix module_device_table
[deliverable/linux.git] / sound / soc / cirrus / snappercl15.c
CommitLineData
315f7da6
RM
1/*
2 * snappercl15.c -- SoC audio for Bluewater Systems Snapper CL15 module
3 *
4 * Copyright (C) 2008 Bluewater Systems Ltd
1c5454ee 5 * Author: Ryan Mallon
315f7da6
RM
6 *
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.
11 *
12 */
13
14#include <linux/platform_device.h>
da155d5b 15#include <linux/module.h>
315f7da6
RM
16#include <sound/core.h>
17#include <sound/pcm.h>
18#include <sound/soc.h>
315f7da6
RM
19
20#include <asm/mach-types.h>
21#include <mach/hardware.h>
22
23#include "../codecs/tlv320aic23.h"
24#include "ep93xx-pcm.h"
315f7da6
RM
25
26#define CODEC_CLOCK 5644800
27
28static int snappercl15_hw_params(struct snd_pcm_substream *substream,
29 struct snd_pcm_hw_params *params)
30{
31 struct snd_soc_pcm_runtime *rtd = substream->private_data;
f0fba2ad
LG
32 struct snd_soc_dai *codec_dai = rtd->codec_dai;
33 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
315f7da6
RM
34 int err;
35
315f7da6
RM
36 err = snd_soc_dai_set_sysclk(codec_dai, 0, CODEC_CLOCK,
37 SND_SOC_CLOCK_IN);
38 if (err)
39 return err;
40
41 err = snd_soc_dai_set_sysclk(cpu_dai, 0, CODEC_CLOCK,
42 SND_SOC_CLOCK_OUT);
43 if (err)
44 return err;
45
46 return 0;
47}
48
49static struct snd_soc_ops snappercl15_ops = {
50 .hw_params = snappercl15_hw_params,
51};
52
53static const struct snd_soc_dapm_widget tlv320aic23_dapm_widgets[] = {
54 SND_SOC_DAPM_HP("Headphone Jack", NULL),
55 SND_SOC_DAPM_LINE("Line In", NULL),
56 SND_SOC_DAPM_MIC("Mic Jack", NULL),
57};
58
59static const struct snd_soc_dapm_route audio_map[] = {
60 {"Headphone Jack", NULL, "LHPOUT"},
61 {"Headphone Jack", NULL, "RHPOUT"},
62
63 {"LLINEIN", NULL, "Line In"},
64 {"RLINEIN", NULL, "Line In"},
65
66 {"MICIN", NULL, "Mic Jack"},
67};
68
f0fba2ad 69static int snappercl15_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd)
315f7da6 70{
f0fba2ad 71 struct snd_soc_codec *codec = rtd->codec;
ce6120cc 72 struct snd_soc_dapm_context *dapm = &codec->dapm;
f0fba2ad 73
ce6120cc 74 snd_soc_dapm_new_controls(dapm, tlv320aic23_dapm_widgets,
315f7da6
RM
75 ARRAY_SIZE(tlv320aic23_dapm_widgets));
76
ce6120cc 77 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
315f7da6
RM
78 return 0;
79}
80
81static struct snd_soc_dai_link snappercl15_dai = {
82 .name = "tlv320aic23",
83 .stream_name = "AIC23",
f0fba2ad
LG
84 .cpu_dai_name = "ep93xx-i2s",
85 .codec_dai_name = "tlv320aic23-hifi",
86 .codec_name = "tlv320aic23-codec.0-001a",
87 .platform_name = "ep93xx-pcm-audio",
315f7da6 88 .init = snappercl15_tlv320aic23_init,
f49f8510
AL
89 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_IF |
90 SND_SOC_DAIFMT_CBS_CFS,
315f7da6
RM
91 .ops = &snappercl15_ops,
92};
93
94static struct snd_soc_card snd_soc_snappercl15 = {
95 .name = "Snapper CL15",
a76a7023 96 .owner = THIS_MODULE,
315f7da6
RM
97 .dai_link = &snappercl15_dai,
98 .num_links = 1,
99};
100
145e2879 101static int snappercl15_probe(struct platform_device *pdev)
315f7da6 102{
62e4f7d1 103 struct snd_soc_card *card = &snd_soc_snappercl15;
315f7da6
RM
104 int ret;
105
44fb864b 106 ret = ep93xx_i2s_acquire();
315f7da6
RM
107 if (ret)
108 return ret;
109
62e4f7d1
MW
110 card->dev = &pdev->dev;
111
112 ret = snd_soc_register_card(card);
113 if (ret) {
114 dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
115 ret);
116 ep93xx_i2s_release();
117 }
315f7da6
RM
118
119 return ret;
120}
121
145e2879 122static int snappercl15_remove(struct platform_device *pdev)
315f7da6 123{
62e4f7d1
MW
124 struct snd_soc_card *card = platform_get_drvdata(pdev);
125
126 snd_soc_unregister_card(card);
315f7da6 127 ep93xx_i2s_release();
62e4f7d1
MW
128
129 return 0;
130}
131
132static struct platform_driver snappercl15_driver = {
133 .driver = {
134 .name = "snappercl15-audio",
135 .owner = THIS_MODULE,
136 },
137 .probe = snappercl15_probe,
145e2879 138 .remove = snappercl15_remove,
62e4f7d1
MW
139};
140
ee18f631 141module_platform_driver(snappercl15_driver);
315f7da6 142
1c5454ee 143MODULE_AUTHOR("Ryan Mallon");
315f7da6
RM
144MODULE_DESCRIPTION("ALSA SoC Snapper CL15");
145MODULE_LICENSE("GPL");
62e4f7d1 146MODULE_ALIAS("platform:snappercl15-audio");
This page took 0.131526 seconds and 5 git commands to generate.