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