blob: 33ba8fdbcf07c2a0845caca16f39bba5d3bbc6bb [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 Brarff6e64d2010-01-27 14:59:19 +090018#include "s3c-dma.h"
19#include "s3c-ac97.h"
20
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
Mark Brown583b2be2010-01-27 20:54:13 +000030 */
31
32/*
Jassi Brarff6e64d2010-01-27 14:59:19 +090033 Playback (HeadPhone):-
Jassi Brar9e9d04c02010-01-29 10:57:07 +090034 $ amixer sset 'Headphone' unmute
35 $ amixer sset 'Right Headphone Out Mux' 'Headphone'
36 $ amixer sset 'Left Headphone Out Mux' 'Headphone'
37 $ amixer sset 'Right HP Mixer PCM' unmute
38 $ amixer sset 'Left HP Mixer PCM' unmute
Jassi Brarff6e64d2010-01-27 14:59:19 +090039
40 Capture (LineIn):-
Jassi Brar9e9d04c02010-01-29 10:57:07 +090041 $ amixer sset 'Right Capture Source' 'Line'
42 $ amixer sset 'Left Capture Source' 'Line'
Jassi Brarff6e64d2010-01-27 14:59:19 +090043*/
44
45static struct snd_soc_dai_link smdk_dai = {
46 .name = "AC97",
47 .stream_name = "AC97 PCM",
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000048 .platform_name = "s3c24xx-pcm-audio",
Jassi Brare66477d2010-09-10 16:40:31 +090049 .cpu_dai_name = "s3c-ac97",
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000050 .codec_dai_name = "wm9713-hifi",
51 .codec_name = "wm9713-codec",
Jassi Brarff6e64d2010-01-27 14:59:19 +090052};
53
54static struct snd_soc_card smdk = {
Mark Brown9fab9632010-09-22 19:44:13 +010055 .name = "SMDK WM9713",
Jassi Brarff6e64d2010-01-27 14:59:19 +090056 .dai_link = &smdk_dai,
57 .num_links = 1,
58};
59
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000060static struct platform_device *smdk_snd_wm9713_device;
Jassi Brarff6e64d2010-01-27 14:59:19 +090061static struct platform_device *smdk_snd_ac97_device;
62
63static int __init smdk_init(void)
64{
65 int ret;
66
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000067 smdk_snd_wm9713_device = platform_device_alloc("wm9713-codec", -1);
68 if (!smdk_snd_wm9713_device)
Jassi Brarff6e64d2010-01-27 14:59:19 +090069 return -ENOMEM;
70
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000071 ret = platform_device_add(smdk_snd_wm9713_device);
72 if (ret)
73 goto err;
74
75 smdk_snd_ac97_device = platform_device_alloc("soc-audio", -1);
76 if (!smdk_snd_ac97_device) {
77 ret = -ENOMEM;
78 goto err;
79 }
80
81 platform_set_drvdata(smdk_snd_ac97_device, &smdk);
Jassi Brarff6e64d2010-01-27 14:59:19 +090082
83 ret = platform_device_add(smdk_snd_ac97_device);
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000084 if (ret) {
Jassi Brarff6e64d2010-01-27 14:59:19 +090085 platform_device_put(smdk_snd_ac97_device);
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000086 goto err;
87 }
Jassi Brarff6e64d2010-01-27 14:59:19 +090088
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000089 return 0;
90err:
91 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");