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
d2bcea68
Commit
d2bcea68
authored
Dec 07, 2012
by
Ben Skeggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drm/nouveau/bios: update gpio parsing apis to match current design
Signed-off-by:
Ben Skeggs
<
bskeggs@redhat.com
>
parent
caba5570
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
90 additions
and
61 deletions
+90
-61
drivers/gpu/drm/nouveau/core/include/subdev/bios/gpio.h
drivers/gpu/drm/nouveau/core/include/subdev/bios/gpio.h
+5
-3
drivers/gpu/drm/nouveau/core/subdev/bios/gpio.c
drivers/gpu/drm/nouveau/core/subdev/bios/gpio.c
+75
-53
drivers/gpu/drm/nouveau/core/subdev/gpio/base.c
drivers/gpu/drm/nouveau/core/subdev/gpio/base.c
+6
-1
drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c
drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c
+2
-2
drivers/gpu/drm/nouveau/core/subdev/gpio/nvd0.c
drivers/gpu/drm/nouveau/core/subdev/gpio/nvd0.c
+2
-2
No files found.
drivers/gpu/drm/nouveau/core/include/subdev/bios/gpio.h
View file @
d2bcea68
...
@@ -25,9 +25,11 @@ struct dcb_gpio_func {
...
@@ -25,9 +25,11 @@ struct dcb_gpio_func {
u8
param
;
u8
param
;
};
};
u16
dcb_gpio_table
(
struct
nouveau_bios
*
);
u16
dcb_gpio_table
(
struct
nouveau_bios
*
,
u8
*
ver
,
u8
*
hdr
,
u8
*
cnt
,
u8
*
len
);
u16
dcb_gpio_entry
(
struct
nouveau_bios
*
,
int
idx
,
int
ent
,
u8
*
ver
);
u16
dcb_gpio_entry
(
struct
nouveau_bios
*
,
int
idx
,
int
ent
,
u8
*
ver
,
u8
*
len
);
int
dcb_gpio_parse
(
struct
nouveau_bios
*
,
int
idx
,
u8
func
,
u8
line
,
u16
dcb_gpio_parse
(
struct
nouveau_bios
*
,
int
idx
,
int
ent
,
u8
*
ver
,
u8
*
len
,
struct
dcb_gpio_func
*
);
struct
dcb_gpio_func
*
);
u16
dcb_gpio_match
(
struct
nouveau_bios
*
,
int
idx
,
u8
func
,
u8
line
,
u8
*
ver
,
u8
*
len
,
struct
dcb_gpio_func
*
);
#endif
#endif
drivers/gpu/drm/nouveau/core/subdev/bios/gpio.c
View file @
d2bcea68
...
@@ -27,84 +27,105 @@
...
@@ -27,84 +27,105 @@
#include <subdev/bios/gpio.h>
#include <subdev/bios/gpio.h>
u16
u16
dcb_gpio_table
(
struct
nouveau_bios
*
bios
)
dcb_gpio_table
(
struct
nouveau_bios
*
bios
,
u8
*
ver
,
u8
*
hdr
,
u8
*
cnt
,
u8
*
len
)
{
{
u
8
ver
,
hdr
,
cnt
,
len
;
u
16
data
=
0x0000
;
u16
dcb
=
dcb_table
(
bios
,
&
ver
,
&
hdr
,
&
cnt
,
&
len
);
u16
dcb
=
dcb_table
(
bios
,
ver
,
hdr
,
cnt
,
len
);
if
(
dcb
)
{
if
(
dcb
)
{
if
(
ver
>=
0x30
&&
hdr
>=
0x0c
)
if
(
*
ver
>=
0x30
&&
*
hdr
>=
0x0c
)
return
nv_ro16
(
bios
,
dcb
+
0x0a
);
data
=
nv_ro16
(
bios
,
dcb
+
0x0a
);
if
(
ver
>=
0x22
&&
nv_ro08
(
bios
,
dcb
-
1
)
>=
0x13
)
else
return
nv_ro16
(
bios
,
dcb
-
0x0f
);
if
(
*
ver
>=
0x22
&&
nv_ro08
(
bios
,
dcb
-
1
)
>=
0x13
)
data
=
nv_ro16
(
bios
,
dcb
-
0x0f
);
if
(
data
)
{
*
ver
=
nv_ro08
(
bios
,
data
+
0x00
);
if
(
*
ver
<
0x30
)
{
*
hdr
=
3
;
*
cnt
=
nv_ro08
(
bios
,
data
+
0x02
);
*
len
=
nv_ro08
(
bios
,
data
+
0x01
);
}
else
if
(
*
ver
<=
0x41
)
{
*
hdr
=
nv_ro08
(
bios
,
data
+
0x01
);
*
cnt
=
nv_ro08
(
bios
,
data
+
0x02
);
*
len
=
nv_ro08
(
bios
,
data
+
0x03
);
}
else
{
data
=
0x0000
;
}
}
}
}
return
0x0000
;
return
data
;
}
}
u16
u16
dcb_gpio_entry
(
struct
nouveau_bios
*
bios
,
int
idx
,
int
ent
,
u8
*
ver
)
dcb_gpio_entry
(
struct
nouveau_bios
*
bios
,
int
idx
,
int
ent
,
u8
*
ver
,
u8
*
len
)
{
{
u16
gpio
=
dcb_gpio_table
(
bios
);
u8
hdr
,
cnt
;
if
(
gpio
)
{
u16
gpio
=
!
idx
?
dcb_gpio_table
(
bios
,
ver
,
&
hdr
,
&
cnt
,
len
)
:
0x0000
;
*
ver
=
nv_ro08
(
bios
,
gpio
);
if
(
gpio
&&
ent
<
cnt
)
if
(
*
ver
<
0x30
&&
ent
<
nv_ro08
(
bios
,
gpio
+
2
))
return
gpio
+
hdr
+
(
ent
*
*
len
);
return
gpio
+
3
+
(
ent
*
nv_ro08
(
bios
,
gpio
+
1
));
else
if
(
ent
<
nv_ro08
(
bios
,
gpio
+
2
))
return
gpio
+
nv_ro08
(
bios
,
gpio
+
1
)
+
(
ent
*
nv_ro08
(
bios
,
gpio
+
3
));
}
return
0x0000
;
return
0x0000
;
}
}
int
u16
dcb_gpio_parse
(
struct
nouveau_bios
*
bios
,
int
idx
,
u8
func
,
u8
line
,
dcb_gpio_parse
(
struct
nouveau_bios
*
bios
,
int
idx
,
int
ent
,
u8
*
ver
,
u8
*
len
,
struct
dcb_gpio_func
*
gpio
)
struct
dcb_gpio_func
*
gpio
)
{
{
u8
ver
,
hdr
,
cnt
,
len
;
u16
data
=
dcb_gpio_entry
(
bios
,
idx
,
ent
,
ver
,
len
);
u16
entry
;
if
(
data
)
{
int
i
=
-
1
;
if
(
*
ver
<
0x40
)
{
u16
info
=
nv_ro16
(
bios
,
data
);
while
((
entry
=
dcb_gpio_entry
(
bios
,
idx
,
++
i
,
&
ver
)))
{
if
(
ver
<
0x40
)
{
u16
data
=
nv_ro16
(
bios
,
entry
);
*
gpio
=
(
struct
dcb_gpio_func
)
{
*
gpio
=
(
struct
dcb_gpio_func
)
{
.
line
=
(
data
&
0x001f
)
>>
0
,
.
line
=
(
info
&
0x001f
)
>>
0
,
.
func
=
(
data
&
0x07e0
)
>>
5
,
.
func
=
(
info
&
0x07e0
)
>>
5
,
.
log
[
0
]
=
(
data
&
0x1800
)
>>
11
,
.
log
[
0
]
=
(
info
&
0x1800
)
>>
11
,
.
log
[
1
]
=
(
data
&
0x6000
)
>>
13
,
.
log
[
1
]
=
(
info
&
0x6000
)
>>
13
,
.
param
=
!!
(
data
&
0x8000
),
.
param
=
!!
(
info
&
0x8000
),
};
};
}
else
}
else
if
(
ver
<
0x41
)
{
if
(
*
ver
<
0x41
)
{
u32
data
=
nv_ro32
(
bios
,
entry
);
u32
info
=
nv_ro32
(
bios
,
data
);
*
gpio
=
(
struct
dcb_gpio_func
)
{
*
gpio
=
(
struct
dcb_gpio_func
)
{
.
line
=
(
data
&
0x0000001f
)
>>
0
,
.
line
=
(
info
&
0x0000001f
)
>>
0
,
.
func
=
(
data
&
0x0000ff00
)
>>
8
,
.
func
=
(
info
&
0x0000ff00
)
>>
8
,
.
log
[
0
]
=
(
data
&
0x18000000
)
>>
27
,
.
log
[
0
]
=
(
info
&
0x18000000
)
>>
27
,
.
log
[
1
]
=
(
data
&
0x60000000
)
>>
29
,
.
log
[
1
]
=
(
info
&
0x60000000
)
>>
29
,
.
param
=
!!
(
data
&
0x80000000
),
.
param
=
!!
(
info
&
0x80000000
),
};
};
}
else
{
}
else
{
u32
data
=
nv_ro32
(
bios
,
entry
+
0
);
u32
info
=
nv_ro32
(
bios
,
data
+
0
);
u8
data1
=
nv_ro32
(
bios
,
entry
+
4
);
u8
info1
=
nv_ro32
(
bios
,
data
+
4
);
*
gpio
=
(
struct
dcb_gpio_func
)
{
*
gpio
=
(
struct
dcb_gpio_func
)
{
.
line
=
(
data
&
0x0000003f
)
>>
0
,
.
line
=
(
info
&
0x0000003f
)
>>
0
,
.
func
=
(
data
&
0x0000ff00
)
>>
8
,
.
func
=
(
info
&
0x0000ff00
)
>>
8
,
.
log
[
0
]
=
(
data
1
&
0x30
)
>>
4
,
.
log
[
0
]
=
(
info
1
&
0x30
)
>>
4
,
.
log
[
1
]
=
(
data
1
&
0xc0
)
>>
6
,
.
log
[
1
]
=
(
info
1
&
0xc0
)
>>
6
,
.
param
=
!!
(
data
&
0x80000000
),
.
param
=
!!
(
info
&
0x80000000
),
};
};
}
}
}
return
data
;
}
u16
dcb_gpio_match
(
struct
nouveau_bios
*
bios
,
int
idx
,
u8
func
,
u8
line
,
u8
*
ver
,
u8
*
len
,
struct
dcb_gpio_func
*
gpio
)
{
u8
hdr
,
cnt
,
i
=
0
;
u16
data
;
while
((
data
=
dcb_gpio_parse
(
bios
,
idx
,
i
++
,
ver
,
len
,
gpio
)))
{
if
((
line
==
0xff
||
line
==
gpio
->
line
)
&&
if
((
line
==
0xff
||
line
==
gpio
->
line
)
&&
(
func
==
0xff
||
func
==
gpio
->
func
))
(
func
==
0xff
||
func
==
gpio
->
func
))
return
0
;
return
data
;
}
}
/* DCB 2.2, fixed TVDAC GPIO data */
/* DCB 2.2, fixed TVDAC GPIO data */
if
((
entry
=
dcb_table
(
bios
,
&
ver
,
&
hdr
,
&
cnt
,
&
len
)))
{
if
((
data
=
dcb_table
(
bios
,
ver
,
&
hdr
,
&
cnt
,
len
)))
{
if
(
ver
>=
0x22
&&
ver
<
0x30
&&
func
==
DCB_GPIO_TVDAC0
)
{
if
(
*
ver
>=
0x22
&&
*
ver
<
0x30
&&
func
==
DCB_GPIO_TVDAC0
)
{
u8
conf
=
nv_ro08
(
bios
,
entry
-
5
);
u8
conf
=
nv_ro08
(
bios
,
data
-
5
);
u8
addr
=
nv_ro08
(
bios
,
entry
-
4
);
u8
addr
=
nv_ro08
(
bios
,
data
-
4
);
if
(
conf
&
0x01
)
{
if
(
conf
&
0x01
)
{
*
gpio
=
(
struct
dcb_gpio_func
)
{
*
gpio
=
(
struct
dcb_gpio_func
)
{
.
func
=
DCB_GPIO_TVDAC0
,
.
func
=
DCB_GPIO_TVDAC0
,
...
@@ -112,10 +133,11 @@ dcb_gpio_parse(struct nouveau_bios *bios, int idx, u8 func, u8 line,
...
@@ -112,10 +133,11 @@ dcb_gpio_parse(struct nouveau_bios *bios, int idx, u8 func, u8 line,
.
log
[
0
]
=
!!
(
conf
&
0x02
),
.
log
[
0
]
=
!!
(
conf
&
0x02
),
.
log
[
1
]
=
!
(
conf
&
0x02
),
.
log
[
1
]
=
!
(
conf
&
0x02
),
};
};
return
0
;
*
ver
=
0x00
;
return
data
;
}
}
}
}
}
}
return
-
EINVAL
;
return
0x0000
;
}
}
drivers/gpu/drm/nouveau/core/subdev/gpio/base.c
View file @
d2bcea68
...
@@ -43,10 +43,15 @@ static int
...
@@ -43,10 +43,15 @@ static int
nouveau_gpio_find
(
struct
nouveau_gpio
*
gpio
,
int
idx
,
u8
tag
,
u8
line
,
nouveau_gpio_find
(
struct
nouveau_gpio
*
gpio
,
int
idx
,
u8
tag
,
u8
line
,
struct
dcb_gpio_func
*
func
)
struct
dcb_gpio_func
*
func
)
{
{
struct
nouveau_bios
*
bios
=
nouveau_bios
(
gpio
);
u8
ver
,
len
;
u16
data
;
if
(
line
==
0xff
&&
tag
==
0xff
)
if
(
line
==
0xff
&&
tag
==
0xff
)
return
-
EINVAL
;
return
-
EINVAL
;
if
(
!
dcb_gpio_parse
(
nouveau_bios
(
gpio
),
idx
,
tag
,
line
,
func
))
data
=
dcb_gpio_match
(
bios
,
idx
,
tag
,
line
,
&
ver
,
&
len
,
func
);
if
(
data
)
return
0
;
return
0
;
/* Apple iMac G4 NV18 */
/* Apple iMac G4 NV18 */
...
...
drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c
View file @
d2bcea68
...
@@ -33,11 +33,11 @@ nv50_gpio_reset(struct nouveau_gpio *gpio)
...
@@ -33,11 +33,11 @@ nv50_gpio_reset(struct nouveau_gpio *gpio)
{
{
struct
nouveau_bios
*
bios
=
nouveau_bios
(
gpio
);
struct
nouveau_bios
*
bios
=
nouveau_bios
(
gpio
);
struct
nv50_gpio_priv
*
priv
=
(
void
*
)
gpio
;
struct
nv50_gpio_priv
*
priv
=
(
void
*
)
gpio
;
u8
ver
,
len
;
u16
entry
;
u16
entry
;
u8
ver
;
int
ent
=
-
1
;
int
ent
=
-
1
;
while
((
entry
=
dcb_gpio_entry
(
bios
,
0
,
++
ent
,
&
ver
)))
{
while
((
entry
=
dcb_gpio_entry
(
bios
,
0
,
++
ent
,
&
ver
,
&
len
)))
{
static
const
u32
regs
[]
=
{
0xe100
,
0xe28c
};
static
const
u32
regs
[]
=
{
0xe100
,
0xe28c
};
u32
data
=
nv_ro32
(
bios
,
entry
);
u32
data
=
nv_ro32
(
bios
,
entry
);
u8
line
=
(
data
&
0x0000001f
);
u8
line
=
(
data
&
0x0000001f
);
...
...
drivers/gpu/drm/nouveau/core/subdev/gpio/nvd0.c
View file @
d2bcea68
...
@@ -33,11 +33,11 @@ nvd0_gpio_reset(struct nouveau_gpio *gpio)
...
@@ -33,11 +33,11 @@ nvd0_gpio_reset(struct nouveau_gpio *gpio)
{
{
struct
nouveau_bios
*
bios
=
nouveau_bios
(
gpio
);
struct
nouveau_bios
*
bios
=
nouveau_bios
(
gpio
);
struct
nvd0_gpio_priv
*
priv
=
(
void
*
)
gpio
;
struct
nvd0_gpio_priv
*
priv
=
(
void
*
)
gpio
;
u8
ver
,
len
;
u16
entry
;
u16
entry
;
u8
ver
;
int
ent
=
-
1
;
int
ent
=
-
1
;
while
((
entry
=
dcb_gpio_entry
(
bios
,
0
,
++
ent
,
&
ver
)))
{
while
((
entry
=
dcb_gpio_entry
(
bios
,
0
,
++
ent
,
&
ver
,
&
len
)))
{
u32
data
=
nv_ro32
(
bios
,
entry
);
u32
data
=
nv_ro32
(
bios
,
entry
);
u8
line
=
(
data
&
0x0000003f
);
u8
line
=
(
data
&
0x0000003f
);
u8
defs
=
!!
(
data
&
0x00000080
);
u8
defs
=
!!
(
data
&
0x00000080
);
...
...
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