| OLD | NEW |
| 1 /* | 1 /* |
| 2 * smdk_wm9713.c -- SoC audio for SMDK | 2 * smdk_wm9713.c -- SoC audio for SMDK |
| 3 * | 3 * |
| 4 * Copyright 2010 Samsung Electronics Co. Ltd. | 4 * Copyright 2010 Samsung Electronics Co. Ltd. |
| 5 * Author: Jaswinder Singh Brar <jassi.brar@samsung.com> | 5 * Author: Jaswinder Singh Brar <jassi.brar@samsung.com> |
| 6 * | 6 * |
| 7 * This program is free software; you can redistribute it and/or | 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 | 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 | 9 * published by the Free Software Foundation; either version 2 of the |
| 10 * License, or (at your option) any later version. | 10 * License, or (at your option) any later version. |
| 11 * | 11 * |
| 12 */ | 12 */ |
| 13 | 13 |
| 14 #include <linux/module.h> | |
| 15 #include <linux/device.h> | |
| 16 #include <sound/soc.h> | 14 #include <sound/soc.h> |
| 17 | 15 |
| 18 #include "s3c-dma.h" | |
| 19 #include "s3c-ac97.h" | |
| 20 | |
| 21 static struct snd_soc_card smdk; | 16 static struct snd_soc_card smdk; |
| 22 | 17 |
| 23 /* | 18 /* |
| 24 * Default CFG switch settings to use this driver: | 19 * Default CFG switch settings to use this driver: |
| 25 * | 20 * |
| 26 * SMDK6410: Set CFG1 1-3 On, CFG2 1-4 Off | 21 * SMDK6410: Set CFG1 1-3 On, CFG2 1-4 Off |
| 27 * SMDKC100: Set CFG6 1-3 On, CFG7 1 On | 22 * SMDKC100: Set CFG6 1-3 On, CFG7 1 On |
| 28 * SMDKC110: Set CFGB10 1-2 Off, CFGB12 1-3 On | 23 * SMDKC110: Set CFGB10 1-2 Off, CFGB12 1-3 On |
| 29 * SMDKV210: Set CFGB10 1-2 Off, CFGB12 1-3 On | 24 * SMDKV210: Set CFGB10 1-2 Off, CFGB12 1-3 On |
| 25 * SMDKV310: Set CFG2 1-2 Off, CFG4 All On, CFG7 All Off, CFG8 1-On |
| 30 */ | 26 */ |
| 31 | 27 |
| 32 /* | 28 /* |
| 33 Playback (HeadPhone):- | 29 Playback (HeadPhone):- |
| 34 $ amixer sset 'Headphone' unmute | 30 $ amixer sset 'Headphone' unmute |
| 35 $ amixer sset 'Right Headphone Out Mux' 'Headphone' | 31 $ amixer sset 'Right Headphone Out Mux' 'Headphone' |
| 36 $ amixer sset 'Left Headphone Out Mux' 'Headphone' | 32 $ amixer sset 'Left Headphone Out Mux' 'Headphone' |
| 37 $ amixer sset 'Right HP Mixer PCM' unmute | 33 $ amixer sset 'Right HP Mixer PCM' unmute |
| 38 $ amixer sset 'Left HP Mixer PCM' unmute | 34 $ amixer sset 'Left HP Mixer PCM' unmute |
| 39 | 35 |
| 40 Capture (LineIn):- | 36 Capture (LineIn):- |
| 41 $ amixer sset 'Right Capture Source' 'Line' | 37 $ amixer sset 'Right Capture Source' 'Line' |
| 42 $ amixer sset 'Left Capture Source' 'Line' | 38 $ amixer sset 'Left Capture Source' 'Line' |
| 43 */ | 39 */ |
| 44 | 40 |
| 45 static struct snd_soc_dai_link smdk_dai = { | 41 static struct snd_soc_dai_link smdk_dai = { |
| 46 .name = "AC97", | 42 .name = "AC97", |
| 47 .stream_name = "AC97 PCM", | 43 .stream_name = "AC97 PCM", |
| 48 » .platform_name = "s3c24xx-pcm-audio", | 44 » .platform_name = "samsung-audio", |
| 49 » .cpu_dai_name = "s3c-ac97", | 45 » .cpu_dai_name = "samsung-ac97", |
| 50 .codec_dai_name = "wm9713-hifi", | 46 .codec_dai_name = "wm9713-hifi", |
| 51 .codec_name = "wm9713-codec", | 47 .codec_name = "wm9713-codec", |
| 52 }; | 48 }; |
| 53 | 49 |
| 54 static struct snd_soc_card smdk = { | 50 static struct snd_soc_card smdk = { |
| 55 .name = "SMDK WM9713", | 51 .name = "SMDK WM9713", |
| 56 .dai_link = &smdk_dai, | 52 .dai_link = &smdk_dai, |
| 57 .num_links = 1, | 53 .num_links = 1, |
| 58 }; | 54 }; |
| 59 | 55 |
| 60 static struct platform_device *smdk_snd_wm9713_device; | 56 static struct platform_device *smdk_snd_wm9713_device; |
| 61 static struct platform_device *smdk_snd_ac97_device; | 57 static struct platform_device *smdk_snd_ac97_device; |
| 62 | 58 |
| 63 static int __init smdk_init(void) | 59 static int __init smdk_init(void) |
| 64 { | 60 { |
| 65 int ret; | 61 int ret; |
| 66 | 62 |
| 67 smdk_snd_wm9713_device = platform_device_alloc("wm9713-codec", -1); | 63 smdk_snd_wm9713_device = platform_device_alloc("wm9713-codec", -1); |
| 68 if (!smdk_snd_wm9713_device) | 64 if (!smdk_snd_wm9713_device) |
| 69 return -ENOMEM; | 65 return -ENOMEM; |
| 70 | 66 |
| 71 ret = platform_device_add(smdk_snd_wm9713_device); | 67 ret = platform_device_add(smdk_snd_wm9713_device); |
| 72 if (ret) | 68 if (ret) |
| 73 » » goto err; | 69 » » goto err1; |
| 74 | 70 |
| 75 smdk_snd_ac97_device = platform_device_alloc("soc-audio", -1); | 71 smdk_snd_ac97_device = platform_device_alloc("soc-audio", -1); |
| 76 if (!smdk_snd_ac97_device) { | 72 if (!smdk_snd_ac97_device) { |
| 77 ret = -ENOMEM; | 73 ret = -ENOMEM; |
| 78 » » goto err; | 74 » » goto err2; |
| 79 } | 75 } |
| 80 | 76 |
| 81 platform_set_drvdata(smdk_snd_ac97_device, &smdk); | 77 platform_set_drvdata(smdk_snd_ac97_device, &smdk); |
| 82 | 78 |
| 83 ret = platform_device_add(smdk_snd_ac97_device); | 79 ret = platform_device_add(smdk_snd_ac97_device); |
| 84 » if (ret) { | 80 » if (ret) |
| 85 » » platform_device_put(smdk_snd_ac97_device); | 81 » » goto err3; |
| 86 » » goto err; | |
| 87 » } | |
| 88 | 82 |
| 89 return 0; | 83 return 0; |
| 90 err: | 84 |
| 85 err3: |
| 86 » platform_device_put(smdk_snd_ac97_device); |
| 87 err2: |
| 88 » platform_device_del(smdk_snd_wm9713_device); |
| 89 err1: |
| 91 platform_device_put(smdk_snd_wm9713_device); | 90 platform_device_put(smdk_snd_wm9713_device); |
| 92 return ret; | 91 return ret; |
| 93 } | 92 } |
| 94 | 93 |
| 95 static void __exit smdk_exit(void) | 94 static void __exit smdk_exit(void) |
| 96 { | 95 { |
| 97 platform_device_unregister(smdk_snd_ac97_device); | 96 platform_device_unregister(smdk_snd_ac97_device); |
| 98 platform_device_unregister(smdk_snd_wm9713_device); | 97 platform_device_unregister(smdk_snd_wm9713_device); |
| 99 } | 98 } |
| 100 | 99 |
| 101 module_init(smdk_init); | 100 module_init(smdk_init); |
| 102 module_exit(smdk_exit); | 101 module_exit(smdk_exit); |
| 103 | 102 |
| 104 /* Module information */ | 103 /* Module information */ |
| 105 MODULE_AUTHOR("Jaswinder Singh Brar, jassi.brar@samsung.com"); | 104 MODULE_AUTHOR("Jaswinder Singh Brar, jassi.brar@samsung.com"); |
| 106 MODULE_DESCRIPTION("ALSA SoC SMDK+WM9713"); | 105 MODULE_DESCRIPTION("ALSA SoC SMDK+WM9713"); |
| 107 MODULE_LICENSE("GPL"); | 106 MODULE_LICENSE("GPL"); |
| OLD | NEW |