Jassi Brar | ff6e64d | 2010-01-27 14:59:19 +0900 | [diff] [blame] | 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 | |
| 18 | #include "../codecs/wm9713.h" |
| 19 | #include "s3c-dma.h" |
| 20 | #include "s3c-ac97.h" |
| 21 | |
| 22 | static struct snd_soc_card smdk; |
| 23 | |
| 24 | /* |
Mark Brown | 583b2be | 2010-01-27 20:54:13 +0000 | [diff] [blame] | 25 | * Default CFG switch settings to use this driver: |
| 26 | * |
| 27 | * SMDK6410: Set CFG1 1-3 On, CFG2 1-4 Off |
Jassi Brar | 3dedece | 2010-05-27 12:11:31 +0900 | [diff] [blame] | 28 | * SMDKC100: Set CFG6 1-3 On, CFG7 1 On |
Jassi Brar | ce1f7d3 | 2010-05-27 12:11:44 +0900 | [diff] [blame] | 29 | * SMDKC110: Set CFGB10 1-2 Off, CFGB12 1-3 On |
| 30 | * SMDKV210: Set CFGB10 1-2 Off, CFGB12 1-3 On |
Mark Brown | 583b2be | 2010-01-27 20:54:13 +0000 | [diff] [blame] | 31 | */ |
| 32 | |
| 33 | /* |
Jassi Brar | ff6e64d | 2010-01-27 14:59:19 +0900 | [diff] [blame] | 34 | Playback (HeadPhone):- |
Jassi Brar | 9e9d04c0 | 2010-01-29 10:57:07 +0900 | [diff] [blame] | 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 |
Jassi Brar | ff6e64d | 2010-01-27 14:59:19 +0900 | [diff] [blame] | 40 | |
| 41 | Capture (LineIn):- |
Jassi Brar | 9e9d04c0 | 2010-01-29 10:57:07 +0900 | [diff] [blame] | 42 | $ amixer sset 'Right Capture Source' 'Line' |
| 43 | $ amixer sset 'Left Capture Source' 'Line' |
Jassi Brar | ff6e64d | 2010-01-27 14:59:19 +0900 | [diff] [blame] | 44 | */ |
| 45 | |
| 46 | static struct snd_soc_dai_link smdk_dai = { |
| 47 | .name = "AC97", |
| 48 | .stream_name = "AC97 PCM", |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 49 | .platform_name = "s3c24xx-pcm-audio", |
Jassi Brar | e66477d | 2010-09-10 16:40:31 +0900 | [diff] [blame] | 50 | .cpu_dai_name = "s3c-ac97", |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 51 | .codec_dai_name = "wm9713-hifi", |
| 52 | .codec_name = "wm9713-codec", |
Jassi Brar | ff6e64d | 2010-01-27 14:59:19 +0900 | [diff] [blame] | 53 | }; |
| 54 | |
| 55 | static struct snd_soc_card smdk = { |
| 56 | .name = "SMDK", |
Jassi Brar | ff6e64d | 2010-01-27 14:59:19 +0900 | [diff] [blame] | 57 | .dai_link = &smdk_dai, |
| 58 | .num_links = 1, |
| 59 | }; |
| 60 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 61 | static struct platform_device *smdk_snd_wm9713_device; |
Jassi Brar | ff6e64d | 2010-01-27 14:59:19 +0900 | [diff] [blame] | 62 | static struct platform_device *smdk_snd_ac97_device; |
| 63 | |
| 64 | static int __init smdk_init(void) |
| 65 | { |
| 66 | int ret; |
| 67 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 68 | smdk_snd_wm9713_device = platform_device_alloc("wm9713-codec", -1); |
| 69 | if (!smdk_snd_wm9713_device) |
Jassi Brar | ff6e64d | 2010-01-27 14:59:19 +0900 | [diff] [blame] | 70 | return -ENOMEM; |
| 71 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 72 | ret = platform_device_add(smdk_snd_wm9713_device); |
| 73 | if (ret) |
| 74 | goto err; |
| 75 | |
| 76 | smdk_snd_ac97_device = platform_device_alloc("soc-audio", -1); |
| 77 | if (!smdk_snd_ac97_device) { |
| 78 | ret = -ENOMEM; |
| 79 | goto err; |
| 80 | } |
| 81 | |
| 82 | platform_set_drvdata(smdk_snd_ac97_device, &smdk); |
Jassi Brar | ff6e64d | 2010-01-27 14:59:19 +0900 | [diff] [blame] | 83 | |
| 84 | ret = platform_device_add(smdk_snd_ac97_device); |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 85 | if (ret) { |
Jassi Brar | ff6e64d | 2010-01-27 14:59:19 +0900 | [diff] [blame] | 86 | platform_device_put(smdk_snd_ac97_device); |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 87 | goto err; |
| 88 | } |
Jassi Brar | ff6e64d | 2010-01-27 14:59:19 +0900 | [diff] [blame] | 89 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 90 | return 0; |
| 91 | err: |
| 92 | platform_device_put(smdk_snd_wm9713_device); |
Jassi Brar | ff6e64d | 2010-01-27 14:59:19 +0900 | [diff] [blame] | 93 | return ret; |
| 94 | } |
| 95 | |
| 96 | static void __exit smdk_exit(void) |
| 97 | { |
| 98 | platform_device_unregister(smdk_snd_ac97_device); |
| 99 | } |
| 100 | |
| 101 | module_init(smdk_init); |
| 102 | module_exit(smdk_exit); |
| 103 | |
| 104 | /* Module information */ |
| 105 | MODULE_AUTHOR("Jaswinder Singh Brar, jassi.brar@samsung.com"); |
| 106 | MODULE_DESCRIPTION("ALSA SoC SMDK+WM9713"); |
| 107 | MODULE_LICENSE("GPL"); |