5 * Copyright (C) 2005 Mike Isely <isely@pobox.com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef __PVRUSB2_I2C_CORE_H
22 #define __PVRUSB2_I2C_CORE_H
24 #include <linux/list.h>
25 #include <linux/i2c.h>
28 struct pvr2_i2c_client
;
29 struct pvr2_i2c_handler
;
30 struct pvr2_i2c_handler_functions
;
32 struct pvr2_i2c_op_functions
;
34 struct pvr2_i2c_client
{
35 struct i2c_client
*client
;
36 struct pvr2_i2c_handler
*handler
;
37 struct list_head list
;
41 unsigned long pend_mask
;
42 unsigned long ctl_mask
;
43 void (*status_poll
)(struct pvr2_i2c_client
*);
46 struct pvr2_i2c_handler
{
48 const struct pvr2_i2c_handler_functions
*func_table
;
51 struct pvr2_i2c_handler_functions
{
52 void (*detach
)(void *);
54 void (*update
)(void *);
55 unsigned int (*describe
)(void *,char *,unsigned int);
59 int (*check
)(struct pvr2_hdw
*);
60 void (*update
)(struct pvr2_hdw
*);
64 void pvr2_i2c_core_init(struct pvr2_hdw
*);
65 void pvr2_i2c_core_done(struct pvr2_hdw
*);
67 int pvr2_i2c_client_cmd(struct pvr2_i2c_client
*,unsigned int cmd
,void *arg
);
68 int pvr2_i2c_core_cmd(struct pvr2_hdw
*,unsigned int cmd
,void *arg
);
70 int pvr2_i2c_core_check_stale(struct pvr2_hdw
*);
71 void pvr2_i2c_core_sync(struct pvr2_hdw
*);
72 void pvr2_i2c_core_status_poll(struct pvr2_hdw
*);
73 unsigned int pvr2_i2c_report(struct pvr2_hdw
*,char *buf
,unsigned int maxlen
);
74 #define PVR2_I2C_DETAIL_DEBUG 0x0001
75 #define PVR2_I2C_DETAIL_HANDLER 0x0002
76 #define PVR2_I2C_DETAIL_CTLMASK 0x0004
77 #define PVR2_I2C_DETAIL_ALL (\
78 PVR2_I2C_DETAIL_DEBUG |\
79 PVR2_I2C_DETAIL_HANDLER |\
80 PVR2_I2C_DETAIL_CTLMASK)
82 void pvr2_i2c_probe(struct pvr2_hdw
*,struct pvr2_i2c_client
*);
83 const struct pvr2_i2c_op
*pvr2_i2c_get_op(unsigned int idx
);
85 #endif /* __PVRUSB2_I2C_CORE_H */
89 Stuff for Emacs to see, in order to encourage consistent editing style:
90 *** Local Variables: ***
92 *** fill-column: 75 ***
94 *** c-basic-offset: 8 ***