1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef __LINUX_ACPI_DMA_H
15#define __LINUX_ACPI_DMA_H
16
17#include <linux/list.h>
18#include <linux/device.h>
19#include <linux/err.h>
20#include <linux/dmaengine.h>
21
22
23
24
25
26
27
28
29struct acpi_dma_spec {
30 int chan_id;
31 int slave_id;
32 struct device *dev;
33};
34
35
36
37
38
39
40
41
42
43
44struct acpi_dma {
45 struct list_head dma_controllers;
46 struct device *dev;
47 struct dma_chan *(*acpi_dma_xlate)
48 (struct acpi_dma_spec *, struct acpi_dma *);
49 void *data;
50 unsigned short base_request_line;
51 unsigned short end_request_line;
52};
53
54
55struct acpi_dma_filter_info {
56 dma_cap_mask_t dma_cap;
57 dma_filter_fn filter_fn;
58};
59
60#ifdef CONFIG_DMA_ACPI
61
62int acpi_dma_controller_register(struct device *dev,
63 struct dma_chan *(*acpi_dma_xlate)
64 (struct acpi_dma_spec *, struct acpi_dma *),
65 void *data);
66int acpi_dma_controller_free(struct device *dev);
67int devm_acpi_dma_controller_register(struct device *dev,
68 struct dma_chan *(*acpi_dma_xlate)
69 (struct acpi_dma_spec *, struct acpi_dma *),
70 void *data);
71void devm_acpi_dma_controller_free(struct device *dev);
72
73struct dma_chan *acpi_dma_request_slave_chan_by_index(struct device *dev,
74 size_t index);
75struct dma_chan *acpi_dma_request_slave_chan_by_name(struct device *dev,
76 const char *name);
77
78struct dma_chan *acpi_dma_simple_xlate(struct acpi_dma_spec *dma_spec,
79 struct acpi_dma *adma);
80#else
81
82static inline int acpi_dma_controller_register(struct device *dev,
83 struct dma_chan *(*acpi_dma_xlate)
84 (struct acpi_dma_spec *, struct acpi_dma *),
85 void *data)
86{
87 return -ENODEV;
88}
89static inline int acpi_dma_controller_free(struct device *dev)
90{
91 return -ENODEV;
92}
93static inline int devm_acpi_dma_controller_register(struct device *dev,
94 struct dma_chan *(*acpi_dma_xlate)
95 (struct acpi_dma_spec *, struct acpi_dma *),
96 void *data)
97{
98 return -ENODEV;
99}
100static inline void devm_acpi_dma_controller_free(struct device *dev)
101{
102}
103
104static inline struct dma_chan *acpi_dma_request_slave_chan_by_index(
105 struct device *dev, size_t index)
106{
107 return ERR_PTR(-ENODEV);
108}
109static inline struct dma_chan *acpi_dma_request_slave_chan_by_name(
110 struct device *dev, const char *name)
111{
112 return ERR_PTR(-ENODEV);
113}
114
115#define acpi_dma_simple_xlate NULL
116
117#endif
118
119#define acpi_dma_request_slave_channel acpi_dma_request_slave_chan_by_index
120
121#endif
122