aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2015-08-20 00:54:12 -0400
committerBen Skeggs <bskeggs@redhat.com>2015-08-27 22:40:22 -0400
commit1cb57d25b6b62b39f07c4ff4370c2c48803000e9 (patch)
treeba1fc8ab30778db26868ce4ee3b30b2f60afd3fc
parent3ecd329b6445efdcad26e94edd57f0fd5ccd080b (diff)
drm/nouveau/i2c: switch to subdev printk macros
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-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 {
32static int 32static int
33anx9805_train(struct nvkm_i2c_port *port, int link_nr, int link_bw, bool enh) 33anx9805_train(struct nvkm_i2c_port *port, int link_nr, int link_bw, bool enh)
34{ 34{
35 struct nvkm_i2c *i2c = nvkm_i2c(port);
36 struct nvkm_subdev *subdev = &i2c->subdev;
35 struct anx9805_i2c_port *chan = (void *)port; 37 struct anx9805_i2c_port *chan = (void *)port;
36 struct nvkm_i2c_port *mast = (void *)nv_object(chan)->parent; 38 struct nvkm_i2c_port *mast = (void *)nv_object(chan)->parent;
37 u8 tmp, i; 39 u8 tmp, i;
38 40
39 DBG("ANX9805 train %d 0x%02x %d\n", link_nr, link_bw, enh); 41 DBG("ANX9805 train %d %02x %d\n", link_nr, link_bw, enh);
40 42
41 nv_wri2cr(mast, chan->addr, 0xa0, link_bw); 43 nv_wri2cr(mast, chan->addr, 0xa0, link_bw);
42 nv_wri2cr(mast, chan->addr, 0xa1, link_nr | (enh ? 0x80 : 0x00)); 44 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)
47 while ((tmp = nv_rdi2cr(mast, chan->addr, 0xa8)) & 0x01) { 49 while ((tmp = nv_rdi2cr(mast, chan->addr, 0xa8)) & 0x01) {
48 mdelay(5); 50 mdelay(5);
49 if (i++ == 100) { 51 if (i++ == 100) {
50 nv_error(port, "link training timed out\n"); 52 nvkm_error(subdev, "link training timed out\n");
51 return -ETIMEDOUT; 53 return -ETIMEDOUT;
52 } 54 }
53 } 55 }
54 56
55 if (tmp & 0x70) { 57 if (tmp & 0x70) {
56 nv_error(port, "link training failed: 0x%02x\n", tmp); 58 nvkm_error(subdev, "link training failed: %02x\n", tmp);
57 return -EIO; 59 return -EIO;
58 } 60 }
59 61
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,
282 bool (*match)(struct nvkm_i2c_port *, 282 bool (*match)(struct nvkm_i2c_port *,
283 struct i2c_board_info *, void *), void *data) 283 struct i2c_board_info *, void *), void *data)
284{ 284{
285 struct nvkm_subdev *subdev = &i2c->subdev;
285 struct nvkm_i2c_port *port = nvkm_i2c_find(i2c, index); 286 struct nvkm_i2c_port *port = nvkm_i2c_find(i2c, index);
286 int i; 287 int i;
287 288
288 if (!port) { 289 if (!port) {
289 nv_debug(i2c, "no bus when probing %s on %d\n", what, index); 290 nvkm_debug(subdev, "no bus when probing %s on %d\n",
291 what, index);
290 return -ENODEV; 292 return -ENODEV;
291 } 293 }
292 294
293 nv_debug(i2c, "probing %ss on bus: %d\n", what, port->index); 295 nvkm_debug(subdev, "probing %ss on bus: %d\n", what, port->index);
294 for (i = 0; info[i].dev.addr; i++) { 296 for (i = 0; info[i].dev.addr; i++) {
295 u8 orig_udelay = 0; 297 u8 orig_udelay = 0;
296 298
297 if ((port->adapter.algo == &i2c_bit_algo) && 299 if ((port->adapter.algo == &i2c_bit_algo) &&
298 (info[i].udelay != 0)) { 300 (info[i].udelay != 0)) {
299 struct i2c_algo_bit_data *algo = port->adapter.algo_data; 301 struct i2c_algo_bit_data *algo = port->adapter.algo_data;
300 nv_debug(i2c, "using custom udelay %d instead of %d\n", 302 nvkm_debug(subdev,
301 info[i].udelay, algo->udelay); 303 "using custom udelay %d instead of %d\n",
304 info[i].udelay, algo->udelay);
302 orig_udelay = algo->udelay; 305 orig_udelay = algo->udelay;
303 algo->udelay = info[i].udelay; 306 algo->udelay = info[i].udelay;
304 } 307 }
305 308
306 if (nv_probe_i2c(port, info[i].dev.addr) && 309 if (nv_probe_i2c(port, info[i].dev.addr) &&
307 (!match || match(port, &info[i].dev, data))) { 310 (!match || match(port, &info[i].dev, data))) {
308 nv_info(i2c, "detected %s: %s\n", what, 311 nvkm_info(subdev, "detected %s: %s\n", what,
309 info[i].dev.type); 312 info[i].dev.type);
310 return i; 313 return i;
311 } 314 }
312 315
@@ -316,7 +319,7 @@ nvkm_i2c_identify(struct nvkm_i2c *i2c, int index, const char *what,
316 } 319 }
317 } 320 }
318 321
319 nv_debug(i2c, "no devices found.\n"); 322 nvkm_debug(subdev, "no devices found.\n");
320 return -ENODEV; 323 return -ENODEV;
321} 324}
322 325
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)
55 nvkm_wr32(device, 0x00e068, temp); 55 nvkm_wr32(device, 0x00e068, temp);
56} 56}
57 57
58#define AUX_DBG(fmt, args...) nv_debug(i2c, "AUXCH(%d): " fmt, ch, ##args) 58#define AUX_DBG(fmt, args...) \
59#define AUX_ERR(fmt, args...) nv_error(i2c, "AUXCH(%d): " fmt, ch, ##args) 59 nvkm_debug(&i2c->subdev, "AUXCH(%d): " fmt, ch, ##args)
60#define AUX_ERR(fmt, args...) \
61 nvkm_error(&i2c->subdev, "AUXCH(%d): " fmt, ch, ##args)
60 62
61static void 63static void
62auxch_fini(struct nvkm_i2c *i2c, int ch) 64auxch_fini(struct nvkm_i2c *i2c, int ch)
@@ -80,7 +82,7 @@ auxch_init(struct nvkm_i2c *i2c, int ch)
80 ctrl = nvkm_rd32(device, 0x00e4e4 + (ch * 0x50)); 82 ctrl = nvkm_rd32(device, 0x00e4e4 + (ch * 0x50));
81 udelay(1); 83 udelay(1);
82 if (!timeout--) { 84 if (!timeout--) {
83 AUX_ERR("begin idle timeout 0x%08x\n", ctrl); 85 AUX_ERR("begin idle timeout %08x\n", ctrl);
84 return -EBUSY; 86 return -EBUSY;
85 } 87 }
86 } while (ctrl & 0x03010000); 88 } while (ctrl & 0x03010000);
@@ -92,7 +94,7 @@ auxch_init(struct nvkm_i2c *i2c, int ch)
92 ctrl = nvkm_rd32(device, 0x00e4e4 + (ch * 0x50)); 94 ctrl = nvkm_rd32(device, 0x00e4e4 + (ch * 0x50));
93 udelay(1); 95 udelay(1);
94 if (!timeout--) { 96 if (!timeout--) {
95 AUX_ERR("magic wait 0x%08x\n", ctrl); 97 AUX_ERR("magic wait %08x\n", ctrl);
96 auxch_fini(i2c, ch); 98 auxch_fini(i2c, ch);
97 return -EBUSY; 99 return -EBUSY;
98 } 100 }
@@ -113,7 +115,7 @@ g94_aux(struct nvkm_i2c_port *base, bool retry,
113 int ch = port->addr; 115 int ch = port->addr;
114 int ret, i; 116 int ret, i;
115 117
116 AUX_DBG("%d: 0x%08x %d\n", type, addr, size); 118 AUX_DBG("%d: %08x %d\n", type, addr, size);
117 119
118 ret = auxch_init(i2c, ch); 120 ret = auxch_init(i2c, ch);
119 if (ret < 0) 121 if (ret < 0)
@@ -129,7 +131,7 @@ g94_aux(struct nvkm_i2c_port *base, bool retry,
129 if (!(type & 1)) { 131 if (!(type & 1)) {
130 memcpy(xbuf, data, size); 132 memcpy(xbuf, data, size);
131 for (i = 0; i < 16; i += 4) { 133 for (i = 0; i < 16; i += 4) {
132 AUX_DBG("wr 0x%08x\n", xbuf[i / 4]); 134 AUX_DBG("wr %08x\n", xbuf[i / 4]);
133 nvkm_wr32(device, 0x00e4c0 + (ch * 0x50) + i, xbuf[i / 4]); 135 nvkm_wr32(device, 0x00e4c0 + (ch * 0x50) + i, xbuf[i / 4]);
134 } 136 }
135 } 137 }
@@ -156,7 +158,7 @@ g94_aux(struct nvkm_i2c_port *base, bool retry,
156 ctrl = nvkm_rd32(device, 0x00e4e4 + (ch * 0x50)); 158 ctrl = nvkm_rd32(device, 0x00e4e4 + (ch * 0x50));
157 udelay(1); 159 udelay(1);
158 if (!timeout--) { 160 if (!timeout--) {
159 AUX_ERR("tx req timeout 0x%08x\n", ctrl); 161 AUX_ERR("tx req timeout %08x\n", ctrl);
160 ret = -EIO; 162 ret = -EIO;
161 goto out; 163 goto out;
162 } 164 }
@@ -173,13 +175,13 @@ g94_aux(struct nvkm_i2c_port *base, bool retry,
173 if ((stat & 0x00000e00)) 175 if ((stat & 0x00000e00))
174 ret = -EIO; 176 ret = -EIO;
175 177
176 AUX_DBG("%02d 0x%08x 0x%08x\n", retries, ctrl, stat); 178 AUX_DBG("%02d %08x %08x\n", retries, ctrl, stat);
177 } 179 }
178 180
179 if (type & 1) { 181 if (type & 1) {
180 for (i = 0; i < 16; i += 4) { 182 for (i = 0; i < 16; i += 4) {
181 xbuf[i / 4] = nvkm_rd32(device, 0x00e4d0 + (ch * 0x50) + i); 183 xbuf[i / 4] = nvkm_rd32(device, 0x00e4d0 + (ch * 0x50) + i);
182 AUX_DBG("rd 0x%08x\n", xbuf[i / 4]); 184 AUX_DBG("rd %08x\n", xbuf[i / 4]);
183 } 185 }
184 memcpy(data, xbuf, size); 186 memcpy(data, xbuf, size);
185 } 187 }
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 @@
23 */ 23 */
24#include "nv50.h" 24#include "nv50.h"
25 25
26#define AUX_DBG(fmt, args...) nv_debug(i2c, "AUXCH(%d): " fmt, ch, ##args) 26#define AUX_DBG(fmt, args...) \
27#define AUX_ERR(fmt, args...) nv_error(i2c, "AUXCH(%d): " fmt, ch, ##args) 27 nvkm_debug(&i2c->subdev, "AUXCH(%d): " fmt, ch, ##args)
28#define AUX_ERR(fmt, args...) \
29 nvkm_error(&i2c->subdev, "AUXCH(%d): " fmt, ch, ##args)
28 30
29static void 31static void
30auxch_fini(struct nvkm_i2c *i2c, int ch) 32auxch_fini(struct nvkm_i2c *i2c, int ch)
@@ -48,7 +50,7 @@ auxch_init(struct nvkm_i2c *i2c, int ch)
48 ctrl = nvkm_rd32(device, 0x00d954 + (ch * 0x50)); 50 ctrl = nvkm_rd32(device, 0x00d954 + (ch * 0x50));
49 udelay(1); 51 udelay(1);
50 if (!timeout--) { 52 if (!timeout--) {
51 AUX_ERR("begin idle timeout 0x%08x\n", ctrl); 53 AUX_ERR("begin idle timeout %08x\n", ctrl);
52 return -EBUSY; 54 return -EBUSY;
53 } 55 }
54 } while (ctrl & 0x03010000); 56 } while (ctrl & 0x03010000);
@@ -60,7 +62,7 @@ auxch_init(struct nvkm_i2c *i2c, int ch)
60 ctrl = nvkm_rd32(device, 0x00d954 + (ch * 0x50)); 62 ctrl = nvkm_rd32(device, 0x00d954 + (ch * 0x50));
61 udelay(1); 63 udelay(1);
62 if (!timeout--) { 64 if (!timeout--) {
63 AUX_ERR("magic wait 0x%08x\n", ctrl); 65 AUX_ERR("magic wait %08x\n", ctrl);
64 auxch_fini(i2c, ch); 66 auxch_fini(i2c, ch);
65 return -EBUSY; 67 return -EBUSY;
66 } 68 }
@@ -81,7 +83,7 @@ gm204_aux(struct nvkm_i2c_port *base, bool retry,
81 int ch = port->addr; 83 int ch = port->addr;
82 int ret, i; 84 int ret, i;
83 85
84 AUX_DBG("%d: 0x%08x %d\n", type, addr, size); 86 AUX_DBG("%d: %08x %d\n", type, addr, size);
85 87
86 ret = auxch_init(i2c, ch); 88 ret = auxch_init(i2c, ch);
87 if (ret < 0) 89 if (ret < 0)
@@ -97,7 +99,7 @@ gm204_aux(struct nvkm_i2c_port *base, bool retry,
97 if (!(type & 1)) { 99 if (!(type & 1)) {
98 memcpy(xbuf, data, size); 100 memcpy(xbuf, data, size);
99 for (i = 0; i < 16; i += 4) { 101 for (i = 0; i < 16; i += 4) {
100 AUX_DBG("wr 0x%08x\n", xbuf[i / 4]); 102 AUX_DBG("wr %08x\n", xbuf[i / 4]);
101 nvkm_wr32(device, 0x00d930 + (ch * 0x50) + i, xbuf[i / 4]); 103 nvkm_wr32(device, 0x00d930 + (ch * 0x50) + i, xbuf[i / 4]);
102 } 104 }
103 } 105 }
@@ -124,7 +126,7 @@ gm204_aux(struct nvkm_i2c_port *base, bool retry,
124 ctrl = nvkm_rd32(device, 0x00d954 + (ch * 0x50)); 126 ctrl = nvkm_rd32(device, 0x00d954 + (ch * 0x50));
125 udelay(1); 127 udelay(1);
126 if (!timeout--) { 128 if (!timeout--) {
127 AUX_ERR("tx req timeout 0x%08x\n", ctrl); 129 AUX_ERR("tx req timeout %08x\n", ctrl);
128 ret = -EIO; 130 ret = -EIO;
129 goto out; 131 goto out;
130 } 132 }
@@ -141,13 +143,13 @@ gm204_aux(struct nvkm_i2c_port *base, bool retry,
141 if ((stat & 0x00000e00)) 143 if ((stat & 0x00000e00))
142 ret = -EIO; 144 ret = -EIO;
143 145
144 AUX_DBG("%02d 0x%08x 0x%08x\n", retries, ctrl, stat); 146 AUX_DBG("%02d %08x %08x\n", retries, ctrl, stat);
145 } 147 }
146 148
147 if (type & 1) { 149 if (type & 1) {
148 for (i = 0; i < 16; i += 4) { 150 for (i = 0; i < 16; i += 4) {
149 xbuf[i / 4] = nvkm_rd32(device, 0x00d940 + (ch * 0x50) + i); 151 xbuf[i / 4] = nvkm_rd32(device, 0x00d940 + (ch * 0x50) + i);
150 AUX_DBG("rd 0x%08x\n", xbuf[i / 4]); 152 AUX_DBG("rd %08x\n", xbuf[i / 4]);
151 } 153 }
152 memcpy(data, xbuf, size); 154 memcpy(data, xbuf, size);
153 } 155 }
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);
46#ifndef MSG 46#ifndef MSG
47#define MSG(l,f,a...) do { \ 47#define MSG(l,f,a...) do { \
48 struct nvkm_i2c_pad *_pad = (void *)pad; \ 48 struct nvkm_i2c_pad *_pad = (void *)pad; \
49 nv_##l(_pad, "PAD:%c:%02x: "f, \ 49 struct nvkm_i2c *_i2c = nvkm_i2c(_pad); \
50 _pad->index >= 0x100 ? 'X' : 'S', \ 50 nvkm_##l(&_i2c->subdev, "PAD:%c:%02x: "f, \
51 _pad->index >= 0x100 ? _pad->index - 0x100 : _pad->index, ##a); \ 51 _pad->index >= 0x100 ? 'X' : 'S', \
52 _pad->index >= 0x100 ? \
53 _pad->index - 0x100 : _pad->index, ##a); \
52} while(0) 54} while(0)
53#define DBG(f,a...) MSG(debug, f, ##a) 55#define DBG(f,a...) MSG(debug, f, ##a)
54#define ERR(f,a...) MSG(error, f, ##a) 56#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 @@
4 4
5#ifndef MSG 5#ifndef MSG
6#define MSG(l,f,a...) do { \ 6#define MSG(l,f,a...) do { \
7 struct nvkm_i2c_port *_port = (void *)port; \ 7 struct nvkm_i2c_port *_port = (void *)port; \
8 nv_##l(_port, "PORT:%02x: "f, _port->index, ##a); \ 8 struct nvkm_i2c *_i2c = nvkm_i2c(_port); \
9 nvkm_##l(&_i2c->subdev, "PORT:%02x: "f, _port->index, ##a); \
9} while(0) 10} while(0)
10#define DBG(f,a...) MSG(debug, f, ##a) 11#define DBG(f,a...) MSG(debug, f, ##a)
11#define ERR(f,a...) MSG(error, f, ##a) 12#define ERR(f,a...) MSG(error, f, ##a)