Merge tag 'iommu-updates-v3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/joro...
[linux-2.6-block.git] / sound / soc / samsung / smdk_wm9713.c
CommitLineData
ff6e64da
JB
1/*
2 * smdk_wm9713.c -- SoC audio for SMDK
3 *
4 * Copyright 2010 Samsung Electronics Co. Ltd.
df8ad335 5 * Author: Jaswinder Singh Brar <jassisinghbrar@gmail.com>
ff6e64da
JB
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
11 *
12 */
13
da155d5b 14#include <linux/module.h>
ff6e64da
JB
15#include <sound/soc.h>
16
ff6e64da
JB
17static struct snd_soc_card smdk;
18
583b2be6
MB
19/*
20 * Default CFG switch settings to use this driver:
21 *
22 * SMDK6410: Set CFG1 1-3 On, CFG2 1-4 Off
3dedece4 23 * SMDKC100: Set CFG6 1-3 On, CFG7 1 On
ce1f7d30
JB
24 * SMDKC110: Set CFGB10 1-2 Off, CFGB12 1-3 On
25 * SMDKV210: Set CFGB10 1-2 Off, CFGB12 1-3 On
4d81acff 26 * SMDKV310: Set CFG2 1-2 Off, CFG4 All On, CFG7 All Off, CFG8 1-On
583b2be6
MB
27 */
28
ff6e64da
JB
29/*
30 Playback (HeadPhone):-
9e9d04c0
JB
31 $ amixer sset 'Headphone' unmute
32 $ amixer sset 'Right Headphone Out Mux' 'Headphone'
33 $ amixer sset 'Left Headphone Out Mux' 'Headphone'
34 $ amixer sset 'Right HP Mixer PCM' unmute
35 $ amixer sset 'Left HP Mixer PCM' unmute
ff6e64da
JB
36
37 Capture (LineIn):-
9e9d04c0
JB
38 $ amixer sset 'Right Capture Source' 'Line'
39 $ amixer sset 'Left Capture Source' 'Line'
ff6e64da
JB
40*/
41
42static struct snd_soc_dai_link smdk_dai = {
43 .name = "AC97",
44 .stream_name = "AC97 PCM",
a08485d8 45 .platform_name = "samsung-ac97",
e6104673 46 .cpu_dai_name = "samsung-ac97",
f0fba2ad
LG
47 .codec_dai_name = "wm9713-hifi",
48 .codec_name = "wm9713-codec",
ff6e64da
JB
49};
50
51static struct snd_soc_card smdk = {
9fab9635 52 .name = "SMDK WM9713",
095d79dc 53 .owner = THIS_MODULE,
ff6e64da
JB
54 .dai_link = &smdk_dai,
55 .num_links = 1,
56};
57
f0fba2ad 58static struct platform_device *smdk_snd_wm9713_device;
ff6e64da
JB
59static struct platform_device *smdk_snd_ac97_device;
60
61static int __init smdk_init(void)
62{
63 int ret;
64
f0fba2ad
LG
65 smdk_snd_wm9713_device = platform_device_alloc("wm9713-codec", -1);
66 if (!smdk_snd_wm9713_device)
ff6e64da
JB
67 return -ENOMEM;
68
f0fba2ad
LG
69 ret = platform_device_add(smdk_snd_wm9713_device);
70 if (ret)
b26bb71f 71 goto err1;
f0fba2ad
LG
72
73 smdk_snd_ac97_device = platform_device_alloc("soc-audio", -1);
74 if (!smdk_snd_ac97_device) {
75 ret = -ENOMEM;
b26bb71f 76 goto err2;
f0fba2ad
LG
77 }
78
79 platform_set_drvdata(smdk_snd_ac97_device, &smdk);
ff6e64da
JB
80
81 ret = platform_device_add(smdk_snd_ac97_device);
b26bb71f
AL
82 if (ret)
83 goto err3;
ff6e64da 84
f0fba2ad 85 return 0;
b26bb71f
AL
86
87err3:
88 platform_device_put(smdk_snd_ac97_device);
89err2:
90 platform_device_del(smdk_snd_wm9713_device);
91err1:
f0fba2ad 92 platform_device_put(smdk_snd_wm9713_device);
ff6e64da
JB
93 return ret;
94}
95
96static void __exit smdk_exit(void)
97{
98 platform_device_unregister(smdk_snd_ac97_device);
97daff36 99 platform_device_unregister(smdk_snd_wm9713_device);
ff6e64da
JB
100}
101
102module_init(smdk_init);
103module_exit(smdk_exit);
104
105/* Module information */
df8ad335 106MODULE_AUTHOR("Jaswinder Singh Brar, jassisinghbrar@gmail.com");
ff6e64da
JB
107MODULE_DESCRIPTION("ALSA SoC SMDK+WM9713");
108MODULE_LICENSE("GPL");