Asish Bhattacharya | 8e2277f | 2017-07-20 18:31:55 +0530 | [diff] [blame] | 1 | /* Copyright (c) 2011-2014, 2017 The Linux Foundation. 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 | |
| 13 | #include <linux/init.h> |
| 14 | #include <linux/module.h> |
| 15 | #include <linux/platform_device.h> |
| 16 | #include <linux/of_device.h> |
| 17 | #include <sound/core.h> |
| 18 | #include <sound/soc.h> |
| 19 | #include <sound/pcm.h> |
| 20 | |
| 21 | |
| 22 | static int msm_pcm_hostless_prepare(struct snd_pcm_substream *substream) |
| 23 | { |
| 24 | if (!substream) { |
| 25 | pr_err("%s: invalid params\n", __func__); |
| 26 | return -EINVAL; |
| 27 | } |
| 28 | pm_qos_remove_request(&substream->latency_pm_qos_req); |
| 29 | return 0; |
| 30 | } |
| 31 | |
| 32 | static const struct snd_pcm_ops msm_pcm_hostless_ops = { |
| 33 | .prepare = msm_pcm_hostless_prepare |
| 34 | }; |
| 35 | |
| 36 | static struct snd_soc_platform_driver msm_soc_hostless_platform = { |
| 37 | .ops = &msm_pcm_hostless_ops, |
| 38 | }; |
| 39 | |
| 40 | static int msm_pcm_hostless_probe(struct platform_device *pdev) |
| 41 | { |
| 42 | |
| 43 | pr_debug("%s: dev name %s\n", __func__, dev_name(&pdev->dev)); |
| 44 | return snd_soc_register_platform(&pdev->dev, |
| 45 | &msm_soc_hostless_platform); |
| 46 | } |
| 47 | |
| 48 | static int msm_pcm_hostless_remove(struct platform_device *pdev) |
| 49 | { |
| 50 | snd_soc_unregister_platform(&pdev->dev); |
| 51 | return 0; |
| 52 | } |
| 53 | |
| 54 | static const struct of_device_id msm_pcm_hostless_dt_match[] = { |
| 55 | {.compatible = "qcom,msm-pcm-hostless"}, |
| 56 | {} |
| 57 | }; |
| 58 | |
| 59 | static struct platform_driver msm_pcm_hostless_driver = { |
| 60 | .driver = { |
| 61 | .name = "msm-pcm-hostless", |
| 62 | .owner = THIS_MODULE, |
| 63 | .of_match_table = msm_pcm_hostless_dt_match, |
| 64 | }, |
| 65 | .probe = msm_pcm_hostless_probe, |
| 66 | .remove = msm_pcm_hostless_remove, |
| 67 | }; |
| 68 | |
Laxminath Kasam | 8b1366a | 2017-10-05 01:44:16 +0530 | [diff] [blame] | 69 | int __init msm_pcm_hostless_init(void) |
Asish Bhattacharya | 8e2277f | 2017-07-20 18:31:55 +0530 | [diff] [blame] | 70 | { |
| 71 | return platform_driver_register(&msm_pcm_hostless_driver); |
| 72 | } |
Asish Bhattacharya | 8e2277f | 2017-07-20 18:31:55 +0530 | [diff] [blame] | 73 | |
Asish Bhattacharya | 5faacb3 | 2017-12-04 17:23:15 +0530 | [diff] [blame] | 74 | void msm_pcm_hostless_exit(void) |
Asish Bhattacharya | 8e2277f | 2017-07-20 18:31:55 +0530 | [diff] [blame] | 75 | { |
| 76 | platform_driver_unregister(&msm_pcm_hostless_driver); |
| 77 | } |
Asish Bhattacharya | 8e2277f | 2017-07-20 18:31:55 +0530 | [diff] [blame] | 78 | |
| 79 | MODULE_DESCRIPTION("Hostless platform driver"); |
| 80 | MODULE_LICENSE("GPL v2"); |