blob: ae5fed6f772f6b26af2cc90677df58d41caa9c57 [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
14#include <linux/module.h>
15#include <linux/device.h>
16#include <sound/soc.h>
17
Jassi Brar4b640cf2010-11-22 15:35:57 +090018#include "dma.h"
Jassi Brar99ce3a32010-11-22 15:36:03 +090019#include "ac97.h"
Jassi Brarff6e64d2010-01-27 14:59:19 +090020
21static struct snd_soc_card smdk;
22
23/*
Mark Brown583b2be2010-01-27 20:54:13 +000024 * Default CFG switch settings to use this driver:
25 *
26 * SMDK6410: Set CFG1 1-3 On, CFG2 1-4 Off
Jassi Brar3dedece2010-05-27 12:11:31 +090027 * SMDKC100: Set CFG6 1-3 On, CFG7 1 On
Jassi Brarce1f7d32010-05-27 12:11:44 +090028 * SMDKC110: Set CFGB10 1-2 Off, CFGB12 1-3 On
29 * SMDKV210: Set CFGB10 1-2 Off, CFGB12 1-3 On
Jassi Brar4d81acf2010-12-20 11:05:56 +090030 * SMDKV310: Set CFG2 1-2 Off, CFG4 All On, CFG7 All Off, CFG8 1-On
Mark Brown583b2be2010-01-27 20:54:13 +000031 */
32
33/*
Jassi Brarff6e64d2010-01-27 14:59:19 +090034 Playback (HeadPhone):-
Jassi Brar9e9d04c02010-01-29 10:57:07 +090035 $ 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
Jassi Brarff6e64d2010-01-27 14:59:19 +090040
41 Capture (LineIn):-
Jassi Brar9e9d04c02010-01-29 10:57:07 +090042 $ amixer sset 'Right Capture Source' 'Line'
43 $ amixer sset 'Left Capture Source' 'Line'
Jassi Brarff6e64d2010-01-27 14:59:19 +090044*/
45
46static struct snd_soc_dai_link smdk_dai = {
47 .name = "AC97",
48 .stream_name = "AC97 PCM",
Jassi Brar58bb4072010-11-22 15:35:50 +090049 .platform_name = "samsung-audio",
Jassi Brare6104672010-11-22 15:36:00 +090050 .cpu_dai_name = "samsung-ac97",
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000051 .codec_dai_name = "wm9713-hifi",
52 .codec_name = "wm9713-codec",
Jassi Brarff6e64d2010-01-27 14:59:19 +090053};
54
55static struct snd_soc_card smdk = {
Mark Brown9fab9632010-09-22 19:44:13 +010056 .name = "SMDK WM9713",
Jassi Brarff6e64d2010-01-27 14:59:19 +090057 .dai_link = &smdk_dai,
58 .num_links = 1,
59};
60
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000061static struct platform_device *smdk_snd_wm9713_device;
Jassi Brarff6e64d2010-01-27 14:59:19 +090062static struct platform_device *smdk_snd_ac97_device;
63
64static int __init smdk_init(void)
65{
66 int ret;
67
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000068 smdk_snd_wm9713_device = platform_device_alloc("wm9713-codec", -1);
69 if (!smdk_snd_wm9713_device)
Jassi Brarff6e64d2010-01-27 14:59:19 +090070 return -ENOMEM;
71
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000072 ret = platform_device_add(smdk_snd_wm9713_device);
73 if (ret)
Axel Linb26bb712010-11-25 15:11:45 +080074 goto err1;
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000075
76 smdk_snd_ac97_device = platform_device_alloc("soc-audio", -1);
77 if (!smdk_snd_ac97_device) {
78 ret = -ENOMEM;
Axel Linb26bb712010-11-25 15:11:45 +080079 goto err2;
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000080 }
81
82 platform_set_drvdata(smdk_snd_ac97_device, &smdk);
Jassi Brarff6e64d2010-01-27 14:59:19 +090083
84 ret = platform_device_add(smdk_snd_ac97_device);
Axel Linb26bb712010-11-25 15:11:45 +080085 if (ret)
86 goto err3;
Jassi Brarff6e64d2010-01-27 14:59:19 +090087
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000088 return 0;
Axel Linb26bb712010-11-25 15:11:45 +080089
90err3:
91 platform_device_put(smdk_snd_ac97_device);
92err2:
93 platform_device_del(smdk_snd_wm9713_device);
94err1:
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000095 platform_device_put(smdk_snd_wm9713_device);
Jassi Brarff6e64d2010-01-27 14:59:19 +090096 return ret;
97}
98
99static void __exit smdk_exit(void)
100{
101 platform_device_unregister(smdk_snd_ac97_device);
Mark Brown97daff32010-09-23 15:28:14 +0100102 platform_device_unregister(smdk_snd_wm9713_device);
Jassi Brarff6e64d2010-01-27 14:59:19 +0900103}
104
105module_init(smdk_init);
106module_exit(smdk_exit);
107
108/* Module information */
109MODULE_AUTHOR("Jaswinder Singh Brar, jassi.brar@samsung.com");
110MODULE_DESCRIPTION("ALSA SoC SMDK+WM9713");
111MODULE_LICENSE("GPL");