Commit | Line | Data |
---|---|---|
ff6e64da JB |
1 | /* |
2 | * smdk_wm9713.c -- SoC audio for SMDK | |
3 | * | |
4 | * Copyright 2010 Samsung Electronics Co. Ltd. | |
5 | * Author: Jaswinder Singh Brar <jassi.brar@samsung.com> | |
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 | ||
ff6e64da JB |
14 | #include <sound/soc.h> |
15 | ||
ff6e64da JB |
16 | static struct snd_soc_card smdk; |
17 | ||
583b2be6 MB |
18 | /* |
19 | * Default CFG switch settings to use this driver: | |
20 | * | |
21 | * SMDK6410: Set CFG1 1-3 On, CFG2 1-4 Off | |
3dedece4 | 22 | * SMDKC100: Set CFG6 1-3 On, CFG7 1 On |
ce1f7d30 JB |
23 | * SMDKC110: Set CFGB10 1-2 Off, CFGB12 1-3 On |
24 | * SMDKV210: Set CFGB10 1-2 Off, CFGB12 1-3 On | |
4d81acff | 25 | * SMDKV310: Set CFG2 1-2 Off, CFG4 All On, CFG7 All Off, CFG8 1-On |
583b2be6 MB |
26 | */ |
27 | ||
ff6e64da JB |
28 | /* |
29 | Playback (HeadPhone):- | |
9e9d04c0 JB |
30 | $ amixer sset 'Headphone' unmute |
31 | $ amixer sset 'Right Headphone Out Mux' 'Headphone' | |
32 | $ amixer sset 'Left Headphone Out Mux' 'Headphone' | |
33 | $ amixer sset 'Right HP Mixer PCM' unmute | |
34 | $ amixer sset 'Left HP Mixer PCM' unmute | |
ff6e64da JB |
35 | |
36 | Capture (LineIn):- | |
9e9d04c0 JB |
37 | $ amixer sset 'Right Capture Source' 'Line' |
38 | $ amixer sset 'Left Capture Source' 'Line' | |
ff6e64da JB |
39 | */ |
40 | ||
41 | static struct snd_soc_dai_link smdk_dai = { | |
42 | .name = "AC97", | |
43 | .stream_name = "AC97 PCM", | |
58bb4072 | 44 | .platform_name = "samsung-audio", |
e6104673 | 45 | .cpu_dai_name = "samsung-ac97", |
f0fba2ad LG |
46 | .codec_dai_name = "wm9713-hifi", |
47 | .codec_name = "wm9713-codec", | |
ff6e64da JB |
48 | }; |
49 | ||
50 | static struct snd_soc_card smdk = { | |
9fab9635 | 51 | .name = "SMDK WM9713", |
ff6e64da JB |
52 | .dai_link = &smdk_dai, |
53 | .num_links = 1, | |
54 | }; | |
55 | ||
f0fba2ad | 56 | static struct platform_device *smdk_snd_wm9713_device; |
ff6e64da JB |
57 | static struct platform_device *smdk_snd_ac97_device; |
58 | ||
59 | static int __init smdk_init(void) | |
60 | { | |
61 | int ret; | |
62 | ||
f0fba2ad LG |
63 | smdk_snd_wm9713_device = platform_device_alloc("wm9713-codec", -1); |
64 | if (!smdk_snd_wm9713_device) | |
ff6e64da JB |
65 | return -ENOMEM; |
66 | ||
f0fba2ad LG |
67 | ret = platform_device_add(smdk_snd_wm9713_device); |
68 | if (ret) | |
b26bb71f | 69 | goto err1; |
f0fba2ad LG |
70 | |
71 | smdk_snd_ac97_device = platform_device_alloc("soc-audio", -1); | |
72 | if (!smdk_snd_ac97_device) { | |
73 | ret = -ENOMEM; | |
b26bb71f | 74 | goto err2; |
f0fba2ad LG |
75 | } |
76 | ||
77 | platform_set_drvdata(smdk_snd_ac97_device, &smdk); | |
ff6e64da JB |
78 | |
79 | ret = platform_device_add(smdk_snd_ac97_device); | |
b26bb71f AL |
80 | if (ret) |
81 | goto err3; | |
ff6e64da | 82 | |
f0fba2ad | 83 | return 0; |
b26bb71f AL |
84 | |
85 | err3: | |
86 | platform_device_put(smdk_snd_ac97_device); | |
87 | err2: | |
88 | platform_device_del(smdk_snd_wm9713_device); | |
89 | err1: | |
f0fba2ad | 90 | platform_device_put(smdk_snd_wm9713_device); |
ff6e64da JB |
91 | return ret; |
92 | } | |
93 | ||
94 | static void __exit smdk_exit(void) | |
95 | { | |
96 | platform_device_unregister(smdk_snd_ac97_device); | |
97daff36 | 97 | platform_device_unregister(smdk_snd_wm9713_device); |
ff6e64da JB |
98 | } |
99 | ||
100 | module_init(smdk_init); | |
101 | module_exit(smdk_exit); | |
102 | ||
103 | /* Module information */ | |
104 | MODULE_AUTHOR("Jaswinder Singh Brar, jassi.brar@samsung.com"); | |
105 | MODULE_DESCRIPTION("ALSA SoC SMDK+WM9713"); | |
106 | MODULE_LICENSE("GPL"); |