Phani Kumar Uppalapati | 87841c8 | 2012-06-14 21:28:43 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved. |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 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 | |
| 13 | #include <linux/init.h> |
| 14 | #include <linux/module.h> |
| 15 | #include <linux/platform_device.h> |
Phani Kumar Uppalapati | 87841c8 | 2012-06-14 21:28:43 -0700 | [diff] [blame] | 16 | #include <linux/of_device.h> |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 17 | #include <sound/core.h> |
| 18 | #include <sound/soc.h> |
| 19 | #include <sound/pcm.h> |
| 20 | |
| 21 | static struct snd_pcm_ops msm_pcm_hostless_ops = {}; |
| 22 | |
| 23 | static struct snd_soc_platform_driver msm_soc_hostless_platform = { |
| 24 | .ops = &msm_pcm_hostless_ops, |
| 25 | }; |
| 26 | |
| 27 | static __devinit int msm_pcm_hostless_probe(struct platform_device *pdev) |
| 28 | { |
Phani Kumar Uppalapati | 87841c8 | 2012-06-14 21:28:43 -0700 | [diff] [blame] | 29 | if (pdev->dev.of_node) |
| 30 | dev_set_name(&pdev->dev, "%s", "msm-pcm-hostless"); |
| 31 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 32 | 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 | |
| 37 | static int msm_pcm_hostless_remove(struct platform_device *pdev) |
| 38 | { |
| 39 | snd_soc_unregister_platform(&pdev->dev); |
| 40 | return 0; |
| 41 | } |
| 42 | |
Phani Kumar Uppalapati | 87841c8 | 2012-06-14 21:28:43 -0700 | [diff] [blame] | 43 | static const struct of_device_id msm_pcm_hostless_dt_match[] = { |
| 44 | {.compatible = "qcom,msm-pcm-hostless"}, |
| 45 | {} |
| 46 | }; |
| 47 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 48 | static struct platform_driver msm_pcm_hostless_driver = { |
| 49 | .driver = { |
| 50 | .name = "msm-pcm-hostless", |
| 51 | .owner = THIS_MODULE, |
Phani Kumar Uppalapati | 87841c8 | 2012-06-14 21:28:43 -0700 | [diff] [blame] | 52 | .of_match_table = msm_pcm_hostless_dt_match, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 53 | }, |
| 54 | .probe = msm_pcm_hostless_probe, |
| 55 | .remove = __devexit_p(msm_pcm_hostless_remove), |
| 56 | }; |
| 57 | |
| 58 | static int __init msm_soc_platform_init(void) |
| 59 | { |
| 60 | return platform_driver_register(&msm_pcm_hostless_driver); |
| 61 | } |
| 62 | module_init(msm_soc_platform_init); |
| 63 | |
| 64 | static void __exit msm_soc_platform_exit(void) |
| 65 | { |
| 66 | platform_driver_unregister(&msm_pcm_hostless_driver); |
| 67 | } |
| 68 | module_exit(msm_soc_platform_exit); |
| 69 | |
| 70 | MODULE_DESCRIPTION("Hostless platform driver"); |
| 71 | MODULE_LICENSE("GPL v2"); |