2018-12-09 23:32:05 -05:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2018-06-29 03:14:37 -04:00
|
|
|
/* Copyright (c) 2011-2014, 2017-2019 The Linux Foundation. All rights reserved.
|
2017-07-20 09:01:55 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/platform_device.h>
|
|
|
|
#include <linux/of_device.h>
|
|
|
|
#include <sound/core.h>
|
|
|
|
#include <sound/soc.h>
|
|
|
|
#include <sound/pcm.h>
|
|
|
|
|
2018-09-04 04:11:58 -04:00
|
|
|
#define DRV_NAME "msm-pcm-hostless"
|
2017-07-20 09:01:55 -04:00
|
|
|
|
|
|
|
static int msm_pcm_hostless_prepare(struct snd_pcm_substream *substream)
|
|
|
|
{
|
|
|
|
if (!substream) {
|
|
|
|
pr_err("%s: invalid params\n", __func__);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
pm_qos_remove_request(&substream->latency_pm_qos_req);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct snd_pcm_ops msm_pcm_hostless_ops = {
|
|
|
|
.prepare = msm_pcm_hostless_prepare
|
|
|
|
};
|
|
|
|
|
2018-09-04 04:11:58 -04:00
|
|
|
static struct snd_soc_component_driver msm_soc_hostless_component = {
|
|
|
|
.name = DRV_NAME,
|
2017-07-20 09:01:55 -04:00
|
|
|
.ops = &msm_pcm_hostless_ops,
|
|
|
|
};
|
|
|
|
|
|
|
|
static int msm_pcm_hostless_probe(struct platform_device *pdev)
|
|
|
|
{
|
|
|
|
|
|
|
|
pr_debug("%s: dev name %s\n", __func__, dev_name(&pdev->dev));
|
2018-09-04 04:11:58 -04:00
|
|
|
return snd_soc_register_component(&pdev->dev,
|
|
|
|
&msm_soc_hostless_component,
|
|
|
|
NULL, 0);
|
2017-07-20 09:01:55 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static int msm_pcm_hostless_remove(struct platform_device *pdev)
|
|
|
|
{
|
2018-09-04 04:11:58 -04:00
|
|
|
snd_soc_unregister_component(&pdev->dev);
|
2017-07-20 09:01:55 -04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct of_device_id msm_pcm_hostless_dt_match[] = {
|
|
|
|
{.compatible = "qcom,msm-pcm-hostless"},
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_driver msm_pcm_hostless_driver = {
|
|
|
|
.driver = {
|
|
|
|
.name = "msm-pcm-hostless",
|
|
|
|
.owner = THIS_MODULE,
|
|
|
|
.of_match_table = msm_pcm_hostless_dt_match,
|
2018-06-29 03:14:37 -04:00
|
|
|
.suppress_bind_attrs = true,
|
2017-07-20 09:01:55 -04:00
|
|
|
},
|
|
|
|
.probe = msm_pcm_hostless_probe,
|
|
|
|
.remove = msm_pcm_hostless_remove,
|
|
|
|
};
|
|
|
|
|
2017-10-04 16:14:16 -04:00
|
|
|
int __init msm_pcm_hostless_init(void)
|
2017-07-20 09:01:55 -04:00
|
|
|
{
|
|
|
|
return platform_driver_register(&msm_pcm_hostless_driver);
|
|
|
|
}
|
|
|
|
|
2017-12-04 06:53:15 -05:00
|
|
|
void msm_pcm_hostless_exit(void)
|
2017-07-20 09:01:55 -04:00
|
|
|
{
|
|
|
|
platform_driver_unregister(&msm_pcm_hostless_driver);
|
|
|
|
}
|
|
|
|
|
|
|
|
MODULE_DESCRIPTION("Hostless platform driver");
|
|
|
|
MODULE_LICENSE("GPL v2");
|