blob: 63c5db85fe42c06913bed50e3a566dc928191284 [file] [log] [blame]
Meng Wang43bbb872018-12-10 12:32:05 +08001// SPDX-License-Identifier: GPL-2.0-only
Xiaojun Sang53cd13a2018-06-29 15:14:37 +08002/* Copyright (c) 2011-2014, 2017-2019 The Linux Foundation. All rights reserved.
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05303 */
4
5#include <linux/init.h>
6#include <linux/module.h>
7#include <linux/platform_device.h>
8#include <linux/of_device.h>
9#include <sound/core.h>
10#include <sound/soc.h>
11#include <sound/pcm.h>
12
Meng Wangee084a02018-09-04 16:11:58 +080013#define DRV_NAME "msm-pcm-hostless"
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053014
15static int msm_pcm_hostless_prepare(struct snd_pcm_substream *substream)
16{
17 if (!substream) {
18 pr_err("%s: invalid params\n", __func__);
19 return -EINVAL;
20 }
21 pm_qos_remove_request(&substream->latency_pm_qos_req);
22 return 0;
23}
24
25static const struct snd_pcm_ops msm_pcm_hostless_ops = {
26 .prepare = msm_pcm_hostless_prepare
27};
28
Meng Wangee084a02018-09-04 16:11:58 +080029static struct snd_soc_component_driver msm_soc_hostless_component = {
30 .name = DRV_NAME,
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053031 .ops = &msm_pcm_hostless_ops,
32};
33
34static int msm_pcm_hostless_probe(struct platform_device *pdev)
35{
36
37 pr_debug("%s: dev name %s\n", __func__, dev_name(&pdev->dev));
Meng Wangee084a02018-09-04 16:11:58 +080038 return snd_soc_register_component(&pdev->dev,
39 &msm_soc_hostless_component,
40 NULL, 0);
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053041}
42
43static int msm_pcm_hostless_remove(struct platform_device *pdev)
44{
Meng Wangee084a02018-09-04 16:11:58 +080045 snd_soc_unregister_component(&pdev->dev);
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053046 return 0;
47}
48
49static const struct of_device_id msm_pcm_hostless_dt_match[] = {
50 {.compatible = "qcom,msm-pcm-hostless"},
51 {}
52};
53
54static struct platform_driver msm_pcm_hostless_driver = {
55 .driver = {
56 .name = "msm-pcm-hostless",
57 .owner = THIS_MODULE,
58 .of_match_table = msm_pcm_hostless_dt_match,
Xiaojun Sang53cd13a2018-06-29 15:14:37 +080059 .suppress_bind_attrs = true,
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053060 },
61 .probe = msm_pcm_hostless_probe,
62 .remove = msm_pcm_hostless_remove,
63};
64
Laxminath Kasam8b1366a2017-10-05 01:44:16 +053065int __init msm_pcm_hostless_init(void)
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053066{
67 return platform_driver_register(&msm_pcm_hostless_driver);
68}
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053069
Asish Bhattacharya5faacb32017-12-04 17:23:15 +053070void msm_pcm_hostless_exit(void)
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053071{
72 platform_driver_unregister(&msm_pcm_hostless_driver);
73}
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053074
75MODULE_DESCRIPTION("Hostless platform driver");
76MODULE_LICENSE("GPL v2");