diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-22 19:34:21 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-22 19:34:21 -0400 |
commit | fb09bafda67041b74a668dc9d77735e36bd33d3b (patch) | |
tree | 2dd32b65062a95045468fdcab366ecdb8e4fcac6 /include | |
parent | 94b5aff4c6f72fee6b0f49d49e4fa8b204e8ded9 (diff) | |
parent | c3c6cc91b0ae7b3d598488ad0b593bafba4a0817 (diff) |
Merge tag 'staging-3.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging tree changes from Greg Kroah-Hartman:
"Here is the big staging tree pull request for the 3.5-rc1 merge
window.
Loads of changes here, and we just narrowly added more lines than we
added:
622 files changed, 28356 insertions(+), 26059 deletions(-)
But, good news is that there is a number of subsystems that moved out
of the staging tree, to their respective "real" portions of the
kernel.
Code that moved out was:
- iio core code
- mei driver
- vme core and bridge drivers
There was one broken network driver that moved into staging as a step
before it is removed from the tree (pc300), and there was a few new
drivers added to the tree:
- new iio drivers
- gdm72xx wimax USB driver
- ipack subsystem and 2 drivers
All of the movements around have acks from the various subsystem
maintainers, and all of this has been in the linux-next tree for a
while.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"
Fixed up various trivial conflicts, along with a non-trivial one found
in -next and pointed out by Olof Johanssen: a clean - but incorrect -
merge of the arch/arm/boot/dts/at91sam9g20.dtsi file. Fix up manually
as per Stephen Rothwell.
* tag 'staging-3.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (536 commits)
Staging: bcm: Remove two unused variables from Adapter.h
Staging: bcm: Removes the volatile type definition from Adapter.h
Staging: bcm: Rename all "INT" to "int" in Adapter.h
Staging: bcm: Fix warning: __packed vs. __attribute__((packed)) in Adapter.h
Staging: bcm: Correctly format all comments in Adapter.h
Staging: bcm: Fix all whitespace issues in Adapter.h
Staging: bcm: Properly format braces in Adapter.h
Staging: ipack/bridges/tpci200: remove unneeded casts
Staging: ipack/bridges/tpci200: remove TPCI200_SHORTNAME constant
Staging: ipack: remove board_name and bus_name fields from struct ipack_device
Staging: ipack: improve the register of a bus and a device in the bus.
staging: comedi: cleanup all the comedi_driver 'detach' functions
staging: comedi: remove all 'default N' in Kconfig
staging: line6/config.h: Delete unused header
staging: gdm72xx depends on NET
staging: gdm72xx: Set up parent link in sysfs for gdm72xx devices
staging: drm/omap: initial dmabuf/prime import support
staging: drm/omap: dmabuf/prime mmap support
pstore/ram: Add ECC support
pstore/ram: Switch to persistent_ram routines
...
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/Kbuild | 2 | ||||
-rw-r--r-- | include/linux/alarmtimer.h | 3 | ||||
-rw-r--r-- | include/linux/iio/buffer.h | 191 | ||||
-rw-r--r-- | include/linux/iio/consumer.h | 96 | ||||
-rw-r--r-- | include/linux/iio/driver.h | 34 | ||||
-rw-r--r-- | include/linux/iio/events.h | 105 | ||||
-rw-r--r-- | include/linux/iio/iio.h | 492 | ||||
-rw-r--r-- | include/linux/iio/kfifo_buf.h | 8 | ||||
-rw-r--r-- | include/linux/iio/machine.h | 24 | ||||
-rw-r--r-- | include/linux/iio/sysfs.h | 117 | ||||
-rw-r--r-- | include/linux/iio/trigger.h | 119 | ||||
-rw-r--r-- | include/linux/iio/trigger_consumer.h | 52 | ||||
-rw-r--r-- | include/linux/iio/types.h | 55 | ||||
-rw-r--r-- | include/linux/mei.h | 110 | ||||
-rw-r--r-- | include/linux/platform_data/at91_adc.h | 61 | ||||
-rw-r--r-- | include/linux/pstore_ram.h | 98 | ||||
-rw-r--r-- | include/linux/ramoops.h | 17 | ||||
-rw-r--r-- | include/linux/uuid.h | 4 | ||||
-rw-r--r-- | include/linux/vme.h | 174 |
19 files changed, 1745 insertions, 17 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild index 0237b84ba541..39737839ce29 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild | |||
@@ -238,6 +238,7 @@ header-y += map_to_7segment.h | |||
238 | header-y += matroxfb.h | 238 | header-y += matroxfb.h |
239 | header-y += mdio.h | 239 | header-y += mdio.h |
240 | header-y += media.h | 240 | header-y += media.h |
241 | header-y += mei.h | ||
241 | header-y += mempolicy.h | 242 | header-y += mempolicy.h |
242 | header-y += meye.h | 243 | header-y += meye.h |
243 | header-y += mii.h | 244 | header-y += mii.h |
@@ -380,6 +381,7 @@ header-y += unistd.h | |||
380 | header-y += usbdevice_fs.h | 381 | header-y += usbdevice_fs.h |
381 | header-y += utime.h | 382 | header-y += utime.h |
382 | header-y += utsname.h | 383 | header-y += utsname.h |
384 | header-y += uuid.h | ||
383 | header-y += uvcvideo.h | 385 | header-y += uvcvideo.h |
384 | header-y += v4l2-mediabus.h | 386 | header-y += v4l2-mediabus.h |
385 | header-y += v4l2-subdev.h | 387 | header-y += v4l2-subdev.h |
diff --git a/include/linux/alarmtimer.h b/include/linux/alarmtimer.h index 975009e1cbe6..96c5c249b086 100644 --- a/include/linux/alarmtimer.h +++ b/include/linux/alarmtimer.h | |||
@@ -76,4 +76,7 @@ static inline int alarmtimer_callback_running(struct alarm *timer) | |||
76 | } | 76 | } |
77 | 77 | ||
78 | 78 | ||
79 | /* Provide way to access the rtc device being used by alarmtimers */ | ||
80 | struct rtc_device *alarmtimer_get_rtcdev(void); | ||
81 | |||
79 | #endif | 82 | #endif |
diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h new file mode 100644 index 000000000000..fb0fe46fd659 --- /dev/null +++ b/include/linux/iio/buffer.h | |||
@@ -0,0 +1,191 @@ | |||
1 | /* The industrial I/O core - generic buffer interfaces. | ||
2 | * | ||
3 | * Copyright (c) 2008 Jonathan Cameron | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License version 2 as published by | ||
7 | * the Free Software Foundation. | ||
8 | */ | ||
9 | |||
10 | #ifndef _IIO_BUFFER_GENERIC_H_ | ||
11 | #define _IIO_BUFFER_GENERIC_H_ | ||
12 | #include <linux/sysfs.h> | ||
13 | #include <linux/iio/iio.h> | ||
14 | |||
15 | #ifdef CONFIG_IIO_BUFFER | ||
16 | |||
17 | struct iio_buffer; | ||
18 | |||
19 | /** | ||
20 | * struct iio_buffer_access_funcs - access functions for buffers. | ||
21 | * @store_to: actually store stuff to the buffer | ||
22 | * @read_first_n: try to get a specified number of bytes (must exist) | ||
23 | * @request_update: if a parameter change has been marked, update underlying | ||
24 | * storage. | ||
25 | * @get_bytes_per_datum:get current bytes per datum | ||
26 | * @set_bytes_per_datum:set number of bytes per datum | ||
27 | * @get_length: get number of datums in buffer | ||
28 | * @set_length: set number of datums in buffer | ||
29 | * | ||
30 | * The purpose of this structure is to make the buffer element | ||
31 | * modular as event for a given driver, different usecases may require | ||
32 | * different buffer designs (space efficiency vs speed for example). | ||
33 | * | ||
34 | * It is worth noting that a given buffer implementation may only support a | ||
35 | * small proportion of these functions. The core code 'should' cope fine with | ||
36 | * any of them not existing. | ||
37 | **/ | ||
38 | struct iio_buffer_access_funcs { | ||
39 | int (*store_to)(struct iio_buffer *buffer, u8 *data, s64 timestamp); | ||
40 | int (*read_first_n)(struct iio_buffer *buffer, | ||
41 | size_t n, | ||
42 | char __user *buf); | ||
43 | |||
44 | int (*request_update)(struct iio_buffer *buffer); | ||
45 | |||
46 | int (*get_bytes_per_datum)(struct iio_buffer *buffer); | ||
47 | int (*set_bytes_per_datum)(struct iio_buffer *buffer, size_t bpd); | ||
48 | int (*get_length)(struct iio_buffer *buffer); | ||
49 | int (*set_length)(struct iio_buffer *buffer, int length); | ||
50 | }; | ||
51 | |||
52 | /** | ||
53 | * struct iio_buffer - general buffer structure | ||
54 | * @length: [DEVICE] number of datums in buffer | ||
55 | * @bytes_per_datum: [DEVICE] size of individual datum including timestamp | ||
56 | * @scan_el_attrs: [DRIVER] control of scan elements if that scan mode | ||
57 | * control method is used | ||
58 | * @scan_mask: [INTERN] bitmask used in masking scan mode elements | ||
59 | * @scan_timestamp: [INTERN] does the scan mode include a timestamp | ||
60 | * @access: [DRIVER] buffer access functions associated with the | ||
61 | * implementation. | ||
62 | * @scan_el_dev_attr_list:[INTERN] list of scan element related attributes. | ||
63 | * @scan_el_group: [DRIVER] attribute group for those attributes not | ||
64 | * created from the iio_chan_info array. | ||
65 | * @pollq: [INTERN] wait queue to allow for polling on the buffer. | ||
66 | * @stufftoread: [INTERN] flag to indicate new data. | ||
67 | * @demux_list: [INTERN] list of operations required to demux the scan. | ||
68 | * @demux_bounce: [INTERN] buffer for doing gather from incoming scan. | ||
69 | **/ | ||
70 | struct iio_buffer { | ||
71 | int length; | ||
72 | int bytes_per_datum; | ||
73 | struct attribute_group *scan_el_attrs; | ||
74 | long *scan_mask; | ||
75 | bool scan_timestamp; | ||
76 | const struct iio_buffer_access_funcs *access; | ||
77 | struct list_head scan_el_dev_attr_list; | ||
78 | struct attribute_group scan_el_group; | ||
79 | wait_queue_head_t pollq; | ||
80 | bool stufftoread; | ||
81 | const struct attribute_group *attrs; | ||
82 | struct list_head demux_list; | ||
83 | unsigned char *demux_bounce; | ||
84 | }; | ||
85 | |||
86 | /** | ||
87 | * iio_buffer_init() - Initialize the buffer structure | ||
88 | * @buffer: buffer to be initialized | ||
89 | **/ | ||
90 | void iio_buffer_init(struct iio_buffer *buffer); | ||
91 | |||
92 | /** | ||
93 | * __iio_update_buffer() - update common elements of buffers | ||
94 | * @buffer: buffer that is the event source | ||
95 | * @bytes_per_datum: size of individual datum including timestamp | ||
96 | * @length: number of datums in buffer | ||
97 | **/ | ||
98 | static inline void __iio_update_buffer(struct iio_buffer *buffer, | ||
99 | int bytes_per_datum, int length) | ||
100 | { | ||
101 | buffer->bytes_per_datum = bytes_per_datum; | ||
102 | buffer->length = length; | ||
103 | } | ||
104 | |||
105 | int iio_scan_mask_query(struct iio_dev *indio_dev, | ||
106 | struct iio_buffer *buffer, int bit); | ||
107 | |||
108 | /** | ||
109 | * iio_scan_mask_set() - set particular bit in the scan mask | ||
110 | * @buffer: the buffer whose scan mask we are interested in | ||
111 | * @bit: the bit to be set. | ||
112 | **/ | ||
113 | int iio_scan_mask_set(struct iio_dev *indio_dev, | ||
114 | struct iio_buffer *buffer, int bit); | ||
115 | |||
116 | /** | ||
117 | * iio_push_to_buffer() - push to a registered buffer. | ||
118 | * @buffer: IIO buffer structure for device | ||
119 | * @scan: Full scan. | ||
120 | * @timestamp: | ||
121 | */ | ||
122 | int iio_push_to_buffer(struct iio_buffer *buffer, unsigned char *data, | ||
123 | s64 timestamp); | ||
124 | |||
125 | int iio_update_demux(struct iio_dev *indio_dev); | ||
126 | |||
127 | /** | ||
128 | * iio_buffer_register() - register the buffer with IIO core | ||
129 | * @indio_dev: device with the buffer to be registered | ||
130 | **/ | ||
131 | int iio_buffer_register(struct iio_dev *indio_dev, | ||
132 | const struct iio_chan_spec *channels, | ||
133 | int num_channels); | ||
134 | |||
135 | /** | ||
136 | * iio_buffer_unregister() - unregister the buffer from IIO core | ||
137 | * @indio_dev: the device with the buffer to be unregistered | ||
138 | **/ | ||
139 | void iio_buffer_unregister(struct iio_dev *indio_dev); | ||
140 | |||
141 | /** | ||
142 | * iio_buffer_read_length() - attr func to get number of datums in the buffer | ||
143 | **/ | ||
144 | ssize_t iio_buffer_read_length(struct device *dev, | ||
145 | struct device_attribute *attr, | ||
146 | char *buf); | ||
147 | /** | ||
148 | * iio_buffer_write_length() - attr func to set number of datums in the buffer | ||
149 | **/ | ||
150 | ssize_t iio_buffer_write_length(struct device *dev, | ||
151 | struct device_attribute *attr, | ||
152 | const char *buf, | ||
153 | size_t len); | ||
154 | /** | ||
155 | * iio_buffer_store_enable() - attr to turn the buffer on | ||
156 | **/ | ||
157 | ssize_t iio_buffer_store_enable(struct device *dev, | ||
158 | struct device_attribute *attr, | ||
159 | const char *buf, | ||
160 | size_t len); | ||
161 | /** | ||
162 | * iio_buffer_show_enable() - attr to see if the buffer is on | ||
163 | **/ | ||
164 | ssize_t iio_buffer_show_enable(struct device *dev, | ||
165 | struct device_attribute *attr, | ||
166 | char *buf); | ||
167 | #define IIO_BUFFER_LENGTH_ATTR DEVICE_ATTR(length, S_IRUGO | S_IWUSR, \ | ||
168 | iio_buffer_read_length, \ | ||
169 | iio_buffer_write_length) | ||
170 | |||
171 | #define IIO_BUFFER_ENABLE_ATTR DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, \ | ||
172 | iio_buffer_show_enable, \ | ||
173 | iio_buffer_store_enable) | ||
174 | |||
175 | int iio_sw_buffer_preenable(struct iio_dev *indio_dev); | ||
176 | |||
177 | #else /* CONFIG_IIO_BUFFER */ | ||
178 | |||
179 | static inline int iio_buffer_register(struct iio_dev *indio_dev, | ||
180 | struct iio_chan_spec *channels, | ||
181 | int num_channels) | ||
182 | { | ||
183 | return 0; | ||
184 | } | ||
185 | |||
186 | static inline void iio_buffer_unregister(struct iio_dev *indio_dev) | ||
187 | {}; | ||
188 | |||
189 | #endif /* CONFIG_IIO_BUFFER */ | ||
190 | |||
191 | #endif /* _IIO_BUFFER_GENERIC_H_ */ | ||
diff --git a/include/linux/iio/consumer.h b/include/linux/iio/consumer.h new file mode 100644 index 000000000000..1a15e560a5a1 --- /dev/null +++ b/include/linux/iio/consumer.h | |||
@@ -0,0 +1,96 @@ | |||
1 | /* | ||
2 | * Industrial I/O in kernel consumer interface | ||
3 | * | ||
4 | * Copyright (c) 2011 Jonathan Cameron | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License version 2 as published by | ||
8 | * the Free Software Foundation. | ||
9 | */ | ||
10 | #ifndef _IIO_INKERN_CONSUMER_H_ | ||
11 | #define _IIO_INKERN_CONSUMER_H | ||
12 | #include <linux/iio/types.h> | ||
13 | |||
14 | struct iio_dev; | ||
15 | struct iio_chan_spec; | ||
16 | |||
17 | /** | ||
18 | * struct iio_channel - everything needed for a consumer to use a channel | ||
19 | * @indio_dev: Device on which the channel exists. | ||
20 | * @channel: Full description of the channel. | ||
21 | */ | ||
22 | struct iio_channel { | ||
23 | struct iio_dev *indio_dev; | ||
24 | const struct iio_chan_spec *channel; | ||
25 | }; | ||
26 | |||
27 | /** | ||
28 | * iio_channel_get() - get description of all that is needed to access channel. | ||
29 | * @name: Unique name of the device as provided in the iio_map | ||
30 | * with which the desired provider to consumer mapping | ||
31 | * was registered. | ||
32 | * @consumer_channel: Unique name to identify the channel on the consumer | ||
33 | * side. This typically describes the channels use within | ||
34 | * the consumer. E.g. 'battery_voltage' | ||
35 | */ | ||
36 | struct iio_channel *iio_st_channel_get(const char *name, | ||
37 | const char *consumer_channel); | ||
38 | |||
39 | /** | ||
40 | * iio_st_channel_release() - release channels obtained via iio_st_channel_get | ||
41 | * @chan: The channel to be released. | ||
42 | */ | ||
43 | void iio_st_channel_release(struct iio_channel *chan); | ||
44 | |||
45 | /** | ||
46 | * iio_st_channel_get_all() - get all channels associated with a client | ||
47 | * @name: name of consumer device. | ||
48 | * | ||
49 | * Returns an array of iio_channel structures terminated with one with | ||
50 | * null iio_dev pointer. | ||
51 | * This function is used by fairly generic consumers to get all the | ||
52 | * channels registered as having this consumer. | ||
53 | */ | ||
54 | struct iio_channel *iio_st_channel_get_all(const char *name); | ||
55 | |||
56 | /** | ||
57 | * iio_st_channel_release_all() - reverse iio_st_get_all | ||
58 | * @chan: Array of channels to be released. | ||
59 | */ | ||
60 | void iio_st_channel_release_all(struct iio_channel *chan); | ||
61 | |||
62 | /** | ||
63 | * iio_st_read_channel_raw() - read from a given channel | ||
64 | * @channel: The channel being queried. | ||
65 | * @val: Value read back. | ||
66 | * | ||
67 | * Note raw reads from iio channels are in adc counts and hence | ||
68 | * scale will need to be applied if standard units required. | ||
69 | */ | ||
70 | int iio_st_read_channel_raw(struct iio_channel *chan, | ||
71 | int *val); | ||
72 | |||
73 | /** | ||
74 | * iio_st_get_channel_type() - get the type of a channel | ||
75 | * @channel: The channel being queried. | ||
76 | * @type: The type of the channel. | ||
77 | * | ||
78 | * returns the enum iio_chan_type of the channel | ||
79 | */ | ||
80 | int iio_st_get_channel_type(struct iio_channel *channel, | ||
81 | enum iio_chan_type *type); | ||
82 | |||
83 | /** | ||
84 | * iio_st_read_channel_scale() - read the scale value for a channel | ||
85 | * @channel: The channel being queried. | ||
86 | * @val: First part of value read back. | ||
87 | * @val2: Second part of value read back. | ||
88 | * | ||
89 | * Note returns a description of what is in val and val2, such | ||
90 | * as IIO_VAL_INT_PLUS_MICRO telling us we have a value of val | ||
91 | * + val2/1e6 | ||
92 | */ | ||
93 | int iio_st_read_channel_scale(struct iio_channel *chan, int *val, | ||
94 | int *val2); | ||
95 | |||
96 | #endif | ||
diff --git a/include/linux/iio/driver.h b/include/linux/iio/driver.h new file mode 100644 index 000000000000..a4f8b2e05af5 --- /dev/null +++ b/include/linux/iio/driver.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | * Industrial I/O in kernel access map interface. | ||
3 | * | ||
4 | * Copyright (c) 2011 Jonathan Cameron | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License version 2 as published by | ||
8 | * the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #ifndef _IIO_INKERN_H_ | ||
12 | #define _IIO_INKERN_H_ | ||
13 | |||
14 | struct iio_map; | ||
15 | |||
16 | /** | ||
17 | * iio_map_array_register() - tell the core about inkernel consumers | ||
18 | * @indio_dev: provider device | ||
19 | * @map: array of mappings specifying association of channel with client | ||
20 | */ | ||
21 | int iio_map_array_register(struct iio_dev *indio_dev, | ||
22 | struct iio_map *map); | ||
23 | |||
24 | /** | ||
25 | * iio_map_array_unregister() - tell the core to remove consumer mappings | ||
26 | * @indio_dev: provider device | ||
27 | * @map: array of mappings to remove. Note these must have same memory | ||
28 | * addresses as those originally added not just equal parameter | ||
29 | * values. | ||
30 | */ | ||
31 | int iio_map_array_unregister(struct iio_dev *indio_dev, | ||
32 | struct iio_map *map); | ||
33 | |||
34 | #endif | ||
diff --git a/include/linux/iio/events.h b/include/linux/iio/events.h new file mode 100644 index 000000000000..b5acbf93c5da --- /dev/null +++ b/include/linux/iio/events.h | |||
@@ -0,0 +1,105 @@ | |||
1 | /* The industrial I/O - event passing to userspace | ||
2 | * | ||
3 | * Copyright (c) 2008-2011 Jonathan Cameron | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License version 2 as published by | ||
7 | * the Free Software Foundation. | ||
8 | */ | ||
9 | #ifndef _IIO_EVENTS_H_ | ||
10 | #define _IIO_EVENTS_H_ | ||
11 | |||
12 | #include <linux/ioctl.h> | ||
13 | #include <linux/types.h> | ||
14 | #include <linux/iio/types.h> | ||
15 | |||
16 | /** | ||
17 | * struct iio_event_data - The actual event being pushed to userspace | ||
18 | * @id: event identifier | ||
19 | * @timestamp: best estimate of time of event occurrence (often from | ||
20 | * the interrupt handler) | ||
21 | */ | ||
22 | struct iio_event_data { | ||
23 | __u64 id; | ||
24 | __s64 timestamp; | ||
25 | }; | ||
26 | |||
27 | #define IIO_GET_EVENT_FD_IOCTL _IOR('i', 0x90, int) | ||
28 | |||
29 | enum iio_event_type { | ||
30 | IIO_EV_TYPE_THRESH, | ||
31 | IIO_EV_TYPE_MAG, | ||
32 | IIO_EV_TYPE_ROC, | ||
33 | IIO_EV_TYPE_THRESH_ADAPTIVE, | ||
34 | IIO_EV_TYPE_MAG_ADAPTIVE, | ||
35 | }; | ||
36 | |||
37 | enum iio_event_direction { | ||
38 | IIO_EV_DIR_EITHER, | ||
39 | IIO_EV_DIR_RISING, | ||
40 | IIO_EV_DIR_FALLING, | ||
41 | }; | ||
42 | |||
43 | /** | ||
44 | * IIO_EVENT_CODE() - create event identifier | ||
45 | * @chan_type: Type of the channel. Should be one of enum iio_chan_type. | ||
46 | * @diff: Whether the event is for an differential channel or not. | ||
47 | * @modifier: Modifier for the channel. Should be one of enum iio_modifier. | ||
48 | * @direction: Direction of the event. One of enum iio_event_direction. | ||
49 | * @type: Type of the event. Should be one enum iio_event_type. | ||
50 | * @chan: Channel number for non-differential channels. | ||
51 | * @chan1: First channel number for differential channels. | ||
52 | * @chan2: Second channel number for differential channels. | ||
53 | */ | ||
54 | |||
55 | #define IIO_EVENT_CODE(chan_type, diff, modifier, direction, \ | ||
56 | type, chan, chan1, chan2) \ | ||
57 | (((u64)type << 56) | ((u64)diff << 55) | \ | ||
58 | ((u64)direction << 48) | ((u64)modifier << 40) | \ | ||
59 | ((u64)chan_type << 32) | (((u16)chan2) << 16) | ((u16)chan1) | \ | ||
60 | ((u16)chan)) | ||
61 | |||
62 | |||
63 | #define IIO_EV_DIR_MAX 4 | ||
64 | #define IIO_EV_BIT(type, direction) \ | ||
65 | (1 << (type*IIO_EV_DIR_MAX + direction)) | ||
66 | |||
67 | /** | ||
68 | * IIO_MOD_EVENT_CODE() - create event identifier for modified channels | ||
69 | * @chan_type: Type of the channel. Should be one of enum iio_chan_type. | ||
70 | * @number: Channel number. | ||
71 | * @modifier: Modifier for the channel. Should be one of enum iio_modifier. | ||
72 | * @type: Type of the event. Should be one enum iio_event_type. | ||
73 | * @direction: Direction of the event. One of enum iio_event_direction. | ||
74 | */ | ||
75 | |||
76 | #define IIO_MOD_EVENT_CODE(chan_type, number, modifier, \ | ||
77 | type, direction) \ | ||
78 | IIO_EVENT_CODE(chan_type, 0, modifier, direction, type, number, 0, 0) | ||
79 | |||
80 | /** | ||
81 | * IIO_UNMOD_EVENT_CODE() - create event identifier for unmodified channels | ||
82 | * @chan_type: Type of the channel. Should be one of enum iio_chan_type. | ||
83 | * @number: Channel number. | ||
84 | * @type: Type of the event. Should be one enum iio_event_type. | ||
85 | * @direction: Direction of the event. One of enum iio_event_direction. | ||
86 | */ | ||
87 | |||
88 | #define IIO_UNMOD_EVENT_CODE(chan_type, number, type, direction) \ | ||
89 | IIO_EVENT_CODE(chan_type, 0, 0, direction, type, number, 0, 0) | ||
90 | |||
91 | #define IIO_EVENT_CODE_EXTRACT_TYPE(mask) ((mask >> 56) & 0xFF) | ||
92 | |||
93 | #define IIO_EVENT_CODE_EXTRACT_DIR(mask) ((mask >> 48) & 0xCF) | ||
94 | |||
95 | #define IIO_EVENT_CODE_EXTRACT_CHAN_TYPE(mask) ((mask >> 32) & 0xFF) | ||
96 | |||
97 | /* Event code number extraction depends on which type of event we have. | ||
98 | * Perhaps review this function in the future*/ | ||
99 | #define IIO_EVENT_CODE_EXTRACT_CHAN(mask) ((__s16)(mask & 0xFFFF)) | ||
100 | #define IIO_EVENT_CODE_EXTRACT_CHAN2(mask) ((__s16)(((mask) >> 16) & 0xFFFF)) | ||
101 | |||
102 | #define IIO_EVENT_CODE_EXTRACT_MODIFIER(mask) ((mask >> 40) & 0xFF) | ||
103 | #define IIO_EVENT_CODE_EXTRACT_DIFF(mask) (((mask) >> 55) & 0x1) | ||
104 | |||
105 | #endif | ||
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h new file mode 100644 index 000000000000..3a4f6a3ab80d --- /dev/null +++ b/include/linux/iio/iio.h | |||
@@ -0,0 +1,492 @@ | |||
1 | |||
2 | /* The industrial I/O core | ||
3 | * | ||
4 | * Copyright (c) 2008 Jonathan Cameron | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License version 2 as published by | ||
8 | * the Free Software Foundation. | ||
9 | */ | ||
10 | #ifndef _INDUSTRIAL_IO_H_ | ||
11 | #define _INDUSTRIAL_IO_H_ | ||
12 | |||
13 | #include <linux/device.h> | ||
14 | #include <linux/cdev.h> | ||
15 | #include <linux/iio/types.h> | ||
16 | /* IIO TODO LIST */ | ||
17 | /* | ||
18 | * Provide means of adjusting timer accuracy. | ||
19 | * Currently assumes nano seconds. | ||
20 | */ | ||
21 | |||
22 | enum iio_chan_info_enum { | ||
23 | IIO_CHAN_INFO_RAW = 0, | ||
24 | IIO_CHAN_INFO_PROCESSED, | ||
25 | IIO_CHAN_INFO_SCALE, | ||
26 | IIO_CHAN_INFO_OFFSET, | ||
27 | IIO_CHAN_INFO_CALIBSCALE, | ||
28 | IIO_CHAN_INFO_CALIBBIAS, | ||
29 | IIO_CHAN_INFO_PEAK, | ||
30 | IIO_CHAN_INFO_PEAK_SCALE, | ||
31 | IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW, | ||
32 | IIO_CHAN_INFO_AVERAGE_RAW, | ||
33 | IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY, | ||
34 | IIO_CHAN_INFO_SAMP_FREQ, | ||
35 | IIO_CHAN_INFO_FREQUENCY, | ||
36 | IIO_CHAN_INFO_PHASE, | ||
37 | IIO_CHAN_INFO_HARDWAREGAIN, | ||
38 | }; | ||
39 | |||
40 | #define IIO_CHAN_INFO_SHARED_BIT(type) BIT(type*2) | ||
41 | #define IIO_CHAN_INFO_SEPARATE_BIT(type) BIT(type*2 + 1) | ||
42 | |||
43 | #define IIO_CHAN_INFO_RAW_SEPARATE_BIT \ | ||
44 | IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_RAW) | ||
45 | #define IIO_CHAN_INFO_PROCESSED_SEPARATE_BIT \ | ||
46 | IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PROCESSED) | ||
47 | #define IIO_CHAN_INFO_SCALE_SEPARATE_BIT \ | ||
48 | IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_SCALE) | ||
49 | #define IIO_CHAN_INFO_SCALE_SHARED_BIT \ | ||
50 | IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_SCALE) | ||
51 | #define IIO_CHAN_INFO_OFFSET_SEPARATE_BIT \ | ||
52 | IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_OFFSET) | ||
53 | #define IIO_CHAN_INFO_OFFSET_SHARED_BIT \ | ||
54 | IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_OFFSET) | ||
55 | #define IIO_CHAN_INFO_CALIBSCALE_SEPARATE_BIT \ | ||
56 | IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_CALIBSCALE) | ||
57 | #define IIO_CHAN_INFO_CALIBSCALE_SHARED_BIT \ | ||
58 | IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_CALIBSCALE) | ||
59 | #define IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT \ | ||
60 | IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_CALIBBIAS) | ||
61 | #define IIO_CHAN_INFO_CALIBBIAS_SHARED_BIT \ | ||
62 | IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_CALIBBIAS) | ||
63 | #define IIO_CHAN_INFO_PEAK_SEPARATE_BIT \ | ||
64 | IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PEAK) | ||
65 | #define IIO_CHAN_INFO_PEAK_SHARED_BIT \ | ||
66 | IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PEAK) | ||
67 | #define IIO_CHAN_INFO_PEAKSCALE_SEPARATE_BIT \ | ||
68 | IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PEAKSCALE) | ||
69 | #define IIO_CHAN_INFO_PEAKSCALE_SHARED_BIT \ | ||
70 | IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PEAKSCALE) | ||
71 | #define IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SEPARATE_BIT \ | ||
72 | IIO_CHAN_INFO_SEPARATE_BIT( \ | ||
73 | IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW) | ||
74 | #define IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SHARED_BIT \ | ||
75 | IIO_CHAN_INFO_SHARED_BIT( \ | ||
76 | IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW) | ||
77 | #define IIO_CHAN_INFO_AVERAGE_RAW_SEPARATE_BIT \ | ||
78 | IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_AVERAGE_RAW) | ||
79 | #define IIO_CHAN_INFO_AVERAGE_RAW_SHARED_BIT \ | ||
80 | IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_AVERAGE_RAW) | ||
81 | #define IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY_SHARED_BIT \ | ||
82 | IIO_CHAN_INFO_SHARED_BIT( \ | ||
83 | IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY) | ||
84 | #define IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY_SEPARATE_BIT \ | ||
85 | IIO_CHAN_INFO_SEPARATE_BIT( \ | ||
86 | IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY) | ||
87 | #define IIO_CHAN_INFO_SAMP_FREQ_SEPARATE_BIT \ | ||
88 | IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_SAMP_FREQ) | ||
89 | #define IIO_CHAN_INFO_SAMP_FREQ_SHARED_BIT \ | ||
90 | IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_SAMP_FREQ) | ||
91 | #define IIO_CHAN_INFO_FREQUENCY_SEPARATE_BIT \ | ||
92 | IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_FREQUENCY) | ||
93 | #define IIO_CHAN_INFO_FREQUENCY_SHARED_BIT \ | ||
94 | IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_FREQUENCY) | ||
95 | #define IIO_CHAN_INFO_PHASE_SEPARATE_BIT \ | ||
96 | IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PHASE) | ||
97 | #define IIO_CHAN_INFO_PHASE_SHARED_BIT \ | ||
98 | IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PHASE) | ||
99 | #define IIO_CHAN_INFO_HARDWAREGAIN_SEPARATE_BIT \ | ||
100 | IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_HARDWAREGAIN) | ||
101 | #define IIO_CHAN_INFO_HARDWAREGAIN_SHARED_BIT \ | ||
102 | IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_HARDWAREGAIN) | ||
103 | |||
104 | enum iio_endian { | ||
105 | IIO_CPU, | ||
106 | IIO_BE, | ||
107 | IIO_LE, | ||
108 | }; | ||
109 | |||
110 | struct iio_chan_spec; | ||
111 | struct iio_dev; | ||
112 | |||
113 | /** | ||
114 | * struct iio_chan_spec_ext_info - Extended channel info attribute | ||
115 | * @name: Info attribute name | ||
116 | * @shared: Whether this attribute is shared between all channels. | ||
117 | * @read: Read callback for this info attribute, may be NULL. | ||
118 | * @write: Write callback for this info attribute, may be NULL. | ||
119 | * @private: Data private to the driver. | ||
120 | */ | ||
121 | struct iio_chan_spec_ext_info { | ||
122 | const char *name; | ||
123 | bool shared; | ||
124 | ssize_t (*read)(struct iio_dev *, uintptr_t private, | ||
125 | struct iio_chan_spec const *, char *buf); | ||
126 | ssize_t (*write)(struct iio_dev *, uintptr_t private, | ||
127 | struct iio_chan_spec const *, const char *buf, | ||
128 | size_t len); | ||
129 | uintptr_t private; | ||
130 | }; | ||
131 | |||
132 | /** | ||
133 | * struct iio_chan_spec - specification of a single channel | ||
134 | * @type: What type of measurement is the channel making. | ||
135 | * @channel: What number or name do we wish to assign the channel. | ||
136 | * @channel2: If there is a second number for a differential | ||
137 | * channel then this is it. If modified is set then the | ||
138 | * value here specifies the modifier. | ||
139 | * @address: Driver specific identifier. | ||
140 | * @scan_index: Monotonic index to give ordering in scans when read | ||
141 | * from a buffer. | ||
142 | * @scan_type: Sign: 's' or 'u' to specify signed or unsigned | ||
143 | * realbits: Number of valid bits of data | ||
144 | * storage_bits: Realbits + padding | ||
145 | * shift: Shift right by this before masking out | ||
146 | * realbits. | ||
147 | * endianness: little or big endian | ||
148 | * @info_mask: What information is to be exported about this channel. | ||
149 | * This includes calibbias, scale etc. | ||
150 | * @event_mask: What events can this channel produce. | ||
151 | * @ext_info: Array of extended info attributes for this channel. | ||
152 | * The array is NULL terminated, the last element should | ||
153 | * have it's name field set to NULL. | ||
154 | * @extend_name: Allows labeling of channel attributes with an | ||
155 | * informative name. Note this has no effect codes etc, | ||
156 | * unlike modifiers. | ||
157 | * @datasheet_name: A name used in in kernel mapping of channels. It should | ||
158 | * correspond to the first name that the channel is referred | ||
159 | * to by in the datasheet (e.g. IND), or the nearest | ||
160 | * possible compound name (e.g. IND-INC). | ||
161 | * @modified: Does a modifier apply to this channel. What these are | ||
162 | * depends on the channel type. Modifier is set in | ||
163 | * channel2. Examples are IIO_MOD_X for axial sensors about | ||
164 | * the 'x' axis. | ||
165 | * @indexed: Specify the channel has a numerical index. If not, | ||
166 | * the value in channel will be suppressed for attribute | ||
167 | * but not for event codes. Typically set it to 0 when | ||
168 | * the index is false. | ||
169 | * @differential: Channel is differential. | ||
170 | */ | ||
171 | struct iio_chan_spec { | ||
172 | enum iio_chan_type type; | ||
173 | int channel; | ||
174 | int channel2; | ||
175 | unsigned long address; | ||
176 | int scan_index; | ||
177 | struct { | ||
178 | char sign; | ||
179 | u8 realbits; | ||
180 | u8 storagebits; | ||
181 | u8 shift; | ||
182 | enum iio_endian endianness; | ||
183 | } scan_type; | ||
184 | long info_mask; | ||
185 | long event_mask; | ||
186 | const struct iio_chan_spec_ext_info *ext_info; | ||
187 | const char *extend_name; | ||
188 | const char *datasheet_name; | ||
189 | unsigned modified:1; | ||
190 | unsigned indexed:1; | ||
191 | unsigned output:1; | ||
192 | unsigned differential:1; | ||
193 | }; | ||
194 | |||
195 | #define IIO_ST(si, rb, sb, sh) \ | ||
196 | { .sign = si, .realbits = rb, .storagebits = sb, .shift = sh } | ||
197 | |||
198 | #define IIO_CHAN_SOFT_TIMESTAMP(_si) \ | ||
199 | { .type = IIO_TIMESTAMP, .channel = -1, \ | ||
200 | .scan_index = _si, .scan_type = IIO_ST('s', 64, 64, 0) } | ||
201 | |||
202 | /** | ||
203 | * iio_get_time_ns() - utility function to get a time stamp for events etc | ||
204 | **/ | ||
205 | static inline s64 iio_get_time_ns(void) | ||
206 | { | ||
207 | struct timespec ts; | ||
208 | /* | ||
209 | * calls getnstimeofday. | ||
210 | * If hrtimers then up to ns accurate, if not microsecond. | ||
211 | */ | ||
212 | ktime_get_real_ts(&ts); | ||
213 | |||
214 | return timespec_to_ns(&ts); | ||
215 | } | ||
216 | |||
217 | /* Device operating modes */ | ||
218 | #define INDIO_DIRECT_MODE 0x01 | ||
219 | #define INDIO_BUFFER_TRIGGERED 0x02 | ||
220 | #define INDIO_BUFFER_HARDWARE 0x08 | ||
221 | |||
222 | #define INDIO_ALL_BUFFER_MODES \ | ||
223 | (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE) | ||
224 | |||
225 | struct iio_trigger; /* forward declaration */ | ||
226 | struct iio_dev; | ||
227 | |||
228 | /** | ||
229 | * struct iio_info - constant information about device | ||
230 | * @driver_module: module structure used to ensure correct | ||
231 | * ownership of chrdevs etc | ||
232 | * @event_attrs: event control attributes | ||
233 | * @attrs: general purpose device attributes | ||
234 | * @read_raw: function to request a value from the device. | ||
235 | * mask specifies which value. Note 0 means a reading of | ||
236 | * the channel in question. Return value will specify the | ||
237 | * type of value returned by the device. val and val2 will | ||
238 | * contain the elements making up the returned value. | ||
239 | * @write_raw: function to write a value to the device. | ||
240 | * Parameters are the same as for read_raw. | ||
241 | * @write_raw_get_fmt: callback function to query the expected | ||
242 | * format/precision. If not set by the driver, write_raw | ||
243 | * returns IIO_VAL_INT_PLUS_MICRO. | ||
244 | * @read_event_config: find out if the event is enabled. | ||
245 | * @write_event_config: set if the event is enabled. | ||
246 | * @read_event_value: read a value associated with the event. Meaning | ||
247 | * is event dependant. event_code specifies which event. | ||
248 | * @write_event_value: write the value associated with the event. | ||
249 | * Meaning is event dependent. | ||
250 | * @validate_trigger: function to validate the trigger when the | ||
251 | * current trigger gets changed. | ||
252 | **/ | ||
253 | struct iio_info { | ||
254 | struct module *driver_module; | ||
255 | struct attribute_group *event_attrs; | ||
256 | const struct attribute_group *attrs; | ||
257 | |||
258 | int (*read_raw)(struct iio_dev *indio_dev, | ||
259 | struct iio_chan_spec const *chan, | ||
260 | int *val, | ||
261 | int *val2, | ||
262 | long mask); | ||
263 | |||
264 | int (*write_raw)(struct iio_dev *indio_dev, | ||
265 | struct iio_chan_spec const *chan, | ||
266 | int val, | ||
267 | int val2, | ||
268 | long mask); | ||
269 | |||
270 | int (*write_raw_get_fmt)(struct iio_dev *indio_dev, | ||
271 | struct iio_chan_spec const *chan, | ||
272 | long mask); | ||
273 | |||
274 | int (*read_event_config)(struct iio_dev *indio_dev, | ||
275 | u64 event_code); | ||
276 | |||
277 | int (*write_event_config)(struct iio_dev *indio_dev, | ||
278 | u64 event_code, | ||
279 | int state); | ||
280 | |||
281 | int (*read_event_value)(struct iio_dev *indio_dev, | ||
282 | u64 event_code, | ||
283 | int *val); | ||
284 | int (*write_event_value)(struct iio_dev *indio_dev, | ||
285 | u64 event_code, | ||
286 | int val); | ||
287 | int (*validate_trigger)(struct iio_dev *indio_dev, | ||
288 | struct iio_trigger *trig); | ||
289 | int (*update_scan_mode)(struct iio_dev *indio_dev, | ||
290 | const unsigned long *scan_mask); | ||
291 | int (*debugfs_reg_access)(struct iio_dev *indio_dev, | ||
292 | unsigned reg, unsigned writeval, | ||
293 | unsigned *readval); | ||
294 | }; | ||
295 | |||
296 | /** | ||
297 | * struct iio_buffer_setup_ops - buffer setup related callbacks | ||
298 | * @preenable: [DRIVER] function to run prior to marking buffer enabled | ||
299 | * @postenable: [DRIVER] function to run after marking buffer enabled | ||
300 | * @predisable: [DRIVER] function to run prior to marking buffer | ||
301 | * disabled | ||
302 | * @postdisable: [DRIVER] function to run after marking buffer disabled | ||
303 | */ | ||
304 | struct iio_buffer_setup_ops { | ||
305 | int (*preenable)(struct iio_dev *); | ||
306 | int (*postenable)(struct iio_dev *); | ||
307 | int (*predisable)(struct iio_dev *); | ||
308 | int (*postdisable)(struct iio_dev *); | ||
309 | }; | ||
310 | |||
311 | /** | ||
312 | * struct iio_dev - industrial I/O device | ||
313 | * @id: [INTERN] used to identify device internally | ||
314 | * @modes: [DRIVER] operating modes supported by device | ||
315 | * @currentmode: [DRIVER] current operating mode | ||
316 | * @dev: [DRIVER] device structure, should be assigned a parent | ||
317 | * and owner | ||
318 | * @event_interface: [INTERN] event chrdevs associated with interrupt lines | ||
319 | * @buffer: [DRIVER] any buffer present | ||
320 | * @scan_bytes: [INTERN] num bytes captured to be fed to buffer demux | ||
321 | * @mlock: [INTERN] lock used to prevent simultaneous device state | ||
322 | * changes | ||
323 | * @available_scan_masks: [DRIVER] optional array of allowed bitmasks | ||
324 | * @masklength: [INTERN] the length of the mask established from | ||
325 | * channels | ||
326 | * @active_scan_mask: [INTERN] union of all scan masks requested by buffers | ||
327 | * @scan_timestamp: [INTERN] set if any buffers have requested timestamp | ||
328 | * @scan_index_timestamp:[INTERN] cache of the index to the timestamp | ||
329 | * @trig: [INTERN] current device trigger (buffer modes) | ||
330 | * @pollfunc: [DRIVER] function run on trigger being received | ||
331 | * @channels: [DRIVER] channel specification structure table | ||
332 | * @num_channels: [DRIVER] number of chanels specified in @channels. | ||
333 | * @channel_attr_list: [INTERN] keep track of automatically created channel | ||
334 | * attributes | ||
335 | * @chan_attr_group: [INTERN] group for all attrs in base directory | ||
336 | * @name: [DRIVER] name of the device. | ||
337 | * @info: [DRIVER] callbacks and constant info from driver | ||
338 | * @info_exist_lock: [INTERN] lock to prevent use during removal | ||
339 | * @setup_ops: [DRIVER] callbacks to call before and after buffer | ||
340 | * enable/disable | ||
341 | * @chrdev: [INTERN] associated character device | ||
342 | * @groups: [INTERN] attribute groups | ||
343 | * @groupcounter: [INTERN] index of next attribute group | ||
344 | * @flags: [INTERN] file ops related flags including busy flag. | ||
345 | * @debugfs_dentry: [INTERN] device specific debugfs dentry. | ||
346 | * @cached_reg_addr: [INTERN] cached register address for debugfs reads. | ||
347 | */ | ||
348 | struct iio_dev { | ||
349 | int id; | ||
350 | |||
351 | int modes; | ||
352 | int currentmode; | ||
353 | struct device dev; | ||
354 | |||
355 | struct iio_event_interface *event_interface; | ||
356 | |||
357 | struct iio_buffer *buffer; | ||
358 | int scan_bytes; | ||
359 | struct mutex mlock; | ||
360 | |||
361 | const unsigned long *available_scan_masks; | ||
362 | unsigned masklength; | ||
363 | const unsigned long *active_scan_mask; | ||
364 | bool scan_timestamp; | ||
365 | unsigned scan_index_timestamp; | ||
366 | struct iio_trigger *trig; | ||
367 | struct iio_poll_func *pollfunc; | ||
368 | |||
369 | struct iio_chan_spec const *channels; | ||
370 | int num_channels; | ||
371 | |||
372 | struct list_head channel_attr_list; | ||
373 | struct attribute_group chan_attr_group; | ||
374 | const char *name; | ||
375 | const struct iio_info *info; | ||
376 | struct mutex info_exist_lock; | ||
377 | const struct iio_buffer_setup_ops *setup_ops; | ||
378 | struct cdev chrdev; | ||
379 | #define IIO_MAX_GROUPS 6 | ||
380 | const struct attribute_group *groups[IIO_MAX_GROUPS + 1]; | ||
381 | int groupcounter; | ||
382 | |||
383 | unsigned long flags; | ||
384 | #if defined(CONFIG_DEBUG_FS) | ||
385 | struct dentry *debugfs_dentry; | ||
386 | unsigned cached_reg_addr; | ||
387 | #endif | ||
388 | }; | ||
389 | |||
390 | /** | ||
391 | * iio_find_channel_from_si() - get channel from its scan index | ||
392 | * @indio_dev: device | ||
393 | * @si: scan index to match | ||
394 | */ | ||
395 | const struct iio_chan_spec | ||
396 | *iio_find_channel_from_si(struct iio_dev *indio_dev, int si); | ||
397 | |||
398 | /** | ||
399 | * iio_device_register() - register a device with the IIO subsystem | ||
400 | * @indio_dev: Device structure filled by the device driver | ||
401 | **/ | ||
402 | int iio_device_register(struct iio_dev *indio_dev); | ||
403 | |||
404 | /** | ||
405 | * iio_device_unregister() - unregister a device from the IIO subsystem | ||
406 | * @indio_dev: Device structure representing the device. | ||
407 | **/ | ||
408 | void iio_device_unregister(struct iio_dev *indio_dev); | ||
409 | |||
410 | /** | ||
411 | * iio_push_event() - try to add event to the list for userspace reading | ||
412 | * @indio_dev: IIO device structure | ||
413 | * @ev_code: What event | ||
414 | * @timestamp: When the event occurred | ||
415 | **/ | ||
416 | int iio_push_event(struct iio_dev *indio_dev, u64 ev_code, s64 timestamp); | ||
417 | |||
418 | extern struct bus_type iio_bus_type; | ||
419 | |||
420 | /** | ||
421 | * iio_device_put() - reference counted deallocation of struct device | ||
422 | * @dev: the iio_device containing the device | ||
423 | **/ | ||
424 | static inline void iio_device_put(struct iio_dev *indio_dev) | ||
425 | { | ||
426 | if (indio_dev) | ||
427 | put_device(&indio_dev->dev); | ||
428 | }; | ||
429 | |||
430 | /** | ||
431 | * dev_to_iio_dev() - Get IIO device struct from a device struct | ||
432 | * @dev: The device embedded in the IIO device | ||
433 | * | ||
434 | * Note: The device must be a IIO device, otherwise the result is undefined. | ||
435 | */ | ||
436 | static inline struct iio_dev *dev_to_iio_dev(struct device *dev) | ||
437 | { | ||
438 | return container_of(dev, struct iio_dev, dev); | ||
439 | } | ||
440 | |||
441 | /* Can we make this smaller? */ | ||
442 | #define IIO_ALIGN L1_CACHE_BYTES | ||
443 | /** | ||
444 | * iio_device_alloc() - allocate an iio_dev from a driver | ||
445 | * @sizeof_priv: Space to allocate for private structure. | ||
446 | **/ | ||
447 | struct iio_dev *iio_device_alloc(int sizeof_priv); | ||
448 | |||
449 | static inline void *iio_priv(const struct iio_dev *indio_dev) | ||
450 | { | ||
451 | return (char *)indio_dev + ALIGN(sizeof(struct iio_dev), IIO_ALIGN); | ||
452 | } | ||
453 | |||
454 | static inline struct iio_dev *iio_priv_to_dev(void *priv) | ||
455 | { | ||
456 | return (struct iio_dev *)((char *)priv - | ||
457 | ALIGN(sizeof(struct iio_dev), IIO_ALIGN)); | ||
458 | } | ||
459 | |||
460 | /** | ||
461 | * iio_device_free() - free an iio_dev from a driver | ||
462 | * @dev: the iio_dev associated with the device | ||
463 | **/ | ||
464 | void iio_device_free(struct iio_dev *indio_dev); | ||
465 | |||
466 | /** | ||
467 | * iio_buffer_enabled() - helper function to test if the buffer is enabled | ||
468 | * @indio_dev: IIO device info structure for device | ||
469 | **/ | ||
470 | static inline bool iio_buffer_enabled(struct iio_dev *indio_dev) | ||
471 | { | ||
472 | return indio_dev->currentmode | ||
473 | & (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE); | ||
474 | }; | ||
475 | |||
476 | /** | ||
477 | * iio_get_debugfs_dentry() - helper function to get the debugfs_dentry | ||
478 | * @indio_dev: IIO device info structure for device | ||
479 | **/ | ||
480 | #if defined(CONFIG_DEBUG_FS) | ||
481 | static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev) | ||
482 | { | ||
483 | return indio_dev->debugfs_dentry; | ||
484 | }; | ||
485 | #else | ||
486 | static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev) | ||
487 | { | ||
488 | return NULL; | ||
489 | }; | ||
490 | #endif | ||
491 | |||
492 | #endif /* _INDUSTRIAL_IO_H_ */ | ||
diff --git a/include/linux/iio/kfifo_buf.h b/include/linux/iio/kfifo_buf.h new file mode 100644 index 000000000000..014d5a13b32b --- /dev/null +++ b/include/linux/iio/kfifo_buf.h | |||
@@ -0,0 +1,8 @@ | |||
1 | |||
2 | #include <linux/kfifo.h> | ||
3 | #include <linux/iio/iio.h> | ||
4 | #include <linux/iio/buffer.h> | ||
5 | |||
6 | struct iio_buffer *iio_kfifo_allocate(struct iio_dev *indio_dev); | ||
7 | void iio_kfifo_free(struct iio_buffer *r); | ||
8 | |||
diff --git a/include/linux/iio/machine.h b/include/linux/iio/machine.h new file mode 100644 index 000000000000..0b1f19bfdc44 --- /dev/null +++ b/include/linux/iio/machine.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* | ||
2 | * Industrial I/O in kernel access map definitions for board files. | ||
3 | * | ||
4 | * Copyright (c) 2011 Jonathan Cameron | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify it | ||
7 | * under the terms of the GNU General Public License version 2 as published by | ||
8 | * the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | /** | ||
12 | * struct iio_map - description of link between consumer and device channels | ||
13 | * @adc_channel_label: Label used to identify the channel on the provider. | ||
14 | * This is matched against the datasheet_name element | ||
15 | * of struct iio_chan_spec. | ||
16 | * @consumer_dev_name: Name to uniquely identify the consumer device. | ||
17 | * @consumer_channel: Unique name used to idenitify the channel on the | ||
18 | * consumer side. | ||
19 | */ | ||
20 | struct iio_map { | ||
21 | const char *adc_channel_label; | ||
22 | const char *consumer_dev_name; | ||
23 | const char *consumer_channel; | ||
24 | }; | ||
diff --git a/include/linux/iio/sysfs.h b/include/linux/iio/sysfs.h new file mode 100644 index 000000000000..bfedb73b850e --- /dev/null +++ b/include/linux/iio/sysfs.h | |||
@@ -0,0 +1,117 @@ | |||
1 | /* The industrial I/O core | ||
2 | * | ||
3 | *Copyright (c) 2008 Jonathan Cameron | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License version 2 as published by | ||
7 | * the Free Software Foundation. | ||
8 | * | ||
9 | * General attributes | ||
10 | */ | ||
11 | |||
12 | #ifndef _INDUSTRIAL_IO_SYSFS_H_ | ||
13 | #define _INDUSTRIAL_IO_SYSFS_H_ | ||
14 | |||
15 | struct iio_chan_spec; | ||
16 | |||
17 | /** | ||
18 | * struct iio_dev_attr - iio specific device attribute | ||
19 | * @dev_attr: underlying device attribute | ||
20 | * @address: associated register address | ||
21 | * @l: list head for maintaining list of dynamically created attrs. | ||
22 | */ | ||
23 | struct iio_dev_attr { | ||
24 | struct device_attribute dev_attr; | ||
25 | u64 address; | ||
26 | struct list_head l; | ||
27 | struct iio_chan_spec const *c; | ||
28 | }; | ||
29 | |||
30 | #define to_iio_dev_attr(_dev_attr) \ | ||
31 | container_of(_dev_attr, struct iio_dev_attr, dev_attr) | ||
32 | |||
33 | ssize_t iio_read_const_attr(struct device *dev, | ||
34 | struct device_attribute *attr, | ||
35 | char *len); | ||
36 | |||
37 | /** | ||
38 | * struct iio_const_attr - constant device specific attribute | ||
39 | * often used for things like available modes | ||
40 | * @string: attribute string | ||
41 | * @dev_attr: underlying device attribute | ||
42 | */ | ||
43 | struct iio_const_attr { | ||
44 | const char *string; | ||
45 | struct device_attribute dev_attr; | ||
46 | }; | ||
47 | |||
48 | #define to_iio_const_attr(_dev_attr) \ | ||
49 | container_of(_dev_attr, struct iio_const_attr, dev_attr) | ||
50 | |||
51 | /* Some attributes will be hard coded (device dependent) and not require an | ||
52 | address, in these cases pass a negative */ | ||
53 | #define IIO_ATTR(_name, _mode, _show, _store, _addr) \ | ||
54 | { .dev_attr = __ATTR(_name, _mode, _show, _store), \ | ||
55 | .address = _addr } | ||
56 | |||
57 | #define IIO_DEVICE_ATTR(_name, _mode, _show, _store, _addr) \ | ||
58 | struct iio_dev_attr iio_dev_attr_##_name \ | ||
59 | = IIO_ATTR(_name, _mode, _show, _store, _addr) | ||
60 | |||
61 | #define IIO_DEVICE_ATTR_NAMED(_vname, _name, _mode, _show, _store, _addr) \ | ||
62 | struct iio_dev_attr iio_dev_attr_##_vname \ | ||
63 | = IIO_ATTR(_name, _mode, _show, _store, _addr) | ||
64 | |||
65 | #define IIO_CONST_ATTR(_name, _string) \ | ||
66 | struct iio_const_attr iio_const_attr_##_name \ | ||
67 | = { .string = _string, \ | ||
68 | .dev_attr = __ATTR(_name, S_IRUGO, iio_read_const_attr, NULL)} | ||
69 | |||
70 | #define IIO_CONST_ATTR_NAMED(_vname, _name, _string) \ | ||
71 | struct iio_const_attr iio_const_attr_##_vname \ | ||
72 | = { .string = _string, \ | ||
73 | .dev_attr = __ATTR(_name, S_IRUGO, iio_read_const_attr, NULL)} | ||
74 | |||
75 | /* Generic attributes of onetype or another */ | ||
76 | /** | ||
77 | * IIO_DEV_ATTR_RESET: resets the device | ||
78 | **/ | ||
79 | #define IIO_DEV_ATTR_RESET(_store) \ | ||
80 | IIO_DEVICE_ATTR(reset, S_IWUSR, NULL, _store, 0) | ||
81 | |||
82 | /** | ||
83 | * IIO_DEV_ATTR_SAMP_FREQ - sets any internal clock frequency | ||
84 | * @_mode: sysfs file mode/permissions | ||
85 | * @_show: output method for the attribute | ||
86 | * @_store: input method for the attribute | ||
87 | **/ | ||
88 | #define IIO_DEV_ATTR_SAMP_FREQ(_mode, _show, _store) \ | ||
89 | IIO_DEVICE_ATTR(sampling_frequency, _mode, _show, _store, 0) | ||
90 | |||
91 | /** | ||
92 | * IIO_DEV_ATTR_SAMP_FREQ_AVAIL - list available sampling frequencies | ||
93 | * @_show: output method for the attribute | ||
94 | * | ||
95 | * May be mode dependent on some devices | ||
96 | **/ | ||
97 | #define IIO_DEV_ATTR_SAMP_FREQ_AVAIL(_show) \ | ||
98 | IIO_DEVICE_ATTR(sampling_frequency_available, S_IRUGO, _show, NULL, 0) | ||
99 | /** | ||
100 | * IIO_CONST_ATTR_AVAIL_SAMP_FREQ - list available sampling frequencies | ||
101 | * @_string: frequency string for the attribute | ||
102 | * | ||
103 | * Constant version | ||
104 | **/ | ||
105 | #define IIO_CONST_ATTR_SAMP_FREQ_AVAIL(_string) \ | ||
106 | IIO_CONST_ATTR(sampling_frequency_available, _string) | ||
107 | |||
108 | #define IIO_DEV_ATTR_TEMP_RAW(_show) \ | ||
109 | IIO_DEVICE_ATTR(in_temp_raw, S_IRUGO, _show, NULL, 0) | ||
110 | |||
111 | #define IIO_CONST_ATTR_TEMP_OFFSET(_string) \ | ||
112 | IIO_CONST_ATTR(in_temp_offset, _string) | ||
113 | |||
114 | #define IIO_CONST_ATTR_TEMP_SCALE(_string) \ | ||
115 | IIO_CONST_ATTR(in_temp_scale, _string) | ||
116 | |||
117 | #endif /* _INDUSTRIAL_IO_SYSFS_H_ */ | ||
diff --git a/include/linux/iio/trigger.h b/include/linux/iio/trigger.h new file mode 100644 index 000000000000..a9819940a84c --- /dev/null +++ b/include/linux/iio/trigger.h | |||
@@ -0,0 +1,119 @@ | |||
1 | /* The industrial I/O core, trigger handling functions | ||
2 | * | ||
3 | * Copyright (c) 2008 Jonathan Cameron | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License version 2 as published by | ||
7 | * the Free Software Foundation. | ||
8 | */ | ||
9 | #include <linux/irq.h> | ||
10 | #include <linux/module.h> | ||
11 | |||
12 | #ifndef _IIO_TRIGGER_H_ | ||
13 | #define _IIO_TRIGGER_H_ | ||
14 | |||
15 | struct iio_subirq { | ||
16 | bool enabled; | ||
17 | }; | ||
18 | |||
19 | /** | ||
20 | * struct iio_trigger_ops - operations structure for an iio_trigger. | ||
21 | * @owner: used to monitor usage count of the trigger. | ||
22 | * @set_trigger_state: switch on/off the trigger on demand | ||
23 | * @try_reenable: function to reenable the trigger when the | ||
24 | * use count is zero (may be NULL) | ||
25 | * @validate_device: function to validate the device when the | ||
26 | * current trigger gets changed. | ||
27 | * | ||
28 | * This is typically static const within a driver and shared by | ||
29 | * instances of a given device. | ||
30 | **/ | ||
31 | struct iio_trigger_ops { | ||
32 | struct module *owner; | ||
33 | int (*set_trigger_state)(struct iio_trigger *trig, bool state); | ||
34 | int (*try_reenable)(struct iio_trigger *trig); | ||
35 | int (*validate_device)(struct iio_trigger *trig, | ||
36 | struct iio_dev *indio_dev); | ||
37 | }; | ||
38 | |||
39 | |||
40 | /** | ||
41 | * struct iio_trigger - industrial I/O trigger device | ||
42 | * | ||
43 | * @id: [INTERN] unique id number | ||
44 | * @name: [DRIVER] unique name | ||
45 | * @dev: [DRIVER] associated device (if relevant) | ||
46 | * @private_data: [DRIVER] device specific data | ||
47 | * @list: [INTERN] used in maintenance of global trigger list | ||
48 | * @alloc_list: [DRIVER] used for driver specific trigger list | ||
49 | * @use_count: use count for the trigger | ||
50 | * @subirq_chip: [INTERN] associate 'virtual' irq chip. | ||
51 | * @subirq_base: [INTERN] base number for irqs provided by trigger. | ||
52 | * @subirqs: [INTERN] information about the 'child' irqs. | ||
53 | * @pool: [INTERN] bitmap of irqs currently in use. | ||
54 | * @pool_lock: [INTERN] protection of the irq pool. | ||
55 | **/ | ||
56 | struct iio_trigger { | ||
57 | const struct iio_trigger_ops *ops; | ||
58 | int id; | ||
59 | const char *name; | ||
60 | struct device dev; | ||
61 | |||
62 | void *private_data; | ||
63 | struct list_head list; | ||
64 | struct list_head alloc_list; | ||
65 | int use_count; | ||
66 | |||
67 | struct irq_chip subirq_chip; | ||
68 | int subirq_base; | ||
69 | |||
70 | struct iio_subirq subirqs[CONFIG_IIO_CONSUMERS_PER_TRIGGER]; | ||
71 | unsigned long pool[BITS_TO_LONGS(CONFIG_IIO_CONSUMERS_PER_TRIGGER)]; | ||
72 | struct mutex pool_lock; | ||
73 | }; | ||
74 | |||
75 | |||
76 | static inline struct iio_trigger *to_iio_trigger(struct device *d) | ||
77 | { | ||
78 | return container_of(d, struct iio_trigger, dev); | ||
79 | }; | ||
80 | |||
81 | static inline void iio_trigger_put(struct iio_trigger *trig) | ||
82 | { | ||
83 | module_put(trig->ops->owner); | ||
84 | put_device(&trig->dev); | ||
85 | }; | ||
86 | |||
87 | static inline void iio_trigger_get(struct iio_trigger *trig) | ||
88 | { | ||
89 | get_device(&trig->dev); | ||
90 | __module_get(trig->ops->owner); | ||
91 | }; | ||
92 | |||
93 | /** | ||
94 | * iio_trigger_register() - register a trigger with the IIO core | ||
95 | * @trig_info: trigger to be registered | ||
96 | **/ | ||
97 | int iio_trigger_register(struct iio_trigger *trig_info); | ||
98 | |||
99 | /** | ||
100 | * iio_trigger_unregister() - unregister a trigger from the core | ||
101 | * @trig_info: trigger to be unregistered | ||
102 | **/ | ||
103 | void iio_trigger_unregister(struct iio_trigger *trig_info); | ||
104 | |||
105 | /** | ||
106 | * iio_trigger_poll() - called on a trigger occurring | ||
107 | * @trig: trigger which occurred | ||
108 | * | ||
109 | * Typically called in relevant hardware interrupt handler. | ||
110 | **/ | ||
111 | void iio_trigger_poll(struct iio_trigger *trig, s64 time); | ||
112 | void iio_trigger_poll_chained(struct iio_trigger *trig, s64 time); | ||
113 | |||
114 | irqreturn_t iio_trigger_generic_data_rdy_poll(int irq, void *private); | ||
115 | |||
116 | __printf(1, 2) struct iio_trigger *iio_trigger_alloc(const char *fmt, ...); | ||
117 | void iio_trigger_free(struct iio_trigger *trig); | ||
118 | |||
119 | #endif /* _IIO_TRIGGER_H_ */ | ||
diff --git a/include/linux/iio/trigger_consumer.h b/include/linux/iio/trigger_consumer.h new file mode 100644 index 000000000000..60d64b356945 --- /dev/null +++ b/include/linux/iio/trigger_consumer.h | |||
@@ -0,0 +1,52 @@ | |||
1 | /* The industrial I/O core, trigger consumer functions | ||
2 | * | ||
3 | * Copyright (c) 2008-2011 Jonathan Cameron | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License version 2 as published by | ||
7 | * the Free Software Foundation. | ||
8 | */ | ||
9 | |||
10 | /** | ||
11 | * struct iio_poll_func - poll function pair | ||
12 | * | ||
13 | * @indio_dev: data specific to device (passed into poll func) | ||
14 | * @h: the function that is actually run on trigger | ||
15 | * @thread: threaded interrupt part | ||
16 | * @type: the type of interrupt (basically if oneshot) | ||
17 | * @name: name used to identify the trigger consumer. | ||
18 | * @irq: the corresponding irq as allocated from the | ||
19 | * trigger pool | ||
20 | * @timestamp: some devices need a timestamp grabbed as soon | ||
21 | * as possible after the trigger - hence handler | ||
22 | * passes it via here. | ||
23 | **/ | ||
24 | struct iio_poll_func { | ||
25 | struct iio_dev *indio_dev; | ||
26 | irqreturn_t (*h)(int irq, void *p); | ||
27 | irqreturn_t (*thread)(int irq, void *p); | ||
28 | int type; | ||
29 | char *name; | ||
30 | int irq; | ||
31 | s64 timestamp; | ||
32 | }; | ||
33 | |||
34 | |||
35 | struct iio_poll_func | ||
36 | *iio_alloc_pollfunc(irqreturn_t (*h)(int irq, void *p), | ||
37 | irqreturn_t (*thread)(int irq, void *p), | ||
38 | int type, | ||
39 | struct iio_dev *indio_dev, | ||
40 | const char *fmt, | ||
41 | ...); | ||
42 | void iio_dealloc_pollfunc(struct iio_poll_func *pf); | ||
43 | irqreturn_t iio_pollfunc_store_time(int irq, void *p); | ||
44 | |||
45 | void iio_trigger_notify_done(struct iio_trigger *trig); | ||
46 | |||
47 | /* | ||
48 | * Two functions for common case where all that happens is a pollfunc | ||
49 | * is attached and detached from a trigger | ||
50 | */ | ||
51 | int iio_triggered_buffer_postenable(struct iio_dev *indio_dev); | ||
52 | int iio_triggered_buffer_predisable(struct iio_dev *indio_dev); | ||
diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h new file mode 100644 index 000000000000..1b073b1cc7c2 --- /dev/null +++ b/include/linux/iio/types.h | |||
@@ -0,0 +1,55 @@ | |||
1 | /* industrial I/O data types needed both in and out of kernel | ||
2 | * | ||
3 | * Copyright (c) 2008 Jonathan Cameron | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License version 2 as published by | ||
7 | * the Free Software Foundation. | ||
8 | */ | ||
9 | |||
10 | #ifndef _IIO_TYPES_H_ | ||
11 | #define _IIO_TYPES_H_ | ||
12 | |||
13 | enum iio_chan_type { | ||
14 | /* real channel types */ | ||
15 | IIO_VOLTAGE, | ||
16 | IIO_CURRENT, | ||
17 | IIO_POWER, | ||
18 | IIO_ACCEL, | ||
19 | IIO_ANGL_VEL, | ||
20 | IIO_MAGN, | ||
21 | IIO_LIGHT, | ||
22 | IIO_INTENSITY, | ||
23 | IIO_PROXIMITY, | ||
24 | IIO_TEMP, | ||
25 | IIO_INCLI, | ||
26 | IIO_ROT, | ||
27 | IIO_ANGL, | ||
28 | IIO_TIMESTAMP, | ||
29 | IIO_CAPACITANCE, | ||
30 | IIO_ALTVOLTAGE, | ||
31 | }; | ||
32 | |||
33 | enum iio_modifier { | ||
34 | IIO_NO_MOD, | ||
35 | IIO_MOD_X, | ||
36 | IIO_MOD_Y, | ||
37 | IIO_MOD_Z, | ||
38 | IIO_MOD_X_AND_Y, | ||
39 | IIO_MOD_X_AND_Z, | ||
40 | IIO_MOD_Y_AND_Z, | ||
41 | IIO_MOD_X_AND_Y_AND_Z, | ||
42 | IIO_MOD_X_OR_Y, | ||
43 | IIO_MOD_X_OR_Z, | ||
44 | IIO_MOD_Y_OR_Z, | ||
45 | IIO_MOD_X_OR_Y_OR_Z, | ||
46 | IIO_MOD_LIGHT_BOTH, | ||
47 | IIO_MOD_LIGHT_IR, | ||
48 | }; | ||
49 | |||
50 | #define IIO_VAL_INT 1 | ||
51 | #define IIO_VAL_INT_PLUS_MICRO 2 | ||
52 | #define IIO_VAL_INT_PLUS_NANO 3 | ||
53 | #define IIO_VAL_INT_PLUS_MICRO_DB 4 | ||
54 | |||
55 | #endif /* _IIO_TYPES_H_ */ | ||
diff --git a/include/linux/mei.h b/include/linux/mei.h new file mode 100644 index 000000000000..bc0d8b69c49e --- /dev/null +++ b/include/linux/mei.h | |||
@@ -0,0 +1,110 @@ | |||
1 | /****************************************************************************** | ||
2 | * Intel Management Engine Interface (Intel MEI) Linux driver | ||
3 | * Intel MEI Interface Header | ||
4 | * | ||
5 | * This file is provided under a dual BSD/GPLv2 license. When using or | ||
6 | * redistributing this file, you may do so under either license. | ||
7 | * | ||
8 | * GPL LICENSE SUMMARY | ||
9 | * | ||
10 | * Copyright(c) 2003 - 2012 Intel Corporation. All rights reserved. | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of version 2 of the GNU General Public License as | ||
14 | * published by the Free Software Foundation. | ||
15 | * | ||
16 | * This program is distributed in the hope that it will be useful, but | ||
17 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
19 | * General Public License for more details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU General Public License | ||
22 | * along with this program; if not, write to the Free Software | ||
23 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, | ||
24 | * USA | ||
25 | * | ||
26 | * The full GNU General Public License is included in this distribution | ||
27 | * in the file called LICENSE.GPL. | ||
28 | * | ||
29 | * Contact Information: | ||
30 | * Intel Corporation. | ||
31 | * linux-mei@linux.intel.com | ||
32 | * http://www.intel.com | ||
33 | * | ||
34 | * BSD LICENSE | ||
35 | * | ||
36 | * Copyright(c) 2003 - 2012 Intel Corporation. All rights reserved. | ||
37 | * All rights reserved. | ||
38 | * | ||
39 | * Redistribution and use in source and binary forms, with or without | ||
40 | * modification, are permitted provided that the following conditions | ||
41 | * are met: | ||
42 | * | ||
43 | * * Redistributions of source code must retain the above copyright | ||
44 | * notice, this list of conditions and the following disclaimer. | ||
45 | * * Redistributions in binary form must reproduce the above copyright | ||
46 | * notice, this list of conditions and the following disclaimer in | ||
47 | * the documentation and/or other materials provided with the | ||
48 | * distribution. | ||
49 | * * Neither the name Intel Corporation nor the names of its | ||
50 | * contributors may be used to endorse or promote products derived | ||
51 | * from this software without specific prior written permission. | ||
52 | * | ||
53 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
54 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
55 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
56 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
57 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
58 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
59 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
60 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
61 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
62 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
63 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
64 | * | ||
65 | *****************************************************************************/ | ||
66 | |||
67 | #ifndef _LINUX_MEI_H | ||
68 | #define _LINUX_MEI_H | ||
69 | |||
70 | #include <linux/uuid.h> | ||
71 | |||
72 | /* | ||
73 | * This IOCTL is used to associate the current file descriptor with a | ||
74 | * FW Client (given by UUID). This opens a communication channel | ||
75 | * between a host client and a FW client. From this point every read and write | ||
76 | * will communicate with the associated FW client. | ||
77 | * Only in close() (file_operation release()) the communication between | ||
78 | * the clients is disconnected | ||
79 | * | ||
80 | * The IOCTL argument is a struct with a union that contains | ||
81 | * the input parameter and the output parameter for this IOCTL. | ||
82 | * | ||
83 | * The input parameter is UUID of the FW Client. | ||
84 | * The output parameter is the properties of the FW client | ||
85 | * (FW protocol version and max message size). | ||
86 | * | ||
87 | */ | ||
88 | #define IOCTL_MEI_CONNECT_CLIENT \ | ||
89 | _IOWR('H' , 0x01, struct mei_connect_client_data) | ||
90 | |||
91 | /* | ||
92 | * Intel MEI client information struct | ||
93 | */ | ||
94 | struct mei_client { | ||
95 | __u32 max_msg_length; | ||
96 | __u8 protocol_version; | ||
97 | __u8 reserved[3]; | ||
98 | }; | ||
99 | |||
100 | /* | ||
101 | * IOCTL Connect Client Data structure | ||
102 | */ | ||
103 | struct mei_connect_client_data { | ||
104 | union { | ||
105 | uuid_le in_client_uuid; | ||
106 | struct mei_client out_client_properties; | ||
107 | }; | ||
108 | }; | ||
109 | |||
110 | #endif /* _LINUX_MEI_H */ | ||
diff --git a/include/linux/platform_data/at91_adc.h b/include/linux/platform_data/at91_adc.h new file mode 100644 index 000000000000..e15745b4f3a5 --- /dev/null +++ b/include/linux/platform_data/at91_adc.h | |||
@@ -0,0 +1,61 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Free Electrons | ||
3 | * | ||
4 | * Licensed under the GPLv2 or later. | ||
5 | */ | ||
6 | |||
7 | #ifndef _AT91_ADC_H_ | ||
8 | #define _AT91_ADC_H_ | ||
9 | |||
10 | /** | ||
11 | * struct at91_adc_reg_desc - Various informations relative to registers | ||
12 | * @channel_base: Base offset for the channel data registers | ||
13 | * @drdy_mask: Mask of the DRDY field in the relevant registers | ||
14 | (Interruptions registers mostly) | ||
15 | * @status_register: Offset of the Interrupt Status Register | ||
16 | * @trigger_register: Offset of the Trigger setup register | ||
17 | */ | ||
18 | struct at91_adc_reg_desc { | ||
19 | u8 channel_base; | ||
20 | u32 drdy_mask; | ||
21 | u8 status_register; | ||
22 | u8 trigger_register; | ||
23 | }; | ||
24 | |||
25 | /** | ||
26 | * struct at91_adc_trigger - description of triggers | ||
27 | * @name: name of the trigger advertised to the user | ||
28 | * @value: value to set in the ADC's trigger setup register | ||
29 | to enable the trigger | ||
30 | * @is_external: Does the trigger rely on an external pin? | ||
31 | */ | ||
32 | struct at91_adc_trigger { | ||
33 | const char *name; | ||
34 | u8 value; | ||
35 | bool is_external; | ||
36 | }; | ||
37 | |||
38 | /** | ||
39 | * struct at91_adc_data - platform data for ADC driver | ||
40 | * @channels_used: channels in use on the board as a bitmask | ||
41 | * @num_channels: global number of channels available on the board | ||
42 | * @registers: Registers definition on the board | ||
43 | * @startup_time: startup time of the ADC in microseconds | ||
44 | * @trigger_list: Triggers available in the ADC | ||
45 | * @trigger_number: Number of triggers available in the ADC | ||
46 | * @use_external_triggers: does the board has external triggers availables | ||
47 | * @vref: Reference voltage for the ADC in millivolts | ||
48 | */ | ||
49 | struct at91_adc_data { | ||
50 | unsigned long channels_used; | ||
51 | u8 num_channels; | ||
52 | struct at91_adc_reg_desc *registers; | ||
53 | u8 startup_time; | ||
54 | struct at91_adc_trigger *trigger_list; | ||
55 | u8 trigger_number; | ||
56 | bool use_external_triggers; | ||
57 | u16 vref; | ||
58 | }; | ||
59 | |||
60 | extern void __init at91_add_device_adc(struct at91_adc_data *data); | ||
61 | #endif | ||
diff --git a/include/linux/pstore_ram.h b/include/linux/pstore_ram.h new file mode 100644 index 000000000000..7ed7fd4dba49 --- /dev/null +++ b/include/linux/pstore_ram.h | |||
@@ -0,0 +1,98 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Marco Stornelli <marco.stornelli@gmail.com> | ||
3 | * Copyright (C) 2011 Kees Cook <keescook@chromium.org> | ||
4 | * Copyright (C) 2011 Google, Inc. | ||
5 | * | ||
6 | * This software is licensed under the terms of the GNU General Public | ||
7 | * License version 2, as published by the Free Software Foundation, and | ||
8 | * may be copied, distributed, and modified under those terms. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | */ | ||
16 | |||
17 | #ifndef __LINUX_PSTORE_RAM_H__ | ||
18 | #define __LINUX_PSTORE_RAM_H__ | ||
19 | |||
20 | #include <linux/device.h> | ||
21 | #include <linux/kernel.h> | ||
22 | #include <linux/list.h> | ||
23 | #include <linux/types.h> | ||
24 | #include <linux/init.h> | ||
25 | |||
26 | struct persistent_ram_buffer; | ||
27 | |||
28 | struct persistent_ram_descriptor { | ||
29 | const char *name; | ||
30 | phys_addr_t size; | ||
31 | }; | ||
32 | |||
33 | struct persistent_ram { | ||
34 | phys_addr_t start; | ||
35 | phys_addr_t size; | ||
36 | |||
37 | int num_descs; | ||
38 | struct persistent_ram_descriptor *descs; | ||
39 | |||
40 | struct list_head node; | ||
41 | }; | ||
42 | |||
43 | struct persistent_ram_zone { | ||
44 | phys_addr_t paddr; | ||
45 | size_t size; | ||
46 | void *vaddr; | ||
47 | struct persistent_ram_buffer *buffer; | ||
48 | size_t buffer_size; | ||
49 | |||
50 | /* ECC correction */ | ||
51 | bool ecc; | ||
52 | char *par_buffer; | ||
53 | char *par_header; | ||
54 | struct rs_control *rs_decoder; | ||
55 | int corrected_bytes; | ||
56 | int bad_blocks; | ||
57 | int ecc_block_size; | ||
58 | int ecc_size; | ||
59 | int ecc_symsize; | ||
60 | int ecc_poly; | ||
61 | |||
62 | char *old_log; | ||
63 | size_t old_log_size; | ||
64 | }; | ||
65 | |||
66 | int persistent_ram_early_init(struct persistent_ram *ram); | ||
67 | |||
68 | struct persistent_ram_zone * __init persistent_ram_new(phys_addr_t start, | ||
69 | size_t size, | ||
70 | bool ecc); | ||
71 | void persistent_ram_free(struct persistent_ram_zone *prz); | ||
72 | struct persistent_ram_zone *persistent_ram_init_ringbuffer(struct device *dev, | ||
73 | bool ecc); | ||
74 | |||
75 | int persistent_ram_write(struct persistent_ram_zone *prz, const void *s, | ||
76 | unsigned int count); | ||
77 | |||
78 | size_t persistent_ram_old_size(struct persistent_ram_zone *prz); | ||
79 | void *persistent_ram_old(struct persistent_ram_zone *prz); | ||
80 | void persistent_ram_free_old(struct persistent_ram_zone *prz); | ||
81 | ssize_t persistent_ram_ecc_string(struct persistent_ram_zone *prz, | ||
82 | char *str, size_t len); | ||
83 | |||
84 | /* | ||
85 | * Ramoops platform data | ||
86 | * @mem_size memory size for ramoops | ||
87 | * @mem_address physical memory address to contain ramoops | ||
88 | */ | ||
89 | |||
90 | struct ramoops_platform_data { | ||
91 | unsigned long mem_size; | ||
92 | unsigned long mem_address; | ||
93 | unsigned long record_size; | ||
94 | int dump_oops; | ||
95 | bool ecc; | ||
96 | }; | ||
97 | |||
98 | #endif | ||
diff --git a/include/linux/ramoops.h b/include/linux/ramoops.h deleted file mode 100644 index 484fef81cd3a..000000000000 --- a/include/linux/ramoops.h +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | #ifndef __RAMOOPS_H | ||
2 | #define __RAMOOPS_H | ||
3 | |||
4 | /* | ||
5 | * Ramoops platform data | ||
6 | * @mem_size memory size for ramoops | ||
7 | * @mem_address physical memory address to contain ramoops | ||
8 | */ | ||
9 | |||
10 | struct ramoops_platform_data { | ||
11 | unsigned long mem_size; | ||
12 | unsigned long mem_address; | ||
13 | unsigned long record_size; | ||
14 | int dump_oops; | ||
15 | }; | ||
16 | |||
17 | #endif | ||
diff --git a/include/linux/uuid.h b/include/linux/uuid.h index 5b7efbfcee4e..f86c37bfd4a0 100644 --- a/include/linux/uuid.h +++ b/include/linux/uuid.h | |||
@@ -54,6 +54,8 @@ typedef struct { | |||
54 | UUID_BE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, \ | 54 | UUID_BE(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, \ |
55 | 0x00, 0x00, 0x00, 0x00) | 55 | 0x00, 0x00, 0x00, 0x00) |
56 | 56 | ||
57 | #ifdef __KERNEL__ | ||
58 | |||
57 | static inline int uuid_le_cmp(const uuid_le u1, const uuid_le u2) | 59 | static inline int uuid_le_cmp(const uuid_le u1, const uuid_le u2) |
58 | { | 60 | { |
59 | return memcmp(&u1, &u2, sizeof(uuid_le)); | 61 | return memcmp(&u1, &u2, sizeof(uuid_le)); |
@@ -67,4 +69,6 @@ static inline int uuid_be_cmp(const uuid_be u1, const uuid_be u2) | |||
67 | extern void uuid_le_gen(uuid_le *u); | 69 | extern void uuid_le_gen(uuid_le *u); |
68 | extern void uuid_be_gen(uuid_be *u); | 70 | extern void uuid_be_gen(uuid_be *u); |
69 | 71 | ||
72 | #endif /* __KERNEL__ */ | ||
73 | |||
70 | #endif | 74 | #endif |
diff --git a/include/linux/vme.h b/include/linux/vme.h new file mode 100644 index 000000000000..c9d65bf14cec --- /dev/null +++ b/include/linux/vme.h | |||
@@ -0,0 +1,174 @@ | |||
1 | #ifndef _VME_H_ | ||
2 | #define _VME_H_ | ||
3 | |||
4 | /* Resource Type */ | ||
5 | enum vme_resource_type { | ||
6 | VME_MASTER, | ||
7 | VME_SLAVE, | ||
8 | VME_DMA, | ||
9 | VME_LM | ||
10 | }; | ||
11 | |||
12 | /* VME Address Spaces */ | ||
13 | #define VME_A16 0x1 | ||
14 | #define VME_A24 0x2 | ||
15 | #define VME_A32 0x4 | ||
16 | #define VME_A64 0x8 | ||
17 | #define VME_CRCSR 0x10 | ||
18 | #define VME_USER1 0x20 | ||
19 | #define VME_USER2 0x40 | ||
20 | #define VME_USER3 0x80 | ||
21 | #define VME_USER4 0x100 | ||
22 | |||
23 | #define VME_A16_MAX 0x10000ULL | ||
24 | #define VME_A24_MAX 0x1000000ULL | ||
25 | #define VME_A32_MAX 0x100000000ULL | ||
26 | #define VME_A64_MAX 0x10000000000000000ULL | ||
27 | #define VME_CRCSR_MAX 0x1000000ULL | ||
28 | |||
29 | |||
30 | /* VME Cycle Types */ | ||
31 | #define VME_SCT 0x1 | ||
32 | #define VME_BLT 0x2 | ||
33 | #define VME_MBLT 0x4 | ||
34 | #define VME_2eVME 0x8 | ||
35 | #define VME_2eSST 0x10 | ||
36 | #define VME_2eSSTB 0x20 | ||
37 | |||
38 | #define VME_2eSST160 0x100 | ||
39 | #define VME_2eSST267 0x200 | ||
40 | #define VME_2eSST320 0x400 | ||
41 | |||
42 | #define VME_SUPER 0x1000 | ||
43 | #define VME_USER 0x2000 | ||
44 | #define VME_PROG 0x4000 | ||
45 | #define VME_DATA 0x8000 | ||
46 | |||
47 | /* VME Data Widths */ | ||
48 | #define VME_D8 0x1 | ||
49 | #define VME_D16 0x2 | ||
50 | #define VME_D32 0x4 | ||
51 | #define VME_D64 0x8 | ||
52 | |||
53 | /* Arbitration Scheduling Modes */ | ||
54 | #define VME_R_ROBIN_MODE 0x1 | ||
55 | #define VME_PRIORITY_MODE 0x2 | ||
56 | |||
57 | #define VME_DMA_PATTERN (1<<0) | ||
58 | #define VME_DMA_PCI (1<<1) | ||
59 | #define VME_DMA_VME (1<<2) | ||
60 | |||
61 | #define VME_DMA_PATTERN_BYTE (1<<0) | ||
62 | #define VME_DMA_PATTERN_WORD (1<<1) | ||
63 | #define VME_DMA_PATTERN_INCREMENT (1<<2) | ||
64 | |||
65 | #define VME_DMA_VME_TO_MEM (1<<0) | ||
66 | #define VME_DMA_MEM_TO_VME (1<<1) | ||
67 | #define VME_DMA_VME_TO_VME (1<<2) | ||
68 | #define VME_DMA_MEM_TO_MEM (1<<3) | ||
69 | #define VME_DMA_PATTERN_TO_VME (1<<4) | ||
70 | #define VME_DMA_PATTERN_TO_MEM (1<<5) | ||
71 | |||
72 | struct vme_dma_attr { | ||
73 | u32 type; | ||
74 | void *private; | ||
75 | }; | ||
76 | |||
77 | struct vme_resource { | ||
78 | enum vme_resource_type type; | ||
79 | struct list_head *entry; | ||
80 | }; | ||
81 | |||
82 | extern struct bus_type vme_bus_type; | ||
83 | |||
84 | /* VME_MAX_BRIDGES comes from the type of vme_bus_numbers */ | ||
85 | #define VME_MAX_BRIDGES (sizeof(unsigned int)*8) | ||
86 | #define VME_MAX_SLOTS 32 | ||
87 | |||
88 | #define VME_SLOT_CURRENT -1 | ||
89 | #define VME_SLOT_ALL -2 | ||
90 | |||
91 | /** | ||
92 | * Structure representing a VME device | ||
93 | * @num: The device number | ||
94 | * @bridge: Pointer to the bridge device this device is on | ||
95 | * @dev: Internal device structure | ||
96 | * @drv_list: List of devices (per driver) | ||
97 | * @bridge_list: List of devices (per bridge) | ||
98 | */ | ||
99 | struct vme_dev { | ||
100 | int num; | ||
101 | struct vme_bridge *bridge; | ||
102 | struct device dev; | ||
103 | struct list_head drv_list; | ||
104 | struct list_head bridge_list; | ||
105 | }; | ||
106 | |||
107 | struct vme_driver { | ||
108 | struct list_head node; | ||
109 | const char *name; | ||
110 | int (*match)(struct vme_dev *); | ||
111 | int (*probe)(struct vme_dev *); | ||
112 | int (*remove)(struct vme_dev *); | ||
113 | void (*shutdown)(void); | ||
114 | struct device_driver driver; | ||
115 | struct list_head devices; | ||
116 | }; | ||
117 | |||
118 | void *vme_alloc_consistent(struct vme_resource *, size_t, dma_addr_t *); | ||
119 | void vme_free_consistent(struct vme_resource *, size_t, void *, | ||
120 | dma_addr_t); | ||
121 | |||
122 | size_t vme_get_size(struct vme_resource *); | ||
123 | |||
124 | struct vme_resource *vme_slave_request(struct vme_dev *, u32, u32); | ||
125 | int vme_slave_set(struct vme_resource *, int, unsigned long long, | ||
126 | unsigned long long, dma_addr_t, u32, u32); | ||
127 | int vme_slave_get(struct vme_resource *, int *, unsigned long long *, | ||
128 | unsigned long long *, dma_addr_t *, u32 *, u32 *); | ||
129 | void vme_slave_free(struct vme_resource *); | ||
130 | |||
131 | struct vme_resource *vme_master_request(struct vme_dev *, u32, u32, u32); | ||
132 | int vme_master_set(struct vme_resource *, int, unsigned long long, | ||
133 | unsigned long long, u32, u32, u32); | ||
134 | int vme_master_get(struct vme_resource *, int *, unsigned long long *, | ||
135 | unsigned long long *, u32 *, u32 *, u32 *); | ||
136 | ssize_t vme_master_read(struct vme_resource *, void *, size_t, loff_t); | ||
137 | ssize_t vme_master_write(struct vme_resource *, void *, size_t, loff_t); | ||
138 | unsigned int vme_master_rmw(struct vme_resource *, unsigned int, unsigned int, | ||
139 | unsigned int, loff_t); | ||
140 | void vme_master_free(struct vme_resource *); | ||
141 | |||
142 | struct vme_resource *vme_dma_request(struct vme_dev *, u32); | ||
143 | struct vme_dma_list *vme_new_dma_list(struct vme_resource *); | ||
144 | struct vme_dma_attr *vme_dma_pattern_attribute(u32, u32); | ||
145 | struct vme_dma_attr *vme_dma_pci_attribute(dma_addr_t); | ||
146 | struct vme_dma_attr *vme_dma_vme_attribute(unsigned long long, u32, u32, u32); | ||
147 | void vme_dma_free_attribute(struct vme_dma_attr *); | ||
148 | int vme_dma_list_add(struct vme_dma_list *, struct vme_dma_attr *, | ||
149 | struct vme_dma_attr *, size_t); | ||
150 | int vme_dma_list_exec(struct vme_dma_list *); | ||
151 | int vme_dma_list_free(struct vme_dma_list *); | ||
152 | int vme_dma_free(struct vme_resource *); | ||
153 | |||
154 | int vme_irq_request(struct vme_dev *, int, int, | ||
155 | void (*callback)(int, int, void *), void *); | ||
156 | void vme_irq_free(struct vme_dev *, int, int); | ||
157 | int vme_irq_generate(struct vme_dev *, int, int); | ||
158 | |||
159 | struct vme_resource *vme_lm_request(struct vme_dev *); | ||
160 | int vme_lm_count(struct vme_resource *); | ||
161 | int vme_lm_set(struct vme_resource *, unsigned long long, u32, u32); | ||
162 | int vme_lm_get(struct vme_resource *, unsigned long long *, u32 *, u32 *); | ||
163 | int vme_lm_attach(struct vme_resource *, int, void (*callback)(int)); | ||
164 | int vme_lm_detach(struct vme_resource *, int); | ||
165 | void vme_lm_free(struct vme_resource *); | ||
166 | |||
167 | int vme_slot_get(struct vme_dev *); | ||
168 | |||
169 | int vme_register_driver(struct vme_driver *, unsigned int); | ||
170 | void vme_unregister_driver(struct vme_driver *); | ||
171 | |||
172 | |||
173 | #endif /* _VME_H_ */ | ||
174 | |||