blob: c9b23d069e041d9db3cfe230f92eb587f330210a [file] [log] [blame]
Phani Kumar Uppalapati87841c82012-06-14 21:28:43 -07001/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
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
13#include <linux/init.h>
14#include <linux/module.h>
15#include <linux/platform_device.h>
Phani Kumar Uppalapati87841c82012-06-14 21:28:43 -070016#include <linux/of_device.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070017#include <sound/core.h>
18#include <sound/soc.h>
19#include <sound/pcm.h>
20
21static struct snd_pcm_ops msm_pcm_hostless_ops = {};
22
23static struct snd_soc_platform_driver msm_soc_hostless_platform = {
24 .ops = &msm_pcm_hostless_ops,
25};
26
27static __devinit int msm_pcm_hostless_probe(struct platform_device *pdev)
28{
Phani Kumar Uppalapati87841c82012-06-14 21:28:43 -070029 if (pdev->dev.of_node)
30 dev_set_name(&pdev->dev, "%s", "msm-pcm-hostless");
31
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070032 pr_debug("%s: dev name %s\n", __func__, dev_name(&pdev->dev));
33 return snd_soc_register_platform(&pdev->dev,
34 &msm_soc_hostless_platform);
35}
36
37static int msm_pcm_hostless_remove(struct platform_device *pdev)
38{
39 snd_soc_unregister_platform(&pdev->dev);
40 return 0;
41}
42
Phani Kumar Uppalapati87841c82012-06-14 21:28:43 -070043static const struct of_device_id msm_pcm_hostless_dt_match[] = {
44 {.compatible = "qcom,msm-pcm-hostless"},
45 {}
46};
47
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070048static struct platform_driver msm_pcm_hostless_driver = {
49 .driver = {
50 .name = "msm-pcm-hostless",
51 .owner = THIS_MODULE,
Phani Kumar Uppalapati87841c82012-06-14 21:28:43 -070052 .of_match_table = msm_pcm_hostless_dt_match,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070053 },
54 .probe = msm_pcm_hostless_probe,
55 .remove = __devexit_p(msm_pcm_hostless_remove),
56};
57
58static int __init msm_soc_platform_init(void)
59{
60 return platform_driver_register(&msm_pcm_hostless_driver);
61}
62module_init(msm_soc_platform_init);
63
64static void __exit msm_soc_platform_exit(void)
65{
66 platform_driver_unregister(&msm_pcm_hostless_driver);
67}
68module_exit(msm_soc_platform_exit);
69
70MODULE_DESCRIPTION("Hostless platform driver");
71MODULE_LICENSE("GPL v2");