Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
1cb57d25
Commit
1cb57d25
authored
Aug 20, 2015
by
Ben Skeggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drm/nouveau/i2c: switch to subdev printk macros
Signed-off-by:
Ben Skeggs
<
bskeggs@redhat.com
>
parent
3ecd329b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
45 additions
and
33 deletions
+45
-33
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/anx9805.c
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/anx9805.c
+5
-3
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c
+10
-7
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/g94.c
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/g94.c
+11
-9
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/gm204.c
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/gm204.c
+11
-9
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.h
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.h
+5
-3
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/port.h
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/port.h
+3
-2
No files found.
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/anx9805.c
View file @
1cb57d25
...
...
@@ -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
"
);
nv
km_error
(
subdev
,
"link training timed out
\n
"
);
return
-
ETIMEDOUT
;
}
}
if
(
tmp
&
0x70
)
{
nv
_error
(
port
,
"link training failed: 0x
%02x
\n
"
,
tmp
);
nv
km_error
(
subdev
,
"link training failed:
%02x
\n
"
,
tmp
);
return
-
EIO
;
}
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c
View file @
1cb57d25
...
...
@@ -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
);
nv
km_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
);
nv
km_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
"
);
nv
km_debug
(
subdev
,
"no devices found.
\n
"
);
return
-
ENODEV
;
}
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/g94.c
View file @
1cb57d25
...
...
@@ -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
);
}
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/gm204.c
View file @
1cb57d25
...
...
@@ -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
);
}
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/pad.h
View file @
1cb57d25
...
...
@@ -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)
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/port.h
View file @
1cb57d25
...
...
@@ -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)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment