Neema Shetty | 8427c26 | 2012-02-16 11:23:43 -0800 | [diff] [blame^] | 1 | /* Copyright (c) 2012, Code Aurora Forum. All rights reserved. |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 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. See the |
| 10 | * GNU General Public License for more details. |
| 11 | */ |
| 12 | #include <linux/init.h> |
| 13 | #include <linux/module.h> |
| 14 | #include <linux/device.h> |
| 15 | #include <linux/platform_device.h> |
| 16 | #include <sound/core.h> |
| 17 | #include <sound/pcm.h> |
| 18 | #include <sound/soc.h> |
| 19 | |
| 20 | static int msm_dai_stub_set_channel_map(struct snd_soc_dai *dai, |
| 21 | unsigned int tx_num, unsigned int *tx_slot, |
| 22 | unsigned int rx_num, unsigned int *rx_slot) |
| 23 | { |
| 24 | pr_debug("%s:\n", __func__); |
| 25 | |
| 26 | return 0; |
| 27 | } |
| 28 | |
| 29 | static struct snd_soc_dai_ops msm_dai_stub_ops = { |
| 30 | .set_channel_map = msm_dai_stub_set_channel_map, |
| 31 | }; |
| 32 | |
| 33 | static struct snd_soc_dai_driver msm_dai_stub_dai = { |
| 34 | .playback = { |
| 35 | .rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 | |
| 36 | SNDRV_PCM_RATE_16000, |
| 37 | .formats = SNDRV_PCM_FMTBIT_S16_LE, |
| 38 | .channels_min = 1, |
| 39 | .channels_max = 2, |
| 40 | .rate_min = 8000, |
| 41 | .rate_max = 48000, |
| 42 | }, |
| 43 | .capture = { |
| 44 | .rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 | |
| 45 | SNDRV_PCM_RATE_16000, |
| 46 | .formats = SNDRV_PCM_FMTBIT_S16_LE, |
| 47 | .channels_min = 1, |
| 48 | .channels_max = 2, |
| 49 | .rate_min = 8000, |
| 50 | .rate_max = 48000, |
| 51 | }, |
| 52 | .ops = &msm_dai_stub_ops, |
| 53 | }; |
| 54 | |
| 55 | static __devinit int msm_dai_stub_dev_probe(struct platform_device *pdev) |
| 56 | { |
| 57 | int rc = 0; |
| 58 | |
| 59 | dev_dbg(&pdev->dev, "dev name %s\n", dev_name(&pdev->dev)); |
| 60 | |
| 61 | rc = snd_soc_register_dai(&pdev->dev, &msm_dai_stub_dai); |
| 62 | |
| 63 | return rc; |
| 64 | } |
| 65 | |
| 66 | static __devexit int msm_dai_stub_dev_remove(struct platform_device *pdev) |
| 67 | { |
| 68 | pr_debug("%s:\n", __func__); |
| 69 | |
| 70 | snd_soc_unregister_dai(&pdev->dev); |
| 71 | |
| 72 | return 0; |
| 73 | } |
| 74 | |
| 75 | static struct platform_driver msm_dai_stub_driver = { |
| 76 | .probe = msm_dai_stub_dev_probe, |
| 77 | .remove = msm_dai_stub_dev_remove, |
| 78 | .driver = { |
| 79 | .name = "msm-dai-stub", |
| 80 | .owner = THIS_MODULE, |
| 81 | }, |
| 82 | }; |
| 83 | |
| 84 | static int __init msm_dai_stub_init(void) |
| 85 | { |
| 86 | pr_debug("%s:\n", __func__); |
| 87 | |
| 88 | return platform_driver_register(&msm_dai_stub_driver); |
| 89 | } |
| 90 | module_init(msm_dai_stub_init); |
| 91 | |
| 92 | static void __exit msm_dai_stub_exit(void) |
| 93 | { |
| 94 | pr_debug("%s:\n", __func__); |
| 95 | |
| 96 | platform_driver_unregister(&msm_dai_stub_driver); |
| 97 | } |
| 98 | module_exit(msm_dai_stub_exit); |
| 99 | |
| 100 | /* Module information */ |
| 101 | MODULE_DESCRIPTION("MSM Stub DSP DAI driver"); |
| 102 | MODULE_LICENSE("GPL v2"); |