summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2015-08-20 07:54:12 +0300
committerBen Skeggs <bskeggs@redhat.com>2015-08-28 05:40:22 +0300
commit1cb57d25b6b62b39f07c4ff4370c2c48803000e9 (patch)
treeba1fc8ab30778db26868ce4ee3b30b2f60afd3fc /drivers
parent3ecd329b6445efdcad26e94edd57f0fd5ccd080b (diff)
downloadlinux-1cb57d25b6b62b39f07c4ff4370c2c48803000e9.tar.xz
drm/nouveau/i2c: switch to subdev printk macros
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/i2c/anx9805.c8
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c17
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/i2c/g94.c20
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/i2c/gm204.c20
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.h8
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/i2c/port.h5
6 files changed, 45 insertions, 33 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/anx9805.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/anx9805.c
index d17dd1cf3c34..7b195393d15c 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/anx9805.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/anx9805.c
@@ -32,11 +32,13 @@ struct anx9805_i2c_port {
static int
anx9805_train(struct nvkm_i2c_port *port, int link_nr, int link_bw, bool enh)
{
+ struct nvkm_i2c *i2c = nvkm_i2c(port);
+ struct nvkm_subdev *subdev = &i2c->subdev;
struct anx9805_i2c_port *chan = (void *)port;
struct nvkm_i2c_port *mast = (void *)nv_object(chan)->parent;
u8 tmp, i;
- DBG("ANX9805 train %d 0x%02x %d\n", link_nr, link_bw, enh);
+ DBG("ANX9805 train %d %02x %d\n", link_nr, link_bw, enh);
nv_wri2cr(mast, chan->addr, 0xa0, link_bw);
nv_wri2cr(mast, chan->addr, 0xa1, link_nr | (enh ? 0x80 : 0x00));
@@ -47,13 +49,13 @@ anx9805_train(struct nvkm_i2c_port *port, int link_nr, int link_bw, bool enh)
while ((tmp = nv_rdi2cr(mast, chan->addr, 0xa8)) & 0x01) {
mdelay(5);
if (i++ == 100) {
- nv_error(port, "link training timed out\n");
+ nvkm_error(subdev, "link training timed out\n");
return -ETIMEDOUT;
}
}
if (tmp & 0x70) {
- nv_error(port, "link training failed: 0x%02x\n", tmp);
+ nvkm_error(subdev, "link training failed: %02x\n", tmp);
return -EIO;
}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c
index 187af1183f2d..3496dfd93264 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c
@@ -282,31 +282,34 @@ nvkm_i2c_identify(struct nvkm_i2c *i2c, int index, const char *what,
bool (*match)(struct nvkm_i2c_port *,
struct i2c_board_info *, void *), void *data)
{
+ struct nvkm_subdev *subdev = &i2c->subdev;
struct nvkm_i2c_port *port = nvkm_i2c_find(i2c, index);
int i;
if (!port) {
- nv_debug(i2c, "no bus when probing %s on %d\n", what, index);
+ nvkm_debug(subdev, "no bus when probing %s on %d\n",
+ what, index);
return -ENODEV;
}
- nv_debug(i2c, "probing %ss on bus: %d\n", what, port->index);
+ nvkm_debug(subdev, "probing %ss on bus: %d\n", what, port->index);
for (i = 0; info[i].dev.addr; i++) {
u8 orig_udelay = 0;
if ((port->adapter.algo == &i2c_bit_algo) &&
(info[i].udelay != 0)) {
struct i2c_algo_bit_data *algo = port->adapter.algo_data;
- nv_debug(i2c, "using custom udelay %d instead of %d\n",
- info[i].udelay, algo->udelay);
+ nvkm_debug(subdev,
+ "using custom udelay %d instead of %d\n",
+ info[i].udelay, algo->udelay);
orig_udelay = algo->udelay;
algo->udelay = info[i].udelay;
}
if (nv_probe_i2c(port, info[i].dev.addr) &&
(!match || match(port, &info[i].dev, data))) {
- nv_info(i2c, "detected %s: %s\n", what,
- info[i].dev.type);
+ nvkm_info(subdev, "detected %s: %s\n", what,
+ info[i].dev.type);
return i;
}
@@ -316,7 +319,7 @@ nvkm_i2c_identify(struct nvkm_i2c *i2c, int index, const char *what,
}
}
- nv_debug(i2c, "no devices found.\n");
+ nvkm_debug(subdev, "no devices found.\n");
return -ENODEV;
}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/g94.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/g94.c
index 17cb172a4a0a..acbfbe0a7ea9 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/g94.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/g94.c
@@ -55,8 +55,10 @@ g94_aux_mask(struct nvkm_i2c *i2c, u32 type, u32 mask, u32 data)
nvkm_wr32(device, 0x00e068, temp);
}
-#define AUX_DBG(fmt, args...) nv_debug(i2c, "AUXCH(%d): " fmt, ch, ##args)
-#define AUX_ERR(fmt, args...) nv_error(i2c, "AUXCH(%d): " fmt, ch, ##args)
+#define AUX_DBG(fmt, args...) \
+ nvkm_debug(&i2c->subdev, "AUXCH(%d): " fmt, ch, ##args)
+#define AUX_ERR(fmt, args...) \
+ nvkm_error(&i2c->subdev, "AUXCH(%d): " fmt, ch, ##args)
static void
auxch_fini(struct nvkm_i2c *i2c, int ch)
@@ -80,7 +82,7 @@ auxch_init(struct nvkm_i2c *i2c, int ch)
ctrl = nvkm_rd32(device, 0x00e4e4 + (ch * 0x50));
udelay(1);
if (!timeout--) {
- AUX_ERR("begin idle timeout 0x%08x\n", ctrl);
+ AUX_ERR("begin idle timeout %08x\n", ctrl);
return -EBUSY;
}
} while (ctrl & 0x03010000);
@@ -92,7 +94,7 @@ auxch_init(struct nvkm_i2c *i2c, int ch)
ctrl = nvkm_rd32(device, 0x00e4e4 + (ch * 0x50));
udelay(1);
if (!timeout--) {
- AUX_ERR("magic wait 0x%08x\n", ctrl);
+ AUX_ERR("magic wait %08x\n", ctrl);
auxch_fini(i2c, ch);
return -EBUSY;
}
@@ -113,7 +115,7 @@ g94_aux(struct nvkm_i2c_port *base, bool retry,
int ch = port->addr;
int ret, i;
- AUX_DBG("%d: 0x%08x %d\n", type, addr, size);
+ AUX_DBG("%d: %08x %d\n", type, addr, size);
ret = auxch_init(i2c, ch);
if (ret < 0)
@@ -129,7 +131,7 @@ g94_aux(struct nvkm_i2c_port *base, bool retry,
if (!(type & 1)) {
memcpy(xbuf, data, size);
for (i = 0; i < 16; i += 4) {
- AUX_DBG("wr 0x%08x\n", xbuf[i / 4]);
+ AUX_DBG("wr %08x\n", xbuf[i / 4]);
nvkm_wr32(device, 0x00e4c0 + (ch * 0x50) + i, xbuf[i / 4]);
}
}
@@ -156,7 +158,7 @@ g94_aux(struct nvkm_i2c_port *base, bool retry,
ctrl = nvkm_rd32(device, 0x00e4e4 + (ch * 0x50));
udelay(1);
if (!timeout--) {
- AUX_ERR("tx req timeout 0x%08x\n", ctrl);
+ AUX_ERR("tx req timeout %08x\n", ctrl);
ret = -EIO;
goto out;
}
@@ -173,13 +175,13 @@ g94_aux(struct nvkm_i2c_port *base, bool retry,
if ((stat & 0x00000e00))
ret = -EIO;
- AUX_DBG("%02d 0x%08x 0x%08x\n", retries, ctrl, stat);
+ AUX_DBG("%02d %08x %08x\n", retries, ctrl, stat);
}
if (type & 1) {
for (i = 0; i < 16; i += 4) {
xbuf[i / 4] = nvkm_rd32(device, 0x00e4d0 + (ch * 0x50) + i);
- AUX_DBG("rd 0x%08x\n", xbuf[i / 4]);
+ AUX_DBG("rd %08x\n", xbuf[i / 4]);
}
memcpy(data, xbuf, size);
}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/gm204.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/gm204.c
index 61c760534ab8..f027aedb7361 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/gm204.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/gm204.c
@@ -23,8 +23,10 @@
*/
#include "nv50.h"
-#define AUX_DBG(fmt, args...) nv_debug(i2c, "AUXCH(%d): " fmt, ch, ##args)
-#define AUX_ERR(fmt, args...) nv_error(i2c, "AUXCH(%d): " fmt, ch, ##args)
+#define AUX_DBG(fmt, args...) \
+ nvkm_debug(&i2c->subdev, "AUXCH(%d): " fmt, ch, ##args)
+#define AUX_ERR(fmt, args...) \
+ nvkm_error(&i2c->subdev, "AUXCH(%d): " fmt, ch, ##args)
static void
auxch_fini(struct nvkm_i2c *i2c, int ch)
@@ -48,7 +50,7 @@ auxch_init(struct nvkm_i2c *i2c, int ch)
ctrl = nvkm_rd32(device, 0x00d954 + (ch * 0x50));
udelay(1);
if (!timeout--) {
- AUX_ERR("begin idle timeout 0x%08x\n", ctrl);
+ AUX_ERR("begin idle timeout %08x\n", ctrl);
return -EBUSY;
}
} while (ctrl & 0x03010000);
@@ -60,7 +62,7 @@ auxch_init(struct nvkm_i2c *i2c, int ch)
ctrl = nvkm_rd32(device, 0x00d954 + (ch * 0x50));
udelay(1);
if (!timeout--) {
- AUX_ERR("magic wait 0x%08x\n", ctrl);
+ AUX_ERR("magic wait %08x\n", ctrl);
auxch_fini(i2c, ch);
return -EBUSY;
}
@@ -81,7 +83,7 @@ gm204_aux(struct nvkm_i2c_port *base, bool retry,
int ch = port->addr;
int ret, i;
- AUX_DBG("%d: 0x%08x %d\n", type, addr, size);
+ AUX_DBG("%d: %08x %d\n", type, addr, size);
ret = auxch_init(i2c, ch);
if (ret < 0)
@@ -97,7 +99,7 @@ gm204_aux(struct nvkm_i2c_port *base, bool retry,
if (!(type & 1)) {
memcpy(xbuf, data, size);
for (i = 0; i < 16; i += 4) {
- AUX_DBG("wr 0x%08x\n", xbuf[i / 4]);
+ AUX_DBG("wr %08x\n", xbuf[i / 4]);
nvkm_wr32(device, 0x00d930 + (ch * 0x50) + i, xbuf[i / 4]);
}
}
@@ -124,7 +126,7 @@ gm204_aux(struct nvkm_i2c_port *base, bool retry,
ctrl = nvkm_rd32(device, 0x00d954 + (ch * 0x50));
udelay(1);
if (!timeout--) {
- AUX_ERR("tx req timeout 0x%08x\n", ctrl);
+ AUX_ERR("tx req timeout %08x\n", ctrl);
ret = -EIO;
goto out;
}
@@ -141,13 +143,13 @@ gm204_aux(struct nvkm_i2c_port *base, bool retry,
if ((stat & 0x00000e00))
ret = -EIO;
- AUX_DBG("%02d 0x%08x 0x%08x\n", retries, ctrl, stat);
+ AUX_DBG("%02d %08x %08x\n", retries, ctrl, stat);
}
if (type & 1) {
for (i = 0; i < 16; i += 4) {
xbuf[i / 4] = nvkm_rd32(device, 0x00d940 + (ch * 0x50) + i);
- AUX_DBG("rd 0x%08x\n", xbuf[i / 4]);
+ AUX_DBG("rd %08x\n", xbuf[i / 4]);
}
memcpy(data, xbuf, size);
}
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.h b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.h
index f3422cc6f8db..577b18ecf5c6 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.h
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.h
@@ -46,9 +46,11 @@ int _nvkm_i2c_pad_fini(struct nvkm_object *, bool);
#ifndef MSG
#define MSG(l,f,a...) do { \
struct nvkm_i2c_pad *_pad = (void *)pad; \
- nv_##l(_pad, "PAD:%c:%02x: "f, \
- _pad->index >= 0x100 ? 'X' : 'S', \
- _pad->index >= 0x100 ? _pad->index - 0x100 : _pad->index, ##a); \
+ struct nvkm_i2c *_i2c = nvkm_i2c(_pad); \
+ nvkm_##l(&_i2c->subdev, "PAD:%c:%02x: "f, \
+ _pad->index >= 0x100 ? 'X' : 'S', \
+ _pad->index >= 0x100 ? \
+ _pad->index - 0x100 : _pad->index, ##a); \
} while(0)
#define DBG(f,a...) MSG(debug, f, ##a)
#define ERR(f,a...) MSG(error, f, ##a)
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/port.h b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/port.h
index 586f53dad813..ac6be7263347 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/port.h
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/port.h
@@ -4,8 +4,9 @@
#ifndef MSG
#define MSG(l,f,a...) do { \
- struct nvkm_i2c_port *_port = (void *)port; \
- nv_##l(_port, "PORT:%02x: "f, _port->index, ##a); \
+ struct nvkm_i2c_port *_port = (void *)port; \
+ struct nvkm_i2c *_i2c = nvkm_i2c(_port); \
+ nvkm_##l(&_i2c->subdev, "PORT:%02x: "f, _port->index, ##a); \
} while(0)
#define DBG(f,a...) MSG(debug, f, ##a)
#define ERR(f,a...) MSG(error, f, ##a)