const struct nouveau_i2c_func *func,
int size, void **pobject)
{
- struct nouveau_device *device = nv_device(engine);
- struct nouveau_i2c *i2c = (void *)engine;
+ struct nouveau_device *device = nv_device(parent);
+ struct nouveau_i2c *i2c = nouveau_i2c(parent);
struct nouveau_i2c_port *port;
int ret;
oclass = impl->pad_x;
}
- ret = nouveau_object_ctor(nv_object(i2c), nv_object(i2c), oclass,
+ ret = nouveau_object_ctor(nv_object(i2c), NULL, oclass,
NULL, pad, &parent);
if (ret < 0)
return;
do {
ret = -EINVAL;
if (oclass->handle == type) {
- ret = nouveau_object_ctor(parent, nv_object(i2c),
+ ret = nouveau_object_ctor(parent, NULL,
oclass, info, index,
&object);
}
do {
if (oclass->handle != info.type)
continue;
- ret = nouveau_object_ctor(parent, *pobject,
+ ret = nouveau_object_ctor(parent, NULL,
oclass, NULL,
index++, &object);
} while (ret && (++oclass)->handle);
static void
nv04_i2c_drive_scl(struct nouveau_i2c_port *base, int state)
{
- struct nv04_i2c_priv *priv = (void *)nv_object(base)->engine;
+ struct nv04_i2c_priv *priv = (void *)nouveau_i2c(base);
struct nv04_i2c_port *port = (void *)base;
u8 val = nv_rdvgac(priv, 0, port->drive);
if (state) val |= 0x20;
static void
nv04_i2c_drive_sda(struct nouveau_i2c_port *base, int state)
{
- struct nv04_i2c_priv *priv = (void *)nv_object(base)->engine;
+ struct nv04_i2c_priv *priv = (void *)nouveau_i2c(base);
struct nv04_i2c_port *port = (void *)base;
u8 val = nv_rdvgac(priv, 0, port->drive);
if (state) val |= 0x10;
static int
nv04_i2c_sense_scl(struct nouveau_i2c_port *base)
{
- struct nv04_i2c_priv *priv = (void *)nv_object(base)->engine;
+ struct nv04_i2c_priv *priv = (void *)nouveau_i2c(base);
struct nv04_i2c_port *port = (void *)base;
return !!(nv_rdvgac(priv, 0, port->sense) & 0x04);
}
static int
nv04_i2c_sense_sda(struct nouveau_i2c_port *base)
{
- struct nv04_i2c_priv *priv = (void *)nv_object(base)->engine;
+ struct nv04_i2c_priv *priv = (void *)nouveau_i2c(base);
struct nv04_i2c_port *port = (void *)base;
return !!(nv_rdvgac(priv, 0, port->sense) & 0x08);
}
static void
nv4e_i2c_drive_scl(struct nouveau_i2c_port *base, int state)
{
- struct nv4e_i2c_priv *priv = (void *)nv_object(base)->engine;
+ struct nv4e_i2c_priv *priv = (void *)nouveau_i2c(base);
struct nv4e_i2c_port *port = (void *)base;
nv_mask(priv, port->addr, 0x2f, state ? 0x21 : 0x01);
}
static void
nv4e_i2c_drive_sda(struct nouveau_i2c_port *base, int state)
{
- struct nv4e_i2c_priv *priv = (void *)nv_object(base)->engine;
+ struct nv4e_i2c_priv *priv = (void *)nouveau_i2c(base);
struct nv4e_i2c_port *port = (void *)base;
nv_mask(priv, port->addr, 0x1f, state ? 0x11 : 0x01);
}
static int
nv4e_i2c_sense_scl(struct nouveau_i2c_port *base)
{
- struct nv4e_i2c_priv *priv = (void *)nv_object(base)->engine;
+ struct nv4e_i2c_priv *priv = (void *)nouveau_i2c(base);
struct nv4e_i2c_port *port = (void *)base;
return !!(nv_rd32(priv, port->addr) & 0x00040000);
}
static int
nv4e_i2c_sense_sda(struct nouveau_i2c_port *base)
{
- struct nv4e_i2c_priv *priv = (void *)nv_object(base)->engine;
+ struct nv4e_i2c_priv *priv = (void *)nouveau_i2c(base);
struct nv4e_i2c_port *port = (void *)base;
return !!(nv_rd32(priv, port->addr) & 0x00080000);
}
void
nv50_i2c_drive_scl(struct nouveau_i2c_port *base, int state)
{
- struct nv50_i2c_priv *priv = (void *)nv_object(base)->engine;
+ struct nv50_i2c_priv *priv = (void *)nouveau_i2c(base);
struct nv50_i2c_port *port = (void *)base;
if (state) port->state |= 0x01;
else port->state &= 0xfe;
void
nv50_i2c_drive_sda(struct nouveau_i2c_port *base, int state)
{
- struct nv50_i2c_priv *priv = (void *)nv_object(base)->engine;
+ struct nv50_i2c_priv *priv = (void *)nouveau_i2c(base);
struct nv50_i2c_port *port = (void *)base;
if (state) port->state |= 0x02;
else port->state &= 0xfd;
int
nv50_i2c_sense_scl(struct nouveau_i2c_port *base)
{
- struct nv50_i2c_priv *priv = (void *)nv_object(base)->engine;
+ struct nv50_i2c_priv *priv = (void *)nouveau_i2c(base);
struct nv50_i2c_port *port = (void *)base;
return !!(nv_rd32(priv, port->addr) & 0x00000001);
}
int
nv50_i2c_sense_sda(struct nouveau_i2c_port *base)
{
- struct nv50_i2c_priv *priv = (void *)nv_object(base)->engine;
+ struct nv50_i2c_priv *priv = (void *)nouveau_i2c(base);
struct nv50_i2c_port *port = (void *)base;
return !!(nv_rd32(priv, port->addr) & 0x00000002);
}
int
nv50_i2c_port_init(struct nouveau_object *object)
{
- struct nv50_i2c_priv *priv = (void *)object->engine;
+ struct nv50_i2c_priv *priv = (void *)nouveau_i2c(object);
struct nv50_i2c_port *port = (void *)object;
nv_wr32(priv, port->addr, port->state);
return nouveau_i2c_port_init(&port->base);
static int
nvd0_i2c_sense_scl(struct nouveau_i2c_port *base)
{
- struct nv50_i2c_priv *priv = (void *)nv_object(base)->engine;
+ struct nv50_i2c_priv *priv = (void *)nouveau_i2c(base);
struct nv50_i2c_port *port = (void *)base;
return !!(nv_rd32(priv, port->addr) & 0x00000010);
}
static int
nvd0_i2c_sense_sda(struct nouveau_i2c_port *base)
{
- struct nv50_i2c_priv *priv = (void *)nv_object(base)->engine;
+ struct nv50_i2c_priv *priv = (void *)nouveau_i2c(base);
struct nv50_i2c_port *port = (void *)base;
return !!(nv_rd32(priv, port->addr) & 0x00000020);
}
struct nouveau_oclass *oclass, int index,
int size, void **pobject)
{
- struct nouveau_i2c *i2c = (void *)engine;
+ struct nouveau_i2c *i2c = nouveau_i2c(parent);
struct nouveau_i2c_port *port;
struct nvkm_i2c_pad *pad;
int ret;
#ifndef MSG
#define MSG(l,f,a...) do { \
struct nvkm_i2c_pad *_pad = (void *)pad; \
- nv_##l(nv_object(_pad)->engine, "PAD:%c:%02x: "f, \
+ nv_##l(_pad, "PAD:%c:%02x: "f, \
_pad->index >= 0x100 ? 'X' : 'S', \
_pad->index >= 0x100 ? _pad->index - 0x100 : _pad->index, ##a); \
} while(0)
static int
gm204_i2c_pad_fini(struct nouveau_object *object, bool suspend)
{
- struct nouveau_i2c *i2c = (void *)object->engine;
+ struct nouveau_i2c *i2c = (void *)nouveau_i2c(object);
struct gm204_i2c_pad *pad = (void *)object;
nv_mask(i2c, 0x00d97c + pad->addr, 0x00000001, 0x00000001);
return nvkm_i2c_pad_fini(&pad->base, suspend);
static int
gm204_i2c_pad_init(struct nouveau_object *object)
{
- struct nouveau_i2c *i2c = (void *)object->engine;
+ struct nouveau_i2c *i2c = (void *)nouveau_i2c(object);
struct gm204_i2c_pad *pad = (void *)object;
switch (nv_oclass(pad->base.next)->handle) {
static int
nv94_i2c_pad_fini(struct nouveau_object *object, bool suspend)
{
- struct nouveau_i2c *i2c = (void *)object->engine;
+ struct nouveau_i2c *i2c = (void *)nouveau_i2c(object);
struct nv94_i2c_pad *pad = (void *)object;
nv_mask(i2c, 0x00e50c + pad->addr, 0x00000001, 0x00000001);
return nvkm_i2c_pad_fini(&pad->base, suspend);
static int
nv94_i2c_pad_init(struct nouveau_object *object)
{
- struct nouveau_i2c *i2c = (void *)object->engine;
+ struct nouveau_i2c *i2c = (void *)nouveau_i2c(object);
struct nv94_i2c_pad *pad = (void *)object;
switch (nv_oclass(pad->base.next)->handle) {
#ifndef MSG
#define MSG(l,f,a...) do { \
struct nouveau_i2c_port *_port = (void *)port; \
- nv_##l(nv_object(_port)->engine, "PORT:%02x: "f, _port->index, ##a); \
+ nv_##l(_port, "PORT:%02x: "f, _port->index, ##a); \
} while(0)
#define DBG(f,a...) MSG(debug, f, ##a)
#define ERR(f,a...) MSG(error, f, ##a)