| OLD | NEW |
| 1 /* | 1 /* |
| 2 * linux/sound/soc/pxa/z2.c | 2 * linux/sound/soc/pxa/z2.c |
| 3 * | 3 * |
| 4 * SoC Audio driver for Aeronix Zipit Z2 | 4 * SoC Audio driver for Aeronix Zipit Z2 |
| 5 * | 5 * |
| 6 * Copyright (C) 2009 Ken McGuire <kenm@desertweyr.com> | 6 * Copyright (C) 2009 Ken McGuire <kenm@desertweyr.com> |
| 7 * Copyright (C) 2010 Marek Vasut <marek.vasut@gmail.com> | 7 * Copyright (C) 2010 Marek Vasut <marek.vasut@gmail.com> |
| 8 * | 8 * |
| 9 * This program is free software; you can redistribute it and/or modify | 9 * This program is free software; you can redistribute it and/or modify |
| 10 * it under the terms of the GNU General Public License version 2 as | 10 * it under the terms of the GNU General Public License version 2 as |
| 11 * published by the Free Software Foundation. | 11 * published by the Free Software Foundation. |
| 12 */ | 12 */ |
| 13 | 13 |
| 14 #include <linux/module.h> | 14 #include <linux/module.h> |
| 15 #include <linux/moduleparam.h> | 15 #include <linux/moduleparam.h> |
| 16 #include <linux/timer.h> | 16 #include <linux/timer.h> |
| 17 #include <linux/interrupt.h> | 17 #include <linux/interrupt.h> |
| 18 #include <linux/platform_device.h> | 18 #include <linux/platform_device.h> |
| 19 #include <linux/gpio.h> | 19 #include <linux/gpio.h> |
| 20 | 20 |
| 21 #include <sound/core.h> | 21 #include <sound/core.h> |
| 22 #include <sound/pcm.h> | 22 #include <sound/pcm.h> |
| 23 #include <sound/soc.h> | 23 #include <sound/soc.h> |
| 24 #include <sound/soc-dapm.h> | |
| 25 #include <sound/jack.h> | 24 #include <sound/jack.h> |
| 26 | 25 |
| 27 #include <asm/mach-types.h> | 26 #include <asm/mach-types.h> |
| 28 #include <mach/hardware.h> | 27 #include <mach/hardware.h> |
| 29 #include <mach/audio.h> | 28 #include <mach/audio.h> |
| 30 #include <mach/z2.h> | 29 #include <mach/z2.h> |
| 31 | 30 |
| 32 #include "../codecs/wm8750.h" | 31 #include "../codecs/wm8750.h" |
| 33 #include "pxa2xx-i2s.h" | 32 #include "pxa2xx-i2s.h" |
| 34 | 33 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 }, | 97 }, |
| 99 }; | 98 }; |
| 100 | 99 |
| 101 /* Headset jack detection gpios */ | 100 /* Headset jack detection gpios */ |
| 102 static struct snd_soc_jack_gpio hs_jack_gpios[] = { | 101 static struct snd_soc_jack_gpio hs_jack_gpios[] = { |
| 103 { | 102 { |
| 104 .gpio = GPIO37_ZIPITZ2_HEADSET_DETECT, | 103 .gpio = GPIO37_ZIPITZ2_HEADSET_DETECT, |
| 105 .name = "hsdet-gpio", | 104 .name = "hsdet-gpio", |
| 106 .report = SND_JACK_HEADSET, | 105 .report = SND_JACK_HEADSET, |
| 107 .debounce_time = 200, | 106 .debounce_time = 200, |
| 107 .invert = 1, |
| 108 }, | 108 }, |
| 109 }; | 109 }; |
| 110 | 110 |
| 111 /* z2 machine dapm widgets */ | 111 /* z2 machine dapm widgets */ |
| 112 static const struct snd_soc_dapm_widget wm8750_dapm_widgets[] = { | 112 static const struct snd_soc_dapm_widget wm8750_dapm_widgets[] = { |
| 113 SND_SOC_DAPM_HP("Headphone Jack", NULL), | 113 SND_SOC_DAPM_HP("Headphone Jack", NULL), |
| 114 SND_SOC_DAPM_MIC("Mic Jack", NULL), | 114 SND_SOC_DAPM_MIC("Mic Jack", NULL), |
| 115 SND_SOC_DAPM_SPK("Ext Spk", NULL), | 115 SND_SOC_DAPM_SPK("Ext Spk", NULL), |
| 116 | 116 |
| 117 /* headset is a mic and mono headphone */ | 117 /* headset is a mic and mono headphone */ |
| (...skipping 15 matching lines...) Expand all Loading... |
| 133 {"RINPUT2", NULL, "Mic Bias"}, | 133 {"RINPUT2", NULL, "Mic Bias"}, |
| 134 {"Mic Bias", NULL, "Mic Jack"}, | 134 {"Mic Bias", NULL, "Mic Jack"}, |
| 135 }; | 135 }; |
| 136 | 136 |
| 137 /* | 137 /* |
| 138 * Logic for a wm8750 as connected on a Z2 Device | 138 * Logic for a wm8750 as connected on a Z2 Device |
| 139 */ | 139 */ |
| 140 static int z2_wm8750_init(struct snd_soc_pcm_runtime *rtd) | 140 static int z2_wm8750_init(struct snd_soc_pcm_runtime *rtd) |
| 141 { | 141 { |
| 142 struct snd_soc_codec *codec = rtd->codec; | 142 struct snd_soc_codec *codec = rtd->codec; |
| 143 struct snd_soc_dapm_context *dapm = &codec->dapm; |
| 143 int ret; | 144 int ret; |
| 144 | 145 |
| 145 /* NC codec pins */ | 146 /* NC codec pins */ |
| 146 » snd_soc_dapm_disable_pin(codec, "LINPUT3"); | 147 » snd_soc_dapm_disable_pin(dapm, "LINPUT3"); |
| 147 » snd_soc_dapm_disable_pin(codec, "RINPUT3"); | 148 » snd_soc_dapm_disable_pin(dapm, "RINPUT3"); |
| 148 » snd_soc_dapm_disable_pin(codec, "OUT3"); | 149 » snd_soc_dapm_disable_pin(dapm, "OUT3"); |
| 149 » snd_soc_dapm_disable_pin(codec, "MONO"); | 150 » snd_soc_dapm_disable_pin(dapm, "MONO"); |
| 150 | 151 |
| 151 /* Add z2 specific widgets */ | 152 /* Add z2 specific widgets */ |
| 152 » snd_soc_dapm_new_controls(codec, wm8750_dapm_widgets, | 153 » snd_soc_dapm_new_controls(dapm, wm8750_dapm_widgets, |
| 153 ARRAY_SIZE(wm8750_dapm_widgets)); | 154 ARRAY_SIZE(wm8750_dapm_widgets)); |
| 154 | 155 |
| 155 /* Set up z2 specific audio paths */ | 156 /* Set up z2 specific audio paths */ |
| 156 » snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); | 157 » snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); |
| 157 | 158 |
| 158 » ret = snd_soc_dapm_sync(codec); | 159 » ret = snd_soc_dapm_sync(dapm); |
| 159 if (ret) | 160 if (ret) |
| 160 goto err; | 161 goto err; |
| 161 | 162 |
| 162 /* Jack detection API stuff */ | 163 /* Jack detection API stuff */ |
| 163 ret = snd_soc_jack_new(codec, "Headset Jack", SND_JACK_HEADSET, | 164 ret = snd_soc_jack_new(codec, "Headset Jack", SND_JACK_HEADSET, |
| 164 &hs_jack); | 165 &hs_jack); |
| 165 if (ret) | 166 if (ret) |
| 166 goto err; | 167 goto err; |
| 167 | 168 |
| 168 ret = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins), | 169 ret = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins), |
| (...skipping 16 matching lines...) Expand all Loading... |
| 185 .hw_params = z2_hw_params, | 186 .hw_params = z2_hw_params, |
| 186 }; | 187 }; |
| 187 | 188 |
| 188 /* z2 digital audio interface glue - connects codec <--> CPU */ | 189 /* z2 digital audio interface glue - connects codec <--> CPU */ |
| 189 static struct snd_soc_dai_link z2_dai = { | 190 static struct snd_soc_dai_link z2_dai = { |
| 190 .name = "wm8750", | 191 .name = "wm8750", |
| 191 .stream_name = "WM8750", | 192 .stream_name = "WM8750", |
| 192 .cpu_dai_name = "pxa2xx-i2s", | 193 .cpu_dai_name = "pxa2xx-i2s", |
| 193 .codec_dai_name = "wm8750-hifi", | 194 .codec_dai_name = "wm8750-hifi", |
| 194 .platform_name = "pxa-pcm-audio", | 195 .platform_name = "pxa-pcm-audio", |
| 195 » .codec_name» = "wm8750-codec.0-001a", | 196 » .codec_name» = "wm8750-codec.0-001b", |
| 196 .init = z2_wm8750_init, | 197 .init = z2_wm8750_init, |
| 197 .ops = &z2_ops, | 198 .ops = &z2_ops, |
| 198 }; | 199 }; |
| 199 | 200 |
| 200 /* z2 audio machine driver */ | 201 /* z2 audio machine driver */ |
| 201 static struct snd_soc_card snd_soc_z2 = { | 202 static struct snd_soc_card snd_soc_z2 = { |
| 202 .name = "Z2", | 203 .name = "Z2", |
| 203 .dai_link = &z2_dai, | 204 .dai_link = &z2_dai, |
| 204 .num_links = 1, | 205 .num_links = 1, |
| 205 }; | 206 }; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 231 platform_device_unregister(z2_snd_device); | 232 platform_device_unregister(z2_snd_device); |
| 232 } | 233 } |
| 233 | 234 |
| 234 module_init(z2_init); | 235 module_init(z2_init); |
| 235 module_exit(z2_exit); | 236 module_exit(z2_exit); |
| 236 | 237 |
| 237 MODULE_AUTHOR("Ken McGuire <kenm@desertweyr.com>, " | 238 MODULE_AUTHOR("Ken McGuire <kenm@desertweyr.com>, " |
| 238 "Marek Vasut <marek.vasut@gmail.com>"); | 239 "Marek Vasut <marek.vasut@gmail.com>"); |
| 239 MODULE_DESCRIPTION("ALSA SoC ZipitZ2"); | 240 MODULE_DESCRIPTION("ALSA SoC ZipitZ2"); |
| 240 MODULE_LICENSE("GPL"); | 241 MODULE_LICENSE("GPL"); |
| OLD | NEW |