4 #include <subdev/i2c.h>
6 extern struct nouveau_oclass nv04_i2c_pad_oclass;
7 extern struct nouveau_oclass nv94_i2c_pad_oclass;
9 #define nouveau_i2c_port_create(p,e,o,i,a,f,d) \
10 nouveau_i2c_port_create_((p), (e), (o), (i), (a), (f), \
11 sizeof(**d), (void **)d)
12 #define nouveau_i2c_port_destroy(p) ({ \
13 struct nouveau_i2c_port *port = (p); \
14 _nouveau_i2c_port_dtor(nv_object(i2c)); \
16 #define nouveau_i2c_port_init(p) \
17 nouveau_object_init(&(p)->base)
18 #define nouveau_i2c_port_fini(p,s) \
19 nouveau_object_fini(&(p)->base, (s))
21 int nouveau_i2c_port_create_(struct nouveau_object *, struct nouveau_object *,
22 struct nouveau_oclass *, u8,
23 const struct i2c_algorithm *,
24 const struct nouveau_i2c_func *,
26 void _nouveau_i2c_port_dtor(struct nouveau_object *);
27 #define _nouveau_i2c_port_init nouveau_object_init
28 int _nouveau_i2c_port_fini(struct nouveau_object *, bool);
30 #define nouveau_i2c_create(p,e,o,d) \
31 nouveau_i2c_create_((p), (e), (o), sizeof(**d), (void **)d)
32 #define nouveau_i2c_destroy(p) ({ \
33 struct nouveau_i2c *i2c = (p); \
34 _nouveau_i2c_dtor(nv_object(i2c)); \
36 #define nouveau_i2c_init(p) ({ \
37 struct nouveau_i2c *i2c = (p); \
38 _nouveau_i2c_init(nv_object(i2c)); \
40 #define nouveau_i2c_fini(p,s) ({ \
41 struct nouveau_i2c *i2c = (p); \
42 _nouveau_i2c_fini(nv_object(i2c), (s)); \
45 int nouveau_i2c_create_(struct nouveau_object *, struct nouveau_object *,
46 struct nouveau_oclass *, int, void **);
47 int _nouveau_i2c_ctor(struct nouveau_object *, struct nouveau_object *,
48 struct nouveau_oclass *, void *, u32,
49 struct nouveau_object **);
50 void _nouveau_i2c_dtor(struct nouveau_object *);
51 int _nouveau_i2c_init(struct nouveau_object *);
52 int _nouveau_i2c_fini(struct nouveau_object *, bool);
54 extern struct nouveau_oclass nouveau_anx9805_sclass[];
55 extern struct nouveau_oclass nvd0_i2c_sclass[];
57 extern const struct i2c_algorithm nouveau_i2c_bit_algo;
58 extern const struct i2c_algorithm nouveau_i2c_aux_algo;
60 struct nouveau_i2c_impl {
61 struct nouveau_oclass base;
63 /* supported i2c port classes */
64 struct nouveau_oclass *sclass;
65 struct nouveau_oclass *pad_x;
66 struct nouveau_oclass *pad_s;
68 /* number of native dp aux channels present */
71 /* read and ack pending interrupts, returning only data
72 * for ports that have not been masked off, while still
73 * performing the ack for anything that was pending.
75 void (*aux_stat)(struct nouveau_i2c *, u32 *, u32 *, u32 *, u32 *);
77 /* mask on/off interrupt types for a given set of auxch
79 void (*aux_mask)(struct nouveau_i2c *, u32, u32, u32);
82 void nv94_aux_stat(struct nouveau_i2c *, u32 *, u32 *, u32 *, u32 *);
83 void nv94_aux_mask(struct nouveau_i2c *, u32, u32, u32);