2 * ACPI helpers for DMA request / controller
6 * Copyright (C) 2013, Intel Corporation
7 * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
14 #ifndef __LINUX_ACPI_DMA_H
15 #define __LINUX_ACPI_DMA_H
17 #include <linux/list.h>
18 #include <linux/device.h>
19 #include <linux/dmaengine.h>
22 * struct acpi_dma_spec - slave device DMA resources
23 * @chan_id: channel unique id
24 * @slave_id: request line unique id
25 * @dev: struct device of the DMA controller to be used in the filter
28 struct acpi_dma_spec
{
35 * struct acpi_dma - representation of the registered DMAC
36 * @dma_controllers: linked list node
37 * @dev: struct device of this controller
38 * @acpi_dma_xlate: callback function to find a suitable channel
39 * @data: private data used by a callback function
42 struct list_head dma_controllers
;
44 struct dma_chan
*(*acpi_dma_xlate
)
45 (struct acpi_dma_spec
*, struct acpi_dma
*);
49 /* Used with acpi_dma_simple_xlate() */
50 struct acpi_dma_filter_info
{
51 dma_cap_mask_t dma_cap
;
52 dma_filter_fn filter_fn
;
55 #ifdef CONFIG_DMA_ACPI
57 int acpi_dma_controller_register(struct device
*dev
,
58 struct dma_chan
*(*acpi_dma_xlate
)
59 (struct acpi_dma_spec
*, struct acpi_dma
*),
61 int acpi_dma_controller_free(struct device
*dev
);
62 int devm_acpi_dma_controller_register(struct device
*dev
,
63 struct dma_chan
*(*acpi_dma_xlate
)
64 (struct acpi_dma_spec
*, struct acpi_dma
*),
66 void devm_acpi_dma_controller_free(struct device
*dev
);
68 struct dma_chan
*acpi_dma_request_slave_chan_by_index(struct device
*dev
,
70 struct dma_chan
*acpi_dma_request_slave_chan_by_name(struct device
*dev
,
73 struct dma_chan
*acpi_dma_simple_xlate(struct acpi_dma_spec
*dma_spec
,
74 struct acpi_dma
*adma
);
77 static inline int acpi_dma_controller_register(struct device
*dev
,
78 struct dma_chan
*(*acpi_dma_xlate
)
79 (struct acpi_dma_spec
*, struct acpi_dma
*),
84 static inline int acpi_dma_controller_free(struct device
*dev
)
88 static inline int devm_acpi_dma_controller_register(struct device
*dev
,
89 struct dma_chan
*(*acpi_dma_xlate
)
90 (struct acpi_dma_spec
*, struct acpi_dma
*),
95 static inline void devm_acpi_dma_controller_free(struct device
*dev
)
99 static inline struct dma_chan
*acpi_dma_request_slave_chan_by_index(
100 struct device
*dev
, size_t index
)
104 static inline struct dma_chan
*acpi_dma_request_slave_chan_by_name(
105 struct device
*dev
, const char *name
)
110 #define acpi_dma_simple_xlate NULL
114 #define acpi_dma_request_slave_channel acpi_dma_request_slave_chan_by_index
116 #endif /* __LINUX_ACPI_DMA_H */