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