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