diff options
Diffstat (limited to 'include/media/lirc_dev.h')
-rw-r--r-- | include/media/lirc_dev.h | 120 |
1 files changed, 68 insertions, 52 deletions
diff --git a/include/media/lirc_dev.h b/include/media/lirc_dev.h index 05e7ad5d2c8b..0ab59a571fee 100644 --- a/include/media/lirc_dev.h +++ b/include/media/lirc_dev.h | |||
@@ -118,6 +118,71 @@ static inline unsigned int lirc_buffer_write(struct lirc_buffer *buf, | |||
118 | return ret; | 118 | return ret; |
119 | } | 119 | } |
120 | 120 | ||
121 | /** | ||
122 | * struct lirc_driver - Defines the parameters on a LIRC driver | ||
123 | * | ||
124 | * @name: this string will be used for logs | ||
125 | * | ||
126 | * @minor: indicates minor device (/dev/lirc) number for | ||
127 | * registered driver if caller fills it with negative | ||
128 | * value, then the first free minor number will be used | ||
129 | * (if available). | ||
130 | * | ||
131 | * @code_length: length of the remote control key code expressed in bits. | ||
132 | * | ||
133 | * @buffer_size: Number of FIFO buffers with @chunk_size size. If zero, | ||
134 | * creates a buffer with BUFLEN size (16 bytes). | ||
135 | * | ||
136 | * @sample_rate: if zero, the device will wait for an event with a new | ||
137 | * code to be parsed. Otherwise, specifies the sample | ||
138 | * rate for polling. Value should be between 0 | ||
139 | * and HZ. If equal to HZ, it would mean one polling per | ||
140 | * second. | ||
141 | * | ||
142 | * @features: lirc compatible hardware features, like LIRC_MODE_RAW, | ||
143 | * LIRC_CAN_*, as defined at include/media/lirc.h. | ||
144 | * | ||
145 | * @chunk_size: Size of each FIFO buffer. | ||
146 | * | ||
147 | * @data: it may point to any driver data and this pointer will | ||
148 | * be passed to all callback functions. | ||
149 | * | ||
150 | * @min_timeout: Minimum timeout for record. Valid only if | ||
151 | * LIRC_CAN_SET_REC_TIMEOUT is defined. | ||
152 | * | ||
153 | * @max_timeout: Maximum timeout for record. Valid only if | ||
154 | * LIRC_CAN_SET_REC_TIMEOUT is defined. | ||
155 | * | ||
156 | * @add_to_buf: add_to_buf will be called after specified period of the | ||
157 | * time or triggered by the external event, this behavior | ||
158 | * depends on value of the sample_rate this function will | ||
159 | * be called in user context. This routine should return | ||
160 | * 0 if data was added to the buffer and -ENODATA if none | ||
161 | * was available. This should add some number of bits | ||
162 | * evenly divisible by code_length to the buffer. | ||
163 | * | ||
164 | * @rbuf: if not NULL, it will be used as a read buffer, you will | ||
165 | * have to write to the buffer by other means, like irq's | ||
166 | * (see also lirc_serial.c). | ||
167 | * | ||
168 | * @set_use_inc: set_use_inc will be called after device is opened | ||
169 | * | ||
170 | * @set_use_dec: set_use_dec will be called after device is closed | ||
171 | * | ||
172 | * @rdev: Pointed to struct rc_dev associated with the LIRC | ||
173 | * device. | ||
174 | * | ||
175 | * @fops: file_operations for drivers which don't fit the current | ||
176 | * driver model. | ||
177 | * Some ioctl's can be directly handled by lirc_dev if the | ||
178 | * driver's ioctl function is NULL or if it returns | ||
179 | * -ENOIOCTLCMD (see also lirc_serial.c). | ||
180 | * | ||
181 | * @dev: pointer to the struct device associated with the LIRC | ||
182 | * device. | ||
183 | * | ||
184 | * @owner: the module owning this struct | ||
185 | */ | ||
121 | struct lirc_driver { | 186 | struct lirc_driver { |
122 | char name[40]; | 187 | char name[40]; |
123 | int minor; | 188 | int minor; |
@@ -131,65 +196,16 @@ struct lirc_driver { | |||
131 | void *data; | 196 | void *data; |
132 | int min_timeout; | 197 | int min_timeout; |
133 | int max_timeout; | 198 | int max_timeout; |
134 | int (*add_to_buf) (void *data, struct lirc_buffer *buf); | 199 | int (*add_to_buf)(void *data, struct lirc_buffer *buf); |
135 | struct lirc_buffer *rbuf; | 200 | struct lirc_buffer *rbuf; |
136 | int (*set_use_inc) (void *data); | 201 | int (*set_use_inc)(void *data); |
137 | void (*set_use_dec) (void *data); | 202 | void (*set_use_dec)(void *data); |
138 | struct rc_dev *rdev; | 203 | struct rc_dev *rdev; |
139 | const struct file_operations *fops; | 204 | const struct file_operations *fops; |
140 | struct device *dev; | 205 | struct device *dev; |
141 | struct module *owner; | 206 | struct module *owner; |
142 | }; | 207 | }; |
143 | 208 | ||
144 | /* name: | ||
145 | * this string will be used for logs | ||
146 | * | ||
147 | * minor: | ||
148 | * indicates minor device (/dev/lirc) number for registered driver | ||
149 | * if caller fills it with negative value, then the first free minor | ||
150 | * number will be used (if available) | ||
151 | * | ||
152 | * code_length: | ||
153 | * length of the remote control key code expressed in bits | ||
154 | * | ||
155 | * sample_rate: | ||
156 | * | ||
157 | * data: | ||
158 | * it may point to any driver data and this pointer will be passed to | ||
159 | * all callback functions | ||
160 | * | ||
161 | * add_to_buf: | ||
162 | * add_to_buf will be called after specified period of the time or | ||
163 | * triggered by the external event, this behavior depends on value of | ||
164 | * the sample_rate this function will be called in user context. This | ||
165 | * routine should return 0 if data was added to the buffer and | ||
166 | * -ENODATA if none was available. This should add some number of bits | ||
167 | * evenly divisible by code_length to the buffer | ||
168 | * | ||
169 | * rbuf: | ||
170 | * if not NULL, it will be used as a read buffer, you will have to | ||
171 | * write to the buffer by other means, like irq's (see also | ||
172 | * lirc_serial.c). | ||
173 | * | ||
174 | * set_use_inc: | ||
175 | * set_use_inc will be called after device is opened | ||
176 | * | ||
177 | * set_use_dec: | ||
178 | * set_use_dec will be called after device is closed | ||
179 | * | ||
180 | * fops: | ||
181 | * file_operations for drivers which don't fit the current driver model. | ||
182 | * | ||
183 | * Some ioctl's can be directly handled by lirc_dev if the driver's | ||
184 | * ioctl function is NULL or if it returns -ENOIOCTLCMD (see also | ||
185 | * lirc_serial.c). | ||
186 | * | ||
187 | * owner: | ||
188 | * the module owning this struct | ||
189 | * | ||
190 | */ | ||
191 | |||
192 | |||
193 | /* following functions can be called ONLY from user context | 209 | /* following functions can be called ONLY from user context |
194 | * | 210 | * |
195 | * returns negative value on error or minor number | 211 | * returns negative value on error or minor number |