]> git.proxmox.com Git - mirror_ubuntu-kernels.git/blame - drivers/gpu/drm/nouveau/nvkm/subdev/i2c/bus.h
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[mirror_ubuntu-kernels.git] / drivers / gpu / drm / nouveau / nvkm / subdev / i2c / bus.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
2aa5eac5
BS
2#ifndef __NVKM_I2C_BUS_H__
3#define __NVKM_I2C_BUS_H__
4#include "pad.h"
5
6struct nvkm_i2c_bus_func {
7 void (*init)(struct nvkm_i2c_bus *);
8 void (*drive_scl)(struct nvkm_i2c_bus *, int state);
9 void (*drive_sda)(struct nvkm_i2c_bus *, int state);
10 int (*sense_scl)(struct nvkm_i2c_bus *);
11 int (*sense_sda)(struct nvkm_i2c_bus *);
12 int (*xfer)(struct nvkm_i2c_bus *, struct i2c_msg *, int num);
13};
14
15int nvkm_i2c_bus_ctor(const struct nvkm_i2c_bus_func *, struct nvkm_i2c_pad *,
16 int id, struct nvkm_i2c_bus *);
17int nvkm_i2c_bus_new_(const struct nvkm_i2c_bus_func *, struct nvkm_i2c_pad *,
18 int id, struct nvkm_i2c_bus **);
19void nvkm_i2c_bus_del(struct nvkm_i2c_bus **);
20void nvkm_i2c_bus_init(struct nvkm_i2c_bus *);
21
22int nvkm_i2c_bit_xfer(struct nvkm_i2c_bus *, struct i2c_msg *, int);
23
24int nv04_i2c_bus_new(struct nvkm_i2c_pad *, int, u8, u8,
25 struct nvkm_i2c_bus **);
26
27int nv4e_i2c_bus_new(struct nvkm_i2c_pad *, int, u8, struct nvkm_i2c_bus **);
28int nv50_i2c_bus_new(struct nvkm_i2c_pad *, int, u8, struct nvkm_i2c_bus **);
29int gf119_i2c_bus_new(struct nvkm_i2c_pad *, int, u8, struct nvkm_i2c_bus **);
30
31#define BUS_MSG(b,l,f,a...) do { \
32 struct nvkm_i2c_bus *_bus = (b); \
33 nvkm_##l(&_bus->pad->i2c->subdev, "bus %04x: "f"\n", _bus->id, ##a); \
34} while(0)
35#define BUS_ERR(b,f,a...) BUS_MSG((b), error, f, ##a)
36#define BUS_DBG(b,f,a...) BUS_MSG((b), debug, f, ##a)
37#define BUS_TRACE(b,f,a...) BUS_MSG((b), trace, f, ##a)
38#endif