Jassi Brar | 5033f43 | 2010-11-22 15:37:25 +0900 | [diff] [blame] | 1 | /* sound/soc/samsung/s3c24xx_simtec_hermes.c |
Ben Dooks | b2ec22e | 2009-08-20 22:50:43 +0100 | [diff] [blame] | 2 | * |
| 3 | * Copyright 2009 Simtec Electronics |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License version 2 as |
| 7 | * published by the Free Software Foundation. |
| 8 | */ |
| 9 | |
Ben Dooks | b2ec22e | 2009-08-20 22:50:43 +0100 | [diff] [blame] | 10 | #include <sound/soc.h> |
Ben Dooks | b2ec22e | 2009-08-20 22:50:43 +0100 | [diff] [blame] | 11 | |
Ben Dooks | b2ec22e | 2009-08-20 22:50:43 +0100 | [diff] [blame] | 12 | #include "s3c24xx_simtec.h" |
| 13 | |
Ben Dooks | b2ec22e | 2009-08-20 22:50:43 +0100 | [diff] [blame] | 14 | static const struct snd_soc_dapm_widget dapm_widgets[] = { |
| 15 | SND_SOC_DAPM_LINE("GSM Out", NULL), |
| 16 | SND_SOC_DAPM_LINE("GSM In", NULL), |
| 17 | SND_SOC_DAPM_LINE("Line In", NULL), |
| 18 | SND_SOC_DAPM_LINE("Line Out", NULL), |
| 19 | SND_SOC_DAPM_LINE("ZV", NULL), |
| 20 | SND_SOC_DAPM_MIC("Mic Jack", NULL), |
| 21 | SND_SOC_DAPM_HP("Headphone Jack", NULL), |
| 22 | }; |
| 23 | |
| 24 | static const struct snd_soc_dapm_route base_map[] = { |
| 25 | /* Headphone connected to HP{L,R}OUT and HP{L,R}COM */ |
| 26 | |
| 27 | { "Headphone Jack", NULL, "HPLOUT" }, |
| 28 | { "Headphone Jack", NULL, "HPLCOM" }, |
| 29 | { "Headphone Jack", NULL, "HPROUT" }, |
| 30 | { "Headphone Jack", NULL, "HPRCOM" }, |
| 31 | |
| 32 | /* ZV connected to Line1 */ |
| 33 | |
| 34 | { "LINE1L", NULL, "ZV" }, |
| 35 | { "LINE1R", NULL, "ZV" }, |
| 36 | |
| 37 | /* Line In connected to Line2 */ |
| 38 | |
| 39 | { "LINE2L", NULL, "Line In" }, |
| 40 | { "LINE2R", NULL, "Line In" }, |
| 41 | |
| 42 | /* Microphone connected to MIC3R and MIC_BIAS */ |
| 43 | |
| 44 | { "MIC3L", NULL, "Mic Jack" }, |
| 45 | |
| 46 | /* GSM connected to MONO_LOUT and MIC3L (in) */ |
| 47 | |
| 48 | { "GSM Out", NULL, "MONO_LOUT" }, |
| 49 | { "MIC3L", NULL, "GSM In" }, |
| 50 | |
| 51 | /* Speaker is connected to LINEOUT{LN,LP,RN,RP}, however we are |
| 52 | * not using the DAPM to power it up and down as there it makes |
| 53 | * a click when powering up. */ |
| 54 | }; |
| 55 | |
| 56 | /** |
| 57 | * simtec_hermes_init - initialise and add controls |
| 58 | * @codec; The codec instance to attach to. |
| 59 | * |
| 60 | * Attach our controls and configure the necessary codec |
| 61 | * mappings for our sound card instance. |
| 62 | */ |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 63 | static int simtec_hermes_init(struct snd_soc_pcm_runtime *rtd) |
Ben Dooks | b2ec22e | 2009-08-20 22:50:43 +0100 | [diff] [blame] | 64 | { |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 65 | struct snd_soc_codec *codec = rtd->codec; |
Liam Girdwood | ce6120c | 2010-11-05 15:53:46 +0200 | [diff] [blame] | 66 | struct snd_soc_dapm_context *dapm = &codec->dapm; |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 67 | |
Liam Girdwood | ce6120c | 2010-11-05 15:53:46 +0200 | [diff] [blame] | 68 | snd_soc_dapm_enable_pin(dapm, "Headphone Jack"); |
| 69 | snd_soc_dapm_enable_pin(dapm, "Line In"); |
| 70 | snd_soc_dapm_enable_pin(dapm, "Line Out"); |
| 71 | snd_soc_dapm_enable_pin(dapm, "Mic Jack"); |
Ben Dooks | b2ec22e | 2009-08-20 22:50:43 +0100 | [diff] [blame] | 72 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 73 | simtec_audio_init(rtd); |
Ben Dooks | b2ec22e | 2009-08-20 22:50:43 +0100 | [diff] [blame] | 74 | |
| 75 | return 0; |
| 76 | } |
| 77 | |
Ben Dooks | b2ec22e | 2009-08-20 22:50:43 +0100 | [diff] [blame] | 78 | static struct snd_soc_dai_link simtec_dai_aic33 = { |
| 79 | .name = "tlv320aic33", |
| 80 | .stream_name = "TLV320AIC33", |
Lars-Peter Clausen | 81d7da5 | 2011-01-24 22:09:22 +0100 | [diff] [blame] | 81 | .codec_name = "tlv320aic3x-codec.0-001a", |
Lars-Peter Clausen | 518aa59 | 2011-01-24 22:12:42 +0100 | [diff] [blame] | 82 | .cpu_dai_name = "s3c24xx-iis", |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 83 | .codec_dai_name = "tlv320aic3x-hifi", |
Jassi Brar | 58bb407 | 2010-11-22 15:35:50 +0900 | [diff] [blame] | 84 | .platform_name = "samsung-audio", |
Ben Dooks | b2ec22e | 2009-08-20 22:50:43 +0100 | [diff] [blame] | 85 | .init = simtec_hermes_init, |
| 86 | }; |
| 87 | |
| 88 | /* simtec audio machine driver */ |
| 89 | static struct snd_soc_card snd_soc_machine_simtec_aic33 = { |
| 90 | .name = "Simtec-Hermes", |
Ben Dooks | b2ec22e | 2009-08-20 22:50:43 +0100 | [diff] [blame] | 91 | .dai_link = &simtec_dai_aic33, |
| 92 | .num_links = 1, |
Mark Brown | 4f5448a | 2011-10-08 12:19:12 +0100 | [diff] [blame] | 93 | |
| 94 | .dapm_widgets = dapm_widgets, |
| 95 | .num_dapm_widgets = ARRAY_SIZE(dapm_widgets), |
| 96 | .dapm_routes = base_map, |
| 97 | .num_dapm_routes = ARRAY_SIZE(base_map), |
Ben Dooks | b2ec22e | 2009-08-20 22:50:43 +0100 | [diff] [blame] | 98 | }; |
| 99 | |
Ben Dooks | b2ec22e | 2009-08-20 22:50:43 +0100 | [diff] [blame] | 100 | static int __devinit simtec_audio_hermes_probe(struct platform_device *pd) |
| 101 | { |
| 102 | dev_info(&pd->dev, "probing....\n"); |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 103 | return simtec_audio_core_probe(pd, &snd_soc_machine_simtec_aic33); |
Ben Dooks | b2ec22e | 2009-08-20 22:50:43 +0100 | [diff] [blame] | 104 | } |
| 105 | |
| 106 | static struct platform_driver simtec_audio_hermes_platdrv = { |
| 107 | .driver = { |
| 108 | .owner = THIS_MODULE, |
| 109 | .name = "s3c24xx-simtec-hermes-snd", |
| 110 | .pm = simtec_audio_pm, |
| 111 | }, |
| 112 | .probe = simtec_audio_hermes_probe, |
| 113 | .remove = __devexit_p(simtec_audio_remove), |
| 114 | }; |
| 115 | |
| 116 | MODULE_ALIAS("platform:s3c24xx-simtec-hermes-snd"); |
| 117 | |
| 118 | static int __init simtec_hermes_modinit(void) |
| 119 | { |
| 120 | return platform_driver_register(&simtec_audio_hermes_platdrv); |
| 121 | } |
| 122 | |
| 123 | static void __exit simtec_hermes_modexit(void) |
| 124 | { |
| 125 | platform_driver_unregister(&simtec_audio_hermes_platdrv); |
| 126 | } |
| 127 | |
| 128 | module_init(simtec_hermes_modinit); |
| 129 | module_exit(simtec_hermes_modexit); |
| 130 | |
| 131 | MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); |
| 132 | MODULE_DESCRIPTION("ALSA SoC Simtec Audio support"); |
| 133 | MODULE_LICENSE("GPL"); |