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. |
Jaswinder Singh | df8ad33 | 2012-02-25 16:24:36 +0530 | [diff] [blame] | 5 | * Author: Jaswinder Singh Brar <jassisinghbrar@gmail.com> |
Jassi Brar | ff6e64d | 2010-01-27 14:59:19 +0900 | [diff] [blame] | 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 Gortmaker | da155d5 | 2011-07-15 12:38:28 -0400 | [diff] [blame] | 14 | #include <linux/module.h> |
Jassi Brar | ff6e64d | 2010-01-27 14:59:19 +0900 | [diff] [blame] | 15 | #include <sound/soc.h> |
| 16 | |
Jassi Brar | ff6e64d | 2010-01-27 14:59:19 +0900 | [diff] [blame] | 17 | static struct snd_soc_card smdk; |
| 18 | |
| 19 | /* |
Mark Brown | 583b2be | 2010-01-27 20:54:13 +0000 | [diff] [blame] | 20 | * Default CFG switch settings to use this driver: |
| 21 | * |
| 22 | * SMDK6410: Set CFG1 1-3 On, CFG2 1-4 Off |
Jassi Brar | 3dedece | 2010-05-27 12:11:31 +0900 | [diff] [blame] | 23 | * SMDKC100: Set CFG6 1-3 On, CFG7 1 On |
Jassi Brar | ce1f7d3 | 2010-05-27 12:11:44 +0900 | [diff] [blame] | 24 | * SMDKC110: Set CFGB10 1-2 Off, CFGB12 1-3 On |
| 25 | * SMDKV210: Set CFGB10 1-2 Off, CFGB12 1-3 On |
Jassi Brar | 4d81acf | 2010-12-20 11:05:56 +0900 | [diff] [blame] | 26 | * SMDKV310: Set CFG2 1-2 Off, CFG4 All On, CFG7 All Off, CFG8 1-On |
Mark Brown | 583b2be | 2010-01-27 20:54:13 +0000 | [diff] [blame] | 27 | */ |
| 28 | |
| 29 | /* |
Jassi Brar | ff6e64d | 2010-01-27 14:59:19 +0900 | [diff] [blame] | 30 | Playback (HeadPhone):- |
Jassi Brar | 9e9d04c0 | 2010-01-29 10:57:07 +0900 | [diff] [blame] | 31 | $ 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 Brar | ff6e64d | 2010-01-27 14:59:19 +0900 | [diff] [blame] | 36 | |
| 37 | Capture (LineIn):- |
Jassi Brar | 9e9d04c0 | 2010-01-29 10:57:07 +0900 | [diff] [blame] | 38 | $ amixer sset 'Right Capture Source' 'Line' |
| 39 | $ amixer sset 'Left Capture Source' 'Line' |
Jassi Brar | ff6e64d | 2010-01-27 14:59:19 +0900 | [diff] [blame] | 40 | */ |
| 41 | |
| 42 | static struct snd_soc_dai_link smdk_dai = { |
| 43 | .name = "AC97", |
| 44 | .stream_name = "AC97 PCM", |
Padmavathi Venna | a08485d8 | 2012-12-07 13:59:21 +0530 | [diff] [blame] | 45 | .platform_name = "samsung-ac97", |
Jassi Brar | e610467 | 2010-11-22 15:36:00 +0900 | [diff] [blame] | 46 | .cpu_dai_name = "samsung-ac97", |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 47 | .codec_dai_name = "wm9713-hifi", |
| 48 | .codec_name = "wm9713-codec", |
Jassi Brar | ff6e64d | 2010-01-27 14:59:19 +0900 | [diff] [blame] | 49 | }; |
| 50 | |
| 51 | static struct snd_soc_card smdk = { |
Mark Brown | 9fab963 | 2010-09-22 19:44:13 +0100 | [diff] [blame] | 52 | .name = "SMDK WM9713", |
Axel Lin | 095d79d | 2011-12-22 10:53:15 +0800 | [diff] [blame] | 53 | .owner = THIS_MODULE, |
Jassi Brar | ff6e64d | 2010-01-27 14:59:19 +0900 | [diff] [blame] | 54 | .dai_link = &smdk_dai, |
| 55 | .num_links = 1, |
| 56 | }; |
| 57 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 58 | static struct platform_device *smdk_snd_wm9713_device; |
Jassi Brar | ff6e64d | 2010-01-27 14:59:19 +0900 | [diff] [blame] | 59 | static struct platform_device *smdk_snd_ac97_device; |
| 60 | |
| 61 | static int __init smdk_init(void) |
| 62 | { |
| 63 | int ret; |
| 64 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 65 | smdk_snd_wm9713_device = platform_device_alloc("wm9713-codec", -1); |
| 66 | if (!smdk_snd_wm9713_device) |
Jassi Brar | ff6e64d | 2010-01-27 14:59:19 +0900 | [diff] [blame] | 67 | return -ENOMEM; |
| 68 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 69 | ret = platform_device_add(smdk_snd_wm9713_device); |
| 70 | if (ret) |
Axel Lin | b26bb71 | 2010-11-25 15:11:45 +0800 | [diff] [blame] | 71 | goto err1; |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 72 | |
| 73 | smdk_snd_ac97_device = platform_device_alloc("soc-audio", -1); |
| 74 | if (!smdk_snd_ac97_device) { |
| 75 | ret = -ENOMEM; |
Axel Lin | b26bb71 | 2010-11-25 15:11:45 +0800 | [diff] [blame] | 76 | goto err2; |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 77 | } |
| 78 | |
| 79 | platform_set_drvdata(smdk_snd_ac97_device, &smdk); |
Jassi Brar | ff6e64d | 2010-01-27 14:59:19 +0900 | [diff] [blame] | 80 | |
| 81 | ret = platform_device_add(smdk_snd_ac97_device); |
Axel Lin | b26bb71 | 2010-11-25 15:11:45 +0800 | [diff] [blame] | 82 | if (ret) |
| 83 | goto err3; |
Jassi Brar | ff6e64d | 2010-01-27 14:59:19 +0900 | [diff] [blame] | 84 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 85 | return 0; |
Axel Lin | b26bb71 | 2010-11-25 15:11:45 +0800 | [diff] [blame] | 86 | |
| 87 | err3: |
| 88 | platform_device_put(smdk_snd_ac97_device); |
| 89 | err2: |
| 90 | platform_device_del(smdk_snd_wm9713_device); |
| 91 | err1: |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 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); |
Mark Brown | 97daff3 | 2010-09-23 15:28:14 +0100 | [diff] [blame] | 99 | platform_device_unregister(smdk_snd_wm9713_device); |
Jassi Brar | ff6e64d | 2010-01-27 14:59:19 +0900 | [diff] [blame] | 100 | } |
| 101 | |
| 102 | module_init(smdk_init); |
| 103 | module_exit(smdk_exit); |
| 104 | |
| 105 | /* Module information */ |
Jaswinder Singh | df8ad33 | 2012-02-25 16:24:36 +0530 | [diff] [blame] | 106 | MODULE_AUTHOR("Jaswinder Singh Brar, jassisinghbrar@gmail.com"); |
Jassi Brar | ff6e64d | 2010-01-27 14:59:19 +0900 | [diff] [blame] | 107 | MODULE_DESCRIPTION("ALSA SoC SMDK+WM9713"); |
| 108 | MODULE_LICENSE("GPL"); |