Linux Audio

Check our new training course

Loading...
v6.8
 1// SPDX-License-Identifier: GPL-2.0
 2// Copyright (C) 2013,2019 Intel Corporation
 3
 4#include <linux/acpi.h>
 5#include <linux/acpi_dma.h>
 6
 7#include "internal.h"
 8
 9static bool dw_dma_acpi_filter(struct dma_chan *chan, void *param)
10{
 
 
11	struct acpi_dma_spec *dma_spec = param;
12	struct dw_dma_slave slave = {
13		.dma_dev = dma_spec->dev,
14		.src_id = dma_spec->slave_id,
15		.dst_id = dma_spec->slave_id,
16		.m_master = 0,
17		.p_master = 1,
18	};
19
20	return dw_dma_filter(chan, &slave);
21}
22
23void dw_dma_acpi_controller_register(struct dw_dma *dw)
24{
25	struct device *dev = dw->dma.dev;
26	struct acpi_dma_filter_info *info;
27	int ret;
28
29	if (!has_acpi_companion(dev))
30		return;
31
32	info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL);
33	if (!info)
34		return;
35
36	dma_cap_zero(info->dma_cap);
37	dma_cap_set(DMA_SLAVE, info->dma_cap);
38	info->filter_fn = dw_dma_acpi_filter;
39
40	ret = acpi_dma_controller_register(dev, acpi_dma_simple_xlate, info);
41	if (ret)
42		dev_err(dev, "could not register acpi_dma_controller\n");
43}
44EXPORT_SYMBOL_GPL(dw_dma_acpi_controller_register);
45
46void dw_dma_acpi_controller_free(struct dw_dma *dw)
47{
48	struct device *dev = dw->dma.dev;
49
50	if (!has_acpi_companion(dev))
51		return;
52
53	acpi_dma_controller_free(dev);
54}
55EXPORT_SYMBOL_GPL(dw_dma_acpi_controller_free);
v6.13.7
 1// SPDX-License-Identifier: GPL-2.0
 2// Copyright (C) 2013,2019 Intel Corporation
 3
 4#include <linux/acpi.h>
 5#include <linux/acpi_dma.h>
 6
 7#include "internal.h"
 8
 9static bool dw_dma_acpi_filter(struct dma_chan *chan, void *param)
10{
11	struct dw_dma *dw = to_dw_dma(chan->device);
12	struct dw_dma_chip_pdata *data = dev_get_drvdata(dw->dma.dev);
13	struct acpi_dma_spec *dma_spec = param;
14	struct dw_dma_slave slave = {
15		.dma_dev = dma_spec->dev,
16		.src_id = dma_spec->slave_id,
17		.dst_id = dma_spec->slave_id,
18		.m_master = data->m_master,
19		.p_master = data->p_master,
20	};
21
22	return dw_dma_filter(chan, &slave);
23}
24
25void dw_dma_acpi_controller_register(struct dw_dma *dw)
26{
27	struct device *dev = dw->dma.dev;
28	struct acpi_dma_filter_info *info;
29	int ret;
30
31	if (!has_acpi_companion(dev))
32		return;
33
34	info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL);
35	if (!info)
36		return;
37
38	dma_cap_zero(info->dma_cap);
39	dma_cap_set(DMA_SLAVE, info->dma_cap);
40	info->filter_fn = dw_dma_acpi_filter;
41
42	ret = acpi_dma_controller_register(dev, acpi_dma_simple_xlate, info);
43	if (ret)
44		dev_err(dev, "could not register acpi_dma_controller\n");
45}
46EXPORT_SYMBOL_GPL(dw_dma_acpi_controller_register);
47
48void dw_dma_acpi_controller_free(struct dw_dma *dw)
49{
50	struct device *dev = dw->dma.dev;
51
52	if (!has_acpi_companion(dev))
53		return;
54
55	acpi_dma_controller_free(dev);
56}
57EXPORT_SYMBOL_GPL(dw_dma_acpi_controller_free);