blob: 31c6daf6d4d02ba632783c711f7e3db563f7ef63 [file] [log] [blame]
Jassi Brarff6e64d2010-01-27 14:59:19 +09001/*
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
Paul Gortmakerda155d52011-07-15 12:38:28 -040014#include <linux/module.h>
Jassi Brarff6e64d2010-01-27 14:59:19 +090015#include <sound/soc.h>
16
Jassi Brarff6e64d2010-01-27 14:59:19 +090017static struct snd_soc_card smdk;
18
19/*
Mark Brown583b2be2010-01-27 20:54:13 +000020 * Default CFG switch settings to use this driver:
21 *
22 * SMDK6410: Set CFG1 1-3 On, CFG2 1-4 Off
Jassi Brar3dedece2010-05-27 12:11:31 +090023 * SMDKC100: Set CFG6 1-3 On, CFG7 1 On
Jassi Brarce1f7d32010-05-27 12:11:44 +090024 * SMDKC110: Set CFGB10 1-2 Off, CFGB12 1-3 On
25 * SMDKV210: Set CFGB10 1-2 Off, CFGB12 1-3 On
Jassi Brar4d81acf2010-12-20 11:05:56 +090026 * SMDKV310: Set CFG2 1-2 Off, CFG4 All On, CFG7 All Off, CFG8 1-On
Mark Brown583b2be2010-01-27 20:54:13 +000027 */
28
29/*
Jassi Brarff6e64d2010-01-27 14:59:19 +090030 Playback (HeadPhone):-
Jassi Brar9e9d04c2010-01-29 10:57:07 +090031 $ 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
Jassi Brarff6e64d2010-01-27 14:59:19 +090036
37 Capture (LineIn):-
Jassi Brar9e9d04c2010-01-29 10:57:07 +090038 $ amixer sset 'Right Capture Source' 'Line'
39 $ amixer sset 'Left Capture Source' 'Line'
Jassi Brarff6e64d2010-01-27 14:59:19 +090040*/
41
42static struct snd_soc_dai_link smdk_dai = {
43 .name = "AC97",
44 .stream_name = "AC97 PCM",
Jassi Brar58bb4072010-11-22 15:35:50 +090045 .platform_name = "samsung-audio",
Jassi Brare6104672010-11-22 15:36:00 +090046 .cpu_dai_name = "samsung-ac97",
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000047 .codec_dai_name = "wm9713-hifi",
48 .codec_name = "wm9713-codec",
Jassi Brarff6e64d2010-01-27 14:59:19 +090049};
50
51static struct snd_soc_card smdk = {
Mark Brown9fab9632010-09-22 19:44:13 +010052 .name = "SMDK WM9713",
Jassi Brarff6e64d2010-01-27 14:59:19 +090053 .dai_link = &smdk_dai,
54 .num_links = 1,
55};
56
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000057static struct platform_device *smdk_snd_wm9713_device;
Jassi Brarff6e64d2010-01-27 14:59:19 +090058static struct platform_device *smdk_snd_ac97_device;
59
60static int __init smdk_init(void)
61{
62 int ret;
63
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000064 smdk_snd_wm9713_device = platform_device_alloc("wm9713-codec", -1);
65 if (!smdk_snd_wm9713_device)
Jassi Brarff6e64d2010-01-27 14:59:19 +090066 return -ENOMEM;
67
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000068 ret = platform_device_add(smdk_snd_wm9713_device);
69 if (ret)
Axel Linb26bb712010-11-25 15:11:45 +080070 goto err1;
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000071
72 smdk_snd_ac97_device = platform_device_alloc("soc-audio", -1);
73 if (!smdk_snd_ac97_device) {
74 ret = -ENOMEM;
Axel Linb26bb712010-11-25 15:11:45 +080075 goto err2;
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000076 }
77
78 platform_set_drvdata(smdk_snd_ac97_device, &smdk);
Jassi Brarff6e64d2010-01-27 14:59:19 +090079
80 ret = platform_device_add(smdk_snd_ac97_device);
Axel Linb26bb712010-11-25 15:11:45 +080081 if (ret)
82 goto err3;
Jassi Brarff6e64d2010-01-27 14:59:19 +090083
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000084 return 0;
Axel Linb26bb712010-11-25 15:11:45 +080085
86err3:
87 platform_device_put(smdk_snd_ac97_device);
88err2:
89 platform_device_del(smdk_snd_wm9713_device);
90err1:
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000091 platform_device_put(smdk_snd_wm9713_device);
Jassi Brarff6e64d2010-01-27 14:59:19 +090092 return ret;
93}
94
95static void __exit smdk_exit(void)
96{
97 platform_device_unregister(smdk_snd_ac97_device);
Mark Brown97daff32010-09-23 15:28:14 +010098 platform_device_unregister(smdk_snd_wm9713_device);
Jassi Brarff6e64d2010-01-27 14:59:19 +090099}
100
101module_init(smdk_init);
102module_exit(smdk_exit);
103
104/* Module information */
105MODULE_AUTHOR("Jaswinder Singh Brar, jassi.brar@samsung.com");
106MODULE_DESCRIPTION("ALSA SoC SMDK+WM9713");
107MODULE_LICENSE("GPL");