blob: e2850a421d671e0b0713b4e6579aba62a74e8318 [file] [log] [blame]
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05301/* 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
22static 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
32static const struct snd_pcm_ops msm_pcm_hostless_ops = {
33 .prepare = msm_pcm_hostless_prepare
34};
35
36static struct snd_soc_platform_driver msm_soc_hostless_platform = {
37 .ops = &msm_pcm_hostless_ops,
38};
39
40static 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
48static int msm_pcm_hostless_remove(struct platform_device *pdev)
49{
50 snd_soc_unregister_platform(&pdev->dev);
51 return 0;
52}
53
54static const struct of_device_id msm_pcm_hostless_dt_match[] = {
55 {.compatible = "qcom,msm-pcm-hostless"},
56 {}
57};
58
59static 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 Kasam8b1366a2017-10-05 01:44:16 +053069int __init msm_pcm_hostless_init(void)
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053070{
71 return platform_driver_register(&msm_pcm_hostless_driver);
72}
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053073
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053074void msm_pcm_hostless_exit(void)
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053075{
76 platform_driver_unregister(&msm_pcm_hostless_driver);
77}
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053078
79MODULE_DESCRIPTION("Hostless platform driver");
80MODULE_LICENSE("GPL v2");