Commit b9ec1424 authored by Ben Skeggs's avatar Ben Skeggs

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: default avatarBen Skeggs <bskeggs@redhat.com>
parent 4e7659fc
...@@ -196,6 +196,7 @@ ...@@ -196,6 +196,7 @@
#define nouveau_gpio nvkm_gpio #define nouveau_gpio nvkm_gpio
#define nouveau_i2c nvkm_i2c #define nouveau_i2c nvkm_i2c
#define nouveau_i2c_port nvkm_i2c_port #define nouveau_i2c_port nvkm_i2c_port
#define nouveau_i2c_board_info nvkm_i2c_board_info
#define nouveau_devinit nvkm_devinit #define nouveau_devinit nvkm_devinit
#define nouveau_bios nvkm_bios #define nouveau_bios nvkm_bios
#define nouveau_bios_oclass nvkm_bios_oclass #define nouveau_bios_oclass nvkm_bios_oclass
......
#ifndef __NOUVEAU_I2C_H__ #ifndef __NVKM_I2C_H__
#define __NOUVEAU_I2C_H__ #define __NVKM_I2C_H__
#include <core/subdev.h> #include <core/subdev.h>
#include <core/device.h> #include <core/event.h>
#include <subdev/bios.h> #include <subdev/bios.h>
#include <subdev/bios/i2c.h> #include <subdev/bios/i2c.h>
...@@ -30,8 +29,8 @@ struct nvkm_i2c_ntfy_rep { ...@@ -30,8 +29,8 @@ struct nvkm_i2c_ntfy_rep {
u8 mask; u8 mask;
}; };
struct nouveau_i2c_port { struct nvkm_i2c_port {
struct nouveau_object base; struct nvkm_object base;
struct i2c_adapter adapter; struct i2c_adapter adapter;
struct mutex mutex; struct mutex mutex;
...@@ -39,62 +38,63 @@ struct nouveau_i2c_port { ...@@ -39,62 +38,63 @@ struct nouveau_i2c_port {
u8 index; u8 index;
int aux; int aux;
const struct nouveau_i2c_func *func; const struct nvkm_i2c_func *func;
}; };
struct nouveau_i2c_func { struct nvkm_i2c_func {
void (*drive_scl)(struct nouveau_i2c_port *, int); void (*drive_scl)(struct nvkm_i2c_port *, int);
void (*drive_sda)(struct nouveau_i2c_port *, int); void (*drive_sda)(struct nvkm_i2c_port *, int);
int (*sense_scl)(struct nouveau_i2c_port *); int (*sense_scl)(struct nvkm_i2c_port *);
int (*sense_sda)(struct nouveau_i2c_port *); int (*sense_sda)(struct nvkm_i2c_port *);
int (*aux)(struct nouveau_i2c_port *, bool, u8, u32, u8 *, u8); int (*aux)(struct nvkm_i2c_port *, bool, u8, u32, u8 *, u8);
int (*pattern)(struct nouveau_i2c_port *, int pattern); int (*pattern)(struct nvkm_i2c_port *, int pattern);
int (*lnk_ctl)(struct nouveau_i2c_port *, int nr, int bw, bool enh); int (*lnk_ctl)(struct nvkm_i2c_port *, int nr, int bw, bool enh);
int (*drv_ctl)(struct nouveau_i2c_port *, int lane, int sw, int pe); 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; struct i2c_board_info dev;
u8 udelay; /* set to 0 to use the standard delay */ u8 udelay; /* set to 0 to use the standard delay */
}; };
struct nouveau_i2c { struct nvkm_i2c {
struct nouveau_subdev base; struct nvkm_subdev base;
struct nvkm_event event; struct nvkm_event event;
struct nouveau_i2c_port *(*find)(struct nouveau_i2c *, u8 index); struct nvkm_i2c_port *(*find)(struct nvkm_i2c *, u8 index);
struct nouveau_i2c_port *(*find_type)(struct nouveau_i2c *, u16 type); struct nvkm_i2c_port *(*find_type)(struct nvkm_i2c *, u16 type);
int (*acquire_pad)(struct nouveau_i2c_port *, unsigned long timeout); int (*acquire_pad)(struct nvkm_i2c_port *, unsigned long timeout);
void (*release_pad)(struct nouveau_i2c_port *); void (*release_pad)(struct nvkm_i2c_port *);
int (*acquire)(struct nouveau_i2c_port *, unsigned long timeout); int (*acquire)(struct nvkm_i2c_port *, unsigned long timeout);
void (*release)(struct nouveau_i2c_port *); void (*release)(struct nvkm_i2c_port *);
int (*identify)(struct nouveau_i2c *, int index, int (*identify)(struct nvkm_i2c *, int index,
const char *what, struct nouveau_i2c_board_info *, const char *what, struct nvkm_i2c_board_info *,
bool (*match)(struct nouveau_i2c_port *, bool (*match)(struct nvkm_i2c_port *,
struct i2c_board_info *, void *), void *); struct i2c_board_info *, void *),
void *);
wait_queue_head_t wait; wait_queue_head_t wait;
struct list_head ports; struct list_head ports;
}; };
static inline struct nouveau_i2c * static inline struct nvkm_i2c *
nouveau_i2c(void *obj) 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 nvkm_oclass *nv04_i2c_oclass;
extern struct nouveau_oclass *nv4e_i2c_oclass; extern struct nvkm_oclass *nv4e_i2c_oclass;
extern struct nouveau_oclass *nv50_i2c_oclass; extern struct nvkm_oclass *nv50_i2c_oclass;
extern struct nouveau_oclass *nv94_i2c_oclass; extern struct nvkm_oclass *g94_i2c_oclass;
extern struct nouveau_oclass *nvd0_i2c_oclass; extern struct nvkm_oclass *gf110_i2c_oclass;
extern struct nouveau_oclass *gf117_i2c_oclass; extern struct nvkm_oclass *gf117_i2c_oclass;
extern struct nouveau_oclass *nve0_i2c_oclass; extern struct nvkm_oclass *gk104_i2c_oclass;
extern struct nouveau_oclass *gm204_i2c_oclass; extern struct nvkm_oclass *gm204_i2c_oclass;
static inline int 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; u8 val;
struct i2c_msg msgs[] = { struct i2c_msg msgs[] = {
...@@ -110,7 +110,7 @@ nv_rdi2cr(struct nouveau_i2c_port *port, u8 addr, u8 reg) ...@@ -110,7 +110,7 @@ nv_rdi2cr(struct nouveau_i2c_port *port, u8 addr, u8 reg)
} }
static inline int 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 }; u8 buf[2] = { reg, val };
struct i2c_msg msgs[] = { struct i2c_msg msgs[] = {
...@@ -125,12 +125,11 @@ nv_wri2cr(struct nouveau_i2c_port *port, u8 addr, u8 reg, u8 val) ...@@ -125,12 +125,11 @@ nv_wri2cr(struct nouveau_i2c_port *port, u8 addr, u8 reg, u8 val)
} }
static inline bool 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; return nv_rdi2cr(port, addr, 0) >= 0;
} }
int nv_rdaux(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 nouveau_i2c_port *, u32 addr, u8 *data, u8 size); int nv_wraux(struct nvkm_i2c_port *, u32 addr, u8 *data, u8 size);
#endif #endif
...@@ -63,7 +63,7 @@ gm100_identify(struct nouveau_device *device) ...@@ -63,7 +63,7 @@ gm100_identify(struct nouveau_device *device)
device->cname = "GM107"; device->cname = "GM107";
device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
device->oclass[NVDEV_SUBDEV_GPIO ] = gk104_gpio_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_FUSE ] = &gm107_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &gm107_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &gm107_therm_oclass;
......
...@@ -178,7 +178,7 @@ nv50_identify(struct nouveau_device *device) ...@@ -178,7 +178,7 @@ nv50_identify(struct nouveau_device *device)
device->cname = "G94"; device->cname = "G94";
device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_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_FUSE ] = &nv50_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass;
...@@ -207,7 +207,7 @@ nv50_identify(struct nouveau_device *device) ...@@ -207,7 +207,7 @@ nv50_identify(struct nouveau_device *device)
device->cname = "G96"; device->cname = "G96";
device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_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_FUSE ] = &nv50_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass;
...@@ -236,7 +236,7 @@ nv50_identify(struct nouveau_device *device) ...@@ -236,7 +236,7 @@ nv50_identify(struct nouveau_device *device)
device->cname = "G98"; device->cname = "G98";
device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_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_FUSE ] = &nv50_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = g84_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass;
...@@ -294,7 +294,7 @@ nv50_identify(struct nouveau_device *device) ...@@ -294,7 +294,7 @@ nv50_identify(struct nouveau_device *device)
device->cname = "MCP77/MCP78"; device->cname = "MCP77/MCP78";
device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_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_FUSE ] = &nv50_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = mcp77_clk_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = mcp77_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass;
...@@ -323,7 +323,7 @@ nv50_identify(struct nouveau_device *device) ...@@ -323,7 +323,7 @@ nv50_identify(struct nouveau_device *device)
device->cname = "MCP79/MCP7A"; device->cname = "MCP79/MCP7A";
device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_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_FUSE ] = &nv50_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = mcp77_clk_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = mcp77_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nv84_therm_oclass;
...@@ -352,7 +352,7 @@ nv50_identify(struct nouveau_device *device) ...@@ -352,7 +352,7 @@ nv50_identify(struct nouveau_device *device)
device->cname = "GT215"; device->cname = "GT215";
device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_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_FUSE ] = &nv50_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gt215_clk_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gt215_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
...@@ -383,7 +383,7 @@ nv50_identify(struct nouveau_device *device) ...@@ -383,7 +383,7 @@ nv50_identify(struct nouveau_device *device)
device->cname = "GT216"; device->cname = "GT216";
device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_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_FUSE ] = &nv50_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gt215_clk_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gt215_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
...@@ -413,7 +413,7 @@ nv50_identify(struct nouveau_device *device) ...@@ -413,7 +413,7 @@ nv50_identify(struct nouveau_device *device)
device->cname = "GT218"; device->cname = "GT218";
device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_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_FUSE ] = &nv50_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gt215_clk_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gt215_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
...@@ -443,7 +443,7 @@ nv50_identify(struct nouveau_device *device) ...@@ -443,7 +443,7 @@ nv50_identify(struct nouveau_device *device)
device->cname = "MCP89"; device->cname = "MCP89";
device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_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_FUSE ] = &nv50_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gt215_clk_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gt215_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
......
...@@ -63,7 +63,7 @@ nvc0_identify(struct nouveau_device *device) ...@@ -63,7 +63,7 @@ nvc0_identify(struct nouveau_device *device)
device->cname = "GF100"; device->cname = "GF100";
device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_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_FUSE ] = &gf100_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
...@@ -96,7 +96,7 @@ nvc0_identify(struct nouveau_device *device) ...@@ -96,7 +96,7 @@ nvc0_identify(struct nouveau_device *device)
device->cname = "GF104"; device->cname = "GF104";
device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_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_FUSE ] = &gf100_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
...@@ -129,7 +129,7 @@ nvc0_identify(struct nouveau_device *device) ...@@ -129,7 +129,7 @@ nvc0_identify(struct nouveau_device *device)
device->cname = "GF106"; device->cname = "GF106";
device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_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_FUSE ] = &gf100_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
...@@ -161,7 +161,7 @@ nvc0_identify(struct nouveau_device *device) ...@@ -161,7 +161,7 @@ nvc0_identify(struct nouveau_device *device)
device->cname = "GF114"; device->cname = "GF114";
device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_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_FUSE ] = &gf100_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
...@@ -194,7 +194,7 @@ nvc0_identify(struct nouveau_device *device) ...@@ -194,7 +194,7 @@ nvc0_identify(struct nouveau_device *device)
device->cname = "GF116"; device->cname = "GF116";
device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_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_FUSE ] = &gf100_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
...@@ -226,7 +226,7 @@ nvc0_identify(struct nouveau_device *device) ...@@ -226,7 +226,7 @@ nvc0_identify(struct nouveau_device *device)
device->cname = "GF108"; device->cname = "GF108";
device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_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_FUSE ] = &gf100_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
...@@ -258,7 +258,7 @@ nvc0_identify(struct nouveau_device *device) ...@@ -258,7 +258,7 @@ nvc0_identify(struct nouveau_device *device)
device->cname = "GF110"; device->cname = "GF110";
device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
device->oclass[NVDEV_SUBDEV_GPIO ] = g94_gpio_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_FUSE ] = &gf100_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nva3_therm_oclass;
...@@ -291,7 +291,7 @@ nvc0_identify(struct nouveau_device *device) ...@@ -291,7 +291,7 @@ nvc0_identify(struct nouveau_device *device)
device->cname = "GF119"; device->cname = "GF119";
device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
device->oclass[NVDEV_SUBDEV_GPIO ] = gf110_gpio_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_FUSE ] = &gf100_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gf100_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass;
......
...@@ -63,7 +63,7 @@ nve0_identify(struct nouveau_device *device) ...@@ -63,7 +63,7 @@ nve0_identify(struct nouveau_device *device)
device->cname = "GK104"; device->cname = "GK104";
device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
device->oclass[NVDEV_SUBDEV_GPIO ] = gk104_gpio_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_FUSE ] = &gf100_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass;
...@@ -97,7 +97,7 @@ nve0_identify(struct nouveau_device *device) ...@@ -97,7 +97,7 @@ nve0_identify(struct nouveau_device *device)
device->cname = "GK107"; device->cname = "GK107";
device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
device->oclass[NVDEV_SUBDEV_GPIO ] = gk104_gpio_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_FUSE ] = &gf100_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass;
...@@ -131,7 +131,7 @@ nve0_identify(struct nouveau_device *device) ...@@ -131,7 +131,7 @@ nve0_identify(struct nouveau_device *device)
device->cname = "GK106"; device->cname = "GK106";
device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
device->oclass[NVDEV_SUBDEV_GPIO ] = gk104_gpio_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_FUSE ] = &gf100_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass;
...@@ -187,7 +187,7 @@ nve0_identify(struct nouveau_device *device) ...@@ -187,7 +187,7 @@ nve0_identify(struct nouveau_device *device)
device->cname = "GK110"; device->cname = "GK110";
device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
device->oclass[NVDEV_SUBDEV_GPIO ] = gk104_gpio_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_FUSE ] = &gf100_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass;
...@@ -221,7 +221,7 @@ nve0_identify(struct nouveau_device *device) ...@@ -221,7 +221,7 @@ nve0_identify(struct nouveau_device *device)
device->cname = "GK110B"; device->cname = "GK110B";
device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
device->oclass[NVDEV_SUBDEV_GPIO ] = gk104_gpio_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_FUSE ] = &gf100_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass;
...@@ -255,7 +255,7 @@ nve0_identify(struct nouveau_device *device) ...@@ -255,7 +255,7 @@ nve0_identify(struct nouveau_device *device)
device->cname = "GK208B"; device->cname = "GK208B";
device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
device->oclass[NVDEV_SUBDEV_GPIO ] = gk104_gpio_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_FUSE ] = &gf100_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass;
...@@ -288,7 +288,7 @@ nve0_identify(struct nouveau_device *device) ...@@ -288,7 +288,7 @@ nve0_identify(struct nouveau_device *device)
device->cname = "GK208"; device->cname = "GK208";
device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass; device->oclass[NVDEV_SUBDEV_VBIOS ] = &nouveau_bios_oclass;
device->oclass[NVDEV_SUBDEV_GPIO ] = gk104_gpio_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_FUSE ] = &gf100_fuse_oclass;
device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass; device->oclass[NVDEV_SUBDEV_CLK ] = &gk104_clk_oclass;
device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass; device->oclass[NVDEV_SUBDEV_THERM ] = &nvd0_therm_oclass;
......
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
#include <subdev/bios/gpio.h> #include <subdev/bios/gpio.h>
#include <subdev/bios/init.h> #include <subdev/bios/init.h>
#include <subdev/bios/ramcfg.h> #include <subdev/bios/ramcfg.h>
#include <core/device.h>
#include <subdev/devinit.h> #include <subdev/devinit.h>
#include <subdev/gpio.h> #include <subdev/gpio.h>
#include <subdev/i2c.h> #include <subdev/i2c.h>
......
...@@ -4,13 +4,13 @@ nvkm-y += nvkm/subdev/i2c/aux.o ...@@ -4,13 +4,13 @@ nvkm-y += nvkm/subdev/i2c/aux.o
nvkm-y += nvkm/subdev/i2c/bit.o nvkm-y += nvkm/subdev/i2c/bit.o
nvkm-y += nvkm/subdev/i2c/pad.o nvkm-y += nvkm/subdev/i2c/pad.o
nvkm-y += nvkm/subdev/i2c/padnv04.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/padgm204.o
nvkm-y += nvkm/subdev/i2c/nv04.o nvkm-y += nvkm/subdev/i2c/nv04.o
nvkm-y += nvkm/subdev/i2c/nv4e.o nvkm-y += nvkm/subdev/i2c/nv4e.o
nvkm-y += nvkm/subdev/i2c/nv50.o nvkm-y += nvkm/subdev/i2c/nv50.o
nvkm-y += nvkm/subdev/i2c/nv94.o nvkm-y += nvkm/subdev/i2c/g94.o
nvkm-y += nvkm/subdev/i2c/nvd0.o nvkm-y += nvkm/subdev/i2c/gf110.o
nvkm-y += nvkm/subdev/i2c/gf117.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 nvkm-y += nvkm/subdev/i2c/gm204.o
...@@ -21,20 +21,19 @@ ...@@ -21,20 +21,19 @@
* *
* Authors: Ben Skeggs <bskeggs@redhat.com> * Authors: Ben Skeggs <bskeggs@redhat.com>
*/ */
#include "port.h" #include "port.h"
struct anx9805_i2c_port { struct anx9805_i2c_port {
struct nouveau_i2c_port base; struct nvkm_i2c_port base;
u32 addr; u32 addr;
u32 ctrl; u32 ctrl;
}; };
static int 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 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; u8 tmp, i;
DBG("ANX9805 train %d 0x%02x %d\n", link_nr, link_bw, enh); 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) ...@@ -62,11 +61,11 @@ anx9805_train(struct nouveau_i2c_port *port, int link_nr, int link_bw, bool enh)
} }
static int 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) u8 type, u32 addr, u8 *data, u8 size)
{ {
struct anx9805_i2c_port *chan = (void *)port; 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; int i, ret = -ETIMEDOUT;
u8 buf[16] = {}; u8 buf[16] = {};
u8 tmp; u8 tmp;
...@@ -116,25 +115,25 @@ anx9805_aux(struct nouveau_i2c_port *port, bool retry, ...@@ -116,25 +115,25 @@ anx9805_aux(struct nouveau_i2c_port *port, bool retry,
return ret; return ret;
} }
static const struct nouveau_i2c_func static const struct nvkm_i2c_func
anx9805_aux_func = { anx9805_aux_func = {
.aux = anx9805_aux, .aux = anx9805_aux,
.lnk_ctl = anx9805_train, .lnk_ctl = anx9805_train,
}; };
static int static int
anx9805_aux_chan_ctor(struct nouveau_object *parent, anx9805_aux_chan_ctor(struct nvkm_object *parent,
struct nouveau_object *engine, struct nvkm_object *engine,
struct nouveau_oclass *oclass, void *data, u32 index, struct nvkm_oclass *oclass, void *data, u32 index,
struct nouveau_object **pobject) struct nvkm_object **pobject)
{ {
struct nouveau_i2c_port *mast = (void *)parent; struct nvkm_i2c_port *mast = (void *)parent;
struct anx9805_i2c_port *chan; struct anx9805_i2c_port *chan;
int ret; int ret;
ret = nouveau_i2c_port_create(parent, engine, oclass, index, ret = nvkm_i2c_port_create(parent, engine, oclass, index,
&nouveau_i2c_aux_algo, &anx9805_aux_func, &nvkm_i2c_aux_algo, &anx9805_aux_func,
&chan); &chan);
*pobject = nv_object(chan); *pobject = nv_object(chan);
if (ret) if (ret)
return ret; return ret;
...@@ -156,22 +155,23 @@ anx9805_aux_chan_ctor(struct nouveau_object *parent, ...@@ -156,22 +155,23 @@ anx9805_aux_chan_ctor(struct nouveau_object *parent,
struct i2c_algo_bit_data *algo = mast->adapter.algo_data; struct i2c_algo_bit_data *algo = mast->adapter.algo_data;
algo->udelay = max(algo->udelay, 40); algo->udelay = max(algo->udelay, 40);
} }
return 0; return 0;
} }
static struct nouveau_ofuncs static struct nvkm_ofuncs
anx9805_aux_ofuncs = { anx9805_aux_ofuncs = {
.ctor = anx9805_aux_chan_ctor, .ctor = anx9805_aux_chan_ctor,
.dtor = _nouveau_i2c_port_dtor, .dtor = _nvkm_i2c_port_dtor,
.init = _nouveau_i2c_port_init, .init = _nvkm_i2c_port_init,
.fini = _nouveau_i2c_port_fini, .fini = _nvkm_i2c_port_fini,
}; };
static int static int
anx9805_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) anx9805_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
{ {
struct anx9805_i2c_port *port = adap->algo_data; 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; struct i2c_msg *msg = msgs;
int ret = -ETIMEDOUT; int ret = -ETIMEDOUT;
int i, j, cnt = num; int i, j, cnt = num;
...@@ -233,23 +233,22 @@ anx9805_i2c_algo = { ...@@ -233,23 +233,22 @@ anx9805_i2c_algo = {
.functionality = anx9805_func .functionality = anx9805_func
}; };
static const struct nouveau_i2c_func static const struct nvkm_i2c_func
anx9805_i2c_func = { anx9805_i2c_func = {
}; };
static int static int
anx9805_ddc_port_ctor(struct nouveau_object *parent, anx9805_ddc_port_ctor(struct nvkm_object *parent,
struct nouveau_object *engine, struct nvkm_object *engine,
struct nouveau_oclass *oclass, void *data, u32 index, struct nvkm_oclass *oclass, void *data, u32 index,
struct nouveau_object **pobject) struct nvkm_object **pobject)
{ {
struct nouveau_i2c_port *mast = (void *)parent; struct nvkm_i2c_port *mast = (void *)parent;
struct anx9805_i2c_port *port; struct anx9805_i2c_port *port;
int ret; int ret;
ret = nouveau_i2c_port_create(parent, engine, oclass, index, ret = nvkm_i2c_port_create(parent, engine, oclass, index,
&anx9805_i2c_algo, &anx9805_i2c_func, &anx9805_i2c_algo, &anx9805_i2c_func, &port);
&port);
*pobject = nv_object(port); *pobject = nv_object(port);
if (ret) if (ret)
return ret; return ret;
...@@ -271,19 +270,20 @@ anx9805_ddc_port_ctor(struct nouveau_object *parent, ...@@ -271,19 +270,20 @@ anx9805_ddc_port_ctor(struct nouveau_object *parent,
struct i2c_algo_bit_data *algo = mast->adapter.algo_data; struct i2c_algo_bit_data *algo = mast->adapter.algo_data;
algo->udelay = max(algo->udelay, 40); algo->udelay = max(algo->udelay, 40);
} }
return 0; return 0;
} }
static struct nouveau_ofuncs static struct nvkm_ofuncs
anx9805_ddc_ofuncs = { anx9805_ddc_ofuncs = {
.ctor = anx9805_ddc_port_ctor, .ctor = anx9805_ddc_port_ctor,
.dtor = _nouveau_i2c_port_dtor, .dtor = _nvkm_i2c_port_dtor,
.init = _nouveau_i2c_port_init, .init = _nvkm_i2c_port_init,
.fini = _nouveau_i2c_port_fini, .fini = _nvkm_i2c_port_fini,
}; };
struct nouveau_oclass struct nvkm_oclass
nouveau_anx9805_sclass[] = { nvkm_anx9805_sclass[] = {
{ .handle = NV_I2C_TYPE_EXTDDC(0x0d), .ofuncs = &anx9805_ddc_ofuncs }, { .handle = NV_I2C_TYPE_EXTDDC(0x0d), .ofuncs = &anx9805_ddc_ofuncs },
{ .handle = NV_I2C_TYPE_EXTAUX(0x0d), .ofuncs = &anx9805_aux_ofuncs }, { .handle = NV_I2C_TYPE_EXTAUX(0x0d), .ofuncs = &anx9805_aux_ofuncs },
{ .handle = NV_I2C_TYPE_EXTDDC(0x0e), .ofuncs = &anx9805_ddc_ofuncs }, { .handle = NV_I2C_TYPE_EXTDDC(0x0e), .ofuncs = &anx9805_ddc_ofuncs },
......
...@@ -21,13 +21,12 @@ ...@@ -21,13 +21,12 @@
* *
* Authors: Ben Skeggs * Authors: Ben Skeggs
*/ */
#include "priv.h" #include "priv.h"
int 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) { if (port->func->aux) {
int ret = i2c->acquire(port, 0); int ret = i2c->acquire(port, 0);
if (ret == 0) { if (ret == 0) {
...@@ -40,9 +39,9 @@ nv_rdaux(struct nouveau_i2c_port *port, u32 addr, u8 *data, u8 size) ...@@ -40,9 +39,9 @@ nv_rdaux(struct nouveau_i2c_port *port, u32 addr, u8 *data, u8 size)
} }
int 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) { if (port->func->aux) {
int ret = i2c->acquire(port, 0); int ret = i2c->acquire(port, 0);
if (ret == 0) { if (ret == 0) {
...@@ -57,8 +56,8 @@ nv_wraux(struct nouveau_i2c_port *port, u32 addr, u8 *data, u8 size) ...@@ -57,8 +56,8 @@ nv_wraux(struct nouveau_i2c_port *port, u32 addr, u8 *data, u8 size)
static int static int
aux_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) aux_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 nouveau_i2c *i2c = nouveau_i2c(port); struct nvkm_i2c *i2c = nvkm_i2c(port);
struct i2c_msg *msg = msgs; struct i2c_msg *msg = msgs;
int ret, mcnt = num; int ret, mcnt = num;
...@@ -108,7 +107,7 @@ aux_func(struct i2c_adapter *adap) ...@@ -108,7 +107,7 @@ aux_func(struct i2c_adapter *adap)
return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; 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, .master_xfer = aux_xfer,
.functionality = aux_func .functionality = aux_func
}; };
...@@ -21,46 +21,45 @@ ...@@ -21,46 +21,45 @@
* *
* Authors: Ben Skeggs * Authors: Ben Skeggs
*/ */
#include "priv.h" #include "priv.h"
#ifdef CONFIG_NOUVEAU_I2C_INTERNAL #ifdef CONFIG_NVKM_I2C_INTERNAL
#define T_TIMEOUT 2200000 #define T_TIMEOUT 2200000
#define T_RISEFALL 1000 #define T_RISEFALL 1000
#define T_HOLD 5000 #define T_HOLD 5000
static inline void 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); port->func->drive_scl(port, state);
} }
static inline void 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); port->func->drive_sda(port, state);
} }
static inline int 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); return port->func->sense_scl(port);
} }
static inline int 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); return port->func->sense_sda(port);
} }
static void static void
i2c_delay(struct nouveau_i2c_port *port, u32 nsec) i2c_delay(struct nvkm_i2c_port *port, u32 nsec)
{ {
udelay((nsec + 500) / 1000); udelay((nsec + 500) / 1000);
} }
static bool static bool
i2c_raise_scl(struct nouveau_i2c_port *port) i2c_raise_scl(struct nvkm_i2c_port *port)
{ {
u32 timeout = T_TIMEOUT / T_RISEFALL; u32 timeout = T_TIMEOUT / T_RISEFALL;
...@@ -73,7 +72,7 @@ i2c_raise_scl(struct nouveau_i2c_port *port) ...@@ -73,7 +72,7 @@ i2c_raise_scl(struct nouveau_i2c_port *port)
} }
static int static int
i2c_start(struct nouveau_i2c_port *port) i2c_start(struct nvkm_i2c_port *port)
{ {
int ret = 0; int ret = 0;
...@@ -93,7 +92,7 @@ i2c_start(struct nouveau_i2c_port *port) ...@@ -93,7 +92,7 @@ i2c_start(struct nouveau_i2c_port *port)
} }
static void static void
i2c_stop(struct nouveau_i2c_port *port) i2c_stop(struct nvkm_i2c_port *port)
{ {
i2c_drive_scl(port, 0); i2c_drive_scl(port, 0);
i2c_drive_sda(port, 0); i2c_drive_sda(port, 0);
...@@ -106,7 +105,7 @@ i2c_stop(struct nouveau_i2c_port *port) ...@@ -106,7 +105,7 @@ i2c_stop(struct nouveau_i2c_port *port)
} }
static int 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_drive_sda(port, sda);
i2c_delay(port, T_RISEFALL); i2c_delay(port, T_RISEFALL);
...@@ -121,7 +120,7 @@ i2c_bitw(struct nouveau_i2c_port *port, int sda) ...@@ -121,7 +120,7 @@ i2c_bitw(struct nouveau_i2c_port *port, int sda)
} }
static int static int
i2c_bitr(struct nouveau_i2c_port *port) i2c_bitr(struct nvkm_i2c_port *port)
{ {
int sda; int sda;
...@@ -140,7 +139,7 @@ i2c_bitr(struct nouveau_i2c_port *port) ...@@ -140,7 +139,7 @@ i2c_bitr(struct nouveau_i2c_port *port)
} }
static int 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; int i, bit;
...@@ -156,7 +155,7 @@ i2c_get_byte(struct nouveau_i2c_port *port, u8 *byte, bool last) ...@@ -156,7 +155,7 @@ i2c_get_byte(struct nouveau_i2c_port *port, u8 *byte, bool last)
} }
static int 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; int i, ret;
for (i = 7; i >= 0; i--) { for (i = 7; i >= 0; i--) {
...@@ -172,7 +171,7 @@ i2c_put_byte(struct nouveau_i2c_port *port, u8 byte) ...@@ -172,7 +171,7 @@ i2c_put_byte(struct nouveau_i2c_port *port, u8 byte)
} }
static int 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; u32 addr = msg->addr << 1;
if (msg->flags & I2C_M_RD) if (msg->flags & I2C_M_RD)
...@@ -183,11 +182,11 @@ i2c_addr(struct nouveau_i2c_port *port, struct i2c_msg *msg) ...@@ -183,11 +182,11 @@ i2c_addr(struct nouveau_i2c_port *port, struct i2c_msg *msg)
static int static int
i2c_bit_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) 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; struct i2c_msg *msg = msgs;
int ret = 0, mcnt = num; 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) if (ret)
return ret; return ret;
...@@ -211,7 +210,7 @@ i2c_bit_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) ...@@ -211,7 +210,7 @@ i2c_bit_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
} }
i2c_stop(port); i2c_stop(port);
nouveau_i2c(port)->release(port); nvkm_i2c(port)->release(port);
return (ret < 0) ? ret : num; return (ret < 0) ? ret : num;
} }
#else #else
...@@ -228,7 +227,7 @@ i2c_bit_func(struct i2c_adapter *adap) ...@@ -228,7 +227,7 @@ i2c_bit_func(struct i2c_adapter *adap)
return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; 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, .master_xfer = i2c_bit_xfer,
.functionality = i2c_bit_func .functionality = i2c_bit_func
}; };
...@@ -21,11 +21,10 @@ ...@@ -21,11 +21,10 @@
* *
* Authors: Ben Skeggs * Authors: Ben Skeggs
*/ */
#include "nv50.h" #include "nv50.h"
void 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 intr = nv_rd32(i2c, 0x00e06c);
u32 stat = nv_rd32(i2c, 0x00e068) & intr, i; 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) ...@@ -39,7 +38,7 @@ nv94_aux_stat(struct nouveau_i2c *i2c, u32 *hi, u32 *lo, u32 *rq, u32 *tx)
} }
void 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; u32 temp = nv_rd32(i2c, 0x00e068), i;
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
...@@ -58,13 +57,13 @@ nv94_aux_mask(struct nouveau_i2c *i2c, u32 type, u32 mask, u32 data) ...@@ -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) #define AUX_ERR(fmt, args...) nv_error(aux, "AUXCH(%d): " fmt, ch, ##args)
static void 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); nv_mask(aux, 0x00e4e4 + (ch * 0x50), 0x00310000, 0x00000000);
} }
static int 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 unksel = 1; /* nfi which to use, or if it matters.. */
const u32 ureq = unksel ? 0x00100000 : 0x00200000; const u32 ureq = unksel ? 0x00100000 : 0x00200000;
...@@ -99,10 +98,10 @@ auxch_init(struct nouveau_i2c *aux, int ch) ...@@ -99,10 +98,10 @@ auxch_init(struct nouveau_i2c *aux, int ch)
} }
int 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) 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; struct nv50_i2c_port *port = (void *)base;
u32 ctrl, stat, timeout, retries; u32 ctrl, stat, timeout, retries;
u32 xbuf[4] = {}; u32 xbuf[4] = {};
...@@ -185,8 +184,8 @@ nv94_aux(struct nouveau_i2c_port *base, bool retry, ...@@ -185,8 +184,8 @@ nv94_aux(struct nouveau_i2c_port *base, bool retry,
return ret < 0 ? ret : (stat & 0x000f0000) >> 16; return ret < 0 ? ret : (stat & 0x000f0000) >> 16;
} }
static const struct nouveau_i2c_func static const struct nvkm_i2c_func
nv94_i2c_func = { g94_i2c_func = {
.drive_scl = nv50_i2c_drive_scl, .drive_scl = nv50_i2c_drive_scl,
.drive_sda = nv50_i2c_drive_sda, .drive_sda = nv50_i2c_drive_sda,
.sense_scl = nv50_i2c_sense_scl, .sense_scl = nv50_i2c_sense_scl,
...@@ -194,17 +193,16 @@ nv94_i2c_func = { ...@@ -194,17 +193,16 @@ nv94_i2c_func = {
}; };
static int static int
nv94_i2c_port_ctor(struct nouveau_object *parent, struct nouveau_object *engine, g94_i2c_port_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nouveau_oclass *oclass, void *data, u32 index, struct nvkm_oclass *oclass, void *data, u32 index,
struct nouveau_object **pobject) struct nvkm_object **pobject)
{ {
struct dcb_i2c_entry *info = data; struct dcb_i2c_entry *info = data;
struct nv50_i2c_port *port; struct nv50_i2c_port *port;
int ret; int ret;
ret = nouveau_i2c_port_create(parent, engine, oclass, index, ret = nvkm_i2c_port_create(parent, engine, oclass, index,
&nouveau_i2c_bit_algo, &nv94_i2c_func, &nvkm_i2c_bit_algo, &g94_i2c_func, &port);
&port);
*pobject = nv_object(port); *pobject = nv_object(port);
if (ret) if (ret)
return ret; return ret;
...@@ -217,23 +215,22 @@ nv94_i2c_port_ctor(struct nouveau_object *parent, struct nouveau_object *engine, ...@@ -217,23 +215,22 @@ nv94_i2c_port_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
return 0; return 0;
} }
static const struct nouveau_i2c_func static const struct nvkm_i2c_func
nv94_aux_func = { g94_aux_func = {
.aux = nv94_aux, .aux = g94_aux,
}; };
int int
nv94_aux_port_ctor(struct nouveau_object *parent, struct nouveau_object *engine, g94_aux_port_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nouveau_oclass *oclass, void *data, u32 index, struct nvkm_oclass *oclass, void *data, u32 index,
struct nouveau_object **pobject) struct nvkm_object **pobject)
{ {
struct dcb_i2c_entry *info = data; struct dcb_i2c_entry *info = data;
struct nv50_i2c_port *port; struct nv50_i2c_port *port;
int ret; int ret;
ret = nouveau_i2c_port_create(parent, engine, oclass, index, ret = nvkm_i2c_port_create(parent, engine, oclass, index,
&nouveau_i2c_aux_algo, &nv94_aux_func, &nvkm_i2c_aux_algo, &g94_aux_func, &port);
&port);
*pobject = nv_object(port); *pobject = nv_object(port);
if (ret) if (ret)
return ret; return ret;
...@@ -243,40 +240,40 @@ nv94_aux_port_ctor(struct nouveau_object *parent, struct nouveau_object *engine, ...@@ -243,40 +240,40 @@ nv94_aux_port_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
return 0; return 0;
} }
static struct nouveau_oclass static struct nvkm_oclass
nv94_i2c_sclass[] = { g94_i2c_sclass[] = {
{ .handle = NV_I2C_TYPE_DCBI2C(DCB_I2C_NVIO_BIT), { .handle = NV_I2C_TYPE_DCBI2C(DCB_I2C_NVIO_BIT),
.ofuncs = &(struct nouveau_ofuncs) { .ofuncs = &(struct nvkm_ofuncs) {
.ctor = nv94_i2c_port_ctor, .ctor = g94_i2c_port_ctor,
.dtor = _nouveau_i2c_port_dtor, .dtor = _nvkm_i2c_port_dtor,
.init = nv50_i2c_port_init, .init = nv50_i2c_port_init,
.fini = _nouveau_i2c_port_fini, .fini = _nvkm_i2c_port_fini,
}, },
}, },
{ .handle = NV_I2C_TYPE_DCBI2C(DCB_I2C_NVIO_AUX), { .handle = NV_I2C_TYPE_DCBI2C(DCB_I2C_NVIO_AUX),
.ofuncs = &(struct nouveau_ofuncs) { .ofuncs = &(struct nvkm_ofuncs) {
.ctor = nv94_aux_port_ctor, .ctor = g94_aux_port_ctor,
.dtor = _nouveau_i2c_port_dtor, .dtor = _nvkm_i2c_port_dtor,
.init = _nouveau_i2c_port_init, .init = _nvkm_i2c_port_init,
.fini = _nouveau_i2c_port_fini, .fini = _nvkm_i2c_port_fini,
}, },
}, },
{} {}
}; };
struct nouveau_oclass * struct nvkm_oclass *
nv94_i2c_oclass = &(struct nouveau_i2c_impl) { g94_i2c_oclass = &(struct nvkm_i2c_impl) {
.base.handle = NV_SUBDEV(I2C, 0x94), .base.handle = NV_SUBDEV(I2C, 0x94),
.base.ofuncs = &(struct nouveau_ofuncs) { .base.ofuncs = &(struct nvkm_ofuncs) {
.ctor = _nouveau_i2c_ctor, .ctor = _nvkm_i2c_ctor,
.dtor = _nouveau_i2c_dtor, .dtor = _nvkm_i2c_dtor,
.init = _nouveau_i2c_init, .init = _nvkm_i2c_init,
.fini = _nouveau_i2c_fini, .fini = _nvkm_i2c_fini,
}, },
.sclass = nv94_i2c_sclass, .sclass = g94_i2c_sclass,
.pad_x = &nv04_i2c_pad_oclass, .pad_x = &nv04_i2c_pad_oclass,
.pad_s = &nv94_i2c_pad_oclass, .pad_s = &g94_i2c_pad_oclass,
.aux = 4, .aux = 4,
.aux_stat = nv94_aux_stat, .aux_stat = g94_aux_stat,
.aux_mask = nv94_aux_mask, .aux_mask = g94_aux_mask,
}.base; }.base;
...@@ -21,45 +21,43 @@ ...@@ -21,45 +21,43 @@
* *
* Authors: Ben Skeggs * Authors: Ben Skeggs
*/ */
#include "nv50.h" #include "nv50.h"
static int 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; struct nv50_i2c_port *port = (void *)base;
return !!(nv_rd32(priv, port->addr) & 0x00000010); return !!(nv_rd32(priv, port->addr) & 0x00000010);
} }
static int 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; struct nv50_i2c_port *port = (void *)base;
return !!(nv_rd32(priv, port->addr) & 0x00000020); return !!(nv_rd32(priv, port->addr) & 0x00000020);
} }
static const struct nouveau_i2c_func static const struct nvkm_i2c_func
nvd0_i2c_func = { gf110_i2c_func = {
.drive_scl = nv50_i2c_drive_scl, .drive_scl = nv50_i2c_drive_scl,
.drive_sda = nv50_i2c_drive_sda, .drive_sda = nv50_i2c_drive_sda,
.sense_scl = nvd0_i2c_sense_scl, .sense_scl = gf110_i2c_sense_scl,
.sense_sda = nvd0_i2c_sense_sda, .sense_sda = gf110_i2c_sense_sda,
}; };
int int
nvd0_i2c_port_ctor(struct nouveau_object *parent, struct nouveau_object *engine, gf110_i2c_port_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nouveau_oclass *oclass, void *data, u32 index, struct nvkm_oclass *oclass, void *data, u32 index,
struct nouveau_object **pobject) struct nvkm_object **pobject)
{ {
struct dcb_i2c_entry *info = data; struct dcb_i2c_entry *info = data;
struct nv50_i2c_port *port; struct nv50_i2c_port *port;
int ret; int ret;
ret = nouveau_i2c_port_create(parent, engine, oclass, index, ret = nvkm_i2c_port_create(parent, engine, oclass, index,
&nouveau_i2c_bit_algo, &nvd0_i2c_func, &nvkm_i2c_bit_algo, &gf110_i2c_func, &port);
&port);
*pobject = nv_object(port); *pobject = nv_object(port);
if (ret) if (ret)
return ret; return ret;
...@@ -69,40 +67,40 @@ nvd0_i2c_port_ctor(struct nouveau_object *parent, struct nouveau_object *engine, ...@@ -69,40 +67,40 @@ nvd0_i2c_port_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
return 0; return 0;
} }
struct nouveau_oclass struct nvkm_oclass
nvd0_i2c_sclass[] = { gf110_i2c_sclass[] = {
{ .handle = NV_I2C_TYPE_DCBI2C(DCB_I2C_NVIO_BIT), { .handle = NV_I2C_TYPE_DCBI2C(DCB_I2C_NVIO_BIT),
.ofuncs = &(struct nouveau_ofuncs) { .ofuncs = &(struct nvkm_ofuncs) {
.ctor = nvd0_i2c_port_ctor, .ctor = gf110_i2c_port_ctor,
.dtor = _nouveau_i2c_port_dtor, .dtor = _nvkm_i2c_port_dtor,
.init = nv50_i2c_port_init, .init = nv50_i2c_port_init,
.fini = _nouveau_i2c_port_fini, .fini = _nvkm_i2c_port_fini,
}, },
}, },
{ .handle = NV_I2C_TYPE_DCBI2C(DCB_I2C_NVIO_AUX), { .handle = NV_I2C_TYPE_DCBI2C(DCB_I2C_NVIO_AUX),
.ofuncs = &(struct nouveau_ofuncs) { .ofuncs = &(struct nvkm_ofuncs) {
.ctor = nv94_aux_port_ctor, .ctor = g94_aux_port_ctor,
.dtor = _nouveau_i2c_port_dtor, .dtor = _nvkm_i2c_port_dtor,
.init = _nouveau_i2c_port_init, .init = _nvkm_i2c_port_init,
.fini = _nouveau_i2c_port_fini, .fini = _nvkm_i2c_port_fini,
}, },
}, },
{} {}
}; };
struct nouveau_oclass * struct nvkm_oclass *
nvd0_i2c_oclass = &(struct nouveau_i2c_impl) { gf110_i2c_oclass = &(struct nvkm_i2c_impl) {
.base.handle = NV_SUBDEV(I2C, 0xd0), .base.handle = NV_SUBDEV(I2C, 0xd0),
.base.ofuncs = &(struct nouveau_ofuncs) { .base.ofuncs = &(struct nvkm_ofuncs) {
.ctor = _nouveau_i2c_ctor, .ctor = _nvkm_i2c_ctor,
.dtor = _nouveau_i2c_dtor, .dtor = _nvkm_i2c_dtor,
.init = _nouveau_i2c_init, .init = _nvkm_i2c_init,
.fini = _nouveau_i2c_fini, .fini = _nvkm_i2c_fini,
}, },
.sclass = nvd0_i2c_sclass, .sclass = gf110_i2c_sclass,
.pad_x = &nv04_i2c_pad_oclass, .pad_x = &nv04_i2c_pad_oclass,
.pad_s = &nv94_i2c_pad_oclass, .pad_s = &g94_i2c_pad_oclass,
.aux = 4, .aux = 4,
.aux_stat = nv94_aux_stat, .aux_stat = g94_aux_stat,
.aux_mask = nv94_aux_mask, .aux_mask = g94_aux_mask,
}.base; }.base;
...@@ -21,19 +21,18 @@ ...@@ -21,19 +21,18 @@
* *
* Authors: Ben Skeggs * Authors: Ben Skeggs
*/ */
#include "nv50.h" #include "nv50.h"
struct nouveau_oclass * struct nvkm_oclass *
gf117_i2c_oclass = &(struct nouveau_i2c_impl) { gf117_i2c_oclass = &(struct nvkm_i2c_impl) {
.base.handle = NV_SUBDEV(I2C, 0xd7), .base.handle = NV_SUBDEV(I2C, 0xd7),
.base.ofuncs = &(struct nouveau_ofuncs) { .base.ofuncs = &(struct nvkm_ofuncs) {
.ctor = _nouveau_i2c_ctor, .ctor = _nvkm_i2c_ctor,
.dtor = _nouveau_i2c_dtor, .dtor = _nvkm_i2c_dtor,
.init = _nouveau_i2c_init, .init = _nvkm_i2c_init,
.fini = _nouveau_i2c_fini, .fini = _nvkm_i2c_fini,
}, },
.sclass = nvd0_i2c_sclass, .sclass = gf110_i2c_sclass,
.pad_x = &nv04_i2c_pad_oclass, .pad_x = &nv04_i2c_pad_oclass,
.pad_s = &nv04_i2c_pad_oclass, .pad_s = &nv04_i2c_pad_oclass,
}.base; }.base;
...@@ -21,11 +21,10 @@ ...@@ -21,11 +21,10 @@
* *
* Authors: Ben Skeggs * Authors: Ben Skeggs
*/ */
#include "nv50.h" #include "nv50.h"
void 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 intr = nv_rd32(i2c, 0x00dc60);
u32 stat = nv_rd32(i2c, 0x00dc68) & intr, i; 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) ...@@ -39,7 +38,7 @@ nve0_aux_stat(struct nouveau_i2c *i2c, u32 *hi, u32 *lo, u32 *rq, u32 *tx)
} }
void 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; u32 temp = nv_rd32(i2c, 0x00dc68), i;
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
...@@ -54,19 +53,19 @@ nve0_aux_mask(struct nouveau_i2c *i2c, u32 type, u32 mask, u32 data) ...@@ -54,19 +53,19 @@ nve0_aux_mask(struct nouveau_i2c *i2c, u32 type, u32 mask, u32 data)
nv_wr32(i2c, 0x00dc68, temp); nv_wr32(i2c, 0x00dc68, temp);
} }
struct nouveau_oclass * struct nvkm_oclass *
nve0_i2c_oclass = &(struct nouveau_i2c_impl) { gk104_i2c_oclass = &(struct nvkm_i2c_impl) {
.base.handle = NV_SUBDEV(I2C, 0xe0), .base.handle = NV_SUBDEV(I2C, 0xe0),
.base.ofuncs = &(struct nouveau_ofuncs) { .base.ofuncs = &(struct nvkm_ofuncs) {
.ctor = _nouveau_i2c_ctor, .ctor = _nvkm_i2c_ctor,
.dtor = _nouveau_i2c_dtor, .dtor = _nvkm_i2c_dtor,
.init = _nouveau_i2c_init, .init = _nvkm_i2c_init,
.fini = _nouveau_i2c_fini, .fini = _nvkm_i2c_fini,
}, },
.sclass = nvd0_i2c_sclass, .sclass = gf110_i2c_sclass,
.pad_x = &nv04_i2c_pad_oclass, .pad_x = &nv04_i2c_pad_oclass,
.pad_s = &nv94_i2c_pad_oclass, .pad_s = &g94_i2c_pad_oclass,
.aux = 4, .aux = 4,
.aux_stat = nve0_aux_stat, .aux_stat = gk104_aux_stat,
.aux_mask = nve0_aux_mask, .aux_mask = gk104_aux_mask,
}.base; }.base;
...@@ -21,20 +21,19 @@ ...@@ -21,20 +21,19 @@
* *
* Authors: Ben Skeggs * Authors: Ben Skeggs
*/ */
#include "nv50.h" #include "nv50.h"
#define AUX_DBG(fmt, args...) nv_debug(aux, "AUXCH(%d): " fmt, ch, ##args) #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) #define AUX_ERR(fmt, args...) nv_error(aux, "AUXCH(%d): " fmt, ch, ##args)
static void 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); nv_mask(aux, 0x00d954 + (ch * 0x50), 0x00310000, 0x00000000);
} }
static int 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 unksel = 1; /* nfi which to use, or if it matters.. */
const u32 ureq = unksel ? 0x00100000 : 0x00200000; const u32 ureq = unksel ? 0x00100000 : 0x00200000;
...@@ -69,10 +68,10 @@ auxch_init(struct nouveau_i2c *aux, int ch) ...@@ -69,10 +68,10 @@ auxch_init(struct nouveau_i2c *aux, int ch)
} }
int 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) 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; struct nv50_i2c_port *port = (void *)base;
u32 ctrl, stat, timeout, retries; u32 ctrl, stat, timeout, retries;
u32 xbuf[4] = {}; u32 xbuf[4] = {};
...@@ -155,24 +154,23 @@ gm204_aux(struct nouveau_i2c_port *base, bool retry, ...@@ -155,24 +154,23 @@ gm204_aux(struct nouveau_i2c_port *base, bool retry,
return ret < 0 ? ret : (stat & 0x000f0000) >> 16; return ret < 0 ? ret : (stat & 0x000f0000) >> 16;
} }
static const struct nouveau_i2c_func static const struct nvkm_i2c_func
gm204_aux_func = { gm204_aux_func = {
.aux = gm204_aux, .aux = gm204_aux,
}; };
int int
gm204_aux_port_ctor(struct nouveau_object *parent, gm204_aux_port_ctor(struct nvkm_object *parent,
struct nouveau_object *engine, struct nvkm_object *engine,
struct nouveau_oclass *oclass, void *data, u32 index, struct nvkm_oclass *oclass, void *data, u32 index,
struct nouveau_object **pobject) struct nvkm_object **pobject)
{ {
struct dcb_i2c_entry *info = data; struct dcb_i2c_entry *info = data;
struct nv50_i2c_port *port; struct nv50_i2c_port *port;
int ret; int ret;
ret = nouveau_i2c_port_create(parent, engine, oclass, index, ret = nvkm_i2c_port_create(parent, engine, oclass, index,
&nouveau_i2c_aux_algo, &gm204_aux_func, &nvkm_i2c_aux_algo, &gm204_aux_func, &port);
&port);
*pobject = nv_object(port); *pobject = nv_object(port);
if (ret) if (ret)
return ret; return ret;
...@@ -182,40 +180,40 @@ gm204_aux_port_ctor(struct nouveau_object *parent, ...@@ -182,40 +180,40 @@ gm204_aux_port_ctor(struct nouveau_object *parent,
return 0; return 0;
} }
struct nouveau_oclass struct nvkm_oclass
gm204_i2c_sclass[] = { gm204_i2c_sclass[] = {
{ .handle = NV_I2C_TYPE_DCBI2C(DCB_I2C_NVIO_BIT), { .handle = NV_I2C_TYPE_DCBI2C(DCB_I2C_NVIO_BIT),
.ofuncs = &(struct nouveau_ofuncs) { .ofuncs = &(struct nvkm_ofuncs) {
.ctor = nvd0_i2c_port_ctor, .ctor = gf110_i2c_port_ctor,
.dtor = _nouveau_i2c_port_dtor, .dtor = _nvkm_i2c_port_dtor,
.init = nv50_i2c_port_init, .init = nv50_i2c_port_init,
.fini = _nouveau_i2c_port_fini, .fini = _nvkm_i2c_port_fini,
}, },
}, },
{ .handle = NV_I2C_TYPE_DCBI2C(DCB_I2C_NVIO_AUX), { .handle = NV_I2C_TYPE_DCBI2C(DCB_I2C_NVIO_AUX),
.ofuncs = &(struct nouveau_ofuncs) { .ofuncs = &(struct nvkm_ofuncs) {
.ctor = gm204_aux_port_ctor, .ctor = gm204_aux_port_ctor,
.dtor = _nouveau_i2c_port_dtor, .dtor = _nvkm_i2c_port_dtor,
.init = _nouveau_i2c_port_init, .init = _nvkm_i2c_port_init,
.fini = _nouveau_i2c_port_fini, .fini = _nvkm_i2c_port_fini,
}, },
}, },
{} {}
}; };
struct nouveau_oclass * struct nvkm_oclass *
gm204_i2c_oclass = &(struct nouveau_i2c_impl) { gm204_i2c_oclass = &(struct nvkm_i2c_impl) {
.base.handle = NV_SUBDEV(I2C, 0x24), .base.handle = NV_SUBDEV(I2C, 0x24),
.base.ofuncs = &(struct nouveau_ofuncs) { .base.ofuncs = &(struct nvkm_ofuncs) {
.ctor = _nouveau_i2c_ctor, .ctor = _nvkm_i2c_ctor,
.dtor = _nouveau_i2c_dtor, .dtor = _nvkm_i2c_dtor,
.init = _nouveau_i2c_init, .init = _nvkm_i2c_init,
.fini = _nouveau_i2c_fini, .fini = _nvkm_i2c_fini,
}, },
.sclass = gm204_i2c_sclass, .sclass = gm204_i2c_sclass,
.pad_x = &nv04_i2c_pad_oclass, .pad_x = &nv04_i2c_pad_oclass,
.pad_s = &gm204_i2c_pad_oclass, .pad_s = &gm204_i2c_pad_oclass,
.aux = 8, .aux = 8,
.aux_stat = nve0_aux_stat, .aux_stat = gk104_aux_stat,
.aux_mask = nve0_aux_mask, .aux_mask = gk104_aux_mask,
}.base; }.base;
...@@ -21,25 +21,24 @@ ...@@ -21,25 +21,24 @@
* *
* Authors: Ben Skeggs * Authors: Ben Skeggs
*/ */
#include "priv.h"
#include <subdev/vga.h> #include <subdev/vga.h>
#include "priv.h"
struct nv04_i2c_priv { struct nv04_i2c_priv {
struct nouveau_i2c base; struct nvkm_i2c base;
}; };
struct nv04_i2c_port { struct nv04_i2c_port {
struct nouveau_i2c_port base; struct nvkm_i2c_port base;
u8 drive; u8 drive;
u8 sense; u8 sense;
}; };
static void 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; struct nv04_i2c_port *port = (void *)base;
u8 val = nv_rdvgac(priv, 0, port->drive); u8 val = nv_rdvgac(priv, 0, port->drive);
if (state) val |= 0x20; if (state) val |= 0x20;
...@@ -48,9 +47,9 @@ nv04_i2c_drive_scl(struct nouveau_i2c_port *base, int state) ...@@ -48,9 +47,9 @@ nv04_i2c_drive_scl(struct nouveau_i2c_port *base, int state)
} }
static void 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; struct nv04_i2c_port *port = (void *)base;
u8 val = nv_rdvgac(priv, 0, port->drive); u8 val = nv_rdvgac(priv, 0, port->drive);
if (state) val |= 0x10; if (state) val |= 0x10;
...@@ -59,22 +58,22 @@ nv04_i2c_drive_sda(struct nouveau_i2c_port *base, int state) ...@@ -59,22 +58,22 @@ nv04_i2c_drive_sda(struct nouveau_i2c_port *base, int state)
} }
static int 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; struct nv04_i2c_port *port = (void *)base;
return !!(nv_rdvgac(priv, 0, port->sense) & 0x04); return !!(nv_rdvgac(priv, 0, port->sense) & 0x04);
} }
static int 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; struct nv04_i2c_port *port = (void *)base;
return !!(nv_rdvgac(priv, 0, port->sense) & 0x08); return !!(nv_rdvgac(priv, 0, port->sense) & 0x08);
} }
static const struct nouveau_i2c_func static const struct nvkm_i2c_func
nv04_i2c_func = { nv04_i2c_func = {
.drive_scl = nv04_i2c_drive_scl, .drive_scl = nv04_i2c_drive_scl,
.drive_sda = nv04_i2c_drive_sda, .drive_sda = nv04_i2c_drive_sda,
...@@ -83,17 +82,16 @@ nv04_i2c_func = { ...@@ -83,17 +82,16 @@ nv04_i2c_func = {
}; };
static int static int
nv04_i2c_port_ctor(struct nouveau_object *parent, struct nouveau_object *engine, nv04_i2c_port_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nouveau_oclass *oclass, void *data, u32 index, struct nvkm_oclass *oclass, void *data, u32 index,
struct nouveau_object **pobject) struct nvkm_object **pobject)
{ {
struct dcb_i2c_entry *info = data; struct dcb_i2c_entry *info = data;
struct nv04_i2c_port *port; struct nv04_i2c_port *port;
int ret; int ret;
ret = nouveau_i2c_port_create(parent, engine, oclass, index, ret = nvkm_i2c_port_create(parent, engine, oclass, index,
&nouveau_i2c_bit_algo, &nv04_i2c_func, &nvkm_i2c_bit_algo, &nv04_i2c_func, &port);
&port);
*pobject = nv_object(port); *pobject = nv_object(port);
if (ret) if (ret)
return ret; return ret;
...@@ -103,27 +101,27 @@ nv04_i2c_port_ctor(struct nouveau_object *parent, struct nouveau_object *engine, ...@@ -103,27 +101,27 @@ nv04_i2c_port_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
return 0; return 0;
} }
static struct nouveau_oclass static struct nvkm_oclass
nv04_i2c_sclass[] = { nv04_i2c_sclass[] = {
{ .handle = NV_I2C_TYPE_DCBI2C(DCB_I2C_NV04_BIT), { .handle = NV_I2C_TYPE_DCBI2C(DCB_I2C_NV04_BIT),
.ofuncs = &(struct nouveau_ofuncs) { .ofuncs = &(struct nvkm_ofuncs) {
.ctor = nv04_i2c_port_ctor, .ctor = nv04_i2c_port_ctor,
.dtor = _nouveau_i2c_port_dtor, .dtor = _nvkm_i2c_port_dtor,
.init = _nouveau_i2c_port_init, .init = _nvkm_i2c_port_init,
.fini = _nouveau_i2c_port_fini, .fini = _nvkm_i2c_port_fini,
}, },
}, },
{} {}
}; };
struct nouveau_oclass * struct nvkm_oclass *
nv04_i2c_oclass = &(struct nouveau_i2c_impl) { nv04_i2c_oclass = &(struct nvkm_i2c_impl) {
.base.handle = NV_SUBDEV(I2C, 0x04), .base.handle = NV_SUBDEV(I2C, 0x04),
.base.ofuncs = &(struct nouveau_ofuncs) { .base.ofuncs = &(struct nvkm_ofuncs) {
.ctor = _nouveau_i2c_ctor, .ctor = _nvkm_i2c_ctor,
.dtor = _nouveau_i2c_dtor, .dtor = _nvkm_i2c_dtor,
.init = _nouveau_i2c_init, .init = _nvkm_i2c_init,
.fini = _nouveau_i2c_fini, .fini = _nvkm_i2c_fini,
}, },
.sclass = nv04_i2c_sclass, .sclass = nv04_i2c_sclass,
.pad_x = &nv04_i2c_pad_oclass, .pad_x = &nv04_i2c_pad_oclass,
......
...@@ -21,53 +21,52 @@ ...@@ -21,53 +21,52 @@
* *
* Authors: Ben Skeggs * Authors: Ben Skeggs
*/ */
#include "priv.h"
#include <subdev/vga.h> #include <subdev/vga.h>
#include "priv.h"
struct nv4e_i2c_priv { struct nv4e_i2c_priv {
struct nouveau_i2c base; struct nvkm_i2c base;
}; };
struct nv4e_i2c_port { struct nv4e_i2c_port {
struct nouveau_i2c_port base; struct nvkm_i2c_port base;
u32 addr; u32 addr;
}; };
static void 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; struct nv4e_i2c_port *port = (void *)base;
nv_mask(priv, port->addr, 0x2f, state ? 0x21 : 0x01); nv_mask(priv, port->addr, 0x2f, state ? 0x21 : 0x01);
} }
static void 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; struct nv4e_i2c_port *port = (void *)base;
nv_mask(priv, port->addr, 0x1f, state ? 0x11 : 0x01); nv_mask(priv, port->addr, 0x1f, state ? 0x11 : 0x01);
} }
static int 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; struct nv4e_i2c_port *port = (void *)base;
return !!(nv_rd32(priv, port->addr) & 0x00040000); return !!(nv_rd32(priv, port->addr) & 0x00040000);
} }
static int 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; struct nv4e_i2c_port *port = (void *)base;
return !!(nv_rd32(priv, port->addr) & 0x00080000); return !!(nv_rd32(priv, port->addr) & 0x00080000);
} }
static const struct nouveau_i2c_func static const struct nvkm_i2c_func
nv4e_i2c_func = { nv4e_i2c_func = {
.drive_scl = nv4e_i2c_drive_scl, .drive_scl = nv4e_i2c_drive_scl,
.drive_sda = nv4e_i2c_drive_sda, .drive_sda = nv4e_i2c_drive_sda,
...@@ -76,17 +75,16 @@ nv4e_i2c_func = { ...@@ -76,17 +75,16 @@ nv4e_i2c_func = {
}; };
static int static int
nv4e_i2c_port_ctor(struct nouveau_object *parent, struct nouveau_object *engine, nv4e_i2c_port_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nouveau_oclass *oclass, void *data, u32 index, struct nvkm_oclass *oclass, void *data, u32 index,
struct nouveau_object **pobject) struct nvkm_object **pobject)
{ {
struct dcb_i2c_entry *info = data; struct dcb_i2c_entry *info = data;
struct nv4e_i2c_port *port; struct nv4e_i2c_port *port;
int ret; int ret;
ret = nouveau_i2c_port_create(parent, engine, oclass, index, ret = nvkm_i2c_port_create(parent, engine, oclass, index,
&nouveau_i2c_bit_algo, &nv4e_i2c_func, &nvkm_i2c_bit_algo, &nv4e_i2c_func, &port);
&port);
*pobject = nv_object(port); *pobject = nv_object(port);
if (ret) if (ret)
return ret; return ret;
...@@ -95,27 +93,27 @@ nv4e_i2c_port_ctor(struct nouveau_object *parent, struct nouveau_object *engine, ...@@ -95,27 +93,27 @@ nv4e_i2c_port_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
return 0; return 0;
} }
static struct nouveau_oclass static struct nvkm_oclass
nv4e_i2c_sclass[] = { nv4e_i2c_sclass[] = {
{ .handle = NV_I2C_TYPE_DCBI2C(DCB_I2C_NV4E_BIT), { .handle = NV_I2C_TYPE_DCBI2C(DCB_I2C_NV4E_BIT),
.ofuncs = &(struct nouveau_ofuncs) { .ofuncs = &(struct nvkm_ofuncs) {
.ctor = nv4e_i2c_port_ctor, .ctor = nv4e_i2c_port_ctor,
.dtor = _nouveau_i2c_port_dtor, .dtor = _nvkm_i2c_port_dtor,
.init = _nouveau_i2c_port_init, .init = _nvkm_i2c_port_init,
.fini = _nouveau_i2c_port_fini, .fini = _nvkm_i2c_port_fini,
}, },
}, },
{} {}
}; };
struct nouveau_oclass * struct nvkm_oclass *
nv4e_i2c_oclass = &(struct nouveau_i2c_impl) { nv4e_i2c_oclass = &(struct nvkm_i2c_impl) {
.base.handle = NV_SUBDEV(I2C, 0x4e), .base.handle = NV_SUBDEV(I2C, 0x4e),
.base.ofuncs = &(struct nouveau_ofuncs) { .base.ofuncs = &(struct nvkm_ofuncs) {
.ctor = _nouveau_i2c_ctor, .ctor = _nvkm_i2c_ctor,
.dtor = _nouveau_i2c_dtor, .dtor = _nvkm_i2c_dtor,
.init = _nouveau_i2c_init, .init = _nvkm_i2c_init,
.fini = _nouveau_i2c_fini, .fini = _nvkm_i2c_fini,
}, },
.sclass = nv4e_i2c_sclass, .sclass = nv4e_i2c_sclass,
.pad_x = &nv04_i2c_pad_oclass, .pad_x = &nv04_i2c_pad_oclass,
......
...@@ -21,13 +21,12 @@ ...@@ -21,13 +21,12 @@
* *
* Authors: Ben Skeggs * Authors: Ben Skeggs
*/ */
#include "nv50.h" #include "nv50.h"
void 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; struct nv50_i2c_port *port = (void *)base;
if (state) port->state |= 0x01; if (state) port->state |= 0x01;
else port->state &= 0xfe; else port->state &= 0xfe;
...@@ -35,9 +34,9 @@ nv50_i2c_drive_scl(struct nouveau_i2c_port *base, int state) ...@@ -35,9 +34,9 @@ nv50_i2c_drive_scl(struct nouveau_i2c_port *base, int state)
} }
void 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; struct nv50_i2c_port *port = (void *)base;
if (state) port->state |= 0x02; if (state) port->state |= 0x02;
else port->state &= 0xfd; else port->state &= 0xfd;
...@@ -45,22 +44,22 @@ nv50_i2c_drive_sda(struct nouveau_i2c_port *base, int state) ...@@ -45,22 +44,22 @@ nv50_i2c_drive_sda(struct nouveau_i2c_port *base, int state)
} }
int 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; struct nv50_i2c_port *port = (void *)base;
return !!(nv_rd32(priv, port->addr) & 0x00000001); return !!(nv_rd32(priv, port->addr) & 0x00000001);
} }
int 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; struct nv50_i2c_port *port = (void *)base;
return !!(nv_rd32(priv, port->addr) & 0x00000002); return !!(nv_rd32(priv, port->addr) & 0x00000002);
} }
static const struct nouveau_i2c_func static const struct nvkm_i2c_func
nv50_i2c_func = { nv50_i2c_func = {
.drive_scl = nv50_i2c_drive_scl, .drive_scl = nv50_i2c_drive_scl,
.drive_sda = nv50_i2c_drive_sda, .drive_sda = nv50_i2c_drive_sda,
...@@ -76,17 +75,16 @@ const u32 nv50_i2c_addr[] = { ...@@ -76,17 +75,16 @@ const u32 nv50_i2c_addr[] = {
const int nv50_i2c_addr_nr = ARRAY_SIZE(nv50_i2c_addr); const int nv50_i2c_addr_nr = ARRAY_SIZE(nv50_i2c_addr);
static int static int
nv50_i2c_port_ctor(struct nouveau_object *parent, struct nouveau_object *engine, nv50_i2c_port_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nouveau_oclass *oclass, void *data, u32 index, struct nvkm_oclass *oclass, void *data, u32 index,
struct nouveau_object **pobject) struct nvkm_object **pobject)
{ {
struct dcb_i2c_entry *info = data; struct dcb_i2c_entry *info = data;
struct nv50_i2c_port *port; struct nv50_i2c_port *port;
int ret; int ret;
ret = nouveau_i2c_port_create(parent, engine, oclass, index, ret = nvkm_i2c_port_create(parent, engine, oclass, index,
&nouveau_i2c_bit_algo, &nv50_i2c_func, &nvkm_i2c_bit_algo, &nv50_i2c_func, &port);
&port);
*pobject = nv_object(port); *pobject = nv_object(port);
if (ret) if (ret)
return ret; return ret;
...@@ -100,35 +98,35 @@ nv50_i2c_port_ctor(struct nouveau_object *parent, struct nouveau_object *engine, ...@@ -100,35 +98,35 @@ nv50_i2c_port_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
} }
int 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; struct nv50_i2c_port *port = (void *)object;
nv_wr32(priv, port->addr, port->state); 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[] = { nv50_i2c_sclass[] = {
{ .handle = NV_I2C_TYPE_DCBI2C(DCB_I2C_NVIO_BIT), { .handle = NV_I2C_TYPE_DCBI2C(DCB_I2C_NVIO_BIT),
.ofuncs = &(struct nouveau_ofuncs) { .ofuncs = &(struct nvkm_ofuncs) {
.ctor = nv50_i2c_port_ctor, .ctor = nv50_i2c_port_ctor,
.dtor = _nouveau_i2c_port_dtor, .dtor = _nvkm_i2c_port_dtor,
.init = nv50_i2c_port_init, .init = nv50_i2c_port_init,
.fini = _nouveau_i2c_port_fini, .fini = _nvkm_i2c_port_fini,
}, },
}, },
{} {}
}; };
struct nouveau_oclass * struct nvkm_oclass *
nv50_i2c_oclass = &(struct nouveau_i2c_impl) { nv50_i2c_oclass = &(struct nvkm_i2c_impl) {
.base.handle = NV_SUBDEV(I2C, 0x50), .base.handle = NV_SUBDEV(I2C, 0x50),
.base.ofuncs = &(struct nouveau_ofuncs) { .base.ofuncs = &(struct nvkm_ofuncs) {
.ctor = _nouveau_i2c_ctor, .ctor = _nvkm_i2c_ctor,
.dtor = _nouveau_i2c_dtor, .dtor = _nvkm_i2c_dtor,
.init = _nouveau_i2c_init, .init = _nvkm_i2c_init,
.fini = _nouveau_i2c_fini, .fini = _nvkm_i2c_fini,
}, },
.sclass = nv50_i2c_sclass, .sclass = nv50_i2c_sclass,
.pad_x = &nv04_i2c_pad_oclass, .pad_x = &nv04_i2c_pad_oclass,
......
#ifndef __NV50_I2C_H__ #ifndef __NV50_I2C_H__
#define __NV50_I2C_H__ #define __NV50_I2C_H__
#include "priv.h" #include "priv.h"
struct nv50_i2c_priv { struct nv50_i2c_priv {
struct nouveau_i2c base; struct nvkm_i2c base;
}; };
struct nv50_i2c_port { struct nv50_i2c_port {
struct nouveau_i2c_port base; struct nvkm_i2c_port base;
u32 addr; u32 addr;
u32 state; u32 state;
}; };
extern const u32 nv50_i2c_addr[]; extern const u32 nv50_i2c_addr[];
extern const int nv50_i2c_addr_nr; extern const int nv50_i2c_addr_nr;
int nv50_i2c_port_init(struct nouveau_object *); int nv50_i2c_port_init(struct nvkm_object *);
int nv50_i2c_sense_scl(struct nouveau_i2c_port *); int nv50_i2c_sense_scl(struct nvkm_i2c_port *);
int nv50_i2c_sense_sda(struct nouveau_i2c_port *); int nv50_i2c_sense_sda(struct nvkm_i2c_port *);
void nv50_i2c_drive_scl(struct nouveau_i2c_port *, int state); void nv50_i2c_drive_scl(struct nvkm_i2c_port *, int state);
void nv50_i2c_drive_sda(struct nouveau_i2c_port *, int state); void nv50_i2c_drive_sda(struct nvkm_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 nvd0_i2c_port_ctor(struct nouveau_object *, struct nouveau_object *, int g94_aux_port_ctor(struct nvkm_object *, struct nvkm_object *,
struct nouveau_oclass *, void *, u32, struct nvkm_oclass *, void *, u32,
struct nouveau_object **); 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 #endif
...@@ -21,35 +21,34 @@ ...@@ -21,35 +21,34 @@
* *
* Authors: Ben Skeggs * Authors: Ben Skeggs
*/ */
#include "pad.h" #include "pad.h"
int 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; struct nvkm_i2c_pad *pad = (void *)object;
DBG("-> NULL\n"); DBG("-> NULL\n");
pad->port = NULL; pad->port = NULL;
return nouveau_object_fini(&pad->base, suspend); return nvkm_object_fini(&pad->base, suspend);
} }
int int
_nvkm_i2c_pad_init(struct nouveau_object *object) _nvkm_i2c_pad_init(struct nvkm_object *object)
{ {
struct nvkm_i2c_pad *pad = (void *)object; struct nvkm_i2c_pad *pad = (void *)object;
DBG("-> PORT:%02x\n", pad->next->index); DBG("-> PORT:%02x\n", pad->next->index);
pad->port = pad->next; pad->port = pad->next;
return nouveau_object_init(&pad->base); return nvkm_object_init(&pad->base);
} }
int int
nvkm_i2c_pad_create_(struct nouveau_object *parent, nvkm_i2c_pad_create_(struct nvkm_object *parent,
struct nouveau_object *engine, struct nvkm_object *engine,
struct nouveau_oclass *oclass, int index, struct nvkm_oclass *oclass, int index,
int size, void **pobject) int size, void **pobject)
{ {
struct nouveau_i2c *i2c = nouveau_i2c(parent); struct nvkm_i2c *i2c = nvkm_i2c(parent);
struct nouveau_i2c_port *port; struct nvkm_i2c_port *port;
struct nvkm_i2c_pad *pad; struct nvkm_i2c_pad *pad;
int ret; int ret;
...@@ -62,7 +61,7 @@ nvkm_i2c_pad_create_(struct nouveau_object *parent, ...@@ -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; pad = *pobject;
if (ret) if (ret)
return ret; return ret;
...@@ -72,9 +71,9 @@ nvkm_i2c_pad_create_(struct nouveau_object *parent, ...@@ -72,9 +71,9 @@ nvkm_i2c_pad_create_(struct nouveau_object *parent,
} }
int int
_nvkm_i2c_pad_ctor(struct nouveau_object *parent, struct nouveau_object *engine, _nvkm_i2c_pad_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nouveau_oclass *oclass, void *data, u32 index, struct nvkm_oclass *oclass, void *data, u32 index,
struct nouveau_object **pobject) struct nvkm_object **pobject)
{ {
struct nvkm_i2c_pad *pad; struct nvkm_i2c_pad *pad;
int ret; int ret;
......
#ifndef __NVKM_I2C_PAD_H__ #ifndef __NVKM_I2C_PAD_H__
#define __NVKM_I2C_PAD_H__ #define __NVKM_I2C_PAD_H__
#include "priv.h" #include "priv.h"
struct nvkm_i2c_pad { struct nvkm_i2c_pad {
struct nouveau_object base; struct nvkm_object base;
int index; int index;
struct nouveau_i2c_port *port; struct nvkm_i2c_port *port;
struct nouveau_i2c_port *next; struct nvkm_i2c_port *next;
}; };
static inline struct nvkm_i2c_pad * 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)) while (!nv_iclass(pad->parent, NV_SUBDEV_CLASS))
pad = pad->parent; pad = pad->parent;
return (void *)pad; return (void *)pad;
...@@ -34,15 +33,15 @@ nvkm_i2c_pad(struct nouveau_i2c_port *port) ...@@ -34,15 +33,15 @@ nvkm_i2c_pad(struct nouveau_i2c_port *port)
_nvkm_i2c_pad_fini(nv_object(_p), (s)); \ _nvkm_i2c_pad_fini(nv_object(_p), (s)); \
}) })
int nvkm_i2c_pad_create_(struct nouveau_object *, struct nouveau_object *, int nvkm_i2c_pad_create_(struct nvkm_object *, struct nvkm_object *,
struct nouveau_oclass *, int index, int, void **); struct nvkm_oclass *, int index, int, void **);
int _nvkm_i2c_pad_ctor(struct nouveau_object *, struct nouveau_object *, int _nvkm_i2c_pad_ctor(struct nvkm_object *, struct nvkm_object *,
struct nouveau_oclass *, void *, u32, struct nvkm_oclass *, void *, u32,
struct nouveau_object **); struct nvkm_object **);
#define _nvkm_i2c_pad_dtor nouveau_object_destroy #define _nvkm_i2c_pad_dtor nvkm_object_destroy
int _nvkm_i2c_pad_init(struct nouveau_object *); int _nvkm_i2c_pad_init(struct nvkm_object *);
int _nvkm_i2c_pad_fini(struct nouveau_object *, bool); int _nvkm_i2c_pad_fini(struct nvkm_object *, bool);
#ifndef MSG #ifndef MSG
#define MSG(l,f,a...) do { \ #define MSG(l,f,a...) do { \
...@@ -54,5 +53,4 @@ int _nvkm_i2c_pad_fini(struct nouveau_object *, bool); ...@@ -54,5 +53,4 @@ int _nvkm_i2c_pad_fini(struct nouveau_object *, bool);
#define DBG(f,a...) MSG(debug, f, ##a) #define DBG(f,a...) MSG(debug, f, ##a)
#define ERR(f,a...) MSG(error, f, ##a) #define ERR(f,a...) MSG(error, f, ##a)
#endif #endif
#endif #endif
...@@ -21,28 +21,27 @@ ...@@ -21,28 +21,27 @@
* *
* Authors: Ben Skeggs * Authors: Ben Skeggs
*/ */
#include "pad.h" #include "pad.h"
struct nv94_i2c_pad { struct g94_i2c_pad {
struct nvkm_i2c_pad base; struct nvkm_i2c_pad base;
int addr; int addr;
}; };
static int 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 nvkm_i2c *i2c = (void *)nvkm_i2c(object);
struct nv94_i2c_pad *pad = (void *)object; struct g94_i2c_pad *pad = (void *)object;
nv_mask(i2c, 0x00e50c + pad->addr, 0x00000001, 0x00000001); nv_mask(i2c, 0x00e50c + pad->addr, 0x00000001, 0x00000001);
return nvkm_i2c_pad_fini(&pad->base, suspend); return nvkm_i2c_pad_fini(&pad->base, suspend);
} }
static int 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 nvkm_i2c *i2c = (void *)nvkm_i2c(object);
struct nv94_i2c_pad *pad = (void *)object; struct g94_i2c_pad *pad = (void *)object;
switch (nv_oclass(pad->base.next)->handle) { switch (nv_oclass(pad->base.next)->handle) {
case NV_I2C_TYPE_DCBI2C(DCB_I2C_NVIO_AUX): case NV_I2C_TYPE_DCBI2C(DCB_I2C_NVIO_AUX):
...@@ -59,11 +58,11 @@ nv94_i2c_pad_init(struct nouveau_object *object) ...@@ -59,11 +58,11 @@ nv94_i2c_pad_init(struct nouveau_object *object)
} }
static int static int
nv94_i2c_pad_ctor(struct nouveau_object *parent, struct nouveau_object *engine, g94_i2c_pad_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nouveau_oclass *oclass, void *data, u32 index, struct nvkm_oclass *oclass, void *data, u32 index,
struct nouveau_object **pobject) struct nvkm_object **pobject)
{ {
struct nv94_i2c_pad *pad; struct g94_i2c_pad *pad;
int ret; int ret;
ret = nvkm_i2c_pad_create(parent, engine, oclass, index, &pad); 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, ...@@ -75,12 +74,12 @@ nv94_i2c_pad_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
return 0; return 0;
} }
struct nouveau_oclass struct nvkm_oclass
nv94_i2c_pad_oclass = { g94_i2c_pad_oclass = {
.ofuncs = &(struct nouveau_ofuncs) { .ofuncs = &(struct nvkm_ofuncs) {
.ctor = nv94_i2c_pad_ctor, .ctor = g94_i2c_pad_ctor,
.dtor = _nvkm_i2c_pad_dtor, .dtor = _nvkm_i2c_pad_dtor,
.init = nv94_i2c_pad_init, .init = g94_i2c_pad_init,
.fini = nv94_i2c_pad_fini, .fini = g94_i2c_pad_fini,
}, },
}; };
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
* *
* Authors: Ben Skeggs * Authors: Ben Skeggs
*/ */
#include "pad.h" #include "pad.h"
struct gm204_i2c_pad { struct gm204_i2c_pad {
...@@ -30,18 +29,18 @@ struct gm204_i2c_pad { ...@@ -30,18 +29,18 @@ struct gm204_i2c_pad {
}; };
static int 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; struct gm204_i2c_pad *pad = (void *)object;
nv_mask(i2c, 0x00d97c + pad->addr, 0x00000001, 0x00000001); nv_mask(i2c, 0x00d97c + pad->addr, 0x00000001, 0x00000001);
return nvkm_i2c_pad_fini(&pad->base, suspend); return nvkm_i2c_pad_fini(&pad->base, suspend);
} }
static int 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; struct gm204_i2c_pad *pad = (void *)object;
switch (nv_oclass(pad->base.next)->handle) { switch (nv_oclass(pad->base.next)->handle) {
...@@ -59,9 +58,9 @@ gm204_i2c_pad_init(struct nouveau_object *object) ...@@ -59,9 +58,9 @@ gm204_i2c_pad_init(struct nouveau_object *object)
} }
static int static int
gm204_i2c_pad_ctor(struct nouveau_object *parent, struct nouveau_object *engine, gm204_i2c_pad_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nouveau_oclass *oclass, void *data, u32 index, struct nvkm_oclass *oclass, void *data, u32 index,
struct nouveau_object **pobject) struct nvkm_object **pobject)
{ {
struct gm204_i2c_pad *pad; struct gm204_i2c_pad *pad;
int ret; int ret;
...@@ -75,9 +74,9 @@ gm204_i2c_pad_ctor(struct nouveau_object *parent, struct nouveau_object *engine, ...@@ -75,9 +74,9 @@ gm204_i2c_pad_ctor(struct nouveau_object *parent, struct nouveau_object *engine,
return 0; return 0;
} }
struct nouveau_oclass struct nvkm_oclass
gm204_i2c_pad_oclass = { gm204_i2c_pad_oclass = {
.ofuncs = &(struct nouveau_ofuncs) { .ofuncs = &(struct nvkm_ofuncs) {
.ctor = gm204_i2c_pad_ctor, .ctor = gm204_i2c_pad_ctor,
.dtor = _nvkm_i2c_pad_dtor, .dtor = _nvkm_i2c_pad_dtor,
.init = gm204_i2c_pad_init, .init = gm204_i2c_pad_init,
......
...@@ -21,12 +21,11 @@ ...@@ -21,12 +21,11 @@
* *
* Authors: Ben Skeggs * Authors: Ben Skeggs
*/ */
#include "pad.h" #include "pad.h"
struct nouveau_oclass struct nvkm_oclass
nv04_i2c_pad_oclass = { nv04_i2c_pad_oclass = {
.ofuncs = &(struct nouveau_ofuncs) { .ofuncs = &(struct nvkm_ofuncs) {
.ctor = _nvkm_i2c_pad_ctor, .ctor = _nvkm_i2c_pad_ctor,
.dtor = _nvkm_i2c_pad_dtor, .dtor = _nvkm_i2c_pad_dtor,
.init = _nvkm_i2c_pad_init, .init = _nvkm_i2c_pad_init,
......
#ifndef __NVKM_I2C_PORT_H__ #ifndef __NVKM_I2C_PORT_H__
#define __NVKM_I2C_PORT_H__ #define __NVKM_I2C_PORT_H__
#include "priv.h" #include "priv.h"
#ifndef MSG #ifndef MSG
#define MSG(l,f,a...) do { \ #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); \ nv_##l(_port, "PORT:%02x: "f, _port->index, ##a); \
} while(0) } while(0)
#define DBG(f,a...) MSG(debug, f, ##a) #define DBG(f,a...) MSG(debug, f, ##a)
#define ERR(f,a...) MSG(error, f, ##a) #define ERR(f,a...) MSG(error, f, ##a)
#endif #endif
#endif #endif
#ifndef __NVKM_I2C_H__ #ifndef __NVKM_I2C_PRIV_H__
#define __NVKM_I2C_H__ #define __NVKM_I2C_PRIV_H__
#include <subdev/i2c.h> #include <subdev/i2c.h>
extern struct nouveau_oclass nv04_i2c_pad_oclass; extern struct nvkm_oclass nv04_i2c_pad_oclass;
extern struct nouveau_oclass nv94_i2c_pad_oclass; extern struct nvkm_oclass g94_i2c_pad_oclass;
extern struct nouveau_oclass gm204_i2c_pad_oclass; extern struct nvkm_oclass gm204_i2c_pad_oclass;
#define nouveau_i2c_port_create(p,e,o,i,a,f,d) \ #define nvkm_i2c_port_create(p,e,o,i,a,f,d) \
nouveau_i2c_port_create_((p), (e), (o), (i), (a), (f), \ nvkm_i2c_port_create_((p), (e), (o), (i), (a), (f), \
sizeof(**d), (void **)d) sizeof(**d), (void **)d)
#define nouveau_i2c_port_destroy(p) ({ \ #define nvkm_i2c_port_destroy(p) ({ \
struct nouveau_i2c_port *port = (p); \ struct nvkm_i2c_port *port = (p); \
_nouveau_i2c_port_dtor(nv_object(i2c)); \ _nvkm_i2c_port_dtor(nv_object(i2c)); \
}) })
#define nouveau_i2c_port_init(p) \ #define nvkm_i2c_port_init(p) \
nouveau_object_init(&(p)->base) nvkm_object_init(&(p)->base)
#define nouveau_i2c_port_fini(p,s) \ #define nvkm_i2c_port_fini(p,s) \
nouveau_object_fini(&(p)->base, (s)) nvkm_object_fini(&(p)->base, (s))
int nouveau_i2c_port_create_(struct nouveau_object *, struct nouveau_object *, int nvkm_i2c_port_create_(struct nvkm_object *, struct nvkm_object *,
struct nouveau_oclass *, u8, struct nvkm_oclass *, u8,
const struct i2c_algorithm *, const struct i2c_algorithm *,
const struct nouveau_i2c_func *, const struct nvkm_i2c_func *,
int, void **); int, void **);
void _nouveau_i2c_port_dtor(struct nouveau_object *); void _nvkm_i2c_port_dtor(struct nvkm_object *);
#define _nouveau_i2c_port_init nouveau_object_init #define _nvkm_i2c_port_init nvkm_object_init
int _nouveau_i2c_port_fini(struct nouveau_object *, bool); int _nvkm_i2c_port_fini(struct nvkm_object *, bool);
#define nouveau_i2c_create(p,e,o,d) \ #define nvkm_i2c_create(p,e,o,d) \
nouveau_i2c_create_((p), (e), (o), sizeof(**d), (void **)d) nvkm_i2c_create_((p), (e), (o), sizeof(**d), (void **)d)
#define nouveau_i2c_destroy(p) ({ \ #define nvkm_i2c_destroy(p) ({ \
struct nouveau_i2c *i2c = (p); \ struct nvkm_i2c *i2c = (p); \
_nouveau_i2c_dtor(nv_object(i2c)); \ _nvkm_i2c_dtor(nv_object(i2c)); \
}) })
#define nouveau_i2c_init(p) ({ \ #define nvkm_i2c_init(p) ({ \
struct nouveau_i2c *i2c = (p); \ struct nvkm_i2c *i2c = (p); \
_nouveau_i2c_init(nv_object(i2c)); \ _nvkm_i2c_init(nv_object(i2c)); \
}) })
#define nouveau_i2c_fini(p,s) ({ \ #define nvkm_i2c_fini(p,s) ({ \
struct nouveau_i2c *i2c = (p); \ struct nvkm_i2c *i2c = (p); \
_nouveau_i2c_fini(nv_object(i2c), (s)); \ _nvkm_i2c_fini(nv_object(i2c), (s)); \
}) })
int nouveau_i2c_create_(struct nouveau_object *, struct nouveau_object *, int nvkm_i2c_create_(struct nvkm_object *, struct nvkm_object *,
struct nouveau_oclass *, int, void **); struct nvkm_oclass *, int, void **);
int _nouveau_i2c_ctor(struct nouveau_object *, struct nouveau_object *, int _nvkm_i2c_ctor(struct nvkm_object *, struct nvkm_object *,
struct nouveau_oclass *, void *, u32, struct nvkm_oclass *, void *, u32,
struct nouveau_object **); struct nvkm_object **);
void _nouveau_i2c_dtor(struct nouveau_object *); void _nvkm_i2c_dtor(struct nvkm_object *);
int _nouveau_i2c_init(struct nouveau_object *); int _nvkm_i2c_init(struct nvkm_object *);
int _nouveau_i2c_fini(struct nouveau_object *, bool); int _nvkm_i2c_fini(struct nvkm_object *, bool);
extern struct nouveau_oclass nouveau_anx9805_sclass[]; extern struct nvkm_oclass nvkm_anx9805_sclass[];
extern struct nouveau_oclass nvd0_i2c_sclass[]; extern struct nvkm_oclass gf110_i2c_sclass[];
extern const struct i2c_algorithm nouveau_i2c_bit_algo; extern const struct i2c_algorithm nvkm_i2c_bit_algo;
extern const struct i2c_algorithm nouveau_i2c_aux_algo; extern const struct i2c_algorithm nvkm_i2c_aux_algo;
struct nouveau_i2c_impl { struct nvkm_i2c_impl {
struct nouveau_oclass base; struct nvkm_oclass base;
/* supported i2c port classes */ /* supported i2c port classes */
struct nouveau_oclass *sclass; struct nvkm_oclass *sclass;
struct nouveau_oclass *pad_x; struct nvkm_oclass *pad_x;
struct nouveau_oclass *pad_s; struct nvkm_oclass *pad_s;
/* number of native dp aux channels present */ /* number of native dp aux channels present */
int aux; int aux;
...@@ -73,17 +72,16 @@ struct nouveau_i2c_impl { ...@@ -73,17 +72,16 @@ struct nouveau_i2c_impl {
* for ports that have not been masked off, while still * for ports that have not been masked off, while still
* performing the ack for anything that was pending. * 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 /* 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 g94_aux_stat(struct nvkm_i2c *, u32 *, u32 *, u32 *, u32 *);
void nv94_aux_mask(struct nouveau_i2c *, u32, u32, u32); void g94_aux_mask(struct nvkm_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 gk104_aux_stat(struct nvkm_i2c *, u32 *, u32 *, u32 *, u32 *);
void gk104_aux_mask(struct nvkm_i2c *, u32, u32, u32);
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment