ASoC: Remove duplicate ADC/DAC widgets from wm_hubs.c
[linux/fpc-iii.git] / drivers / staging / meilhaus / mesubdevice.c
blobb2e956726b5ff1e7fcc264617bb339e71cffff2a
1 /**
2 * @file mesubdevice.c
4 * @brief Subdevice base class implemention.
5 * @note Copyright (C) 2007 Meilhaus Electronic GmbH (support@meilhaus.de)
6 * @author Guenter Gebhardt
7 */
9 /*
10 * This file is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #ifndef __KERNEL__
26 # define __KERNEL__
27 #endif
29 #include <linux/slab.h>
31 #include "medefines.h"
32 #include "meerror.h"
34 #include "medebug.h"
35 #include "mesubdevice.h"
37 static int me_subdevice_io_irq_start(struct me_subdevice *subdevice,
38 struct file *filep,
39 int channel,
40 int irq_source,
41 int irq_edge, int irq_arg, int flags)
43 PDEBUG("executed.\n");
44 return ME_ERRNO_NOT_SUPPORTED;
47 static int me_subdevice_io_irq_wait(struct me_subdevice *subdevice,
48 struct file *filep,
49 int channel,
50 int *irq_count,
51 int *value, int time_out, int flags)
53 PDEBUG("executed.\n");
54 return ME_ERRNO_NOT_SUPPORTED;
57 static int me_subdevice_io_irq_stop(struct me_subdevice *subdevice,
58 struct file *filep, int channel, int flags)
60 PDEBUG("executed.\n");
61 return ME_ERRNO_NOT_SUPPORTED;
64 static int me_subdevice_io_reset_subdevice(struct me_subdevice *subdevice,
65 struct file *filep, int flags)
67 PDEBUG("executed.\n");
68 return ME_ERRNO_NOT_SUPPORTED;
71 static int me_subdevice_io_single_config(struct me_subdevice *subdevice,
72 struct file *filep,
73 int channel,
74 int single_config,
75 int ref,
76 int trig_chan,
77 int trig_type,
78 int trig_edge, int flags)
80 PDEBUG("executed.\n");
81 return ME_ERRNO_NOT_SUPPORTED;
84 static int me_subdevice_io_single_read(struct me_subdevice *subdevice,
85 struct file *filep,
86 int channel,
87 int *value, int time_out, int flags)
89 PDEBUG("executed.\n");
90 return ME_ERRNO_NOT_SUPPORTED;
93 static int me_subdevice_io_single_write(struct me_subdevice *subdevice,
94 struct file *filep,
95 int channel,
96 int value, int time_out, int flags)
98 PDEBUG("executed.\n");
99 return ME_ERRNO_NOT_SUPPORTED;
102 static int me_subdevice_io_stream_config(struct me_subdevice *subdevice,
103 struct file *filep,
104 meIOStreamConfig_t *config_list,
105 int count,
106 meIOStreamTrigger_t *trigger,
107 int fifo_irq_threshold, int flags)
109 PDEBUG("executed.\n");
110 return ME_ERRNO_NOT_SUPPORTED;
113 static int me_subdevice_io_stream_new_values(struct me_subdevice *subdevice,
114 struct file *filep,
115 int time_out,
116 int *count, int flags)
118 PDEBUG("executed.\n");
119 return ME_ERRNO_NOT_SUPPORTED;
122 static int me_subdevice_io_stream_read(struct me_subdevice *subdevice,
123 struct file *filep,
124 int read_mode,
125 int *values, int *count, int flags)
127 PDEBUG("executed.\n");
128 return ME_ERRNO_NOT_SUPPORTED;
131 static int me_subdevice_io_stream_start(struct me_subdevice *subdevice,
132 struct file *filep,
133 int start_mode, int time_out, int flags)
135 PDEBUG("executed.\n");
136 return ME_ERRNO_NOT_SUPPORTED;
139 static int me_subdevice_io_stream_status(struct me_subdevice *subdevice,
140 struct file *filep,
141 int wait,
142 int *status, int *count, int flags)
144 PDEBUG("executed.\n");
145 return ME_ERRNO_NOT_SUPPORTED;
148 static int me_subdevice_io_stream_stop(struct me_subdevice *subdevice,
149 struct file *filep,
150 int stop_mode, int flags)
152 PDEBUG("executed.\n");
153 return ME_ERRNO_NOT_SUPPORTED;
156 static int me_subdevice_io_stream_write(struct me_subdevice *subdevice,
157 struct file *filep,
158 int write_mode,
159 int *values, int *count, int flags)
161 PDEBUG("executed.\n");
162 return ME_ERRNO_NOT_SUPPORTED;
165 static int me_subdevice_lock_subdevice(me_subdevice_t *subdevice,
166 struct file *filep, int lock, int flags)
168 PDEBUG("executed.\n");
169 return me_slock_lock(&subdevice->lock, filep, lock);
172 static int me_subdevice_query_number_channels(struct me_subdevice *subdevice,
173 int *number)
175 PDEBUG("executed.\n");
176 return ME_ERRNO_NOT_SUPPORTED;
179 static int me_subdevice_query_number_ranges(struct me_subdevice *subdevice,
180 int unit, int *count)
182 PDEBUG("executed.\n");
183 return ME_ERRNO_NOT_SUPPORTED;
186 static int me_subdevice_query_range_by_min_max(struct me_subdevice *subdevice,
187 int unit,
188 int *min,
189 int *max,
190 int *maxdata, int *range)
192 PDEBUG("executed.\n");
193 return ME_ERRNO_NOT_SUPPORTED;
196 static int me_subdevice_query_range_info(struct me_subdevice *subdevice,
197 int range,
198 int *unit,
199 int *min, int *max, int *maxdata)
201 PDEBUG("executed.\n");
202 return ME_ERRNO_NOT_SUPPORTED;
205 static int me_subdevice_query_subdevice_type(struct me_subdevice *subdevice,
206 int *type, int *subtype)
208 PDEBUG("executed.\n");
209 return ME_ERRNO_NOT_SUPPORTED;
212 static int me_subdevice_query_subdevice_caps(struct me_subdevice *subdevice,
213 int *caps)
215 PDEBUG("executed.\n");
216 *caps = 0;
217 return ME_ERRNO_SUCCESS;
220 static int me_subdevice_query_subdevice_caps_args(struct me_subdevice
221 *subdevice, int cap,
222 int *args, int count)
224 PDEBUG("executed.\n");
225 return ME_ERRNO_NOT_SUPPORTED;
228 static int me_subdevice_query_timer(struct me_subdevice *subdevice,
229 int timer,
230 int *base_frequency,
231 long long *min_ticks, long long *max_ticks)
233 PDEBUG("executed.\n");
234 return ME_ERRNO_NOT_SUPPORTED;
237 static int me_subdevice_config_load(struct me_subdevice *subdevice,
238 me_cfg_device_entry_t *config)
240 PDEBUG("executed.\n");
241 return ME_ERRNO_SUCCESS;
244 static void me_subdevice_destructor(struct me_subdevice *subdevice)
246 PDEBUG("executed.\n");
247 me_subdevice_deinit(subdevice);
248 kfree(subdevice);
251 int me_subdevice_init(me_subdevice_t *subdevice)
253 int err;
255 PDEBUG("executed.\n");
257 /* Init list head */
258 INIT_LIST_HEAD(&subdevice->list);
260 /* Initialize the subdevice lock instance */
262 err = me_slock_init(&subdevice->lock);
264 if (err) {
265 PERROR("Cannot initialize subdevice lock instance.\n");
266 return 1;
269 /* Subdevice base class methods */
270 subdevice->me_subdevice_io_irq_start = me_subdevice_io_irq_start;
271 subdevice->me_subdevice_io_irq_wait = me_subdevice_io_irq_wait;
272 subdevice->me_subdevice_io_irq_stop = me_subdevice_io_irq_stop;
273 subdevice->me_subdevice_io_reset_subdevice =
274 me_subdevice_io_reset_subdevice;
275 subdevice->me_subdevice_io_single_config =
276 me_subdevice_io_single_config;
277 subdevice->me_subdevice_io_single_read = me_subdevice_io_single_read;
278 subdevice->me_subdevice_io_single_write = me_subdevice_io_single_write;
279 subdevice->me_subdevice_io_stream_config =
280 me_subdevice_io_stream_config;
281 subdevice->me_subdevice_io_stream_new_values =
282 me_subdevice_io_stream_new_values;
283 subdevice->me_subdevice_io_stream_read = me_subdevice_io_stream_read;
284 subdevice->me_subdevice_io_stream_start = me_subdevice_io_stream_start;
285 subdevice->me_subdevice_io_stream_status =
286 me_subdevice_io_stream_status;
287 subdevice->me_subdevice_io_stream_stop = me_subdevice_io_stream_stop;
288 subdevice->me_subdevice_io_stream_write = me_subdevice_io_stream_write;
289 subdevice->me_subdevice_lock_subdevice = me_subdevice_lock_subdevice;
290 subdevice->me_subdevice_query_number_channels =
291 me_subdevice_query_number_channels;
292 subdevice->me_subdevice_query_number_ranges =
293 me_subdevice_query_number_ranges;
294 subdevice->me_subdevice_query_range_by_min_max =
295 me_subdevice_query_range_by_min_max;
296 subdevice->me_subdevice_query_range_info =
297 me_subdevice_query_range_info;
298 subdevice->me_subdevice_query_subdevice_type =
299 me_subdevice_query_subdevice_type;
300 subdevice->me_subdevice_query_subdevice_caps =
301 me_subdevice_query_subdevice_caps;
302 subdevice->me_subdevice_query_subdevice_caps_args =
303 me_subdevice_query_subdevice_caps_args;
304 subdevice->me_subdevice_query_timer = me_subdevice_query_timer;
305 subdevice->me_subdevice_config_load = me_subdevice_config_load;
306 subdevice->me_subdevice_destructor = me_subdevice_destructor;
308 return 0;
311 void me_subdevice_deinit(me_subdevice_t *subdevice)
313 PDEBUG("executed.\n");
314 me_subdevice_io_reset_subdevice(subdevice, NULL,
315 ME_IO_RESET_SUBDEVICE_NO_FLAGS);
316 me_slock_deinit(&subdevice->lock);