1 /* include/linux/adc.h
\r
3 * This program is free software; you can redistribute it and/or modify
\r
4 * it under the terms of the GNU General Public License version 2 as
\r
5 * published by the Free Software Foundation.
\r
9 #ifndef __ASM_ADC_CORE_H
\r
10 #define __ASM_ADC_CORE_H
\r
12 #define MAX_ADC_CHN 4
\r
13 #define MAX_ADC_FIFO_DEPTH 8
\r
20 void (*callback)(struct adc_client *, void *, int);
\r
21 void *callback_param;
\r
23 struct adc_host *adc;
\r
26 struct adc_request {
\r
29 void (*callback)(struct adc_client *, void *, int);
\r
30 void *callback_param;
\r
31 struct adc_client *client;
\r
32 /* Used in case of sync requests */
\r
33 struct completion completion;
\r
37 void (*start)(struct adc_host *);
\r
38 void (*stop)(struct adc_host *);
\r
39 int (*read)(struct adc_host *);
\r
46 struct adc_request *queue[MAX_ADC_FIFO_DEPTH];
\r
49 struct mutex queue_mutex;
\r
50 struct adc_client *cur;
\r
51 const struct adc_ops *ops;
\r
52 unsigned long private[0];
\r
54 static inline void *adc_priv(struct adc_host *adc)
\r
56 return (void *)adc->private;
\r
59 extern struct adc_host *adc_alloc_host(int extra, struct device *dev);
\r
60 extern void adc_free_host(struct adc_host *adc);
\r
61 extern void adc_core_irq_handle(struct adc_host *adc);
\r
65 extern struct adc_client *adc_register(int chn,
\r
66 void (*callback)(struct adc_client *, void *, int),
\r
67 void *callback_param);
\r
68 extern void adc_unregister(struct adc_client *client);
\r
70 extern int adc_sync_read(struct adc_client *client);
\r
71 extern int adc_async_read(struct adc_client *client);
\r
73 static inline struct adc_client *adc_register(int chn,
\r
74 void (*callback)(struct adc_client *, void *, int),
\r
75 void *callback_param)
\r
79 static inline void adc_unregister(struct adc_client *client) {}
\r
80 static inline int adc_sync_read(struct adc_client *client) { return -EINVAL; }
\r
81 static inline int adc_async_read(struct adc_client *client) { return -EINVAL; }
\r