0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef __LINUX_ACPI_DMA_H
0012 #define __LINUX_ACPI_DMA_H
0013
0014 #include <linux/list.h>
0015 #include <linux/device.h>
0016 #include <linux/err.h>
0017 #include <linux/dmaengine.h>
0018
0019
0020
0021
0022
0023
0024
0025
0026 struct acpi_dma_spec {
0027 int chan_id;
0028 int slave_id;
0029 struct device *dev;
0030 };
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041 struct acpi_dma {
0042 struct list_head dma_controllers;
0043 struct device *dev;
0044 struct dma_chan *(*acpi_dma_xlate)
0045 (struct acpi_dma_spec *, struct acpi_dma *);
0046 void *data;
0047 unsigned short base_request_line;
0048 unsigned short end_request_line;
0049 };
0050
0051
0052 struct acpi_dma_filter_info {
0053 dma_cap_mask_t dma_cap;
0054 dma_filter_fn filter_fn;
0055 };
0056
0057 #ifdef CONFIG_DMA_ACPI
0058
0059 int acpi_dma_controller_register(struct device *dev,
0060 struct dma_chan *(*acpi_dma_xlate)
0061 (struct acpi_dma_spec *, struct acpi_dma *),
0062 void *data);
0063 int acpi_dma_controller_free(struct device *dev);
0064 int devm_acpi_dma_controller_register(struct device *dev,
0065 struct dma_chan *(*acpi_dma_xlate)
0066 (struct acpi_dma_spec *, struct acpi_dma *),
0067 void *data);
0068 void devm_acpi_dma_controller_free(struct device *dev);
0069
0070 struct dma_chan *acpi_dma_request_slave_chan_by_index(struct device *dev,
0071 size_t index);
0072 struct dma_chan *acpi_dma_request_slave_chan_by_name(struct device *dev,
0073 const char *name);
0074
0075 struct dma_chan *acpi_dma_simple_xlate(struct acpi_dma_spec *dma_spec,
0076 struct acpi_dma *adma);
0077 #else
0078
0079 static inline int acpi_dma_controller_register(struct device *dev,
0080 struct dma_chan *(*acpi_dma_xlate)
0081 (struct acpi_dma_spec *, struct acpi_dma *),
0082 void *data)
0083 {
0084 return -ENODEV;
0085 }
0086 static inline int acpi_dma_controller_free(struct device *dev)
0087 {
0088 return -ENODEV;
0089 }
0090 static inline int devm_acpi_dma_controller_register(struct device *dev,
0091 struct dma_chan *(*acpi_dma_xlate)
0092 (struct acpi_dma_spec *, struct acpi_dma *),
0093 void *data)
0094 {
0095 return -ENODEV;
0096 }
0097 static inline void devm_acpi_dma_controller_free(struct device *dev)
0098 {
0099 }
0100
0101 static inline struct dma_chan *acpi_dma_request_slave_chan_by_index(
0102 struct device *dev, size_t index)
0103 {
0104 return ERR_PTR(-ENODEV);
0105 }
0106 static inline struct dma_chan *acpi_dma_request_slave_chan_by_name(
0107 struct device *dev, const char *name)
0108 {
0109 return ERR_PTR(-ENODEV);
0110 }
0111
0112 #define acpi_dma_simple_xlate NULL
0113
0114 #endif
0115
0116 #define acpi_dma_request_slave_channel acpi_dma_request_slave_chan_by_index
0117
0118 #endif