| OLD | NEW |
| 1 /* | 1 /* |
| 2 * sam9g20_wm8731 -- SoC audio for AT91SAM9G20-based | 2 * sam9g20_wm8731 -- SoC audio for AT91SAM9G20-based |
| 3 * ATMEL AT91SAM9G20ek board. | 3 * ATMEL AT91SAM9G20ek board. |
| 4 * | 4 * |
| 5 * Copyright (C) 2005 SAN People | 5 * Copyright (C) 2005 SAN People |
| 6 * Copyright (C) 2008 Atmel | 6 * Copyright (C) 2008 Atmel |
| 7 * | 7 * |
| 8 * Authors: Sedji Gaouaou <sedji.gaouaou@atmel.com> | 8 * Authors: Sedji Gaouaou <sedji.gaouaou@atmel.com> |
| 9 * | 9 * |
| 10 * Based on ati_b1_wm8731.c by: | 10 * Based on ati_b1_wm8731.c by: |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #include <linux/interrupt.h> | 37 #include <linux/interrupt.h> |
| 38 #include <linux/platform_device.h> | 38 #include <linux/platform_device.h> |
| 39 #include <linux/i2c.h> | 39 #include <linux/i2c.h> |
| 40 | 40 |
| 41 #include <linux/atmel-ssc.h> | 41 #include <linux/atmel-ssc.h> |
| 42 | 42 |
| 43 #include <sound/core.h> | 43 #include <sound/core.h> |
| 44 #include <sound/pcm.h> | 44 #include <sound/pcm.h> |
| 45 #include <sound/pcm_params.h> | 45 #include <sound/pcm_params.h> |
| 46 #include <sound/soc.h> | 46 #include <sound/soc.h> |
| 47 #include <sound/soc-dapm.h> | |
| 48 | 47 |
| 49 #include <asm/mach-types.h> | 48 #include <asm/mach-types.h> |
| 50 #include <mach/hardware.h> | 49 #include <mach/hardware.h> |
| 51 #include <mach/gpio.h> | 50 #include <mach/gpio.h> |
| 52 | 51 |
| 53 #include "../codecs/wm8731.h" | 52 #include "../codecs/wm8731.h" |
| 54 #include "atmel-pcm.h" | 53 #include "atmel-pcm.h" |
| 55 #include "atmel_ssc_dai.h" | 54 #include "atmel_ssc_dai.h" |
| 56 | 55 |
| 57 #define MCLK_RATE 12000000 | 56 #define MCLK_RATE 12000000 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 {"Mic Bias", NULL, "Int Mic"}, | 132 {"Mic Bias", NULL, "Int Mic"}, |
| 134 }; | 133 }; |
| 135 | 134 |
| 136 /* | 135 /* |
| 137 * Logic for a wm8731 as connected on a at91sam9g20ek board. | 136 * Logic for a wm8731 as connected on a at91sam9g20ek board. |
| 138 */ | 137 */ |
| 139 static int at91sam9g20ek_wm8731_init(struct snd_soc_pcm_runtime *rtd) | 138 static int at91sam9g20ek_wm8731_init(struct snd_soc_pcm_runtime *rtd) |
| 140 { | 139 { |
| 141 struct snd_soc_codec *codec = rtd->codec; | 140 struct snd_soc_codec *codec = rtd->codec; |
| 142 struct snd_soc_dai *codec_dai = rtd->codec_dai; | 141 struct snd_soc_dai *codec_dai = rtd->codec_dai; |
| 142 struct snd_soc_dapm_context *dapm = &codec->dapm; |
| 143 int ret; | 143 int ret; |
| 144 | 144 |
| 145 printk(KERN_DEBUG | 145 printk(KERN_DEBUG |
| 146 "at91sam9g20ek_wm8731 " | 146 "at91sam9g20ek_wm8731 " |
| 147 ": at91sam9g20ek_wm8731_init() called\n"); | 147 ": at91sam9g20ek_wm8731_init() called\n"); |
| 148 | 148 |
| 149 ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_XTAL, | 149 ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_XTAL, |
| 150 MCLK_RATE, SND_SOC_CLOCK_IN); | 150 MCLK_RATE, SND_SOC_CLOCK_IN); |
| 151 if (ret < 0) { | 151 if (ret < 0) { |
| 152 printk(KERN_ERR "Failed to set WM8731 SYSCLK: %d\n", ret); | 152 printk(KERN_ERR "Failed to set WM8731 SYSCLK: %d\n", ret); |
| 153 return ret; | 153 return ret; |
| 154 } | 154 } |
| 155 | 155 |
| 156 /* Add specific widgets */ | 156 /* Add specific widgets */ |
| 157 » snd_soc_dapm_new_controls(codec, at91sam9g20ek_dapm_widgets, | 157 » snd_soc_dapm_new_controls(dapm, at91sam9g20ek_dapm_widgets, |
| 158 ARRAY_SIZE(at91sam9g20ek_dapm_widgets)); | 158 ARRAY_SIZE(at91sam9g20ek_dapm_widgets)); |
| 159 /* Set up specific audio path interconnects */ | 159 /* Set up specific audio path interconnects */ |
| 160 » snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); | 160 » snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon)); |
| 161 | 161 |
| 162 /* not connected */ | 162 /* not connected */ |
| 163 » snd_soc_dapm_nc_pin(codec, "RLINEIN"); | 163 » snd_soc_dapm_nc_pin(dapm, "RLINEIN"); |
| 164 » snd_soc_dapm_nc_pin(codec, "LLINEIN"); | 164 » snd_soc_dapm_nc_pin(dapm, "LLINEIN"); |
| 165 | 165 |
| 166 #ifdef ENABLE_MIC_INPUT | 166 #ifdef ENABLE_MIC_INPUT |
| 167 » snd_soc_dapm_enable_pin(codec, "Int Mic"); | 167 » snd_soc_dapm_enable_pin(dapm, "Int Mic"); |
| 168 #else | 168 #else |
| 169 » snd_soc_dapm_nc_pin(codec, "Int Mic"); | 169 » snd_soc_dapm_nc_pin(dapm, "Int Mic"); |
| 170 #endif | 170 #endif |
| 171 | 171 |
| 172 /* always connected */ | 172 /* always connected */ |
| 173 » snd_soc_dapm_enable_pin(codec, "Ext Spk"); | 173 » snd_soc_dapm_enable_pin(dapm, "Ext Spk"); |
| 174 | 174 |
| 175 » snd_soc_dapm_sync(codec); | 175 » snd_soc_dapm_sync(dapm); |
| 176 | 176 |
| 177 return 0; | 177 return 0; |
| 178 } | 178 } |
| 179 | 179 |
| 180 static struct snd_soc_dai_link at91sam9g20ek_dai = { | 180 static struct snd_soc_dai_link at91sam9g20ek_dai = { |
| 181 .name = "WM8731", | 181 .name = "WM8731", |
| 182 .stream_name = "WM8731 PCM", | 182 .stream_name = "WM8731 PCM", |
| 183 .cpu_dai_name = "atmel-ssc-dai.0", | 183 .cpu_dai_name = "atmel-ssc-dai.0", |
| 184 .codec_dai_name = "wm8731-hifi", | 184 .codec_dai_name = "wm8731-hifi", |
| 185 .init = at91sam9g20ek_wm8731_init, | 185 .init = at91sam9g20ek_wm8731_init, |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 mclk = NULL; | 271 mclk = NULL; |
| 272 } | 272 } |
| 273 | 273 |
| 274 module_init(at91sam9g20ek_init); | 274 module_init(at91sam9g20ek_init); |
| 275 module_exit(at91sam9g20ek_exit); | 275 module_exit(at91sam9g20ek_exit); |
| 276 | 276 |
| 277 /* Module information */ | 277 /* Module information */ |
| 278 MODULE_AUTHOR("Sedji Gaouaou <sedji.gaouaou@atmel.com>"); | 278 MODULE_AUTHOR("Sedji Gaouaou <sedji.gaouaou@atmel.com>"); |
| 279 MODULE_DESCRIPTION("ALSA SoC AT91SAM9G20EK_WM8731"); | 279 MODULE_DESCRIPTION("ALSA SoC AT91SAM9G20EK_WM8731"); |
| 280 MODULE_LICENSE("GPL"); | 280 MODULE_LICENSE("GPL"); |
| OLD | NEW |