diff options
| -rw-r--r-- | sound/soc/samsung/Kconfig | 11 | ||||
| -rw-r--r-- | sound/soc/samsung/Makefile | 2 | ||||
| -rw-r--r-- | sound/soc/samsung/goni_wm8994.c | 289 |
3 files changed, 0 insertions, 302 deletions
diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig index e817a2f43ea8..3cebf6ca03df 100644 --- a/sound/soc/samsung/Kconfig +++ b/sound/soc/samsung/Kconfig | |||
| @@ -146,17 +146,6 @@ config SND_SOC_SMARTQ | |||
| 146 | select SND_SAMSUNG_I2S | 146 | select SND_SAMSUNG_I2S |
| 147 | select SND_SOC_WM8750 | 147 | select SND_SOC_WM8750 |
| 148 | 148 | ||
| 149 | config SND_SOC_GONI_AQUILA_WM8994 | ||
| 150 | tristate "SoC I2S Audio support for AQUILA/GONI - WM8994" | ||
| 151 | depends on SND_SOC_SAMSUNG && (MACH_GONI || MACH_AQUILA) | ||
| 152 | depends on I2C=y | ||
| 153 | select SND_SAMSUNG_I2S | ||
| 154 | select MFD_WM8994 | ||
| 155 | select SND_SOC_WM8994 | ||
| 156 | help | ||
| 157 | Say Y if you want to add support for SoC audio on goni or aquila | ||
| 158 | with the WM8994. | ||
| 159 | |||
| 160 | config SND_SOC_SAMSUNG_SMDK_SPDIF | 149 | config SND_SOC_SAMSUNG_SMDK_SPDIF |
| 161 | tristate "SoC S/PDIF Audio support for SMDK" | 150 | tristate "SoC S/PDIF Audio support for SMDK" |
| 162 | depends on SND_SOC_SAMSUNG | 151 | depends on SND_SOC_SAMSUNG |
diff --git a/sound/soc/samsung/Makefile b/sound/soc/samsung/Makefile index 31e3dba7e3b5..052fe71be518 100644 --- a/sound/soc/samsung/Makefile +++ b/sound/soc/samsung/Makefile | |||
| @@ -35,7 +35,6 @@ snd-soc-smdk-wm8994-objs := smdk_wm8994.o | |||
| 35 | snd-soc-snow-objs := snow.o | 35 | snd-soc-snow-objs := snow.o |
| 36 | snd-soc-smdk-wm9713-objs := smdk_wm9713.o | 36 | snd-soc-smdk-wm9713-objs := smdk_wm9713.o |
| 37 | snd-soc-s3c64xx-smartq-wm8987-objs := smartq_wm8987.o | 37 | snd-soc-s3c64xx-smartq-wm8987-objs := smartq_wm8987.o |
| 38 | snd-soc-goni-wm8994-objs := goni_wm8994.o | ||
| 39 | snd-soc-smdk-spdif-objs := smdk_spdif.o | 38 | snd-soc-smdk-spdif-objs := smdk_spdif.o |
| 40 | snd-soc-smdk-wm8580pcm-objs := smdk_wm8580pcm.o | 39 | snd-soc-smdk-wm8580pcm-objs := smdk_wm8580pcm.o |
| 41 | snd-soc-smdk-wm8994pcm-objs := smdk_wm8994pcm.o | 40 | snd-soc-smdk-wm8994pcm-objs := smdk_wm8994pcm.o |
| @@ -63,7 +62,6 @@ obj-$(CONFIG_SND_SOC_SNOW) += snd-soc-snow.o | |||
| 63 | obj-$(CONFIG_SND_SOC_SAMSUNG_SMDK_WM9713) += snd-soc-smdk-wm9713.o | 62 | obj-$(CONFIG_SND_SOC_SAMSUNG_SMDK_WM9713) += snd-soc-smdk-wm9713.o |
| 64 | obj-$(CONFIG_SND_SOC_SMARTQ) += snd-soc-s3c64xx-smartq-wm8987.o | 63 | obj-$(CONFIG_SND_SOC_SMARTQ) += snd-soc-s3c64xx-smartq-wm8987.o |
| 65 | obj-$(CONFIG_SND_SOC_SAMSUNG_SMDK_SPDIF) += snd-soc-smdk-spdif.o | 64 | obj-$(CONFIG_SND_SOC_SAMSUNG_SMDK_SPDIF) += snd-soc-smdk-spdif.o |
| 66 | obj-$(CONFIG_SND_SOC_GONI_AQUILA_WM8994) += snd-soc-goni-wm8994.o | ||
| 67 | obj-$(CONFIG_SND_SOC_SMDK_WM8580_PCM) += snd-soc-smdk-wm8580pcm.o | 65 | obj-$(CONFIG_SND_SOC_SMDK_WM8580_PCM) += snd-soc-smdk-wm8580pcm.o |
| 68 | obj-$(CONFIG_SND_SOC_SMDK_WM8994_PCM) += snd-soc-smdk-wm8994pcm.o | 66 | obj-$(CONFIG_SND_SOC_SMDK_WM8994_PCM) += snd-soc-smdk-wm8994pcm.o |
| 69 | obj-$(CONFIG_SND_SOC_SPEYSIDE) += snd-soc-speyside.o | 67 | obj-$(CONFIG_SND_SOC_SPEYSIDE) += snd-soc-speyside.o |
diff --git a/sound/soc/samsung/goni_wm8994.c b/sound/soc/samsung/goni_wm8994.c deleted file mode 100644 index fad56b9e7369..000000000000 --- a/sound/soc/samsung/goni_wm8994.c +++ /dev/null | |||
| @@ -1,289 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * goni_wm8994.c | ||
| 3 | * | ||
| 4 | * Copyright (C) 2010 Samsung Electronics Co.Ltd | ||
| 5 | * Author: Chanwoo Choi <cw00.choi@samsung.com> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify it | ||
| 8 | * under the terms of the GNU General Public License as published by the | ||
| 9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 10 | * option) any later version. | ||
| 11 | * | ||
| 12 | */ | ||
| 13 | |||
| 14 | #include <linux/module.h> | ||
| 15 | #include <sound/soc.h> | ||
| 16 | #include <sound/jack.h> | ||
| 17 | |||
| 18 | #include <asm/mach-types.h> | ||
| 19 | #include <mach/gpio-samsung.h> | ||
| 20 | |||
| 21 | #include "../codecs/wm8994.h" | ||
| 22 | |||
| 23 | #define MACHINE_NAME 0 | ||
| 24 | #define CPU_VOICE_DAI 1 | ||
| 25 | |||
| 26 | static const char *aquila_str[] = { | ||
| 27 | [MACHINE_NAME] = "aquila", | ||
| 28 | [CPU_VOICE_DAI] = "aquila-voice-dai", | ||
| 29 | }; | ||
| 30 | |||
| 31 | static struct snd_soc_card goni; | ||
| 32 | static struct platform_device *goni_snd_device; | ||
| 33 | |||
| 34 | /* 3.5 pie jack */ | ||
| 35 | static struct snd_soc_jack jack; | ||
| 36 | |||
| 37 | /* 3.5 pie jack detection DAPM pins */ | ||
| 38 | static struct snd_soc_jack_pin jack_pins[] = { | ||
| 39 | { | ||
| 40 | .pin = "Headset Mic", | ||
| 41 | .mask = SND_JACK_MICROPHONE, | ||
| 42 | }, { | ||
| 43 | .pin = "Headset Stereophone", | ||
| 44 | .mask = SND_JACK_HEADPHONE | SND_JACK_MECHANICAL | | ||
| 45 | SND_JACK_AVOUT, | ||
| 46 | }, | ||
| 47 | }; | ||
| 48 | |||
| 49 | /* 3.5 pie jack detection gpios */ | ||
| 50 | static struct snd_soc_jack_gpio jack_gpios[] = { | ||
| 51 | { | ||
| 52 | .gpio = S5PV210_GPH0(6), | ||
| 53 | .name = "DET_3.5", | ||
| 54 | .report = SND_JACK_HEADSET | SND_JACK_MECHANICAL | | ||
| 55 | SND_JACK_AVOUT, | ||
| 56 | .debounce_time = 200, | ||
| 57 | }, | ||
| 58 | }; | ||
| 59 | |||
| 60 | static const struct snd_soc_dapm_widget goni_dapm_widgets[] = { | ||
| 61 | SND_SOC_DAPM_SPK("Ext Left Spk", NULL), | ||
| 62 | SND_SOC_DAPM_SPK("Ext Right Spk", NULL), | ||
| 63 | SND_SOC_DAPM_SPK("Ext Rcv", NULL), | ||
| 64 | SND_SOC_DAPM_HP("Headset Stereophone", NULL), | ||
| 65 | SND_SOC_DAPM_MIC("Headset Mic", NULL), | ||
| 66 | SND_SOC_DAPM_MIC("Main Mic", NULL), | ||
| 67 | SND_SOC_DAPM_MIC("2nd Mic", NULL), | ||
| 68 | SND_SOC_DAPM_LINE("Radio In", NULL), | ||
| 69 | }; | ||
| 70 | |||
| 71 | static const struct snd_soc_dapm_route goni_dapm_routes[] = { | ||
| 72 | {"Ext Left Spk", NULL, "SPKOUTLP"}, | ||
| 73 | {"Ext Left Spk", NULL, "SPKOUTLN"}, | ||
| 74 | |||
| 75 | {"Ext Right Spk", NULL, "SPKOUTRP"}, | ||
| 76 | {"Ext Right Spk", NULL, "SPKOUTRN"}, | ||
| 77 | |||
| 78 | {"Ext Rcv", NULL, "HPOUT2N"}, | ||
| 79 | {"Ext Rcv", NULL, "HPOUT2P"}, | ||
| 80 | |||
| 81 | {"Headset Stereophone", NULL, "HPOUT1L"}, | ||
| 82 | {"Headset Stereophone", NULL, "HPOUT1R"}, | ||
| 83 | |||
| 84 | {"IN1RN", NULL, "Headset Mic"}, | ||
| 85 | {"IN1RP", NULL, "Headset Mic"}, | ||
| 86 | |||
| 87 | {"IN1RN", NULL, "2nd Mic"}, | ||
| 88 | {"IN1RP", NULL, "2nd Mic"}, | ||
| 89 | |||
| 90 | {"IN1LN", NULL, "Main Mic"}, | ||
| 91 | {"IN1LP", NULL, "Main Mic"}, | ||
| 92 | |||
| 93 | {"IN2LN", NULL, "Radio In"}, | ||
| 94 | {"IN2RN", NULL, "Radio In"}, | ||
| 95 | }; | ||
| 96 | |||
| 97 | static int goni_wm8994_init(struct snd_soc_pcm_runtime *rtd) | ||
| 98 | { | ||
| 99 | struct snd_soc_codec *codec = rtd->codec; | ||
| 100 | struct snd_soc_dapm_context *dapm = &codec->dapm; | ||
| 101 | int ret; | ||
| 102 | |||
| 103 | /* set endpoints to not connected */ | ||
| 104 | snd_soc_dapm_nc_pin(dapm, "IN2LP:VXRN"); | ||
| 105 | snd_soc_dapm_nc_pin(dapm, "IN2RP:VXRP"); | ||
| 106 | snd_soc_dapm_nc_pin(dapm, "LINEOUT1N"); | ||
| 107 | snd_soc_dapm_nc_pin(dapm, "LINEOUT1P"); | ||
| 108 | snd_soc_dapm_nc_pin(dapm, "LINEOUT2N"); | ||
| 109 | snd_soc_dapm_nc_pin(dapm, "LINEOUT2P"); | ||
| 110 | |||
| 111 | if (machine_is_aquila()) { | ||
| 112 | snd_soc_dapm_nc_pin(dapm, "SPKOUTRN"); | ||
| 113 | snd_soc_dapm_nc_pin(dapm, "SPKOUTRP"); | ||
| 114 | } | ||
| 115 | |||
| 116 | /* Headset jack detection */ | ||
| 117 | ret = snd_soc_jack_new(codec, "Headset Jack", | ||
| 118 | SND_JACK_HEADSET | SND_JACK_MECHANICAL | SND_JACK_AVOUT, | ||
| 119 | &jack); | ||
| 120 | if (ret) | ||
| 121 | return ret; | ||
| 122 | |||
| 123 | ret = snd_soc_jack_add_pins(&jack, ARRAY_SIZE(jack_pins), jack_pins); | ||
| 124 | if (ret) | ||
| 125 | return ret; | ||
| 126 | |||
| 127 | ret = snd_soc_jack_add_gpios(&jack, ARRAY_SIZE(jack_gpios), jack_gpios); | ||
| 128 | if (ret) | ||
| 129 | return ret; | ||
| 130 | |||
| 131 | return 0; | ||
| 132 | } | ||
| 133 | |||
| 134 | static int goni_hifi_hw_params(struct snd_pcm_substream *substream, | ||
| 135 | struct snd_pcm_hw_params *params) | ||
| 136 | { | ||
| 137 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
| 138 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | ||
| 139 | unsigned int pll_out = 24000000; | ||
| 140 | int ret = 0; | ||
| 141 | |||
| 142 | /* set the codec FLL */ | ||
| 143 | ret = snd_soc_dai_set_pll(codec_dai, WM8994_FLL1, 0, pll_out, | ||
| 144 | params_rate(params) * 256); | ||
| 145 | if (ret < 0) | ||
| 146 | return ret; | ||
| 147 | |||
| 148 | /* set the codec system clock */ | ||
| 149 | ret = snd_soc_dai_set_sysclk(codec_dai, WM8994_SYSCLK_FLL1, | ||
| 150 | params_rate(params) * 256, SND_SOC_CLOCK_IN); | ||
| 151 | if (ret < 0) | ||
| 152 | return ret; | ||
| 153 | |||
| 154 | return 0; | ||
| 155 | } | ||
| 156 | |||
| 157 | static struct snd_soc_ops goni_hifi_ops = { | ||
| 158 | .hw_params = goni_hifi_hw_params, | ||
| 159 | }; | ||
| 160 | |||
| 161 | static int goni_voice_hw_params(struct snd_pcm_substream *substream, | ||
| 162 | struct snd_pcm_hw_params *params) | ||
| 163 | { | ||
| 164 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
| 165 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | ||
| 166 | unsigned int pll_out = 24000000; | ||
| 167 | int ret = 0; | ||
| 168 | |||
| 169 | if (params_rate(params) != 8000) | ||
| 170 | return -EINVAL; | ||
| 171 | |||
| 172 | /* set the codec FLL */ | ||
| 173 | ret = snd_soc_dai_set_pll(codec_dai, WM8994_FLL2, 0, pll_out, | ||
| 174 | params_rate(params) * 256); | ||
| 175 | if (ret < 0) | ||
| 176 | return ret; | ||
| 177 | |||
| 178 | /* set the codec system clock */ | ||
| 179 | ret = snd_soc_dai_set_sysclk(codec_dai, WM8994_SYSCLK_FLL2, | ||
| 180 | params_rate(params) * 256, SND_SOC_CLOCK_IN); | ||
| 181 | if (ret < 0) | ||
| 182 | return ret; | ||
| 183 | |||
| 184 | return 0; | ||
| 185 | } | ||
| 186 | |||
| 187 | static struct snd_soc_dai_driver voice_dai = { | ||
| 188 | .name = "goni-voice-dai", | ||
| 189 | .id = 0, | ||
| 190 | .playback = { | ||
| 191 | .channels_min = 1, | ||
| 192 | .channels_max = 2, | ||
| 193 | .rates = SNDRV_PCM_RATE_8000, | ||
| 194 | .formats = SNDRV_PCM_FMTBIT_S16_LE,}, | ||
| 195 | .capture = { | ||
| 196 | .channels_min = 1, | ||
| 197 | .channels_max = 2, | ||
| 198 | .rates = SNDRV_PCM_RATE_8000, | ||
| 199 | .formats = SNDRV_PCM_FMTBIT_S16_LE,}, | ||
| 200 | }; | ||
| 201 | |||
| 202 | static const struct snd_soc_component_driver voice_component = { | ||
| 203 | .name = "goni-voice", | ||
| 204 | }; | ||
| 205 | |||
| 206 | static struct snd_soc_ops goni_voice_ops = { | ||
| 207 | .hw_params = goni_voice_hw_params, | ||
| 208 | }; | ||
| 209 | |||
| 210 | static struct snd_soc_dai_link goni_dai[] = { | ||
| 211 | { | ||
| 212 | .name = "WM8994", | ||
| 213 | .stream_name = "WM8994 HiFi", | ||
| 214 | .cpu_dai_name = "samsung-i2s.0", | ||
| 215 | .codec_dai_name = "wm8994-aif1", | ||
| 216 | .platform_name = "samsung-i2s.0", | ||
| 217 | .codec_name = "wm8994-codec.0-001a", | ||
| 218 | .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | | ||
| 219 | SND_SOC_DAIFMT_CBM_CFM, | ||
| 220 | .init = goni_wm8994_init, | ||
| 221 | .ops = &goni_hifi_ops, | ||
| 222 | }, { | ||
| 223 | .name = "WM8994 Voice", | ||
| 224 | .stream_name = "Voice", | ||
| 225 | .cpu_dai_name = "goni-voice-dai", | ||
| 226 | .codec_dai_name = "wm8994-aif2", | ||
| 227 | .codec_name = "wm8994-codec.0-001a", | ||
| 228 | .dai_fmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_IB_IF | | ||
| 229 | SND_SOC_DAIFMT_CBM_CFM, | ||
| 230 | .ops = &goni_voice_ops, | ||
| 231 | }, | ||
| 232 | }; | ||
| 233 | |||
| 234 | static struct snd_soc_card goni = { | ||
| 235 | .name = "goni", | ||
| 236 | .owner = THIS_MODULE, | ||
| 237 | .dai_link = goni_dai, | ||
| 238 | .num_links = ARRAY_SIZE(goni_dai), | ||
| 239 | |||
| 240 | .dapm_widgets = goni_dapm_widgets, | ||
| 241 | .num_dapm_widgets = ARRAY_SIZE(goni_dapm_widgets), | ||
| 242 | .dapm_routes = goni_dapm_routes, | ||
| 243 | .num_dapm_routes = ARRAY_SIZE(goni_dapm_routes), | ||
| 244 | }; | ||
| 245 | |||
| 246 | static int __init goni_init(void) | ||
| 247 | { | ||
| 248 | int ret; | ||
| 249 | |||
| 250 | if (machine_is_aquila()) { | ||
| 251 | voice_dai.name = aquila_str[CPU_VOICE_DAI]; | ||
| 252 | goni_dai[1].cpu_dai_name = aquila_str[CPU_VOICE_DAI]; | ||
| 253 | goni.name = aquila_str[MACHINE_NAME]; | ||
| 254 | } else if (!machine_is_goni()) | ||
| 255 | return -ENODEV; | ||
| 256 | |||
| 257 | goni_snd_device = platform_device_alloc("soc-audio", -1); | ||
| 258 | if (!goni_snd_device) | ||
| 259 | return -ENOMEM; | ||
| 260 | |||
| 261 | /* register voice DAI here */ | ||
| 262 | ret = devm_snd_soc_register_component(&goni_snd_device->dev, | ||
| 263 | &voice_component, &voice_dai, 1); | ||
| 264 | if (ret) { | ||
| 265 | platform_device_put(goni_snd_device); | ||
| 266 | return ret; | ||
| 267 | } | ||
| 268 | |||
| 269 | platform_set_drvdata(goni_snd_device, &goni); | ||
| 270 | ret = platform_device_add(goni_snd_device); | ||
| 271 | |||
| 272 | if (ret) | ||
| 273 | platform_device_put(goni_snd_device); | ||
| 274 | |||
| 275 | return ret; | ||
| 276 | } | ||
| 277 | |||
| 278 | static void __exit goni_exit(void) | ||
| 279 | { | ||
| 280 | platform_device_unregister(goni_snd_device); | ||
| 281 | } | ||
| 282 | |||
| 283 | module_init(goni_init); | ||
| 284 | module_exit(goni_exit); | ||
| 285 | |||
| 286 | /* Module information */ | ||
| 287 | MODULE_DESCRIPTION("ALSA SoC WM8994 GONI(S5PV210)"); | ||
| 288 | MODULE_AUTHOR("Chanwoo Choi <cw00.choi@samsung.com>"); | ||
| 289 | MODULE_LICENSE("GPL"); | ||
