Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2010, Code Aurora Forum. All rights reserved. |
| 2 | * |
| 3 | * This software is licensed under the terms of the GNU General Public |
| 4 | * License version 2, as published by the Free Software Foundation, and |
| 5 | * may be copied, distributed, and modified under those terms. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 10 | * |
| 11 | * See the GNU General Public License for more details. |
| 12 | * You should have received a copy of the GNU General Public License |
| 13 | * along with this program; if not, you can find it at http://www.fsf.org. |
| 14 | */ |
| 15 | |
| 16 | #include <linux/init.h> |
| 17 | #include <linux/module.h> |
| 18 | #include <linux/device.h> |
| 19 | #include <linux/delay.h> |
| 20 | #include <linux/clk.h> |
| 21 | #include <linux/platform_device.h> |
| 22 | #include <sound/core.h> |
| 23 | #include <sound/pcm.h> |
| 24 | #include <sound/initval.h> |
| 25 | #include <sound/soc.h> |
| 26 | #include "msm_audio_mvs.h" |
| 27 | |
| 28 | static struct snd_soc_dai_driver msm_mvs_codec_dais[] = { |
| 29 | { |
| 30 | .name = "mvs-codec-dai", |
| 31 | .playback = { |
| 32 | .channels_max = 2, |
| 33 | .rates = (SNDRV_PCM_RATE_8000), |
| 34 | .rate_min = 8000, |
| 35 | .rate_max = 8000, |
| 36 | .formats = SNDRV_PCM_FMTBIT_S16_LE, |
| 37 | }, |
| 38 | .capture = { |
| 39 | .channels_max = 2, |
| 40 | .rates = (SNDRV_PCM_RATE_8000), |
| 41 | .rate_min = 8000, |
| 42 | .rate_max = 8000, |
| 43 | .formats = SNDRV_PCM_FMTBIT_S16_LE, |
| 44 | }, |
| 45 | }, |
| 46 | }; |
| 47 | static struct snd_soc_dai_driver msm_mvs_cpu_dais[] = { |
| 48 | { |
| 49 | .name = "mvs-cpu-dai", |
| 50 | .playback = { |
| 51 | .channels_max = 2, |
| 52 | .rates = (SNDRV_PCM_RATE_8000), |
| 53 | .rate_min = 8000, |
| 54 | .rate_max = 8000, |
| 55 | .formats = SNDRV_PCM_FMTBIT_S16_LE, |
| 56 | }, |
| 57 | .capture = { |
| 58 | .channels_max = 2, |
| 59 | .rates = (SNDRV_PCM_RATE_8000), |
| 60 | .rate_min = 8000, |
| 61 | .rate_max = 8000, |
| 62 | .formats = SNDRV_PCM_FMTBIT_S16_LE, |
| 63 | }, |
| 64 | }, |
| 65 | }; |
| 66 | |
| 67 | static struct snd_soc_codec_driver soc_codec_dev_msm = { |
| 68 | .compress_type = SND_SOC_FLAT_COMPRESSION, |
| 69 | }; |
| 70 | |
| 71 | static __devinit int asoc_mvs_codec_probe(struct platform_device *pdev) |
| 72 | { |
| 73 | dev_info(&pdev->dev, "%s: dev name %s\n", __func__, dev_name(&pdev->dev)); |
| 74 | return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_msm, |
| 75 | msm_mvs_codec_dais, ARRAY_SIZE(msm_mvs_codec_dais)); |
| 76 | } |
| 77 | |
| 78 | static int __devexit asoc_mvs_codec_remove(struct platform_device *pdev) |
| 79 | { |
| 80 | snd_soc_unregister_dai(&pdev->dev); |
| 81 | return 0; |
| 82 | } |
| 83 | |
| 84 | static __devinit int asoc_mvs_cpu_probe(struct platform_device *pdev) |
| 85 | { |
| 86 | dev_info(&pdev->dev, "%s: dev name %s\n", __func__, dev_name(&pdev->dev)); |
| 87 | return snd_soc_register_dai(&pdev->dev, msm_mvs_cpu_dais); |
| 88 | } |
| 89 | |
| 90 | static int __devexit asoc_mvs_cpu_remove(struct platform_device *pdev) |
| 91 | { |
| 92 | snd_soc_unregister_dai(&pdev->dev); |
| 93 | return 0; |
| 94 | } |
| 95 | |
| 96 | static struct platform_driver asoc_mvs_codec_driver = { |
| 97 | .probe = asoc_mvs_codec_probe, |
| 98 | .remove = __devexit_p(asoc_mvs_codec_remove), |
| 99 | .driver = { |
| 100 | .name = "mvs-codec-dai", |
| 101 | .owner = THIS_MODULE, |
| 102 | }, |
| 103 | }; |
| 104 | |
| 105 | static struct platform_driver asoc_mvs_cpu_driver = { |
| 106 | .probe = asoc_mvs_cpu_probe, |
| 107 | .remove = __devexit_p(asoc_mvs_cpu_remove), |
| 108 | .driver = { |
| 109 | .name = "mvs-cpu-dai", |
| 110 | .owner = THIS_MODULE, |
| 111 | }, |
| 112 | }; |
| 113 | |
| 114 | static int __init mvs_codec_dai_init(void) |
| 115 | { |
| 116 | return platform_driver_register(&asoc_mvs_codec_driver); |
| 117 | } |
| 118 | |
| 119 | static void __exit mvs_codec_dai_exit(void) |
| 120 | { |
| 121 | platform_driver_unregister(&asoc_mvs_codec_driver); |
| 122 | } |
| 123 | |
| 124 | static int __init mvs_cpu_dai_init(void) |
| 125 | { |
| 126 | return platform_driver_register(&asoc_mvs_cpu_driver); |
| 127 | } |
| 128 | |
| 129 | static void __exit mvs_cpu_dai_exit(void) |
| 130 | { |
| 131 | platform_driver_unregister(&asoc_mvs_cpu_driver); |
| 132 | } |
| 133 | |
| 134 | module_init(mvs_codec_dai_init); |
| 135 | module_exit(mvs_codec_dai_exit); |
| 136 | module_init(mvs_cpu_dai_init); |
| 137 | module_exit(mvs_cpu_dai_exit); |
| 138 | |
| 139 | /* Module information */ |
| 140 | MODULE_DESCRIPTION("MSM Codec/Cpu Dai driver"); |
| 141 | MODULE_LICENSE("GPL v2"); |