| OLD | NEW |
| 1 /* | 1 /* |
| 2 * ALSA SoC CQ0093 Voice Codec Driver for DaVinci platforms | 2 * ALSA SoC CQ0093 Voice Codec Driver for DaVinci platforms |
| 3 * | 3 * |
| 4 * Copyright (C) 2010 Texas Instruments, Inc | 4 * Copyright (C) 2010 Texas Instruments, Inc |
| 5 * | 5 * |
| 6 * Author: Miguel Aguilar <miguel.aguilar@ridgerun.com> | 6 * Author: Miguel Aguilar <miguel.aguilar@ridgerun.com> |
| 7 * | 7 * |
| 8 * This program is free software; you can redistribute it and/or modify | 8 * This program is free software; you can redistribute it and/or modify |
| 9 * it under the terms of the GNU General Public License as published by | 9 * it under the terms of the GNU General Public License as published by |
| 10 * the Free Software Foundation; either version 2 of the License, or | 10 * the Free Software Foundation; either version 2 of the License, or |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include <linux/device.h> | 29 #include <linux/device.h> |
| 30 #include <linux/slab.h> | 30 #include <linux/slab.h> |
| 31 #include <linux/clk.h> | 31 #include <linux/clk.h> |
| 32 #include <linux/mfd/davinci_voicecodec.h> | 32 #include <linux/mfd/davinci_voicecodec.h> |
| 33 #include <linux/spi/spi.h> | 33 #include <linux/spi/spi.h> |
| 34 | 34 |
| 35 #include <sound/core.h> | 35 #include <sound/core.h> |
| 36 #include <sound/pcm.h> | 36 #include <sound/pcm.h> |
| 37 #include <sound/pcm_params.h> | 37 #include <sound/pcm_params.h> |
| 38 #include <sound/soc.h> | 38 #include <sound/soc.h> |
| 39 #include <sound/soc-dai.h> | |
| 40 #include <sound/soc-dapm.h> | |
| 41 #include <sound/initval.h> | 39 #include <sound/initval.h> |
| 42 | 40 |
| 43 #include <mach/dm365.h> | 41 #include <mach/dm365.h> |
| 44 | 42 |
| 45 static inline unsigned int cq93vc_read(struct snd_soc_codec *codec, | 43 static inline unsigned int cq93vc_read(struct snd_soc_codec *codec, |
| 46 unsigned int reg) | 44 unsigned int reg) |
| 47 { | 45 { |
| 48 struct davinci_vc *davinci_vc = codec->control_data; | 46 struct davinci_vc *davinci_vc = codec->control_data; |
| 49 | 47 |
| 50 return readl(davinci_vc->base + reg); | 48 return readl(davinci_vc->base + reg); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 case SND_SOC_BIAS_STANDBY: | 107 case SND_SOC_BIAS_STANDBY: |
| 110 cq93vc_write(codec, DAVINCI_VC_REG12, | 108 cq93vc_write(codec, DAVINCI_VC_REG12, |
| 111 DAVINCI_VC_REG12_POWER_ALL_OFF); | 109 DAVINCI_VC_REG12_POWER_ALL_OFF); |
| 112 break; | 110 break; |
| 113 case SND_SOC_BIAS_OFF: | 111 case SND_SOC_BIAS_OFF: |
| 114 /* force all power off */ | 112 /* force all power off */ |
| 115 cq93vc_write(codec, DAVINCI_VC_REG12, | 113 cq93vc_write(codec, DAVINCI_VC_REG12, |
| 116 DAVINCI_VC_REG12_POWER_ALL_OFF); | 114 DAVINCI_VC_REG12_POWER_ALL_OFF); |
| 117 break; | 115 break; |
| 118 } | 116 } |
| 119 » codec->bias_level = level; | 117 » codec->dapm.bias_level = level; |
| 120 | 118 |
| 121 return 0; | 119 return 0; |
| 122 } | 120 } |
| 123 | 121 |
| 124 #define CQ93VC_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000) | 122 #define CQ93VC_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000) |
| 125 #define CQ93VC_FORMATS (SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE) | 123 #define CQ93VC_FORMATS (SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE) |
| 126 | 124 |
| 127 static struct snd_soc_dai_ops cq93vc_dai_ops = { | 125 static struct snd_soc_dai_ops cq93vc_dai_ops = { |
| 128 .digital_mute = cq93vc_mute, | 126 .digital_mute = cq93vc_mute, |
| 129 .set_sysclk = cq93vc_set_dai_sysclk, | 127 .set_sysclk = cq93vc_set_dai_sysclk, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 148 | 146 |
| 149 static int cq93vc_resume(struct snd_soc_codec *codec) | 147 static int cq93vc_resume(struct snd_soc_codec *codec) |
| 150 { | 148 { |
| 151 cq93vc_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 149 cq93vc_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
| 152 | 150 |
| 153 return 0; | 151 return 0; |
| 154 } | 152 } |
| 155 | 153 |
| 156 static int cq93vc_probe(struct snd_soc_codec *codec) | 154 static int cq93vc_probe(struct snd_soc_codec *codec) |
| 157 { | 155 { |
| 158 » struct davinci_vc *davinci_vc = codec->dev->platform_data; | 156 » struct davinci_vc *davinci_vc = snd_soc_codec_get_drvdata(codec); |
| 159 | 157 |
| 160 davinci_vc->cq93vc.codec = codec; | 158 davinci_vc->cq93vc.codec = codec; |
| 161 codec->control_data = davinci_vc; | 159 codec->control_data = davinci_vc; |
| 162 | 160 |
| 163 /* Set controls */ | 161 /* Set controls */ |
| 164 snd_soc_add_controls(codec, cq93vc_snd_controls, | 162 snd_soc_add_controls(codec, cq93vc_snd_controls, |
| 165 ARRAY_SIZE(cq93vc_snd_controls)); | 163 ARRAY_SIZE(cq93vc_snd_controls)); |
| 166 | 164 |
| 167 /* Off, with power on */ | 165 /* Off, with power on */ |
| 168 cq93vc_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | 166 cq93vc_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 214 |
| 217 static void __exit cq93vc_exit(void) | 215 static void __exit cq93vc_exit(void) |
| 218 { | 216 { |
| 219 platform_driver_unregister(&cq93vc_codec_driver); | 217 platform_driver_unregister(&cq93vc_codec_driver); |
| 220 } | 218 } |
| 221 module_exit(cq93vc_exit); | 219 module_exit(cq93vc_exit); |
| 222 | 220 |
| 223 MODULE_DESCRIPTION("Texas Instruments DaVinci ASoC CQ0093 Voice Codec Driver"); | 221 MODULE_DESCRIPTION("Texas Instruments DaVinci ASoC CQ0093 Voice Codec Driver"); |
| 224 MODULE_AUTHOR("Miguel Aguilar"); | 222 MODULE_AUTHOR("Miguel Aguilar"); |
| 225 MODULE_LICENSE("GPL"); | 223 MODULE_LICENSE("GPL"); |
| OLD | NEW |