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
eeb3ca12
Commit
eeb3ca12
authored
Jul 02, 2011
by
Ben Skeggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drm/nvd0/i2c: initial implementation
Signed-off-by:
Ben Skeggs
<
bskeggs@redhat.com
>
parent
d9f61c2d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
16 deletions
+35
-16
drivers/gpu/drm/nouveau/nouveau_i2c.c
drivers/gpu/drm/nouveau/nouveau_i2c.c
+35
-16
No files found.
drivers/gpu/drm/nouveau/nouveau_i2c.c
View file @
eeb3ca12
...
...
@@ -107,6 +107,13 @@ nv4e_i2c_getsda(void *data)
return
!!
((
nv_rd32
(
dev
,
i2c
->
rd
)
>>
16
)
&
8
);
}
static
const
uint32_t
nv50_i2c_port
[]
=
{
0x00e138
,
0x00e150
,
0x00e168
,
0x00e180
,
0x00e254
,
0x00e274
,
0x00e764
,
0x00e780
,
0x00e79c
,
0x00e7b8
};
#define NV50_I2C_PORTS ARRAY_SIZE(nv50_i2c_port)
static
int
nv50_i2c_getscl
(
void
*
data
)
{
...
...
@@ -130,28 +137,32 @@ static void
nv50_i2c_setscl
(
void
*
data
,
int
state
)
{
struct
nouveau_i2c_chan
*
i2c
=
data
;
struct
drm_device
*
dev
=
i2c
->
dev
;
nv_wr32
(
dev
,
i2c
->
wr
,
4
|
(
i2c
->
data
?
2
:
0
)
|
(
state
?
1
:
0
));
nv_wr32
(
i2c
->
dev
,
i2c
->
wr
,
4
|
(
i2c
->
data
?
2
:
0
)
|
(
state
?
1
:
0
));
}
static
void
nv50_i2c_setsda
(
void
*
data
,
int
state
)
{
struct
nouveau_i2c_chan
*
i2c
=
data
;
struct
drm_device
*
dev
=
i2c
->
dev
;
nv_wr32
(
dev
,
i2c
->
wr
,
(
nv_rd32
(
dev
,
i2c
->
rd
)
&
1
)
|
4
|
(
state
?
2
:
0
));
nv_mask
(
i2c
->
dev
,
i2c
->
wr
,
0x00000006
,
4
|
(
state
?
2
:
0
));
i2c
->
data
=
state
;
}
static
const
uint32_t
nv50_i2c_port
[]
=
{
0x00e138
,
0x00e150
,
0x00e168
,
0x00e180
,
0x00e254
,
0x00e274
,
0x00e764
,
0x00e780
,
0x00e79c
,
0x00e7b8
};
#define NV50_I2C_PORTS ARRAY_SIZE(nv50_i2c_port)
static
int
nvd0_i2c_getscl
(
void
*
data
)
{
struct
nouveau_i2c_chan
*
i2c
=
data
;
return
!!
(
nv_rd32
(
i2c
->
dev
,
i2c
->
rd
)
&
0x10
);
}
static
int
nvd0_i2c_getsda
(
void
*
data
)
{
struct
nouveau_i2c_chan
*
i2c
=
data
;
return
!!
(
nv_rd32
(
i2c
->
dev
,
i2c
->
rd
)
&
0x20
);
}
int
nouveau_i2c_init
(
struct
drm_device
*
dev
,
struct
dcb_i2c_entry
*
entry
,
int
index
)
...
...
@@ -163,7 +174,8 @@ nouveau_i2c_init(struct drm_device *dev, struct dcb_i2c_entry *entry, int index)
if
(
entry
->
chan
)
return
-
EEXIST
;
if
(
dev_priv
->
card_type
>=
NV_50
&&
entry
->
read
>=
NV50_I2C_PORTS
)
{
if
(
dev_priv
->
card_type
>=
NV_50
&&
dev_priv
->
card_type
<=
NV_C0
&&
entry
->
read
>=
NV50_I2C_PORTS
)
{
NV_ERROR
(
dev
,
"unknown i2c port %d
\n
"
,
entry
->
read
);
return
-
EINVAL
;
}
...
...
@@ -192,10 +204,17 @@ nouveau_i2c_init(struct drm_device *dev, struct dcb_i2c_entry *entry, int index)
case
5
:
i2c
->
bit
.
setsda
=
nv50_i2c_setsda
;
i2c
->
bit
.
setscl
=
nv50_i2c_setscl
;
i2c
->
bit
.
getsda
=
nv50_i2c_getsda
;
i2c
->
bit
.
getscl
=
nv50_i2c_getscl
;
i2c
->
rd
=
nv50_i2c_port
[
entry
->
read
];
i2c
->
wr
=
i2c
->
rd
;
if
(
dev_priv
->
card_type
<
NV_D0
)
{
i2c
->
bit
.
getsda
=
nv50_i2c_getsda
;
i2c
->
bit
.
getscl
=
nv50_i2c_getscl
;
i2c
->
rd
=
nv50_i2c_port
[
entry
->
read
];
i2c
->
wr
=
i2c
->
rd
;
}
else
{
i2c
->
bit
.
getsda
=
nvd0_i2c_getsda
;
i2c
->
bit
.
getscl
=
nvd0_i2c_getscl
;
i2c
->
rd
=
0x00d014
+
(
entry
->
read
*
0x20
);
i2c
->
wr
=
i2c
->
rd
;
}
break
;
case
6
:
i2c
->
rd
=
entry
->
read
;
...
...
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