1 #ifndef __NVKM_I2C_AUX_H__
2 #define __NVKM_I2C_AUX_H__
3 #include "pad.h"
4 
5 struct nvkm_i2c_aux_func {
6 	int  (*xfer)(struct nvkm_i2c_aux *, bool retry, u8 type,
7 		     u32 addr, u8 *data, u8 size);
8 	int  (*lnk_ctl)(struct nvkm_i2c_aux *, int link_nr, int link_bw,
9 			bool enhanced_framing);
10 };
11 
12 int nvkm_i2c_aux_ctor(const struct nvkm_i2c_aux_func *, struct nvkm_i2c_pad *,
13 		      int id, struct nvkm_i2c_aux *);
14 int nvkm_i2c_aux_new_(const struct nvkm_i2c_aux_func *, struct nvkm_i2c_pad *,
15 		      int id, struct nvkm_i2c_aux **);
16 void nvkm_i2c_aux_del(struct nvkm_i2c_aux **);
17 int nvkm_i2c_aux_xfer(struct nvkm_i2c_aux *, bool retry, u8 type,
18 		      u32 addr, u8 *data, u8 size);
19 
20 int g94_i2c_aux_new(struct nvkm_i2c_pad *, int, u8, struct nvkm_i2c_aux **);
21 int gm200_i2c_aux_new(struct nvkm_i2c_pad *, int, u8, struct nvkm_i2c_aux **);
22 
23 #define AUX_MSG(b,l,f,a...) do {                                               \
24 	struct nvkm_i2c_aux *_aux = (b);                                       \
25 	nvkm_##l(&_aux->pad->i2c->subdev, "aux %04x: "f"\n", _aux->id, ##a);   \
26 } while(0)
27 #define AUX_ERR(b,f,a...) AUX_MSG((b), error, f, ##a)
28 #define AUX_DBG(b,f,a...) AUX_MSG((b), debug, f, ##a)
29 #define AUX_TRACE(b,f,a...) AUX_MSG((b), trace, f, ##a)
30 #endif
31