1 /* SPDX-License-Identifier: MIT */
2 #ifndef __NVKM_I2C_PAD_H__
3 #define __NVKM_I2C_PAD_H__
4 #include <subdev/i2c.h>
7 const struct nvkm_i2c_pad_func
*func
;
9 #define NVKM_I2C_PAD_HYBRID(n) /* 'n' is hw pad index */ (n)
10 #define NVKM_I2C_PAD_CCB(n) /* 'n' is ccb index */ ((n) + 0x100)
11 #define NVKM_I2C_PAD_EXT(n) /* 'n' is dcb external encoder type */ ((n) + 0x200)
14 enum nvkm_i2c_pad_mode
{
20 struct list_head head
;
23 struct nvkm_i2c_pad_func
{
24 int (*bus_new_0
)(struct nvkm_i2c_pad
*, int id
, u8 drive
, u8 sense
,
25 struct nvkm_i2c_bus
**);
26 int (*bus_new_4
)(struct nvkm_i2c_pad
*, int id
, u8 drive
,
27 struct nvkm_i2c_bus
**);
29 int (*aux_new_6
)(struct nvkm_i2c_pad
*, int id
, u8 drive
,
30 struct nvkm_i2c_aux
**);
32 void (*mode
)(struct nvkm_i2c_pad
*, enum nvkm_i2c_pad_mode
);
35 void nvkm_i2c_pad_ctor(const struct nvkm_i2c_pad_func
*, struct nvkm_i2c
*,
36 int id
, struct nvkm_i2c_pad
*);
37 int nvkm_i2c_pad_new_(const struct nvkm_i2c_pad_func
*, struct nvkm_i2c
*,
38 int id
, struct nvkm_i2c_pad
**);
39 void nvkm_i2c_pad_del(struct nvkm_i2c_pad
**);
40 void nvkm_i2c_pad_init(struct nvkm_i2c_pad
*);
41 void nvkm_i2c_pad_fini(struct nvkm_i2c_pad
*);
42 void nvkm_i2c_pad_mode(struct nvkm_i2c_pad
*, enum nvkm_i2c_pad_mode
);
43 int nvkm_i2c_pad_acquire(struct nvkm_i2c_pad
*, enum nvkm_i2c_pad_mode
);
44 void nvkm_i2c_pad_release(struct nvkm_i2c_pad
*);
46 void g94_i2c_pad_mode(struct nvkm_i2c_pad
*, enum nvkm_i2c_pad_mode
);
48 int nv04_i2c_pad_new(struct nvkm_i2c
*, int, struct nvkm_i2c_pad
**);
49 int nv4e_i2c_pad_new(struct nvkm_i2c
*, int, struct nvkm_i2c_pad
**);
50 int nv50_i2c_pad_new(struct nvkm_i2c
*, int, struct nvkm_i2c_pad
**);
51 int g94_i2c_pad_x_new(struct nvkm_i2c
*, int, struct nvkm_i2c_pad
**);
52 int gf119_i2c_pad_x_new(struct nvkm_i2c
*, int, struct nvkm_i2c_pad
**);
53 int gm200_i2c_pad_x_new(struct nvkm_i2c
*, int, struct nvkm_i2c_pad
**);
55 int g94_i2c_pad_s_new(struct nvkm_i2c
*, int, struct nvkm_i2c_pad
**);
56 int gf119_i2c_pad_s_new(struct nvkm_i2c
*, int, struct nvkm_i2c_pad
**);
57 int gm200_i2c_pad_s_new(struct nvkm_i2c
*, int, struct nvkm_i2c_pad
**);
59 int anx9805_pad_new(struct nvkm_i2c_bus
*, int, u8
, struct nvkm_i2c_pad
**);
61 #define PAD_MSG(p,l,f,a...) do { \
62 struct nvkm_i2c_pad *_pad = (p); \
63 nvkm_##l(&_pad->i2c->subdev, "pad %04x: "f"\n", _pad->id, ##a); \
65 #define PAD_ERR(p,f,a...) PAD_MSG((p), error, f, ##a)
66 #define PAD_DBG(p,f,a...) PAD_MSG((p), debug, f, ##a)
67 #define PAD_TRACE(p,f,a...) PAD_MSG((p), trace, f, ##a)