| OLD | NEW |
| 1 /* | 1 /* |
| 2 * omap3pandora.c -- SoC audio for Pandora Handheld Console | 2 * omap3pandora.c -- SoC audio for Pandora Handheld Console |
| 3 * | 3 * |
| 4 * Author: Gražvydas Ignotas <notasas@gmail.com> | 4 * Author: Gražvydas Ignotas <notasas@gmail.com> |
| 5 * | 5 * |
| 6 * This program is free software; you can redistribute it and/or | 6 * This program is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU General Public License | 7 * modify it under the terms of the GNU General Public License |
| 8 * version 2 as published by the Free Software Foundation. | 8 * version 2 as published by the Free Software Foundation. |
| 9 * | 9 * |
| 10 * This program is distributed in the hope that it will be useful, but | 10 * This program is distributed in the hope that it will be useful, but |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 #include <linux/clk.h> | 22 #include <linux/clk.h> |
| 23 #include <linux/platform_device.h> | 23 #include <linux/platform_device.h> |
| 24 #include <linux/gpio.h> | 24 #include <linux/gpio.h> |
| 25 #include <linux/delay.h> | 25 #include <linux/delay.h> |
| 26 #include <linux/regulator/consumer.h> | 26 #include <linux/regulator/consumer.h> |
| 27 | 27 |
| 28 #include <sound/core.h> | 28 #include <sound/core.h> |
| 29 #include <sound/pcm.h> | 29 #include <sound/pcm.h> |
| 30 #include <sound/soc.h> | 30 #include <sound/soc.h> |
| 31 #include <sound/soc-dapm.h> | |
| 32 | 31 |
| 33 #include <asm/mach-types.h> | 32 #include <asm/mach-types.h> |
| 34 #include <plat/mcbsp.h> | 33 #include <plat/mcbsp.h> |
| 35 | 34 |
| 36 #include "omap-mcbsp.h" | 35 #include "omap-mcbsp.h" |
| 37 #include "omap-pcm.h" | 36 #include "omap-pcm.h" |
| 38 | 37 |
| 39 #define OMAP3_PANDORA_DAC_POWER_GPIO 118 | 38 #define OMAP3_PANDORA_DAC_POWER_GPIO 118 |
| 40 #define OMAP3_PANDORA_AMP_POWER_GPIO 14 | 39 #define OMAP3_PANDORA_AMP_POWER_GPIO 14 |
| 41 | 40 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 {"MAINMIC", NULL, "Mic Bias 1"}, | 162 {"MAINMIC", NULL, "Mic Bias 1"}, |
| 164 {"Mic Bias 1", NULL, "Mic (internal)"}, | 163 {"Mic Bias 1", NULL, "Mic (internal)"}, |
| 165 | 164 |
| 166 {"SUBMIC", NULL, "Mic Bias 2"}, | 165 {"SUBMIC", NULL, "Mic Bias 2"}, |
| 167 {"Mic Bias 2", NULL, "Mic (external)"}, | 166 {"Mic Bias 2", NULL, "Mic (external)"}, |
| 168 }; | 167 }; |
| 169 | 168 |
| 170 static int omap3pandora_out_init(struct snd_soc_pcm_runtime *rtd) | 169 static int omap3pandora_out_init(struct snd_soc_pcm_runtime *rtd) |
| 171 { | 170 { |
| 172 struct snd_soc_codec *codec = rtd->codec; | 171 struct snd_soc_codec *codec = rtd->codec; |
| 172 struct snd_soc_dapm_context *dapm = &codec->dapm; |
| 173 int ret; | 173 int ret; |
| 174 | 174 |
| 175 /* All TWL4030 output pins are floating */ | 175 /* All TWL4030 output pins are floating */ |
| 176 » snd_soc_dapm_nc_pin(codec, "EARPIECE"); | 176 » snd_soc_dapm_nc_pin(dapm, "EARPIECE"); |
| 177 » snd_soc_dapm_nc_pin(codec, "PREDRIVEL"); | 177 » snd_soc_dapm_nc_pin(dapm, "PREDRIVEL"); |
| 178 » snd_soc_dapm_nc_pin(codec, "PREDRIVER"); | 178 » snd_soc_dapm_nc_pin(dapm, "PREDRIVER"); |
| 179 » snd_soc_dapm_nc_pin(codec, "HSOL"); | 179 » snd_soc_dapm_nc_pin(dapm, "HSOL"); |
| 180 » snd_soc_dapm_nc_pin(codec, "HSOR"); | 180 » snd_soc_dapm_nc_pin(dapm, "HSOR"); |
| 181 » snd_soc_dapm_nc_pin(codec, "CARKITL"); | 181 » snd_soc_dapm_nc_pin(dapm, "CARKITL"); |
| 182 » snd_soc_dapm_nc_pin(codec, "CARKITR"); | 182 » snd_soc_dapm_nc_pin(dapm, "CARKITR"); |
| 183 » snd_soc_dapm_nc_pin(codec, "HFL"); | 183 » snd_soc_dapm_nc_pin(dapm, "HFL"); |
| 184 » snd_soc_dapm_nc_pin(codec, "HFR"); | 184 » snd_soc_dapm_nc_pin(dapm, "HFR"); |
| 185 » snd_soc_dapm_nc_pin(codec, "VIBRA"); | 185 » snd_soc_dapm_nc_pin(dapm, "VIBRA"); |
| 186 | 186 |
| 187 » ret = snd_soc_dapm_new_controls(codec, omap3pandora_out_dapm_widgets, | 187 » ret = snd_soc_dapm_new_controls(dapm, omap3pandora_out_dapm_widgets, |
| 188 ARRAY_SIZE(omap3pandora_out_dapm_widgets)); | 188 ARRAY_SIZE(omap3pandora_out_dapm_widgets)); |
| 189 if (ret < 0) | 189 if (ret < 0) |
| 190 return ret; | 190 return ret; |
| 191 | 191 |
| 192 » snd_soc_dapm_add_routes(codec, omap3pandora_out_map, | 192 » snd_soc_dapm_add_routes(dapm, omap3pandora_out_map, |
| 193 ARRAY_SIZE(omap3pandora_out_map)); | 193 ARRAY_SIZE(omap3pandora_out_map)); |
| 194 | 194 |
| 195 » return snd_soc_dapm_sync(codec); | 195 » return snd_soc_dapm_sync(dapm); |
| 196 } | 196 } |
| 197 | 197 |
| 198 static int omap3pandora_in_init(struct snd_soc_pcm_runtime *rtd) | 198 static int omap3pandora_in_init(struct snd_soc_pcm_runtime *rtd) |
| 199 { | 199 { |
| 200 struct snd_soc_codec *codec = rtd->codec; | 200 struct snd_soc_codec *codec = rtd->codec; |
| 201 struct snd_soc_dapm_context *dapm = &codec->dapm; |
| 201 int ret; | 202 int ret; |
| 202 | 203 |
| 203 /* Not comnnected */ | 204 /* Not comnnected */ |
| 204 » snd_soc_dapm_nc_pin(codec, "HSMIC"); | 205 » snd_soc_dapm_nc_pin(dapm, "HSMIC"); |
| 205 » snd_soc_dapm_nc_pin(codec, "CARKITMIC"); | 206 » snd_soc_dapm_nc_pin(dapm, "CARKITMIC"); |
| 206 » snd_soc_dapm_nc_pin(codec, "DIGIMIC0"); | 207 » snd_soc_dapm_nc_pin(dapm, "DIGIMIC0"); |
| 207 » snd_soc_dapm_nc_pin(codec, "DIGIMIC1"); | 208 » snd_soc_dapm_nc_pin(dapm, "DIGIMIC1"); |
| 208 | 209 |
| 209 » ret = snd_soc_dapm_new_controls(codec, omap3pandora_in_dapm_widgets, | 210 » ret = snd_soc_dapm_new_controls(dapm, omap3pandora_in_dapm_widgets, |
| 210 ARRAY_SIZE(omap3pandora_in_dapm_widgets)); | 211 ARRAY_SIZE(omap3pandora_in_dapm_widgets)); |
| 211 if (ret < 0) | 212 if (ret < 0) |
| 212 return ret; | 213 return ret; |
| 213 | 214 |
| 214 » snd_soc_dapm_add_routes(codec, omap3pandora_in_map, | 215 » snd_soc_dapm_add_routes(dapm, omap3pandora_in_map, |
| 215 ARRAY_SIZE(omap3pandora_in_map)); | 216 ARRAY_SIZE(omap3pandora_in_map)); |
| 216 | 217 |
| 217 » return snd_soc_dapm_sync(codec); | 218 » return snd_soc_dapm_sync(dapm); |
| 218 } | 219 } |
| 219 | 220 |
| 220 static struct snd_soc_ops omap3pandora_ops = { | 221 static struct snd_soc_ops omap3pandora_ops = { |
| 221 .hw_params = omap3pandora_hw_params, | 222 .hw_params = omap3pandora_hw_params, |
| 222 }; | 223 }; |
| 223 | 224 |
| 224 /* Digital audio interface glue - connects codec <--> CPU */ | 225 /* Digital audio interface glue - connects codec <--> CPU */ |
| 225 static struct snd_soc_dai_link omap3pandora_dai[] = { | 226 static struct snd_soc_dai_link omap3pandora_dai[] = { |
| 226 { | 227 { |
| 227 .name = "PCM1773", | 228 .name = "PCM1773", |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 regulator_put(omap3pandora_dac_reg); | 330 regulator_put(omap3pandora_dac_reg); |
| 330 platform_device_unregister(omap3pandora_snd_device); | 331 platform_device_unregister(omap3pandora_snd_device); |
| 331 gpio_free(OMAP3_PANDORA_AMP_POWER_GPIO); | 332 gpio_free(OMAP3_PANDORA_AMP_POWER_GPIO); |
| 332 gpio_free(OMAP3_PANDORA_DAC_POWER_GPIO); | 333 gpio_free(OMAP3_PANDORA_DAC_POWER_GPIO); |
| 333 } | 334 } |
| 334 module_exit(omap3pandora_soc_exit); | 335 module_exit(omap3pandora_soc_exit); |
| 335 | 336 |
| 336 MODULE_AUTHOR("Grazvydas Ignotas <notasas@gmail.com>"); | 337 MODULE_AUTHOR("Grazvydas Ignotas <notasas@gmail.com>"); |
| 337 MODULE_DESCRIPTION("ALSA SoC OMAP3 Pandora"); | 338 MODULE_DESCRIPTION("ALSA SoC OMAP3 Pandora"); |
| 338 MODULE_LICENSE("GPL"); | 339 MODULE_LICENSE("GPL"); |
| OLD | NEW |