4 #include <subdev/i2c.h>
6 extern struct nouveau_oclass nv04_i2c_pad_oclass;
7 extern struct nouveau_oclass nv94_i2c_pad_oclass;
8 extern struct nouveau_oclass gm204_i2c_pad_oclass;
10 #define nouveau_i2c_port_create(p,e,o,i,a,f,d) \
11 nouveau_i2c_port_create_((p), (e), (o), (i), (a), (f), \
12 sizeof(**d), (void **)d)
13 #define nouveau_i2c_port_destroy(p) ({ \
14 struct nouveau_i2c_port *port = (p); \
15 _nouveau_i2c_port_dtor(nv_object(i2c)); \
17 #define nouveau_i2c_port_init(p) \
18 nouveau_object_init(&(p)->base)
19 #define nouveau_i2c_port_fini(p,s) \
20 nouveau_object_fini(&(p)->base, (s))
22 int nouveau_i2c_port_create_(struct nouveau_object *, struct nouveau_object *,
23 struct nouveau_oclass *, u8,
24 const struct i2c_algorithm *,
25 const struct nouveau_i2c_func *,
27 void _nouveau_i2c_port_dtor(struct nouveau_object *);
28 #define _nouveau_i2c_port_init nouveau_object_init
29 int _nouveau_i2c_port_fini(struct nouveau_object *, bool);
31 #define nouveau_i2c_create(p,e,o,d) \
32 nouveau_i2c_create_((p), (e), (o), sizeof(**d), (void **)d)
33 #define nouveau_i2c_destroy(p) ({ \
34 struct nouveau_i2c *i2c = (p); \
35 _nouveau_i2c_dtor(nv_object(i2c)); \
37 #define nouveau_i2c_init(p) ({ \
38 struct nouveau_i2c *i2c = (p); \
39 _nouveau_i2c_init(nv_object(i2c)); \
41 #define nouveau_i2c_fini(p,s) ({ \
42 struct nouveau_i2c *i2c = (p); \
43 _nouveau_i2c_fini(nv_object(i2c), (s)); \
46 int nouveau_i2c_create_(struct nouveau_object *, struct nouveau_object *,
47 struct nouveau_oclass *, int, void **);
48 int _nouveau_i2c_ctor(struct nouveau_object *, struct nouveau_object *,
49 struct nouveau_oclass *, void *, u32,
50 struct nouveau_object **);
51 void _nouveau_i2c_dtor(struct nouveau_object *);
52 int _nouveau_i2c_init(struct nouveau_object *);
53 int _nouveau_i2c_fini(struct nouveau_object *, bool);
55 extern struct nouveau_oclass nouveau_anx9805_sclass[];
56 extern struct nouveau_oclass nvd0_i2c_sclass[];
58 extern const struct i2c_algorithm nouveau_i2c_bit_algo;
59 extern const struct i2c_algorithm nouveau_i2c_aux_algo;
61 struct nouveau_i2c_impl {
62 struct nouveau_oclass base;
64 /* supported i2c port classes */
65 struct nouveau_oclass *sclass;
66 struct nouveau_oclass *pad_x;
67 struct nouveau_oclass *pad_s;
69 /* number of native dp aux channels present */
72 /* read and ack pending interrupts, returning only data
73 * for ports that have not been masked off, while still
74 * performing the ack for anything that was pending.
76 void (*aux_stat)(struct nouveau_i2c *, u32 *, u32 *, u32 *, u32 *);
78 /* mask on/off interrupt types for a given set of auxch
80 void (*aux_mask)(struct nouveau_i2c *, u32, u32, u32);
83 void nv94_aux_stat(struct nouveau_i2c *, u32 *, u32 *, u32 *, u32 *);
84 void nv94_aux_mask(struct nouveau_i2c *, u32, u32, u32);
86 void nve0_aux_stat(struct nouveau_i2c *, u32 *, u32 *, u32 *, u32 *);
87 void nve0_aux_mask(struct nouveau_i2c *, u32, u32, u32);