Merge branch 'sched-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[pandora-kernel.git] / drivers / media / video / pvrusb2 / pvrusb2-i2c-core.h
1 /*
2  *
3  *
4  *  Copyright (C) 2005 Mike Isely <isely@pobox.com>
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License
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  *  You should have received a copy of the GNU General Public License
16  *  along with this program; if not, write to the Free Software
17  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  *
19  */
20 #ifndef __PVRUSB2_I2C_CORE_H
21 #define __PVRUSB2_I2C_CORE_H
22
23 #include <linux/list.h>
24 #include <linux/i2c.h>
25
26 struct pvr2_hdw;
27 struct pvr2_i2c_client;
28 struct pvr2_i2c_handler;
29 struct pvr2_i2c_handler_functions;
30 struct pvr2_i2c_op;
31 struct pvr2_i2c_op_functions;
32
33 struct pvr2_i2c_client {
34         struct i2c_client *client;
35         struct pvr2_i2c_handler *handler;
36         struct list_head list;
37         struct pvr2_hdw *hdw;
38         int detected_flag;
39         int recv_enable;
40         unsigned long pend_mask;
41         unsigned long ctl_mask;
42         void (*status_poll)(struct pvr2_i2c_client *);
43 };
44
45 struct pvr2_i2c_handler {
46         void *func_data;
47         const struct pvr2_i2c_handler_functions *func_table;
48 };
49
50 struct pvr2_i2c_handler_functions {
51         void (*detach)(void *);
52         int (*check)(void *);
53         void (*update)(void *);
54         unsigned int (*describe)(void *,char *,unsigned int);
55 };
56
57 struct pvr2_i2c_op {
58         int (*check)(struct pvr2_hdw *);
59         void (*update)(struct pvr2_hdw *);
60         const char *name;
61 };
62
63 void pvr2_i2c_core_init(struct pvr2_hdw *);
64 void pvr2_i2c_core_done(struct pvr2_hdw *);
65
66 int pvr2_i2c_client_cmd(struct pvr2_i2c_client *,unsigned int cmd,void *arg);
67 int pvr2_i2c_core_cmd(struct pvr2_hdw *,unsigned int cmd,void *arg);
68
69 int pvr2_i2c_core_check_stale(struct pvr2_hdw *);
70 void pvr2_i2c_core_sync(struct pvr2_hdw *);
71 void pvr2_i2c_core_status_poll(struct pvr2_hdw *);
72 unsigned int pvr2_i2c_report(struct pvr2_hdw *,char *buf,unsigned int maxlen);
73 #define PVR2_I2C_DETAIL_DEBUG   0x0001
74 #define PVR2_I2C_DETAIL_HANDLER 0x0002
75 #define PVR2_I2C_DETAIL_CTLMASK 0x0004
76 #define PVR2_I2C_DETAIL_ALL (\
77         PVR2_I2C_DETAIL_DEBUG |\
78         PVR2_I2C_DETAIL_HANDLER |\
79         PVR2_I2C_DETAIL_CTLMASK)
80
81 void pvr2_i2c_probe(struct pvr2_hdw *,struct pvr2_i2c_client *);
82 const struct pvr2_i2c_op *pvr2_i2c_get_op(unsigned int idx);
83
84 #endif /* __PVRUSB2_I2C_CORE_H */
85
86
87 /*
88   Stuff for Emacs to see, in order to encourage consistent editing style:
89   *** Local Variables: ***
90   *** mode: c ***
91   *** fill-column: 75 ***
92   *** tab-width: 8 ***
93   *** c-basic-offset: 8 ***
94   *** End: ***
95   */