1 /* SPDX-License-Identifier: GPL-2.0 */ 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 int nvkm_i2c_aux_xfer(struct nvkm_i2c_aux *, bool retry, u8 type, 20 u32 addr, u8 *data, u8 *size); 21 22 int g94_i2c_aux_new_(const struct nvkm_i2c_aux_func *, struct nvkm_i2c_pad *, 23 int, u8, struct nvkm_i2c_aux **); 24 25 int g94_i2c_aux_new(struct nvkm_i2c_pad *, int, u8, struct nvkm_i2c_aux **); 26 int g94_i2c_aux_xfer(struct nvkm_i2c_aux *, bool, u8, u32, u8 *, u8 *); 27 int gf119_i2c_aux_new(struct nvkm_i2c_pad *, int, u8, struct nvkm_i2c_aux **); 28 int gm200_i2c_aux_new(struct nvkm_i2c_pad *, int, u8, struct nvkm_i2c_aux **); 29 30 #define AUX_MSG(b,l,f,a...) do { \ 31 struct nvkm_i2c_aux *_aux = (b); \ 32 nvkm_##l(&_aux->pad->i2c->subdev, "aux %04x: "f"\n", _aux->id, ##a); \ 33 } while(0) 34 #define AUX_ERR(b,f,a...) AUX_MSG((b), error, f, ##a) 35 #define AUX_DBG(b,f,a...) AUX_MSG((b), debug, f, ##a) 36 #define AUX_TRACE(b,f,a...) AUX_MSG((b), trace, f, ##a) 37 #endif 38