From: Ben Skeggs Date: Wed, 14 Jan 2015 05:04:16 +0000 (+1000) Subject: drm/nouveau/i2c: namespace + nvidia gpu names (no binary change) X-Git-Tag: v5.15~16316^2~34^2~26 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b9ec14246dc4260294ccfb25ec40b113d23e5b9a;p=platform%2Fkernel%2Flinux-starfive.git drm/nouveau/i2c: namespace + nvidia gpu names (no binary change) The namespace of NVKM is being changed to nvkm_ instead of nouveau_, which will be used for the DRM part of the driver. This is being done in order to make it very clear as to what part of the driver a given symbol belongs to, and as a minor step towards splitting the DRM driver out to be able to stand on its own (for virt). Because there's already a large amount of churn here anyway, this is as good a time as any to also switch to NVIDIA's device and chipset naming to ease collaboration with them. A comparison of objdump disassemblies proves no code changes. Signed-off-by: Ben Skeggs --- diff --git a/drivers/gpu/drm/nouveau/include/nvkm/core/os.h b/drivers/gpu/drm/nouveau/include/nvkm/core/os.h index 4c16deb..58f8d8b 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/core/os.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/core/os.h @@ -196,6 +196,7 @@ #define nouveau_gpio nvkm_gpio #define nouveau_i2c nvkm_i2c #define nouveau_i2c_port nvkm_i2c_port +#define nouveau_i2c_board_info nvkm_i2c_board_info #define nouveau_devinit nvkm_devinit #define nouveau_bios nvkm_bios #define nouveau_bios_oclass nvkm_bios_oclass diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/i2c.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/i2c.h index a400e67..a2e3373 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/subdev/i2c.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/subdev/i2c.h @@ -1,8 +1,7 @@ -#ifndef __NOUVEAU_I2C_H__ -#define __NOUVEAU_I2C_H__ - +#ifndef __NVKM_I2C_H__ +#define __NVKM_I2C_H__ #include -#include +#include #include #include @@ -30,8 +29,8 @@ struct nvkm_i2c_ntfy_rep { u8 mask; }; -struct nouveau_i2c_port { - struct nouveau_object base; +struct nvkm_i2c_port { + struct nvkm_object base; struct i2c_adapter adapter; struct mutex mutex; @@ -39,62 +38,63 @@ struct nouveau_i2c_port { u8 index; int aux; - const struct nouveau_i2c_func *func; + const struct nvkm_i2c_func *func; }; -struct nouveau_i2c_func { - void (*drive_scl)(struct nouveau_i2c_port *, int); - void (*drive_sda)(struct nouveau_i2c_port *, int); - int (*sense_scl)(struct nouveau_i2c_port *); - int (*sense_sda)(struct nouveau_i2c_port *); +struct nvkm_i2c_func { + void (*drive_scl)(struct nvkm_i2c_port *, int); + void (*drive_sda)(struct nvkm_i2c_port *, int); + int (*sense_scl)(struct nvkm_i2c_port *); + int (*sense_sda)(struct nvkm_i2c_port *); - int (*aux)(struct nouveau_i2c_port *, bool, u8, u32, u8 *, u8); - int (*pattern)(struct nouveau_i2c_port *, int pattern); - int (*lnk_ctl)(struct nouveau_i2c_port *, int nr, int bw, bool enh); - int (*drv_ctl)(struct nouveau_i2c_port *, int lane, int sw, int pe); + int (*aux)(struct nvkm_i2c_port *, bool, u8, u32, u8 *, u8); + int (*pattern)(struct nvkm_i2c_port *, int pattern); + int (*lnk_ctl)(struct nvkm_i2c_port *, int nr, int bw, bool enh); + int (*drv_ctl)(struct nvkm_i2c_port *, int lane, int sw, int pe); }; -struct nouveau_i2c_board_info { +struct nvkm_i2c_board_info { struct i2c_board_info dev; u8 udelay; /* set to 0 to use the standard delay */ }; -struct nouveau_i2c { - struct nouveau_subdev base; +struct nvkm_i2c { + struct nvkm_subdev base; struct nvkm_event event; - struct nouveau_i2c_port *(*find)(struct nouveau_i2c *, u8 index); - struct nouveau_i2c_port *(*find_type)(struct nouveau_i2c *, u16 type); - int (*acquire_pad)(struct nouveau_i2c_port *, unsigned long timeout); - void (*release_pad)(struct nouveau_i2c_port *); - int (*acquire)(struct nouveau_i2c_port *, unsigned long timeout); - void (*release)(struct nouveau_i2c_port *); - int (*identify)(struct nouveau_i2c *, int index, - const char *what, struct nouveau_i2c_board_info *, - bool (*match)(struct nouveau_i2c_port *, - struct i2c_board_info *, void *), void *); + struct nvkm_i2c_port *(*find)(struct nvkm_i2c *, u8 index); + struct nvkm_i2c_port *(*find_type)(struct nvkm_i2c *, u16 type); + int (*acquire_pad)(struct nvkm_i2c_port *, unsigned long timeout); + void (*release_pad)(struct nvkm_i2c_port *); + int (*acquire)(struct nvkm_i2c_port *, unsigned long timeout); + void (*release)(struct nvkm_i2c_port *); + int (*identify)(struct nvkm_i2c *, int index, + const char *what, struct nvkm_i2c_board_info *, + bool (*match)(struct nvkm_i2c_port *, + struct i2c_board_info *, void *), + void *); wait_queue_head_t wait; struct list_head ports; }; -static inline struct nouveau_i2c * -nouveau_i2c(void *obj) +static inline struct nvkm_i2c * +nvkm_i2c(void *obj) { - return (void *)nouveau_subdev(obj, NVDEV_SUBDEV_I2C); + return (void *)nvkm_subdev(obj, NVDEV_SUBDEV_I2C); } -extern struct nouveau_oclass *nv04_i2c_oclass; -extern struct nouveau_oclass *nv4e_i2c_oclass; -extern struct nouveau_oclass *nv50_i2c_oclass; -extern struct nouveau_oclass *nv94_i2c_oclass; -extern struct nouveau_oclass *nvd0_i2c_oclass; -extern struct nouveau_oclass *gf117_i2c_oclass; -extern struct nouveau_oclass *nve0_i2c_oclass; -extern struct nouveau_oclass *gm204_i2c_oclass; +extern struct nvkm_oclass *nv04_i2c_oclass; +extern struct nvkm_oclass *nv4e_i2c_oclass; +extern struct nvkm_oclass *nv50_i2c_oclass; +extern struct nvkm_oclass *g94_i2c_oclass; +extern struct nvkm_oclass *gf110_i2c_oclass; +extern struct nvkm_oclass *gf117_i2c_oclass; +extern struct nvkm_oclass *gk104_i2c_oclass; +extern struct nvkm_oclass *gm204_i2c_oclass; static inline int -nv_rdi2cr(struct nouveau_i2c_port *port, u8 addr, u8 reg) +nv_rdi2cr(struct nvkm_i2c_port *port, u8 addr, u8 reg) { u8 val; struct i2c_msg msgs[] = { @@ -110,7 +110,7 @@ nv_rdi2cr(struct nouveau_i2c_port *port, u8 addr, u8 reg) } static inline int -nv_wri2cr(struct nouveau_i2c_port *port, u8 addr, u8 reg, u8 val) +nv_wri2cr(struct nvkm_i2c_port *port, u8 addr, u8 reg, u8 val) { u8 buf[2] = { reg, val }; struct i2c_msg msgs[] = { @@ -125,12 +125,11 @@ nv_wri2cr(struct nouveau_i2c_port *port, u8 addr, u8 reg, u8 val) } static inline bool -nv_probe_i2c(struct nouveau_i2c_port *port, u8 addr) +nv_probe_i2c(struct nvkm_i2c_port *port, u8 addr) { return nv_rdi2cr(port, addr, 0) >= 0; } -int nv_rdaux(struct nouveau_i2c_port *, u32 addr, u8 *data, u8 size); -int nv_wraux(struct nouveau_i2c_port *, u32 addr, u8 *data, u8 size); - +int nv_rdaux(struct nvkm_i2c_port *, u32 addr, u8 *data, u8 size); +int nv_wraux(struct nvkm_i2c_port *, u32 addr, u8 *data, u8 size); #endif diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/gm100.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/gm100.c index f27932e..e2581c4 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/gm100.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/gm100.c @@ -63,7 +63,7 @@ gm100_identify(struct nouveau_device *device) device->cname = "GM107"; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = gk104_gpio_oclass; - device->oclass[NVDEV_SUBDEV_I2C ] = nvd0_i2c_oclass; + device->oclass[NVDEV_SUBDEV_I2C ] = gf110_i2c_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gm107_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &gm107_therm_oclass; diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/nv50.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/nv50.c index 7476517..579829a 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/nv50.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/nv50.c @@ -178,7 +178,7 @@ nv50_identify(struct nouveau_device *device) device->cname = "G94"; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass; - device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; + device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass; @@ -207,7 +207,7 @@ nv50_identify(struct nouveau_device *device) device->cname = "G96"; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass; - device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; + device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass; @@ -236,7 +236,7 @@ nv50_identify(struct nouveau_device *device) device->cname = "G98"; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass; - device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; + device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass; @@ -294,7 +294,7 @@ nv50_identify(struct nouveau_device *device) device->cname = "MCP77/MCP78"; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass; - device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; + device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = mcp77_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass; @@ -323,7 +323,7 @@ nv50_identify(struct nouveau_device *device) device->cname = "MCP79/MCP7A"; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass; - device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; + device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = mcp77_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass; @@ -352,7 +352,7 @@ nv50_identify(struct nouveau_device *device) device->cname = "GT215"; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass; - device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; + device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = >215_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; @@ -383,7 +383,7 @@ nv50_identify(struct nouveau_device *device) device->cname = "GT216"; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass; - device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; + device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = >215_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; @@ -413,7 +413,7 @@ nv50_identify(struct nouveau_device *device) device->cname = "GT218"; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass; - device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; + device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = >215_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; @@ -443,7 +443,7 @@ nv50_identify(struct nouveau_device *device) device->cname = "MCP89"; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass; - device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; + device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &nv50_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = >215_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/nvc0.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/nvc0.c index 5a67aad..310fd41 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/nvc0.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/nvc0.c @@ -63,7 +63,7 @@ nvc0_identify(struct nouveau_device *device) device->cname = "GF100"; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass; - device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; + device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; @@ -96,7 +96,7 @@ nvc0_identify(struct nouveau_device *device) device->cname = "GF104"; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass; - device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; + device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; @@ -129,7 +129,7 @@ nvc0_identify(struct nouveau_device *device) device->cname = "GF106"; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass; - device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; + device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; @@ -161,7 +161,7 @@ nvc0_identify(struct nouveau_device *device) device->cname = "GF114"; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass; - device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; + device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; @@ -194,7 +194,7 @@ nvc0_identify(struct nouveau_device *device) device->cname = "GF116"; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass; - device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; + device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; @@ -226,7 +226,7 @@ nvc0_identify(struct nouveau_device *device) device->cname = "GF108"; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass; - device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; + device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; @@ -258,7 +258,7 @@ nvc0_identify(struct nouveau_device *device) device->cname = "GF110"; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_oclass; - device->oclass[NVDEV_SUBDEV_I2C ] = nv94_i2c_oclass; + device->oclass[NVDEV_SUBDEV_I2C ] = g94_i2c_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; @@ -291,7 +291,7 @@ nvc0_identify(struct nouveau_device *device) device->cname = "GF119"; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = gf110_gpio_oclass; - device->oclass[NVDEV_SUBDEV_I2C ] = nvd0_i2c_oclass; + device->oclass[NVDEV_SUBDEV_I2C ] = gf110_i2c_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/nve0.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/nve0.c index 024059a..89ac2ca 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/nve0.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/nve0.c @@ -63,7 +63,7 @@ nve0_identify(struct nouveau_device *device) device->cname = "GK104"; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = gk104_gpio_oclass; - device->oclass[NVDEV_SUBDEV_I2C ] = nve0_i2c_oclass; + device->oclass[NVDEV_SUBDEV_I2C ] = gk104_i2c_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; @@ -97,7 +97,7 @@ nve0_identify(struct nouveau_device *device) device->cname = "GK107"; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = gk104_gpio_oclass; - device->oclass[NVDEV_SUBDEV_I2C ] = nve0_i2c_oclass; + device->oclass[NVDEV_SUBDEV_I2C ] = gk104_i2c_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; @@ -131,7 +131,7 @@ nve0_identify(struct nouveau_device *device) device->cname = "GK106"; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = gk104_gpio_oclass; - device->oclass[NVDEV_SUBDEV_I2C ] = nve0_i2c_oclass; + device->oclass[NVDEV_SUBDEV_I2C ] = gk104_i2c_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; @@ -187,7 +187,7 @@ nve0_identify(struct nouveau_device *device) device->cname = "GK110"; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = gk104_gpio_oclass; - device->oclass[NVDEV_SUBDEV_I2C ] = nve0_i2c_oclass; + device->oclass[NVDEV_SUBDEV_I2C ] = gk104_i2c_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; @@ -221,7 +221,7 @@ nve0_identify(struct nouveau_device *device) device->cname = "GK110B"; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = gk104_gpio_oclass; - device->oclass[NVDEV_SUBDEV_I2C ] = nvd0_i2c_oclass; + device->oclass[NVDEV_SUBDEV_I2C ] = gf110_i2c_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; @@ -255,7 +255,7 @@ nve0_identify(struct nouveau_device *device) device->cname = "GK208B"; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = gk104_gpio_oclass; - device->oclass[NVDEV_SUBDEV_I2C ] = nve0_i2c_oclass; + device->oclass[NVDEV_SUBDEV_I2C ] = gk104_i2c_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; @@ -288,7 +288,7 @@ nve0_identify(struct nouveau_device *device) device->cname = "GK208"; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_GPIO ] = gk104_gpio_oclass; - device->oclass[NVDEV_SUBDEV_I2C ] = nve0_i2c_oclass; + device->oclass[NVDEV_SUBDEV_I2C ] = gk104_i2c_oclass; device->oclass[NVDEV_SUBDEV_FUSE ] = &gf100_fuse_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c index 63c9607..f67cdae 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c @@ -30,6 +30,8 @@ #include #include #include + +#include #include #include #include diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/Kbuild b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/Kbuild index cc8bd83..d683074 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/Kbuild +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/Kbuild @@ -4,13 +4,13 @@ nvkm-y += nvkm/subdev/i2c/aux.o nvkm-y += nvkm/subdev/i2c/bit.o nvkm-y += nvkm/subdev/i2c/pad.o nvkm-y += nvkm/subdev/i2c/padnv04.o -nvkm-y += nvkm/subdev/i2c/padnv94.o +nvkm-y += nvkm/subdev/i2c/padg94.o nvkm-y += nvkm/subdev/i2c/padgm204.o nvkm-y += nvkm/subdev/i2c/nv04.o nvkm-y += nvkm/subdev/i2c/nv4e.o nvkm-y += nvkm/subdev/i2c/nv50.o -nvkm-y += nvkm/subdev/i2c/nv94.o -nvkm-y += nvkm/subdev/i2c/nvd0.o +nvkm-y += nvkm/subdev/i2c/g94.o +nvkm-y += nvkm/subdev/i2c/gf110.o nvkm-y += nvkm/subdev/i2c/gf117.o -nvkm-y += nvkm/subdev/i2c/nve0.o +nvkm-y += nvkm/subdev/i2c/gk104.o nvkm-y += nvkm/subdev/i2c/gm204.o diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/anx9805.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/anx9805.c index 2c2731a..d17dd1c 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/anx9805.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/anx9805.c @@ -21,20 +21,19 @@ * * Authors: Ben Skeggs */ - #include "port.h" struct anx9805_i2c_port { - struct nouveau_i2c_port base; + struct nvkm_i2c_port base; u32 addr; u32 ctrl; }; static int -anx9805_train(struct nouveau_i2c_port *port, int link_nr, int link_bw, bool enh) +anx9805_train(struct nvkm_i2c_port *port, int link_nr, int link_bw, bool enh) { struct anx9805_i2c_port *chan = (void *)port; - struct nouveau_i2c_port *mast = (void *)nv_object(chan)->parent; + struct nvkm_i2c_port *mast = (void *)nv_object(chan)->parent; u8 tmp, i; DBG("ANX9805 train %d 0x%02x %d\n", link_nr, link_bw, enh); @@ -62,11 +61,11 @@ anx9805_train(struct nouveau_i2c_port *port, int link_nr, int link_bw, bool enh) } static int -anx9805_aux(struct nouveau_i2c_port *port, bool retry, +anx9805_aux(struct nvkm_i2c_port *port, bool retry, u8 type, u32 addr, u8 *data, u8 size) { struct anx9805_i2c_port *chan = (void *)port; - struct nouveau_i2c_port *mast = (void *)nv_object(chan)->parent; + struct nvkm_i2c_port *mast = (void *)nv_object(chan)->parent; int i, ret = -ETIMEDOUT; u8 buf[16] = {}; u8 tmp; @@ -116,25 +115,25 @@ done: return ret; } -static const struct nouveau_i2c_func +static const struct nvkm_i2c_func anx9805_aux_func = { .aux = anx9805_aux, .lnk_ctl = anx9805_train, }; static int -anx9805_aux_chan_ctor(struct nouveau_object *parent, - struct nouveau_object *engine, - struct nouveau_oclass *oclass, void *data, u32 index, - struct nouveau_object **pobject) +anx9805_aux_chan_ctor(struct nvkm_object *parent, + struct nvkm_object *engine, + struct nvkm_oclass *oclass, void *data, u32 index, + struct nvkm_object **pobject) { - struct nouveau_i2c_port *mast = (void *)parent; + struct nvkm_i2c_port *mast = (void *)parent; struct anx9805_i2c_port *chan; int ret; - ret = nouveau_i2c_port_create(parent, engine, oclass, index, - &nouveau_i2c_aux_algo, &anx9805_aux_func, - &chan); + ret = nvkm_i2c_port_create(parent, engine, oclass, index, + &nvkm_i2c_aux_algo, &anx9805_aux_func, + &chan); *pobject = nv_object(chan); if (ret) return ret; @@ -156,22 +155,23 @@ anx9805_aux_chan_ctor(struct nouveau_object *parent, struct i2c_algo_bit_data *algo = mast->adapter.algo_data; algo->udelay = max(algo->udelay, 40); } + return 0; } -static struct nouveau_ofuncs +static struct nvkm_ofuncs anx9805_aux_ofuncs = { .ctor = anx9805_aux_chan_ctor, - .dtor = _nouveau_i2c_port_dtor, - .init = _nouveau_i2c_port_init, - .fini = _nouveau_i2c_port_fini, + .dtor = _nvkm_i2c_port_dtor, + .init = _nvkm_i2c_port_init, + .fini = _nvkm_i2c_port_fini, }; static int anx9805_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) { struct anx9805_i2c_port *port = adap->algo_data; - struct nouveau_i2c_port *mast = (void *)nv_object(port)->parent; + struct nvkm_i2c_port *mast = (void *)nv_object(port)->parent; struct i2c_msg *msg = msgs; int ret = -ETIMEDOUT; int i, j, cnt = num; @@ -233,23 +233,22 @@ anx9805_i2c_algo = { .functionality = anx9805_func }; -static const struct nouveau_i2c_func +static const struct nvkm_i2c_func anx9805_i2c_func = { }; static int -anx9805_ddc_port_ctor(struct nouveau_object *parent, - struct nouveau_object *engine, - struct nouveau_oclass *oclass, void *data, u32 index, - struct nouveau_object **pobject) +anx9805_ddc_port_ctor(struct nvkm_object *parent, + struct nvkm_object *engine, + struct nvkm_oclass *oclass, void *data, u32 index, + struct nvkm_object **pobject) { - struct nouveau_i2c_port *mast = (void *)parent; + struct nvkm_i2c_port *mast = (void *)parent; struct anx9805_i2c_port *port; int ret; - ret = nouveau_i2c_port_create(parent, engine, oclass, index, - &anx9805_i2c_algo, &anx9805_i2c_func, - &port); + ret = nvkm_i2c_port_create(parent, engine, oclass, index, + &anx9805_i2c_algo, &anx9805_i2c_func, &port); *pobject = nv_object(port); if (ret) return ret; @@ -271,19 +270,20 @@ anx9805_ddc_port_ctor(struct nouveau_object *parent, struct i2c_algo_bit_data *algo = mast->adapter.algo_data; algo->udelay = max(algo->udelay, 40); } + return 0; } -static struct nouveau_ofuncs +static struct nvkm_ofuncs anx9805_ddc_ofuncs = { .ctor = anx9805_ddc_port_ctor, - .dtor = _nouveau_i2c_port_dtor, - .init = _nouveau_i2c_port_init, - .fini = _nouveau_i2c_port_fini, + .dtor = _nvkm_i2c_port_dtor, + .init = _nvkm_i2c_port_init, + .fini = _nvkm_i2c_port_fini, }; -struct nouveau_oclass -nouveau_anx9805_sclass[] = { +struct nvkm_oclass +nvkm_anx9805_sclass[] = { { .handle = NV_I2C_TYPE_EXTDDC(0x0d), .ofuncs = &anx9805_ddc_ofuncs }, { .handle = NV_I2C_TYPE_EXTAUX(0x0d), .ofuncs = &anx9805_aux_ofuncs }, { .handle = NV_I2C_TYPE_EXTDDC(0x0e), .ofuncs = &anx9805_ddc_ofuncs }, diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c index 02eb42b..1c18860 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c @@ -21,13 +21,12 @@ * * Authors: Ben Skeggs */ - #include "priv.h" int -nv_rdaux(struct nouveau_i2c_port *port, u32 addr, u8 *data, u8 size) +nv_rdaux(struct nvkm_i2c_port *port, u32 addr, u8 *data, u8 size) { - struct nouveau_i2c *i2c = nouveau_i2c(port); + struct nvkm_i2c *i2c = nvkm_i2c(port); if (port->func->aux) { int ret = i2c->acquire(port, 0); if (ret == 0) { @@ -40,9 +39,9 @@ nv_rdaux(struct nouveau_i2c_port *port, u32 addr, u8 *data, u8 size) } int -nv_wraux(struct nouveau_i2c_port *port, u32 addr, u8 *data, u8 size) +nv_wraux(struct nvkm_i2c_port *port, u32 addr, u8 *data, u8 size) { - struct nouveau_i2c *i2c = nouveau_i2c(port); + struct nvkm_i2c *i2c = nvkm_i2c(port); if (port->func->aux) { int ret = i2c->acquire(port, 0); if (ret == 0) { @@ -57,8 +56,8 @@ nv_wraux(struct nouveau_i2c_port *port, u32 addr, u8 *data, u8 size) static int aux_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) { - struct nouveau_i2c_port *port = adap->algo_data; - struct nouveau_i2c *i2c = nouveau_i2c(port); + struct nvkm_i2c_port *port = adap->algo_data; + struct nvkm_i2c *i2c = nvkm_i2c(port); struct i2c_msg *msg = msgs; int ret, mcnt = num; @@ -108,7 +107,7 @@ aux_func(struct i2c_adapter *adap) return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; } -const struct i2c_algorithm nouveau_i2c_aux_algo = { +const struct i2c_algorithm nvkm_i2c_aux_algo = { .master_xfer = aux_xfer, .functionality = aux_func }; diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c index bd477cd..bfb0388 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c @@ -21,71 +21,66 @@ * * Authors: Ben Skeggs */ +#include "priv.h" +#include "pad.h" +#include #include #include -#include -#include - #include #include -#include -#include - -#include "priv.h" -#include "pad.h" /****************************************************************************** * interface to linux i2c bit-banging algorithm *****************************************************************************/ -#ifdef CONFIG_NOUVEAU_I2C_INTERNAL_DEFAULT +#ifdef CONFIG_NVKM_I2C_INTERNAL_DEFAULT #define CSTMSEL true #else #define CSTMSEL false #endif static int -nouveau_i2c_pre_xfer(struct i2c_adapter *adap) +nvkm_i2c_pre_xfer(struct i2c_adapter *adap) { struct i2c_algo_bit_data *bit = adap->algo_data; - struct nouveau_i2c_port *port = bit->data; - return nouveau_i2c(port)->acquire(port, bit->timeout); + struct nvkm_i2c_port *port = bit->data; + return nvkm_i2c(port)->acquire(port, bit->timeout); } static void -nouveau_i2c_post_xfer(struct i2c_adapter *adap) +nvkm_i2c_post_xfer(struct i2c_adapter *adap) { struct i2c_algo_bit_data *bit = adap->algo_data; - struct nouveau_i2c_port *port = bit->data; - return nouveau_i2c(port)->release(port); + struct nvkm_i2c_port *port = bit->data; + return nvkm_i2c(port)->release(port); } static void -nouveau_i2c_setscl(void *data, int state) +nvkm_i2c_setscl(void *data, int state) { - struct nouveau_i2c_port *port = data; + struct nvkm_i2c_port *port = data; port->func->drive_scl(port, state); } static void -nouveau_i2c_setsda(void *data, int state) +nvkm_i2c_setsda(void *data, int state) { - struct nouveau_i2c_port *port = data; + struct nvkm_i2c_port *port = data; port->func->drive_sda(port, state); } static int -nouveau_i2c_getscl(void *data) +nvkm_i2c_getscl(void *data) { - struct nouveau_i2c_port *port = data; + struct nvkm_i2c_port *port = data; return port->func->sense_scl(port); } static int -nouveau_i2c_getsda(void *data) +nvkm_i2c_getsda(void *data) { - struct nouveau_i2c_port *port = data; + struct nvkm_i2c_port *port = data; return port->func->sense_sda(port); } @@ -94,42 +89,41 @@ nouveau_i2c_getsda(void *data) *****************************************************************************/ int -_nouveau_i2c_port_fini(struct nouveau_object *object, bool suspend) +_nvkm_i2c_port_fini(struct nvkm_object *object, bool suspend) { - struct nouveau_i2c_port *port = (void *)object; + struct nvkm_i2c_port *port = (void *)object; struct nvkm_i2c_pad *pad = nvkm_i2c_pad(port); nv_ofuncs(pad)->fini(nv_object(pad), suspend); - return nouveau_object_fini(&port->base, suspend); + return nvkm_object_fini(&port->base, suspend); } void -_nouveau_i2c_port_dtor(struct nouveau_object *object) +_nvkm_i2c_port_dtor(struct nvkm_object *object) { - struct nouveau_i2c_port *port = (void *)object; + struct nvkm_i2c_port *port = (void *)object; i2c_del_adapter(&port->adapter); - nouveau_object_destroy(&port->base); + nvkm_object_destroy(&port->base); } int -nouveau_i2c_port_create_(struct nouveau_object *parent, - struct nouveau_object *engine, - struct nouveau_oclass *oclass, u8 index, - const struct i2c_algorithm *algo, - const struct nouveau_i2c_func *func, - int size, void **pobject) +nvkm_i2c_port_create_(struct nvkm_object *parent, struct nvkm_object *engine, + struct nvkm_oclass *oclass, u8 index, + const struct i2c_algorithm *algo, + const struct nvkm_i2c_func *func, + int size, void **pobject) { - struct nouveau_device *device = nv_device(parent); - struct nouveau_i2c *i2c = nouveau_i2c(parent); - struct nouveau_i2c_port *port; + struct nvkm_device *device = nv_device(parent); + struct nvkm_i2c *i2c = nvkm_i2c(parent); + struct nvkm_i2c_port *port; int ret; - ret = nouveau_object_create_(parent, engine, oclass, 0, size, pobject); + ret = nvkm_object_create_(parent, engine, oclass, 0, size, pobject); port = *pobject; if (ret) return ret; snprintf(port->adapter.name, sizeof(port->adapter.name), - "nouveau-%s-%d", device->name, index); + "nvkm-%s-%d", device->name, index); port->adapter.owner = THIS_MODULE; port->adapter.dev.parent = nv_device_base(device); port->index = index; @@ -137,8 +131,8 @@ nouveau_i2c_port_create_(struct nouveau_object *parent, port->func = func; mutex_init(&port->mutex); - if ( algo == &nouveau_i2c_bit_algo && - !nouveau_boolopt(device->cfgopt, "NvI2C", CSTMSEL)) { + if ( algo == &nvkm_i2c_bit_algo && + !nvkm_boolopt(device->cfgopt, "NvI2C", CSTMSEL)) { struct i2c_algo_bit_data *bit; bit = kzalloc(sizeof(*bit), GFP_KERNEL); @@ -148,12 +142,12 @@ nouveau_i2c_port_create_(struct nouveau_object *parent, bit->udelay = 10; bit->timeout = usecs_to_jiffies(2200); bit->data = port; - bit->pre_xfer = nouveau_i2c_pre_xfer; - bit->post_xfer = nouveau_i2c_post_xfer; - bit->setsda = nouveau_i2c_setsda; - bit->setscl = nouveau_i2c_setscl; - bit->getsda = nouveau_i2c_getsda; - bit->getscl = nouveau_i2c_getscl; + bit->pre_xfer = nvkm_i2c_pre_xfer; + bit->post_xfer = nvkm_i2c_post_xfer; + bit->setsda = nvkm_i2c_setsda; + bit->setscl = nvkm_i2c_setscl; + bit->getsda = nvkm_i2c_getsda; + bit->getscl = nvkm_i2c_getscl; port->adapter.algo_data = bit; ret = i2c_bit_add_bus(&port->adapter); @@ -172,11 +166,11 @@ nouveau_i2c_port_create_(struct nouveau_object *parent, * base i2c subdev class implementation *****************************************************************************/ -static struct nouveau_i2c_port * -nouveau_i2c_find(struct nouveau_i2c *i2c, u8 index) +static struct nvkm_i2c_port * +nvkm_i2c_find(struct nvkm_i2c *i2c, u8 index) { - struct nouveau_bios *bios = nouveau_bios(i2c); - struct nouveau_i2c_port *port; + struct nvkm_bios *bios = nvkm_bios(i2c); + struct nvkm_i2c_port *port; if (index == NV_I2C_DEFAULT(0) || index == NV_I2C_DEFAULT(1)) { @@ -201,10 +195,10 @@ nouveau_i2c_find(struct nouveau_i2c *i2c, u8 index) return NULL; } -static struct nouveau_i2c_port * -nouveau_i2c_find_type(struct nouveau_i2c *i2c, u16 type) +static struct nvkm_i2c_port * +nvkm_i2c_find_type(struct nvkm_i2c *i2c, u16 type) { - struct nouveau_i2c_port *port; + struct nvkm_i2c_port *port; list_for_each_entry(port, &i2c->ports, head) { if (nv_hclass(port) == type) @@ -215,10 +209,10 @@ nouveau_i2c_find_type(struct nouveau_i2c *i2c, u16 type) } static void -nouveau_i2c_release_pad(struct nouveau_i2c_port *port) +nvkm_i2c_release_pad(struct nvkm_i2c_port *port) { struct nvkm_i2c_pad *pad = nvkm_i2c_pad(port); - struct nouveau_i2c *i2c = nouveau_i2c(port); + struct nvkm_i2c *i2c = nvkm_i2c(port); if (atomic_dec_and_test(&nv_object(pad)->usecount)) { nv_ofuncs(pad)->fini(nv_object(pad), false); @@ -227,18 +221,18 @@ nouveau_i2c_release_pad(struct nouveau_i2c_port *port) } static int -nouveau_i2c_try_acquire_pad(struct nouveau_i2c_port *port) +nvkm_i2c_try_acquire_pad(struct nvkm_i2c_port *port) { struct nvkm_i2c_pad *pad = nvkm_i2c_pad(port); if (atomic_add_return(1, &nv_object(pad)->usecount) != 1) { - struct nouveau_object *owner = (void *)pad->port; + struct nvkm_object *owner = (void *)pad->port; do { if (owner == (void *)port) return 0; owner = owner->parent; } while(owner); - nouveau_i2c_release_pad(port); + nvkm_i2c_release_pad(port); return -EBUSY; } @@ -248,48 +242,48 @@ nouveau_i2c_try_acquire_pad(struct nouveau_i2c_port *port) } static int -nouveau_i2c_acquire_pad(struct nouveau_i2c_port *port, unsigned long timeout) +nvkm_i2c_acquire_pad(struct nvkm_i2c_port *port, unsigned long timeout) { - struct nouveau_i2c *i2c = nouveau_i2c(port); + struct nvkm_i2c *i2c = nvkm_i2c(port); if (timeout) { if (wait_event_timeout(i2c->wait, - nouveau_i2c_try_acquire_pad(port) == 0, + nvkm_i2c_try_acquire_pad(port) == 0, timeout) == 0) return -EBUSY; } else { - wait_event(i2c->wait, nouveau_i2c_try_acquire_pad(port) == 0); + wait_event(i2c->wait, nvkm_i2c_try_acquire_pad(port) == 0); } return 0; } static void -nouveau_i2c_release(struct nouveau_i2c_port *port) +nvkm_i2c_release(struct nvkm_i2c_port *port) __releases(pad->mutex) { - nouveau_i2c(port)->release_pad(port); + nvkm_i2c(port)->release_pad(port); mutex_unlock(&port->mutex); } static int -nouveau_i2c_acquire(struct nouveau_i2c_port *port, unsigned long timeout) +nvkm_i2c_acquire(struct nvkm_i2c_port *port, unsigned long timeout) __acquires(pad->mutex) { int ret; mutex_lock(&port->mutex); - if ((ret = nouveau_i2c(port)->acquire_pad(port, timeout))) + if ((ret = nvkm_i2c(port)->acquire_pad(port, timeout))) mutex_unlock(&port->mutex); return ret; } static int -nouveau_i2c_identify(struct nouveau_i2c *i2c, int index, const char *what, - struct nouveau_i2c_board_info *info, - bool (*match)(struct nouveau_i2c_port *, - struct i2c_board_info *, void *), void *data) +nvkm_i2c_identify(struct nvkm_i2c *i2c, int index, const char *what, + struct nvkm_i2c_board_info *info, + bool (*match)(struct nvkm_i2c_port *, + struct i2c_board_info *, void *), void *data) { - struct nouveau_i2c_port *port = nouveau_i2c_find(i2c, index); + struct nvkm_i2c_port *port = nvkm_i2c_find(i2c, index); int i; if (!port) { @@ -328,27 +322,27 @@ nouveau_i2c_identify(struct nouveau_i2c *i2c, int index, const char *what, } static void -nouveau_i2c_intr_fini(struct nvkm_event *event, int type, int index) +nvkm_i2c_intr_fini(struct nvkm_event *event, int type, int index) { - struct nouveau_i2c *i2c = container_of(event, typeof(*i2c), event); - struct nouveau_i2c_port *port = i2c->find(i2c, index); - const struct nouveau_i2c_impl *impl = (void *)nv_object(i2c)->oclass; + struct nvkm_i2c *i2c = container_of(event, typeof(*i2c), event); + struct nvkm_i2c_port *port = i2c->find(i2c, index); + const struct nvkm_i2c_impl *impl = (void *)nv_object(i2c)->oclass; if (port && port->aux >= 0) impl->aux_mask(i2c, type, 1 << port->aux, 0); } static void -nouveau_i2c_intr_init(struct nvkm_event *event, int type, int index) +nvkm_i2c_intr_init(struct nvkm_event *event, int type, int index) { - struct nouveau_i2c *i2c = container_of(event, typeof(*i2c), event); - struct nouveau_i2c_port *port = i2c->find(i2c, index); - const struct nouveau_i2c_impl *impl = (void *)nv_object(i2c)->oclass; + struct nvkm_i2c *i2c = container_of(event, typeof(*i2c), event); + struct nvkm_i2c_port *port = i2c->find(i2c, index); + const struct nvkm_i2c_impl *impl = (void *)nv_object(i2c)->oclass; if (port && port->aux >= 0) impl->aux_mask(i2c, type, 1 << port->aux, 1 << port->aux); } static int -nouveau_i2c_intr_ctor(struct nouveau_object *object, void *data, u32 size, +nvkm_i2c_intr_ctor(struct nvkm_object *object, void *data, u32 size, struct nvkm_notify *notify) { struct nvkm_i2c_ntfy_req *req = data; @@ -362,11 +356,11 @@ nouveau_i2c_intr_ctor(struct nouveau_object *object, void *data, u32 size, } static void -nouveau_i2c_intr(struct nouveau_subdev *subdev) +nvkm_i2c_intr(struct nvkm_subdev *subdev) { - struct nouveau_i2c_impl *impl = (void *)nv_oclass(subdev); - struct nouveau_i2c *i2c = nouveau_i2c(subdev); - struct nouveau_i2c_port *port; + struct nvkm_i2c_impl *impl = (void *)nv_oclass(subdev); + struct nvkm_i2c *i2c = nvkm_i2c(subdev); + struct nvkm_i2c_port *port; u32 hi, lo, rq, tx, e; if (impl->aux_stat) { @@ -394,18 +388,18 @@ nouveau_i2c_intr(struct nouveau_subdev *subdev) } static const struct nvkm_event_func -nouveau_i2c_intr_func = { - .ctor = nouveau_i2c_intr_ctor, - .init = nouveau_i2c_intr_init, - .fini = nouveau_i2c_intr_fini, +nvkm_i2c_intr_func = { + .ctor = nvkm_i2c_intr_ctor, + .init = nvkm_i2c_intr_init, + .fini = nvkm_i2c_intr_fini, }; int -_nouveau_i2c_fini(struct nouveau_object *object, bool suspend) +_nvkm_i2c_fini(struct nvkm_object *object, bool suspend) { - struct nouveau_i2c_impl *impl = (void *)nv_oclass(object); - struct nouveau_i2c *i2c = (void *)object; - struct nouveau_i2c_port *port; + struct nvkm_i2c_impl *impl = (void *)nv_oclass(object); + struct nvkm_i2c *i2c = (void *)object; + struct nvkm_i2c_port *port; u32 mask; int ret; @@ -420,7 +414,7 @@ _nouveau_i2c_fini(struct nouveau_object *object, bool suspend) impl->aux_stat(i2c, &mask, &mask, &mask, &mask); } - return nouveau_subdev_fini(&i2c->base, suspend); + return nvkm_subdev_fini(&i2c->base, suspend); fail: list_for_each_entry_continue_reverse(port, &i2c->ports, head) { nv_ofuncs(port)->init(nv_object(port)); @@ -430,13 +424,13 @@ fail: } int -_nouveau_i2c_init(struct nouveau_object *object) +_nvkm_i2c_init(struct nvkm_object *object) { - struct nouveau_i2c *i2c = (void *)object; - struct nouveau_i2c_port *port; + struct nvkm_i2c *i2c = (void *)object; + struct nvkm_i2c_port *port; int ret; - ret = nouveau_subdev_init(&i2c->base); + ret = nvkm_subdev_init(&i2c->base); if (ret == 0) { list_for_each_entry(port, &i2c->ports, head) { ret = nv_ofuncs(port)->init(nv_object(port)); @@ -455,33 +449,33 @@ fail: } void -_nouveau_i2c_dtor(struct nouveau_object *object) +_nvkm_i2c_dtor(struct nvkm_object *object) { - struct nouveau_i2c *i2c = (void *)object; - struct nouveau_i2c_port *port, *temp; + struct nvkm_i2c *i2c = (void *)object; + struct nvkm_i2c_port *port, *temp; nvkm_event_fini(&i2c->event); list_for_each_entry_safe(port, temp, &i2c->ports, head) { - nouveau_object_ref(NULL, (struct nouveau_object **)&port); + nvkm_object_ref(NULL, (struct nvkm_object **)&port); } - nouveau_subdev_destroy(&i2c->base); + nvkm_subdev_destroy(&i2c->base); } -static struct nouveau_oclass * -nouveau_i2c_extdev_sclass[] = { - nouveau_anx9805_sclass, +static struct nvkm_oclass * +nvkm_i2c_extdev_sclass[] = { + nvkm_anx9805_sclass, }; static void -nouveau_i2c_create_port(struct nouveau_i2c *i2c, int index, u8 type, - struct dcb_i2c_entry *info) +nvkm_i2c_create_port(struct nvkm_i2c *i2c, int index, u8 type, + struct dcb_i2c_entry *info) { - const struct nouveau_i2c_impl *impl = (void *)nv_oclass(i2c); - struct nouveau_oclass *oclass; - struct nouveau_object *parent; - struct nouveau_object *object; + const struct nvkm_i2c_impl *impl = (void *)nv_oclass(i2c); + struct nvkm_oclass *oclass; + struct nvkm_object *parent; + struct nvkm_object *object; int ret, pad; if (info->share != DCB_I2C_UNUSED) { @@ -495,8 +489,8 @@ nouveau_i2c_create_port(struct nouveau_i2c *i2c, int index, u8 type, oclass = impl->pad_x; } - ret = nouveau_object_ctor(nv_object(i2c), NULL, oclass, - NULL, pad, &parent); + ret = nvkm_object_ctor(nv_object(i2c), NULL, oclass, + NULL, pad, &parent); if (ret < 0) return; @@ -504,44 +498,40 @@ nouveau_i2c_create_port(struct nouveau_i2c *i2c, int index, u8 type, do { ret = -EINVAL; if (oclass->handle == type) { - ret = nouveau_object_ctor(parent, NULL, - oclass, info, index, - &object); + ret = nvkm_object_ctor(parent, NULL, oclass, + info, index, &object); } } while (ret && (++oclass)->handle); - nouveau_object_ref(NULL, &parent); + nvkm_object_ref(NULL, &parent); } int -nouveau_i2c_create_(struct nouveau_object *parent, - struct nouveau_object *engine, - struct nouveau_oclass *oclass, - int length, void **pobject) +nvkm_i2c_create_(struct nvkm_object *parent, struct nvkm_object *engine, + struct nvkm_oclass *oclass, int length, void **pobject) { - struct nouveau_bios *bios = nouveau_bios(parent); - struct nouveau_i2c *i2c; - struct nouveau_object *object; + struct nvkm_bios *bios = nvkm_bios(parent); + struct nvkm_i2c *i2c; + struct nvkm_object *object; struct dcb_i2c_entry info; int ret, i, j, index = -1; struct dcb_output outp; u8 ver, hdr; u32 data; - ret = nouveau_subdev_create(parent, engine, oclass, 0, - "I2C", "i2c", &i2c); + ret = nvkm_subdev_create(parent, engine, oclass, 0, "I2C", "i2c", &i2c); *pobject = nv_object(i2c); if (ret) return ret; - nv_subdev(i2c)->intr = nouveau_i2c_intr; - i2c->find = nouveau_i2c_find; - i2c->find_type = nouveau_i2c_find_type; - i2c->acquire_pad = nouveau_i2c_acquire_pad; - i2c->release_pad = nouveau_i2c_release_pad; - i2c->acquire = nouveau_i2c_acquire; - i2c->release = nouveau_i2c_release; - i2c->identify = nouveau_i2c_identify; + nv_subdev(i2c)->intr = nvkm_i2c_intr; + i2c->find = nvkm_i2c_find; + i2c->find_type = nvkm_i2c_find_type; + i2c->acquire_pad = nvkm_i2c_acquire_pad; + i2c->release_pad = nvkm_i2c_release_pad; + i2c->acquire = nvkm_i2c_acquire; + i2c->release = nvkm_i2c_release; + i2c->identify = nvkm_i2c_identify; init_waitqueue_head(&i2c->wait); INIT_LIST_HEAD(&i2c->ports); @@ -550,23 +540,21 @@ nouveau_i2c_create_(struct nouveau_object *parent, case DCB_I2C_NV04_BIT: case DCB_I2C_NV4E_BIT: case DCB_I2C_NVIO_BIT: - nouveau_i2c_create_port(i2c, NV_I2C_PORT(index), - info.type, &info); + nvkm_i2c_create_port(i2c, NV_I2C_PORT(index), + info.type, &info); break; case DCB_I2C_NVIO_AUX: - nouveau_i2c_create_port(i2c, NV_I2C_AUX(index), - info.type, &info); + nvkm_i2c_create_port(i2c, NV_I2C_AUX(index), + info.type, &info); break; case DCB_I2C_PMGR: if (info.drive != DCB_I2C_UNUSED) { - nouveau_i2c_create_port(i2c, NV_I2C_PORT(index), - DCB_I2C_NVIO_BIT, - &info); + nvkm_i2c_create_port(i2c, NV_I2C_PORT(index), + DCB_I2C_NVIO_BIT, &info); } if (info.auxch != DCB_I2C_UNUSED) { - nouveau_i2c_create_port(i2c, NV_I2C_AUX(index), - DCB_I2C_NVIO_AUX, - &info); + nvkm_i2c_create_port(i2c, NV_I2C_AUX(index), + DCB_I2C_NVIO_AUX, &info); } break; case DCB_I2C_UNUSED: @@ -598,20 +586,19 @@ nouveau_i2c_create_(struct nouveau_object *parent, ret = -ENODEV; j = -1; - while (ret && ++j < ARRAY_SIZE(nouveau_i2c_extdev_sclass)) { + while (ret && ++j < ARRAY_SIZE(nvkm_i2c_extdev_sclass)) { parent = nv_object(i2c->find(i2c, outp.i2c_index)); - oclass = nouveau_i2c_extdev_sclass[j]; + oclass = nvkm_i2c_extdev_sclass[j]; do { if (oclass->handle != info.type) continue; - ret = nouveau_object_ctor(parent, NULL, - oclass, NULL, - index++, &object); + ret = nvkm_object_ctor(parent, NULL, oclass, + NULL, index++, &object); } while (ret && (++oclass)->handle); } } - ret = nvkm_event_init(&nouveau_i2c_intr_func, 4, index, &i2c->event); + ret = nvkm_event_init(&nvkm_i2c_intr_func, 4, index, &i2c->event); if (ret) return ret; @@ -619,14 +606,14 @@ nouveau_i2c_create_(struct nouveau_object *parent, } int -_nouveau_i2c_ctor(struct nouveau_object *parent, struct nouveau_object *engine, - struct nouveau_oclass *oclass, void *data, u32 size, - struct nouveau_object **pobject) +_nvkm_i2c_ctor(struct nvkm_object *parent, struct nvkm_object *engine, + struct nvkm_oclass *oclass, void *data, u32 size, + struct nvkm_object **pobject) { - struct nouveau_i2c *i2c; + struct nvkm_i2c *i2c; int ret; - ret = nouveau_i2c_create(parent, engine, oclass, &i2c); + ret = nvkm_i2c_create(parent, engine, oclass, &i2c); *pobject = nv_object(i2c); if (ret) return ret; diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/bit.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/bit.c index 813ffc9..35132ba 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/bit.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/bit.c @@ -21,46 +21,45 @@ * * Authors: Ben Skeggs */ - #include "priv.h" -#ifdef CONFIG_NOUVEAU_I2C_INTERNAL +#ifdef CONFIG_NVKM_I2C_INTERNAL #define T_TIMEOUT 2200000 #define T_RISEFALL 1000 #define T_HOLD 5000 static inline void -i2c_drive_scl(struct nouveau_i2c_port *port, int state) +i2c_drive_scl(struct nvkm_i2c_port *port, int state) { port->func->drive_scl(port, state); } static inline void -i2c_drive_sda(struct nouveau_i2c_port *port, int state) +i2c_drive_sda(struct nvkm_i2c_port *port, int state) { port->func->drive_sda(port, state); } static inline int -i2c_sense_scl(struct nouveau_i2c_port *port) +i2c_sense_scl(struct nvkm_i2c_port *port) { return port->func->sense_scl(port); } static inline int -i2c_sense_sda(struct nouveau_i2c_port *port) +i2c_sense_sda(struct nvkm_i2c_port *port) { return port->func->sense_sda(port); } static void -i2c_delay(struct nouveau_i2c_port *port, u32 nsec) +i2c_delay(struct nvkm_i2c_port *port, u32 nsec) { udelay((nsec + 500) / 1000); } static bool -i2c_raise_scl(struct nouveau_i2c_port *port) +i2c_raise_scl(struct nvkm_i2c_port *port) { u32 timeout = T_TIMEOUT / T_RISEFALL; @@ -73,7 +72,7 @@ i2c_raise_scl(struct nouveau_i2c_port *port) } static int -i2c_start(struct nouveau_i2c_port *port) +i2c_start(struct nvkm_i2c_port *port) { int ret = 0; @@ -93,7 +92,7 @@ i2c_start(struct nouveau_i2c_port *port) } static void -i2c_stop(struct nouveau_i2c_port *port) +i2c_stop(struct nvkm_i2c_port *port) { i2c_drive_scl(port, 0); i2c_drive_sda(port, 0); @@ -106,7 +105,7 @@ i2c_stop(struct nouveau_i2c_port *port) } static int -i2c_bitw(struct nouveau_i2c_port *port, int sda) +i2c_bitw(struct nvkm_i2c_port *port, int sda) { i2c_drive_sda(port, sda); i2c_delay(port, T_RISEFALL); @@ -121,7 +120,7 @@ i2c_bitw(struct nouveau_i2c_port *port, int sda) } static int -i2c_bitr(struct nouveau_i2c_port *port) +i2c_bitr(struct nvkm_i2c_port *port) { int sda; @@ -140,7 +139,7 @@ i2c_bitr(struct nouveau_i2c_port *port) } static int -i2c_get_byte(struct nouveau_i2c_port *port, u8 *byte, bool last) +i2c_get_byte(struct nvkm_i2c_port *port, u8 *byte, bool last) { int i, bit; @@ -156,7 +155,7 @@ i2c_get_byte(struct nouveau_i2c_port *port, u8 *byte, bool last) } static int -i2c_put_byte(struct nouveau_i2c_port *port, u8 byte) +i2c_put_byte(struct nvkm_i2c_port *port, u8 byte) { int i, ret; for (i = 7; i >= 0; i--) { @@ -172,7 +171,7 @@ i2c_put_byte(struct nouveau_i2c_port *port, u8 byte) } static int -i2c_addr(struct nouveau_i2c_port *port, struct i2c_msg *msg) +i2c_addr(struct nvkm_i2c_port *port, struct i2c_msg *msg) { u32 addr = msg->addr << 1; if (msg->flags & I2C_M_RD) @@ -183,11 +182,11 @@ i2c_addr(struct nouveau_i2c_port *port, struct i2c_msg *msg) static int i2c_bit_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) { - struct nouveau_i2c_port *port = adap->algo_data; + struct nvkm_i2c_port *port = adap->algo_data; struct i2c_msg *msg = msgs; int ret = 0, mcnt = num; - ret = nouveau_i2c(port)->acquire(port, nsecs_to_jiffies(T_TIMEOUT)); + ret = nvkm_i2c(port)->acquire(port, nsecs_to_jiffies(T_TIMEOUT)); if (ret) return ret; @@ -211,7 +210,7 @@ i2c_bit_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) } i2c_stop(port); - nouveau_i2c(port)->release(port); + nvkm_i2c(port)->release(port); return (ret < 0) ? ret : num; } #else @@ -228,7 +227,7 @@ i2c_bit_func(struct i2c_adapter *adap) return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; } -const struct i2c_algorithm nouveau_i2c_bit_algo = { +const struct i2c_algorithm nvkm_i2c_bit_algo = { .master_xfer = i2c_bit_xfer, .functionality = i2c_bit_func }; diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/nv94.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/g94.c similarity index 76% rename from drivers/gpu/drm/nouveau/nvkm/subdev/i2c/nv94.c rename to drivers/gpu/drm/nouveau/nvkm/subdev/i2c/g94.c index e383ee8..2a2dd47 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/nv94.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/g94.c @@ -21,11 +21,10 @@ * * Authors: Ben Skeggs */ - #include "nv50.h" void -nv94_aux_stat(struct nouveau_i2c *i2c, u32 *hi, u32 *lo, u32 *rq, u32 *tx) +g94_aux_stat(struct nvkm_i2c *i2c, u32 *hi, u32 *lo, u32 *rq, u32 *tx) { u32 intr = nv_rd32(i2c, 0x00e06c); u32 stat = nv_rd32(i2c, 0x00e068) & intr, i; @@ -39,7 +38,7 @@ nv94_aux_stat(struct nouveau_i2c *i2c, u32 *hi, u32 *lo, u32 *rq, u32 *tx) } void -nv94_aux_mask(struct nouveau_i2c *i2c, u32 type, u32 mask, u32 data) +g94_aux_mask(struct nvkm_i2c *i2c, u32 type, u32 mask, u32 data) { u32 temp = nv_rd32(i2c, 0x00e068), i; for (i = 0; i < 8; i++) { @@ -58,13 +57,13 @@ nv94_aux_mask(struct nouveau_i2c *i2c, u32 type, u32 mask, u32 data) #define AUX_ERR(fmt, args...) nv_error(aux, "AUXCH(%d): " fmt, ch, ##args) static void -auxch_fini(struct nouveau_i2c *aux, int ch) +auxch_fini(struct nvkm_i2c *aux, int ch) { nv_mask(aux, 0x00e4e4 + (ch * 0x50), 0x00310000, 0x00000000); } static int -auxch_init(struct nouveau_i2c *aux, int ch) +auxch_init(struct nvkm_i2c *aux, int ch) { const u32 unksel = 1; /* nfi which to use, or if it matters.. */ const u32 ureq = unksel ? 0x00100000 : 0x00200000; @@ -99,10 +98,10 @@ auxch_init(struct nouveau_i2c *aux, int ch) } int -nv94_aux(struct nouveau_i2c_port *base, bool retry, +g94_aux(struct nvkm_i2c_port *base, bool retry, u8 type, u32 addr, u8 *data, u8 size) { - struct nouveau_i2c *aux = nouveau_i2c(base); + struct nvkm_i2c *aux = nvkm_i2c(base); struct nv50_i2c_port *port = (void *)base; u32 ctrl, stat, timeout, retries; u32 xbuf[4] = {}; @@ -185,8 +184,8 @@ out: return ret < 0 ? ret : (stat & 0x000f0000) >> 16; } -static const struct nouveau_i2c_func -nv94_i2c_func = { +static const struct nvkm_i2c_func +g94_i2c_func = { .drive_scl = nv50_i2c_drive_scl, .drive_sda = nv50_i2c_drive_sda, .sense_scl = nv50_i2c_sense_scl, @@ -194,17 +193,16 @@ nv94_i2c_func = { }; static int -nv94_i2c_port_ctor(struct nouveau_object *parent, struct nouveau_object *engine, - struct nouveau_oclass *oclass, void *data, u32 index, - struct nouveau_object **pobject) +g94_i2c_port_ctor(struct nvkm_object *parent, struct nvkm_object *engine, + struct nvkm_oclass *oclass, void *data, u32 index, + struct nvkm_object **pobject) { struct dcb_i2c_entry *info = data; struct nv50_i2c_port *port; int ret; - ret = nouveau_i2c_port_create(parent, engine, oclass, index, - &nouveau_i2c_bit_algo, &nv94_i2c_func, - &port); + ret = nvkm_i2c_port_create(parent, engine, oclass, index, + &nvkm_i2c_bit_algo, &g94_i2c_func, &port); *pobject = nv_object(port); if (ret) return ret; @@ -217,23 +215,22 @@ nv94_i2c_port_ctor(struct nouveau_object *parent, struct nouveau_object *engine, return 0; } -static const struct nouveau_i2c_func -nv94_aux_func = { - .aux = nv94_aux, +static const struct nvkm_i2c_func +g94_aux_func = { + .aux = g94_aux, }; int -nv94_aux_port_ctor(struct nouveau_object *parent, struct nouveau_object *engine, - struct nouveau_oclass *oclass, void *data, u32 index, - struct nouveau_object **pobject) +g94_aux_port_ctor(struct nvkm_object *parent, struct nvkm_object *engine, + struct nvkm_oclass *oclass, void *data, u32 index, + struct nvkm_object **pobject) { struct dcb_i2c_entry *info = data; struct nv50_i2c_port *port; int ret; - ret = nouveau_i2c_port_create(parent, engine, oclass, index, - &nouveau_i2c_aux_algo, &nv94_aux_func, - &port); + ret = nvkm_i2c_port_create(parent, engine, oclass, index, + &nvkm_i2c_aux_algo, &g94_aux_func, &port); *pobject = nv_object(port); if (ret) return ret; @@ -243,40 +240,40 @@ nv94_aux_port_ctor(struct nouveau_object *parent, struct nouveau_object *engine, return 0; } -static struct nouveau_oclass -nv94_i2c_sclass[] = { +static struct nvkm_oclass +g94_i2c_sclass[] = { { .handle = NV_I2C_TYPE_DCBI2C(DCB_I2C_NVIO_BIT), - .ofuncs = &(struct nouveau_ofuncs) { - .ctor = nv94_i2c_port_ctor, - .dtor = _nouveau_i2c_port_dtor, + .ofuncs = &(struct nvkm_ofuncs) { + .ctor = g94_i2c_port_ctor, + .dtor = _nvkm_i2c_port_dtor, .init = nv50_i2c_port_init, - .fini = _nouveau_i2c_port_fini, + .fini = _nvkm_i2c_port_fini, }, }, { .handle = NV_I2C_TYPE_DCBI2C(DCB_I2C_NVIO_AUX), - .ofuncs = &(struct nouveau_ofuncs) { - .ctor = nv94_aux_port_ctor, - .dtor = _nouveau_i2c_port_dtor, - .init = _nouveau_i2c_port_init, - .fini = _nouveau_i2c_port_fini, + .ofuncs = &(struct nvkm_ofuncs) { + .ctor = g94_aux_port_ctor, + .dtor = _nvkm_i2c_port_dtor, + .init = _nvkm_i2c_port_init, + .fini = _nvkm_i2c_port_fini, }, }, {} }; -struct nouveau_oclass * -nv94_i2c_oclass = &(struct nouveau_i2c_impl) { +struct nvkm_oclass * +g94_i2c_oclass = &(struct nvkm_i2c_impl) { .base.handle = NV_SUBDEV(I2C, 0x94), - .base.ofuncs = &(struct nouveau_ofuncs) { - .ctor = _nouveau_i2c_ctor, - .dtor = _nouveau_i2c_dtor, - .init = _nouveau_i2c_init, - .fini = _nouveau_i2c_fini, + .base.ofuncs = &(struct nvkm_ofuncs) { + .ctor = _nvkm_i2c_ctor, + .dtor = _nvkm_i2c_dtor, + .init = _nvkm_i2c_init, + .fini = _nvkm_i2c_fini, }, - .sclass = nv94_i2c_sclass, + .sclass = g94_i2c_sclass, .pad_x = &nv04_i2c_pad_oclass, - .pad_s = &nv94_i2c_pad_oclass, + .pad_s = &g94_i2c_pad_oclass, .aux = 4, - .aux_stat = nv94_aux_stat, - .aux_mask = nv94_aux_mask, + .aux_stat = g94_aux_stat, + .aux_mask = g94_aux_mask, }.base; diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/nvd0.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/gf110.c similarity index 58% rename from drivers/gpu/drm/nouveau/nvkm/subdev/i2c/nvd0.c rename to drivers/gpu/drm/nouveau/nvkm/subdev/i2c/gf110.c index 62dde9b..4d4ac66 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/nvd0.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/gf110.c @@ -21,45 +21,43 @@ * * Authors: Ben Skeggs */ - #include "nv50.h" static int -nvd0_i2c_sense_scl(struct nouveau_i2c_port *base) +gf110_i2c_sense_scl(struct nvkm_i2c_port *base) { - struct nv50_i2c_priv *priv = (void *)nouveau_i2c(base); + struct nv50_i2c_priv *priv = (void *)nvkm_i2c(base); struct nv50_i2c_port *port = (void *)base; return !!(nv_rd32(priv, port->addr) & 0x00000010); } static int -nvd0_i2c_sense_sda(struct nouveau_i2c_port *base) +gf110_i2c_sense_sda(struct nvkm_i2c_port *base) { - struct nv50_i2c_priv *priv = (void *)nouveau_i2c(base); + struct nv50_i2c_priv *priv = (void *)nvkm_i2c(base); struct nv50_i2c_port *port = (void *)base; return !!(nv_rd32(priv, port->addr) & 0x00000020); } -static const struct nouveau_i2c_func -nvd0_i2c_func = { +static const struct nvkm_i2c_func +gf110_i2c_func = { .drive_scl = nv50_i2c_drive_scl, .drive_sda = nv50_i2c_drive_sda, - .sense_scl = nvd0_i2c_sense_scl, - .sense_sda = nvd0_i2c_sense_sda, + .sense_scl = gf110_i2c_sense_scl, + .sense_sda = gf110_i2c_sense_sda, }; int -nvd0_i2c_port_ctor(struct nouveau_object *parent, struct nouveau_object *engine, - struct nouveau_oclass *oclass, void *data, u32 index, - struct nouveau_object **pobject) +gf110_i2c_port_ctor(struct nvkm_object *parent, struct nvkm_object *engine, + struct nvkm_oclass *oclass, void *data, u32 index, + struct nvkm_object **pobject) { struct dcb_i2c_entry *info = data; struct nv50_i2c_port *port; int ret; - ret = nouveau_i2c_port_create(parent, engine, oclass, index, - &nouveau_i2c_bit_algo, &nvd0_i2c_func, - &port); + ret = nvkm_i2c_port_create(parent, engine, oclass, index, + &nvkm_i2c_bit_algo, &gf110_i2c_func, &port); *pobject = nv_object(port); if (ret) return ret; @@ -69,40 +67,40 @@ nvd0_i2c_port_ctor(struct nouveau_object *parent, struct nouveau_object *engine, return 0; } -struct nouveau_oclass -nvd0_i2c_sclass[] = { +struct nvkm_oclass +gf110_i2c_sclass[] = { { .handle = NV_I2C_TYPE_DCBI2C(DCB_I2C_NVIO_BIT), - .ofuncs = &(struct nouveau_ofuncs) { - .ctor = nvd0_i2c_port_ctor, - .dtor = _nouveau_i2c_port_dtor, + .ofuncs = &(struct nvkm_ofuncs) { + .ctor = gf110_i2c_port_ctor, + .dtor = _nvkm_i2c_port_dtor, .init = nv50_i2c_port_init, - .fini = _nouveau_i2c_port_fini, + .fini = _nvkm_i2c_port_fini, }, }, { .handle = NV_I2C_TYPE_DCBI2C(DCB_I2C_NVIO_AUX), - .ofuncs = &(struct nouveau_ofuncs) { - .ctor = nv94_aux_port_ctor, - .dtor = _nouveau_i2c_port_dtor, - .init = _nouveau_i2c_port_init, - .fini = _nouveau_i2c_port_fini, + .ofuncs = &(struct nvkm_ofuncs) { + .ctor = g94_aux_port_ctor, + .dtor = _nvkm_i2c_port_dtor, + .init = _nvkm_i2c_port_init, + .fini = _nvkm_i2c_port_fini, }, }, {} }; -struct nouveau_oclass * -nvd0_i2c_oclass = &(struct nouveau_i2c_impl) { +struct nvkm_oclass * +gf110_i2c_oclass = &(struct nvkm_i2c_impl) { .base.handle = NV_SUBDEV(I2C, 0xd0), - .base.ofuncs = &(struct nouveau_ofuncs) { - .ctor = _nouveau_i2c_ctor, - .dtor = _nouveau_i2c_dtor, - .init = _nouveau_i2c_init, - .fini = _nouveau_i2c_fini, + .base.ofuncs = &(struct nvkm_ofuncs) { + .ctor = _nvkm_i2c_ctor, + .dtor = _nvkm_i2c_dtor, + .init = _nvkm_i2c_init, + .fini = _nvkm_i2c_fini, }, - .sclass = nvd0_i2c_sclass, + .sclass = gf110_i2c_sclass, .pad_x = &nv04_i2c_pad_oclass, - .pad_s = &nv94_i2c_pad_oclass, + .pad_s = &g94_i2c_pad_oclass, .aux = 4, - .aux_stat = nv94_aux_stat, - .aux_mask = nv94_aux_mask, + .aux_stat = g94_aux_stat, + .aux_mask = g94_aux_mask, }.base; diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/gf117.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/gf117.c index fa891c3..e290b40 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/gf117.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/gf117.c @@ -21,19 +21,18 @@ * * Authors: Ben Skeggs */ - #include "nv50.h" -struct nouveau_oclass * -gf117_i2c_oclass = &(struct nouveau_i2c_impl) { +struct nvkm_oclass * +gf117_i2c_oclass = &(struct nvkm_i2c_impl) { .base.handle = NV_SUBDEV(I2C, 0xd7), - .base.ofuncs = &(struct nouveau_ofuncs) { - .ctor = _nouveau_i2c_ctor, - .dtor = _nouveau_i2c_dtor, - .init = _nouveau_i2c_init, - .fini = _nouveau_i2c_fini, + .base.ofuncs = &(struct nvkm_ofuncs) { + .ctor = _nvkm_i2c_ctor, + .dtor = _nvkm_i2c_dtor, + .init = _nvkm_i2c_init, + .fini = _nvkm_i2c_fini, }, - .sclass = nvd0_i2c_sclass, + .sclass = gf110_i2c_sclass, .pad_x = &nv04_i2c_pad_oclass, .pad_s = &nv04_i2c_pad_oclass, }.base; diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/nve0.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/gk104.c similarity index 79% rename from drivers/gpu/drm/nouveau/nvkm/subdev/i2c/nve0.c rename to drivers/gpu/drm/nouveau/nvkm/subdev/i2c/gk104.c index 25fe5c2..1a464903 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/nve0.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/gk104.c @@ -21,11 +21,10 @@ * * Authors: Ben Skeggs */ - #include "nv50.h" void -nve0_aux_stat(struct nouveau_i2c *i2c, u32 *hi, u32 *lo, u32 *rq, u32 *tx) +gk104_aux_stat(struct nvkm_i2c *i2c, u32 *hi, u32 *lo, u32 *rq, u32 *tx) { u32 intr = nv_rd32(i2c, 0x00dc60); u32 stat = nv_rd32(i2c, 0x00dc68) & intr, i; @@ -39,7 +38,7 @@ nve0_aux_stat(struct nouveau_i2c *i2c, u32 *hi, u32 *lo, u32 *rq, u32 *tx) } void -nve0_aux_mask(struct nouveau_i2c *i2c, u32 type, u32 mask, u32 data) +gk104_aux_mask(struct nvkm_i2c *i2c, u32 type, u32 mask, u32 data) { u32 temp = nv_rd32(i2c, 0x00dc68), i; for (i = 0; i < 8; i++) { @@ -54,19 +53,19 @@ nve0_aux_mask(struct nouveau_i2c *i2c, u32 type, u32 mask, u32 data) nv_wr32(i2c, 0x00dc68, temp); } -struct nouveau_oclass * -nve0_i2c_oclass = &(struct nouveau_i2c_impl) { +struct nvkm_oclass * +gk104_i2c_oclass = &(struct nvkm_i2c_impl) { .base.handle = NV_SUBDEV(I2C, 0xe0), - .base.ofuncs = &(struct nouveau_ofuncs) { - .ctor = _nouveau_i2c_ctor, - .dtor = _nouveau_i2c_dtor, - .init = _nouveau_i2c_init, - .fini = _nouveau_i2c_fini, + .base.ofuncs = &(struct nvkm_ofuncs) { + .ctor = _nvkm_i2c_ctor, + .dtor = _nvkm_i2c_dtor, + .init = _nvkm_i2c_init, + .fini = _nvkm_i2c_fini, }, - .sclass = nvd0_i2c_sclass, + .sclass = gf110_i2c_sclass, .pad_x = &nv04_i2c_pad_oclass, - .pad_s = &nv94_i2c_pad_oclass, + .pad_s = &g94_i2c_pad_oclass, .aux = 4, - .aux_stat = nve0_aux_stat, - .aux_mask = nve0_aux_mask, + .aux_stat = gk104_aux_stat, + .aux_mask = gk104_aux_mask, }.base; diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/gm204.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/gm204.c index 06a2b87..ab64237 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/gm204.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/gm204.c @@ -21,20 +21,19 @@ * * Authors: Ben Skeggs */ - #include "nv50.h" #define AUX_DBG(fmt, args...) nv_debug(aux, "AUXCH(%d): " fmt, ch, ##args) #define AUX_ERR(fmt, args...) nv_error(aux, "AUXCH(%d): " fmt, ch, ##args) static void -auxch_fini(struct nouveau_i2c *aux, int ch) +auxch_fini(struct nvkm_i2c *aux, int ch) { nv_mask(aux, 0x00d954 + (ch * 0x50), 0x00310000, 0x00000000); } static int -auxch_init(struct nouveau_i2c *aux, int ch) +auxch_init(struct nvkm_i2c *aux, int ch) { const u32 unksel = 1; /* nfi which to use, or if it matters.. */ const u32 ureq = unksel ? 0x00100000 : 0x00200000; @@ -69,10 +68,10 @@ auxch_init(struct nouveau_i2c *aux, int ch) } int -gm204_aux(struct nouveau_i2c_port *base, bool retry, +gm204_aux(struct nvkm_i2c_port *base, bool retry, u8 type, u32 addr, u8 *data, u8 size) { - struct nouveau_i2c *aux = nouveau_i2c(base); + struct nvkm_i2c *aux = nvkm_i2c(base); struct nv50_i2c_port *port = (void *)base; u32 ctrl, stat, timeout, retries; u32 xbuf[4] = {}; @@ -155,24 +154,23 @@ out: return ret < 0 ? ret : (stat & 0x000f0000) >> 16; } -static const struct nouveau_i2c_func +static const struct nvkm_i2c_func gm204_aux_func = { .aux = gm204_aux, }; int -gm204_aux_port_ctor(struct nouveau_object *parent, - struct nouveau_object *engine, - struct nouveau_oclass *oclass, void *data, u32 index, - struct nouveau_object **pobject) +gm204_aux_port_ctor(struct nvkm_object *parent, + struct nvkm_object *engine, + struct nvkm_oclass *oclass, void *data, u32 index, + struct nvkm_object **pobject) { struct dcb_i2c_entry *info = data; struct nv50_i2c_port *port; int ret; - ret = nouveau_i2c_port_create(parent, engine, oclass, index, - &nouveau_i2c_aux_algo, &gm204_aux_func, - &port); + ret = nvkm_i2c_port_create(parent, engine, oclass, index, + &nvkm_i2c_aux_algo, &gm204_aux_func, &port); *pobject = nv_object(port); if (ret) return ret; @@ -182,40 +180,40 @@ gm204_aux_port_ctor(struct nouveau_object *parent, return 0; } -struct nouveau_oclass +struct nvkm_oclass gm204_i2c_sclass[] = { { .handle = NV_I2C_TYPE_DCBI2C(DCB_I2C_NVIO_BIT), - .ofuncs = &(struct nouveau_ofuncs) { - .ctor = nvd0_i2c_port_ctor, - .dtor = _nouveau_i2c_port_dtor, + .ofuncs = &(struct nvkm_ofuncs) { + .ctor = gf110_i2c_port_ctor, + .dtor = _nvkm_i2c_port_dtor, .init = nv50_i2c_port_init, - .fini = _nouveau_i2c_port_fini, + .fini = _nvkm_i2c_port_fini, }, }, { .handle = NV_I2C_TYPE_DCBI2C(DCB_I2C_NVIO_AUX), - .ofuncs = &(struct nouveau_ofuncs) { + .ofuncs = &(struct nvkm_ofuncs) { .ctor = gm204_aux_port_ctor, - .dtor = _nouveau_i2c_port_dtor, - .init = _nouveau_i2c_port_init, - .fini = _nouveau_i2c_port_fini, + .dtor = _nvkm_i2c_port_dtor, + .init = _nvkm_i2c_port_init, + .fini = _nvkm_i2c_port_fini, }, }, {} }; -struct nouveau_oclass * -gm204_i2c_oclass = &(struct nouveau_i2c_impl) { +struct nvkm_oclass * +gm204_i2c_oclass = &(struct nvkm_i2c_impl) { .base.handle = NV_SUBDEV(I2C, 0x24), - .base.ofuncs = &(struct nouveau_ofuncs) { - .ctor = _nouveau_i2c_ctor, - .dtor = _nouveau_i2c_dtor, - .init = _nouveau_i2c_init, - .fini = _nouveau_i2c_fini, + .base.ofuncs = &(struct nvkm_ofuncs) { + .ctor = _nvkm_i2c_ctor, + .dtor = _nvkm_i2c_dtor, + .init = _nvkm_i2c_init, + .fini = _nvkm_i2c_fini, }, .sclass = gm204_i2c_sclass, .pad_x = &nv04_i2c_pad_oclass, .pad_s = &gm204_i2c_pad_oclass, .aux = 8, - .aux_stat = nve0_aux_stat, - .aux_mask = nve0_aux_mask, + .aux_stat = gk104_aux_stat, + .aux_mask = gk104_aux_mask, }.base; diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/nv04.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/nv04.c index 0db5de6..4cdf1c4 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/nv04.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/nv04.c @@ -21,25 +21,24 @@ * * Authors: Ben Skeggs */ +#include "priv.h" #include -#include "priv.h" - struct nv04_i2c_priv { - struct nouveau_i2c base; + struct nvkm_i2c base; }; struct nv04_i2c_port { - struct nouveau_i2c_port base; + struct nvkm_i2c_port base; u8 drive; u8 sense; }; static void -nv04_i2c_drive_scl(struct nouveau_i2c_port *base, int state) +nv04_i2c_drive_scl(struct nvkm_i2c_port *base, int state) { - struct nv04_i2c_priv *priv = (void *)nouveau_i2c(base); + struct nv04_i2c_priv *priv = (void *)nvkm_i2c(base); struct nv04_i2c_port *port = (void *)base; u8 val = nv_rdvgac(priv, 0, port->drive); if (state) val |= 0x20; @@ -48,9 +47,9 @@ nv04_i2c_drive_scl(struct nouveau_i2c_port *base, int state) } static void -nv04_i2c_drive_sda(struct nouveau_i2c_port *base, int state) +nv04_i2c_drive_sda(struct nvkm_i2c_port *base, int state) { - struct nv04_i2c_priv *priv = (void *)nouveau_i2c(base); + struct nv04_i2c_priv *priv = (void *)nvkm_i2c(base); struct nv04_i2c_port *port = (void *)base; u8 val = nv_rdvgac(priv, 0, port->drive); if (state) val |= 0x10; @@ -59,22 +58,22 @@ nv04_i2c_drive_sda(struct nouveau_i2c_port *base, int state) } static int -nv04_i2c_sense_scl(struct nouveau_i2c_port *base) +nv04_i2c_sense_scl(struct nvkm_i2c_port *base) { - struct nv04_i2c_priv *priv = (void *)nouveau_i2c(base); + struct nv04_i2c_priv *priv = (void *)nvkm_i2c(base); struct nv04_i2c_port *port = (void *)base; return !!(nv_rdvgac(priv, 0, port->sense) & 0x04); } static int -nv04_i2c_sense_sda(struct nouveau_i2c_port *base) +nv04_i2c_sense_sda(struct nvkm_i2c_port *base) { - struct nv04_i2c_priv *priv = (void *)nouveau_i2c(base); + struct nv04_i2c_priv *priv = (void *)nvkm_i2c(base); struct nv04_i2c_port *port = (void *)base; return !!(nv_rdvgac(priv, 0, port->sense) & 0x08); } -static const struct nouveau_i2c_func +static const struct nvkm_i2c_func nv04_i2c_func = { .drive_scl = nv04_i2c_drive_scl, .drive_sda = nv04_i2c_drive_sda, @@ -83,17 +82,16 @@ nv04_i2c_func = { }; static int -nv04_i2c_port_ctor(struct nouveau_object *parent, struct nouveau_object *engine, - struct nouveau_oclass *oclass, void *data, u32 index, - struct nouveau_object **pobject) +nv04_i2c_port_ctor(struct nvkm_object *parent, struct nvkm_object *engine, + struct nvkm_oclass *oclass, void *data, u32 index, + struct nvkm_object **pobject) { struct dcb_i2c_entry *info = data; struct nv04_i2c_port *port; int ret; - ret = nouveau_i2c_port_create(parent, engine, oclass, index, - &nouveau_i2c_bit_algo, &nv04_i2c_func, - &port); + ret = nvkm_i2c_port_create(parent, engine, oclass, index, + &nvkm_i2c_bit_algo, &nv04_i2c_func, &port); *pobject = nv_object(port); if (ret) return ret; @@ -103,27 +101,27 @@ nv04_i2c_port_ctor(struct nouveau_object *parent, struct nouveau_object *engine, return 0; } -static struct nouveau_oclass +static struct nvkm_oclass nv04_i2c_sclass[] = { { .handle = NV_I2C_TYPE_DCBI2C(DCB_I2C_NV04_BIT), - .ofuncs = &(struct nouveau_ofuncs) { + .ofuncs = &(struct nvkm_ofuncs) { .ctor = nv04_i2c_port_ctor, - .dtor = _nouveau_i2c_port_dtor, - .init = _nouveau_i2c_port_init, - .fini = _nouveau_i2c_port_fini, + .dtor = _nvkm_i2c_port_dtor, + .init = _nvkm_i2c_port_init, + .fini = _nvkm_i2c_port_fini, }, }, {} }; -struct nouveau_oclass * -nv04_i2c_oclass = &(struct nouveau_i2c_impl) { +struct nvkm_oclass * +nv04_i2c_oclass = &(struct nvkm_i2c_impl) { .base.handle = NV_SUBDEV(I2C, 0x04), - .base.ofuncs = &(struct nouveau_ofuncs) { - .ctor = _nouveau_i2c_ctor, - .dtor = _nouveau_i2c_dtor, - .init = _nouveau_i2c_init, - .fini = _nouveau_i2c_fini, + .base.ofuncs = &(struct nvkm_ofuncs) { + .ctor = _nvkm_i2c_ctor, + .dtor = _nvkm_i2c_dtor, + .init = _nvkm_i2c_init, + .fini = _nvkm_i2c_fini, }, .sclass = nv04_i2c_sclass, .pad_x = &nv04_i2c_pad_oclass, diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/nv4e.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/nv4e.c index 0d78389..046fe5e 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/nv4e.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/nv4e.c @@ -21,53 +21,52 @@ * * Authors: Ben Skeggs */ +#include "priv.h" #include -#include "priv.h" - struct nv4e_i2c_priv { - struct nouveau_i2c base; + struct nvkm_i2c base; }; struct nv4e_i2c_port { - struct nouveau_i2c_port base; + struct nvkm_i2c_port base; u32 addr; }; static void -nv4e_i2c_drive_scl(struct nouveau_i2c_port *base, int state) +nv4e_i2c_drive_scl(struct nvkm_i2c_port *base, int state) { - struct nv4e_i2c_priv *priv = (void *)nouveau_i2c(base); + struct nv4e_i2c_priv *priv = (void *)nvkm_i2c(base); struct nv4e_i2c_port *port = (void *)base; nv_mask(priv, port->addr, 0x2f, state ? 0x21 : 0x01); } static void -nv4e_i2c_drive_sda(struct nouveau_i2c_port *base, int state) +nv4e_i2c_drive_sda(struct nvkm_i2c_port *base, int state) { - struct nv4e_i2c_priv *priv = (void *)nouveau_i2c(base); + struct nv4e_i2c_priv *priv = (void *)nvkm_i2c(base); struct nv4e_i2c_port *port = (void *)base; nv_mask(priv, port->addr, 0x1f, state ? 0x11 : 0x01); } static int -nv4e_i2c_sense_scl(struct nouveau_i2c_port *base) +nv4e_i2c_sense_scl(struct nvkm_i2c_port *base) { - struct nv4e_i2c_priv *priv = (void *)nouveau_i2c(base); + struct nv4e_i2c_priv *priv = (void *)nvkm_i2c(base); struct nv4e_i2c_port *port = (void *)base; return !!(nv_rd32(priv, port->addr) & 0x00040000); } static int -nv4e_i2c_sense_sda(struct nouveau_i2c_port *base) +nv4e_i2c_sense_sda(struct nvkm_i2c_port *base) { - struct nv4e_i2c_priv *priv = (void *)nouveau_i2c(base); + struct nv4e_i2c_priv *priv = (void *)nvkm_i2c(base); struct nv4e_i2c_port *port = (void *)base; return !!(nv_rd32(priv, port->addr) & 0x00080000); } -static const struct nouveau_i2c_func +static const struct nvkm_i2c_func nv4e_i2c_func = { .drive_scl = nv4e_i2c_drive_scl, .drive_sda = nv4e_i2c_drive_sda, @@ -76,17 +75,16 @@ nv4e_i2c_func = { }; static int -nv4e_i2c_port_ctor(struct nouveau_object *parent, struct nouveau_object *engine, - struct nouveau_oclass *oclass, void *data, u32 index, - struct nouveau_object **pobject) +nv4e_i2c_port_ctor(struct nvkm_object *parent, struct nvkm_object *engine, + struct nvkm_oclass *oclass, void *data, u32 index, + struct nvkm_object **pobject) { struct dcb_i2c_entry *info = data; struct nv4e_i2c_port *port; int ret; - ret = nouveau_i2c_port_create(parent, engine, oclass, index, - &nouveau_i2c_bit_algo, &nv4e_i2c_func, - &port); + ret = nvkm_i2c_port_create(parent, engine, oclass, index, + &nvkm_i2c_bit_algo, &nv4e_i2c_func, &port); *pobject = nv_object(port); if (ret) return ret; @@ -95,27 +93,27 @@ nv4e_i2c_port_ctor(struct nouveau_object *parent, struct nouveau_object *engine, return 0; } -static struct nouveau_oclass +static struct nvkm_oclass nv4e_i2c_sclass[] = { { .handle = NV_I2C_TYPE_DCBI2C(DCB_I2C_NV4E_BIT), - .ofuncs = &(struct nouveau_ofuncs) { + .ofuncs = &(struct nvkm_ofuncs) { .ctor = nv4e_i2c_port_ctor, - .dtor = _nouveau_i2c_port_dtor, - .init = _nouveau_i2c_port_init, - .fini = _nouveau_i2c_port_fini, + .dtor = _nvkm_i2c_port_dtor, + .init = _nvkm_i2c_port_init, + .fini = _nvkm_i2c_port_fini, }, }, {} }; -struct nouveau_oclass * -nv4e_i2c_oclass = &(struct nouveau_i2c_impl) { +struct nvkm_oclass * +nv4e_i2c_oclass = &(struct nvkm_i2c_impl) { .base.handle = NV_SUBDEV(I2C, 0x4e), - .base.ofuncs = &(struct nouveau_ofuncs) { - .ctor = _nouveau_i2c_ctor, - .dtor = _nouveau_i2c_dtor, - .init = _nouveau_i2c_init, - .fini = _nouveau_i2c_fini, + .base.ofuncs = &(struct nvkm_ofuncs) { + .ctor = _nvkm_i2c_ctor, + .dtor = _nvkm_i2c_dtor, + .init = _nvkm_i2c_init, + .fini = _nvkm_i2c_fini, }, .sclass = nv4e_i2c_sclass, .pad_x = &nv04_i2c_pad_oclass, diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/nv50.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/nv50.c index 33dd89f..fba5b26 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/nv50.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/nv50.c @@ -21,13 +21,12 @@ * * Authors: Ben Skeggs */ - #include "nv50.h" void -nv50_i2c_drive_scl(struct nouveau_i2c_port *base, int state) +nv50_i2c_drive_scl(struct nvkm_i2c_port *base, int state) { - struct nv50_i2c_priv *priv = (void *)nouveau_i2c(base); + struct nv50_i2c_priv *priv = (void *)nvkm_i2c(base); struct nv50_i2c_port *port = (void *)base; if (state) port->state |= 0x01; else port->state &= 0xfe; @@ -35,9 +34,9 @@ nv50_i2c_drive_scl(struct nouveau_i2c_port *base, int state) } void -nv50_i2c_drive_sda(struct nouveau_i2c_port *base, int state) +nv50_i2c_drive_sda(struct nvkm_i2c_port *base, int state) { - struct nv50_i2c_priv *priv = (void *)nouveau_i2c(base); + struct nv50_i2c_priv *priv = (void *)nvkm_i2c(base); struct nv50_i2c_port *port = (void *)base; if (state) port->state |= 0x02; else port->state &= 0xfd; @@ -45,22 +44,22 @@ nv50_i2c_drive_sda(struct nouveau_i2c_port *base, int state) } int -nv50_i2c_sense_scl(struct nouveau_i2c_port *base) +nv50_i2c_sense_scl(struct nvkm_i2c_port *base) { - struct nv50_i2c_priv *priv = (void *)nouveau_i2c(base); + struct nv50_i2c_priv *priv = (void *)nvkm_i2c(base); struct nv50_i2c_port *port = (void *)base; return !!(nv_rd32(priv, port->addr) & 0x00000001); } int -nv50_i2c_sense_sda(struct nouveau_i2c_port *base) +nv50_i2c_sense_sda(struct nvkm_i2c_port *base) { - struct nv50_i2c_priv *priv = (void *)nouveau_i2c(base); + struct nv50_i2c_priv *priv = (void *)nvkm_i2c(base); struct nv50_i2c_port *port = (void *)base; return !!(nv_rd32(priv, port->addr) & 0x00000002); } -static const struct nouveau_i2c_func +static const struct nvkm_i2c_func nv50_i2c_func = { .drive_scl = nv50_i2c_drive_scl, .drive_sda = nv50_i2c_drive_sda, @@ -76,17 +75,16 @@ const u32 nv50_i2c_addr[] = { const int nv50_i2c_addr_nr = ARRAY_SIZE(nv50_i2c_addr); static int -nv50_i2c_port_ctor(struct nouveau_object *parent, struct nouveau_object *engine, - struct nouveau_oclass *oclass, void *data, u32 index, - struct nouveau_object **pobject) +nv50_i2c_port_ctor(struct nvkm_object *parent, struct nvkm_object *engine, + struct nvkm_oclass *oclass, void *data, u32 index, + struct nvkm_object **pobject) { struct dcb_i2c_entry *info = data; struct nv50_i2c_port *port; int ret; - ret = nouveau_i2c_port_create(parent, engine, oclass, index, - &nouveau_i2c_bit_algo, &nv50_i2c_func, - &port); + ret = nvkm_i2c_port_create(parent, engine, oclass, index, + &nvkm_i2c_bit_algo, &nv50_i2c_func, &port); *pobject = nv_object(port); if (ret) return ret; @@ -100,35 +98,35 @@ nv50_i2c_port_ctor(struct nouveau_object *parent, struct nouveau_object *engine, } int -nv50_i2c_port_init(struct nouveau_object *object) +nv50_i2c_port_init(struct nvkm_object *object) { - struct nv50_i2c_priv *priv = (void *)nouveau_i2c(object); + struct nv50_i2c_priv *priv = (void *)nvkm_i2c(object); struct nv50_i2c_port *port = (void *)object; nv_wr32(priv, port->addr, port->state); - return nouveau_i2c_port_init(&port->base); + return nvkm_i2c_port_init(&port->base); } -static struct nouveau_oclass +static struct nvkm_oclass nv50_i2c_sclass[] = { { .handle = NV_I2C_TYPE_DCBI2C(DCB_I2C_NVIO_BIT), - .ofuncs = &(struct nouveau_ofuncs) { + .ofuncs = &(struct nvkm_ofuncs) { .ctor = nv50_i2c_port_ctor, - .dtor = _nouveau_i2c_port_dtor, + .dtor = _nvkm_i2c_port_dtor, .init = nv50_i2c_port_init, - .fini = _nouveau_i2c_port_fini, + .fini = _nvkm_i2c_port_fini, }, }, {} }; -struct nouveau_oclass * -nv50_i2c_oclass = &(struct nouveau_i2c_impl) { +struct nvkm_oclass * +nv50_i2c_oclass = &(struct nvkm_i2c_impl) { .base.handle = NV_SUBDEV(I2C, 0x50), - .base.ofuncs = &(struct nouveau_ofuncs) { - .ctor = _nouveau_i2c_ctor, - .dtor = _nouveau_i2c_dtor, - .init = _nouveau_i2c_init, - .fini = _nouveau_i2c_fini, + .base.ofuncs = &(struct nvkm_ofuncs) { + .ctor = _nvkm_i2c_ctor, + .dtor = _nvkm_i2c_dtor, + .init = _nvkm_i2c_init, + .fini = _nvkm_i2c_fini, }, .sclass = nv50_i2c_sclass, .pad_x = &nv04_i2c_pad_oclass, diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/nv50.h b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/nv50.h index 9ef9656..b3139e7 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/nv50.h +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/nv50.h @@ -1,34 +1,32 @@ #ifndef __NV50_I2C_H__ #define __NV50_I2C_H__ - #include "priv.h" struct nv50_i2c_priv { - struct nouveau_i2c base; + struct nvkm_i2c base; }; struct nv50_i2c_port { - struct nouveau_i2c_port base; + struct nvkm_i2c_port base; u32 addr; u32 state; }; extern const u32 nv50_i2c_addr[]; extern const int nv50_i2c_addr_nr; -int nv50_i2c_port_init(struct nouveau_object *); -int nv50_i2c_sense_scl(struct nouveau_i2c_port *); -int nv50_i2c_sense_sda(struct nouveau_i2c_port *); -void nv50_i2c_drive_scl(struct nouveau_i2c_port *, int state); -void nv50_i2c_drive_sda(struct nouveau_i2c_port *, int state); - -int nv94_aux_port_ctor(struct nouveau_object *, struct nouveau_object *, - struct nouveau_oclass *, void *, u32, - struct nouveau_object **); -void nv94_i2c_acquire(struct nouveau_i2c_port *); -void nv94_i2c_release(struct nouveau_i2c_port *); +int nv50_i2c_port_init(struct nvkm_object *); +int nv50_i2c_sense_scl(struct nvkm_i2c_port *); +int nv50_i2c_sense_sda(struct nvkm_i2c_port *); +void nv50_i2c_drive_scl(struct nvkm_i2c_port *, int state); +void nv50_i2c_drive_sda(struct nvkm_i2c_port *, int state); -int nvd0_i2c_port_ctor(struct nouveau_object *, struct nouveau_object *, - struct nouveau_oclass *, void *, u32, - struct nouveau_object **); +int g94_aux_port_ctor(struct nvkm_object *, struct nvkm_object *, + struct nvkm_oclass *, void *, u32, + struct nvkm_object **); +void g94_i2c_acquire(struct nvkm_i2c_port *); +void g94_i2c_release(struct nvkm_i2c_port *); +int gf110_i2c_port_ctor(struct nvkm_object *, struct nvkm_object *, + struct nvkm_oclass *, void *, u32, + struct nvkm_object **); #endif diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.c index a3d0d82..a242eeb 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.c @@ -21,35 +21,34 @@ * * Authors: Ben Skeggs */ - #include "pad.h" int -_nvkm_i2c_pad_fini(struct nouveau_object *object, bool suspend) +_nvkm_i2c_pad_fini(struct nvkm_object *object, bool suspend) { struct nvkm_i2c_pad *pad = (void *)object; DBG("-> NULL\n"); pad->port = NULL; - return nouveau_object_fini(&pad->base, suspend); + return nvkm_object_fini(&pad->base, suspend); } int -_nvkm_i2c_pad_init(struct nouveau_object *object) +_nvkm_i2c_pad_init(struct nvkm_object *object) { struct nvkm_i2c_pad *pad = (void *)object; DBG("-> PORT:%02x\n", pad->next->index); pad->port = pad->next; - return nouveau_object_init(&pad->base); + return nvkm_object_init(&pad->base); } int -nvkm_i2c_pad_create_(struct nouveau_object *parent, - struct nouveau_object *engine, - struct nouveau_oclass *oclass, int index, +nvkm_i2c_pad_create_(struct nvkm_object *parent, + struct nvkm_object *engine, + struct nvkm_oclass *oclass, int index, int size, void **pobject) { - struct nouveau_i2c *i2c = nouveau_i2c(parent); - struct nouveau_i2c_port *port; + struct nvkm_i2c *i2c = nvkm_i2c(parent); + struct nvkm_i2c_port *port; struct nvkm_i2c_pad *pad; int ret; @@ -62,7 +61,7 @@ nvkm_i2c_pad_create_(struct nouveau_object *parent, } } - ret = nouveau_object_create_(parent, engine, oclass, 0, size, pobject); + ret = nvkm_object_create_(parent, engine, oclass, 0, size, pobject); pad = *pobject; if (ret) return ret; @@ -72,9 +71,9 @@ nvkm_i2c_pad_create_(struct nouveau_object *parent, } int -_nvkm_i2c_pad_ctor(struct nouveau_object *parent, struct nouveau_object *engine, - struct nouveau_oclass *oclass, void *data, u32 index, - struct nouveau_object **pobject) +_nvkm_i2c_pad_ctor(struct nvkm_object *parent, struct nvkm_object *engine, + struct nvkm_oclass *oclass, void *data, u32 index, + struct nvkm_object **pobject) { struct nvkm_i2c_pad *pad; int ret; diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.h b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.h index f03138b..f3422cc 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.h +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.h @@ -1,19 +1,18 @@ #ifndef __NVKM_I2C_PAD_H__ #define __NVKM_I2C_PAD_H__ - #include "priv.h" struct nvkm_i2c_pad { - struct nouveau_object base; + struct nvkm_object base; int index; - struct nouveau_i2c_port *port; - struct nouveau_i2c_port *next; + struct nvkm_i2c_port *port; + struct nvkm_i2c_port *next; }; static inline struct nvkm_i2c_pad * -nvkm_i2c_pad(struct nouveau_i2c_port *port) +nvkm_i2c_pad(struct nvkm_i2c_port *port) { - struct nouveau_object *pad = nv_object(port); + struct nvkm_object *pad = nv_object(port); while (!nv_iclass(pad->parent, NV_SUBDEV_CLASS)) pad = pad->parent; return (void *)pad; @@ -34,15 +33,15 @@ nvkm_i2c_pad(struct nouveau_i2c_port *port) _nvkm_i2c_pad_fini(nv_object(_p), (s)); \ }) -int nvkm_i2c_pad_create_(struct nouveau_object *, struct nouveau_object *, - struct nouveau_oclass *, int index, int, void **); +int nvkm_i2c_pad_create_(struct nvkm_object *, struct nvkm_object *, + struct nvkm_oclass *, int index, int, void **); -int _nvkm_i2c_pad_ctor(struct nouveau_object *, struct nouveau_object *, - struct nouveau_oclass *, void *, u32, - struct nouveau_object **); -#define _nvkm_i2c_pad_dtor nouveau_object_destroy -int _nvkm_i2c_pad_init(struct nouveau_object *); -int _nvkm_i2c_pad_fini(struct nouveau_object *, bool); +int _nvkm_i2c_pad_ctor(struct nvkm_object *, struct nvkm_object *, + struct nvkm_oclass *, void *, u32, + struct nvkm_object **); +#define _nvkm_i2c_pad_dtor nvkm_object_destroy +int _nvkm_i2c_pad_init(struct nvkm_object *); +int _nvkm_i2c_pad_fini(struct nvkm_object *, bool); #ifndef MSG #define MSG(l,f,a...) do { \ @@ -54,5 +53,4 @@ int _nvkm_i2c_pad_fini(struct nouveau_object *, bool); #define DBG(f,a...) MSG(debug, f, ##a) #define ERR(f,a...) MSG(error, f, ##a) #endif - #endif diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/padnv94.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/padg94.c similarity index 73% rename from drivers/gpu/drm/nouveau/nvkm/subdev/i2c/padnv94.c rename to drivers/gpu/drm/nouveau/nvkm/subdev/i2c/padg94.c index afe7989..e9832f7 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/padnv94.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/padg94.c @@ -21,28 +21,27 @@ * * Authors: Ben Skeggs */ - #include "pad.h" -struct nv94_i2c_pad { +struct g94_i2c_pad { struct nvkm_i2c_pad base; int addr; }; static int -nv94_i2c_pad_fini(struct nouveau_object *object, bool suspend) +g94_i2c_pad_fini(struct nvkm_object *object, bool suspend) { - struct nouveau_i2c *i2c = (void *)nouveau_i2c(object); - struct nv94_i2c_pad *pad = (void *)object; + struct nvkm_i2c *i2c = (void *)nvkm_i2c(object); + struct g94_i2c_pad *pad = (void *)object; nv_mask(i2c, 0x00e50c + pad->addr, 0x00000001, 0x00000001); return nvkm_i2c_pad_fini(&pad->base, suspend); } static int -nv94_i2c_pad_init(struct nouveau_object *object) +g94_i2c_pad_init(struct nvkm_object *object) { - struct nouveau_i2c *i2c = (void *)nouveau_i2c(object); - struct nv94_i2c_pad *pad = (void *)object; + struct nvkm_i2c *i2c = (void *)nvkm_i2c(object); + struct g94_i2c_pad *pad = (void *)object; switch (nv_oclass(pad->base.next)->handle) { case NV_I2C_TYPE_DCBI2C(DCB_I2C_NVIO_AUX): @@ -59,11 +58,11 @@ nv94_i2c_pad_init(struct nouveau_object *object) } static int -nv94_i2c_pad_ctor(struct nouveau_object *parent, struct nouveau_object *engine, - struct nouveau_oclass *oclass, void *data, u32 index, - struct nouveau_object **pobject) +g94_i2c_pad_ctor(struct nvkm_object *parent, struct nvkm_object *engine, + struct nvkm_oclass *oclass, void *data, u32 index, + struct nvkm_object **pobject) { - struct nv94_i2c_pad *pad; + struct g94_i2c_pad *pad; int ret; ret = nvkm_i2c_pad_create(parent, engine, oclass, index, &pad); @@ -75,12 +74,12 @@ nv94_i2c_pad_ctor(struct nouveau_object *parent, struct nouveau_object *engine, return 0; } -struct nouveau_oclass -nv94_i2c_pad_oclass = { - .ofuncs = &(struct nouveau_ofuncs) { - .ctor = nv94_i2c_pad_ctor, +struct nvkm_oclass +g94_i2c_pad_oclass = { + .ofuncs = &(struct nvkm_ofuncs) { + .ctor = g94_i2c_pad_ctor, .dtor = _nvkm_i2c_pad_dtor, - .init = nv94_i2c_pad_init, - .fini = nv94_i2c_pad_fini, + .init = g94_i2c_pad_init, + .fini = g94_i2c_pad_fini, }, }; diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/padgm204.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/padgm204.c index 1630a93..be59040 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/padgm204.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/padgm204.c @@ -21,7 +21,6 @@ * * Authors: Ben Skeggs */ - #include "pad.h" struct gm204_i2c_pad { @@ -30,18 +29,18 @@ struct gm204_i2c_pad { }; static int -gm204_i2c_pad_fini(struct nouveau_object *object, bool suspend) +gm204_i2c_pad_fini(struct nvkm_object *object, bool suspend) { - struct nouveau_i2c *i2c = (void *)nouveau_i2c(object); + struct nvkm_i2c *i2c = (void *)nvkm_i2c(object); struct gm204_i2c_pad *pad = (void *)object; nv_mask(i2c, 0x00d97c + pad->addr, 0x00000001, 0x00000001); return nvkm_i2c_pad_fini(&pad->base, suspend); } static int -gm204_i2c_pad_init(struct nouveau_object *object) +gm204_i2c_pad_init(struct nvkm_object *object) { - struct nouveau_i2c *i2c = (void *)nouveau_i2c(object); + struct nvkm_i2c *i2c = (void *)nvkm_i2c(object); struct gm204_i2c_pad *pad = (void *)object; switch (nv_oclass(pad->base.next)->handle) { @@ -59,9 +58,9 @@ gm204_i2c_pad_init(struct nouveau_object *object) } static int -gm204_i2c_pad_ctor(struct nouveau_object *parent, struct nouveau_object *engine, - struct nouveau_oclass *oclass, void *data, u32 index, - struct nouveau_object **pobject) +gm204_i2c_pad_ctor(struct nvkm_object *parent, struct nvkm_object *engine, + struct nvkm_oclass *oclass, void *data, u32 index, + struct nvkm_object **pobject) { struct gm204_i2c_pad *pad; int ret; @@ -75,9 +74,9 @@ gm204_i2c_pad_ctor(struct nouveau_object *parent, struct nouveau_object *engine, return 0; } -struct nouveau_oclass +struct nvkm_oclass gm204_i2c_pad_oclass = { - .ofuncs = &(struct nouveau_ofuncs) { + .ofuncs = &(struct nvkm_ofuncs) { .ctor = gm204_i2c_pad_ctor, .dtor = _nvkm_i2c_pad_dtor, .init = gm204_i2c_pad_init, diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/padnv04.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/padnv04.c index 2c4b612..22c7daa 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/padnv04.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/padnv04.c @@ -21,12 +21,11 @@ * * Authors: Ben Skeggs */ - #include "pad.h" -struct nouveau_oclass +struct nvkm_oclass nv04_i2c_pad_oclass = { - .ofuncs = &(struct nouveau_ofuncs) { + .ofuncs = &(struct nvkm_ofuncs) { .ctor = _nvkm_i2c_pad_ctor, .dtor = _nvkm_i2c_pad_dtor, .init = _nvkm_i2c_pad_init, diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/port.h b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/port.h index b9acf78..586f53d 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/port.h +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/port.h @@ -1,15 +1,13 @@ #ifndef __NVKM_I2C_PORT_H__ #define __NVKM_I2C_PORT_H__ - #include "priv.h" #ifndef MSG #define MSG(l,f,a...) do { \ - struct nouveau_i2c_port *_port = (void *)port; \ + struct nvkm_i2c_port *_port = (void *)port; \ nv_##l(_port, "PORT:%02x: "f, _port->index, ##a); \ } while(0) #define DBG(f,a...) MSG(debug, f, ##a) #define ERR(f,a...) MSG(error, f, ##a) #endif - #endif diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/priv.h b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/priv.h index 4fe7ae3..6586e15 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/priv.h +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/priv.h @@ -1,70 +1,69 @@ -#ifndef __NVKM_I2C_H__ -#define __NVKM_I2C_H__ - +#ifndef __NVKM_I2C_PRIV_H__ +#define __NVKM_I2C_PRIV_H__ #include -extern struct nouveau_oclass nv04_i2c_pad_oclass; -extern struct nouveau_oclass nv94_i2c_pad_oclass; -extern struct nouveau_oclass gm204_i2c_pad_oclass; +extern struct nvkm_oclass nv04_i2c_pad_oclass; +extern struct nvkm_oclass g94_i2c_pad_oclass; +extern struct nvkm_oclass gm204_i2c_pad_oclass; -#define nouveau_i2c_port_create(p,e,o,i,a,f,d) \ - nouveau_i2c_port_create_((p), (e), (o), (i), (a), (f), \ +#define nvkm_i2c_port_create(p,e,o,i,a,f,d) \ + nvkm_i2c_port_create_((p), (e), (o), (i), (a), (f), \ sizeof(**d), (void **)d) -#define nouveau_i2c_port_destroy(p) ({ \ - struct nouveau_i2c_port *port = (p); \ - _nouveau_i2c_port_dtor(nv_object(i2c)); \ +#define nvkm_i2c_port_destroy(p) ({ \ + struct nvkm_i2c_port *port = (p); \ + _nvkm_i2c_port_dtor(nv_object(i2c)); \ }) -#define nouveau_i2c_port_init(p) \ - nouveau_object_init(&(p)->base) -#define nouveau_i2c_port_fini(p,s) \ - nouveau_object_fini(&(p)->base, (s)) +#define nvkm_i2c_port_init(p) \ + nvkm_object_init(&(p)->base) +#define nvkm_i2c_port_fini(p,s) \ + nvkm_object_fini(&(p)->base, (s)) -int nouveau_i2c_port_create_(struct nouveau_object *, struct nouveau_object *, - struct nouveau_oclass *, u8, +int nvkm_i2c_port_create_(struct nvkm_object *, struct nvkm_object *, + struct nvkm_oclass *, u8, const struct i2c_algorithm *, - const struct nouveau_i2c_func *, + const struct nvkm_i2c_func *, int, void **); -void _nouveau_i2c_port_dtor(struct nouveau_object *); -#define _nouveau_i2c_port_init nouveau_object_init -int _nouveau_i2c_port_fini(struct nouveau_object *, bool); - -#define nouveau_i2c_create(p,e,o,d) \ - nouveau_i2c_create_((p), (e), (o), sizeof(**d), (void **)d) -#define nouveau_i2c_destroy(p) ({ \ - struct nouveau_i2c *i2c = (p); \ - _nouveau_i2c_dtor(nv_object(i2c)); \ +void _nvkm_i2c_port_dtor(struct nvkm_object *); +#define _nvkm_i2c_port_init nvkm_object_init +int _nvkm_i2c_port_fini(struct nvkm_object *, bool); + +#define nvkm_i2c_create(p,e,o,d) \ + nvkm_i2c_create_((p), (e), (o), sizeof(**d), (void **)d) +#define nvkm_i2c_destroy(p) ({ \ + struct nvkm_i2c *i2c = (p); \ + _nvkm_i2c_dtor(nv_object(i2c)); \ }) -#define nouveau_i2c_init(p) ({ \ - struct nouveau_i2c *i2c = (p); \ - _nouveau_i2c_init(nv_object(i2c)); \ +#define nvkm_i2c_init(p) ({ \ + struct nvkm_i2c *i2c = (p); \ + _nvkm_i2c_init(nv_object(i2c)); \ }) -#define nouveau_i2c_fini(p,s) ({ \ - struct nouveau_i2c *i2c = (p); \ - _nouveau_i2c_fini(nv_object(i2c), (s)); \ +#define nvkm_i2c_fini(p,s) ({ \ + struct nvkm_i2c *i2c = (p); \ + _nvkm_i2c_fini(nv_object(i2c), (s)); \ }) -int nouveau_i2c_create_(struct nouveau_object *, struct nouveau_object *, - struct nouveau_oclass *, int, void **); -int _nouveau_i2c_ctor(struct nouveau_object *, struct nouveau_object *, - struct nouveau_oclass *, void *, u32, - struct nouveau_object **); -void _nouveau_i2c_dtor(struct nouveau_object *); -int _nouveau_i2c_init(struct nouveau_object *); -int _nouveau_i2c_fini(struct nouveau_object *, bool); +int nvkm_i2c_create_(struct nvkm_object *, struct nvkm_object *, + struct nvkm_oclass *, int, void **); +int _nvkm_i2c_ctor(struct nvkm_object *, struct nvkm_object *, + struct nvkm_oclass *, void *, u32, + struct nvkm_object **); +void _nvkm_i2c_dtor(struct nvkm_object *); +int _nvkm_i2c_init(struct nvkm_object *); +int _nvkm_i2c_fini(struct nvkm_object *, bool); -extern struct nouveau_oclass nouveau_anx9805_sclass[]; -extern struct nouveau_oclass nvd0_i2c_sclass[]; +extern struct nvkm_oclass nvkm_anx9805_sclass[]; +extern struct nvkm_oclass gf110_i2c_sclass[]; -extern const struct i2c_algorithm nouveau_i2c_bit_algo; -extern const struct i2c_algorithm nouveau_i2c_aux_algo; +extern const struct i2c_algorithm nvkm_i2c_bit_algo; +extern const struct i2c_algorithm nvkm_i2c_aux_algo; -struct nouveau_i2c_impl { - struct nouveau_oclass base; +struct nvkm_i2c_impl { + struct nvkm_oclass base; /* supported i2c port classes */ - struct nouveau_oclass *sclass; - struct nouveau_oclass *pad_x; - struct nouveau_oclass *pad_s; + struct nvkm_oclass *sclass; + struct nvkm_oclass *pad_x; + struct nvkm_oclass *pad_s; /* number of native dp aux channels present */ int aux; @@ -73,17 +72,16 @@ struct nouveau_i2c_impl { * for ports that have not been masked off, while still * performing the ack for anything that was pending. */ - void (*aux_stat)(struct nouveau_i2c *, u32 *, u32 *, u32 *, u32 *); + void (*aux_stat)(struct nvkm_i2c *, u32 *, u32 *, u32 *, u32 *); /* mask on/off interrupt types for a given set of auxch */ - void (*aux_mask)(struct nouveau_i2c *, u32, u32, u32); + void (*aux_mask)(struct nvkm_i2c *, u32, u32, u32); }; -void nv94_aux_stat(struct nouveau_i2c *, u32 *, u32 *, u32 *, u32 *); -void nv94_aux_mask(struct nouveau_i2c *, u32, u32, u32); - -void nve0_aux_stat(struct nouveau_i2c *, u32 *, u32 *, u32 *, u32 *); -void nve0_aux_mask(struct nouveau_i2c *, u32, u32, u32); +void g94_aux_stat(struct nvkm_i2c *, u32 *, u32 *, u32 *, u32 *); +void g94_aux_mask(struct nvkm_i2c *, u32, u32, u32); +void gk104_aux_stat(struct nvkm_i2c *, u32 *, u32 *, u32 *, u32 *); +void gk104_aux_mask(struct nvkm_i2c *, u32, u32, u32); #endif