Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Kirill Smelkov
linux
Commits
f60dfb99
Commit
f60dfb99
authored
13 years ago
by
Ben Skeggs
Browse files
Options
Download
Email Patches
Plain Diff
drm/nouveau/pm: initial attempt at parsing volt 0x40
Signed-off-by:
Ben Skeggs
<
bskeggs@redhat.com
>
parent
c3450239
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
8 deletions
+35
-8
drivers/gpu/drm/nouveau/nouveau_volt.c
drivers/gpu/drm/nouveau/nouveau_volt.c
+35
-8
No files found.
drivers/gpu/drm/nouveau/nouveau_volt.c
View file @
f60dfb99
...
...
@@ -170,6 +170,13 @@ nouveau_volt_init(struct drm_device *dev)
*/
vidshift
=
2
;
break
;
case
0x40
:
headerlen
=
volt
[
1
];
recordlen
=
volt
[
2
];
entries
=
volt
[
3
];
/* not a clue what the entries are for.. */
vidmask
=
volt
[
11
];
/* guess.. */
vidshift
=
0
;
break
;
default:
NV_WARN
(
dev
,
"voltage table 0x%02x unknown
\n
"
,
volt
[
0
]);
return
;
...
...
@@ -197,16 +204,36 @@ nouveau_volt_init(struct drm_device *dev)
}
/* parse vbios entries into common format */
voltage
->
level
=
kcalloc
(
entries
,
sizeof
(
*
voltage
->
level
),
GFP_KERNEL
);
if
(
!
voltage
->
level
)
return
;
if
(
volt
[
0
]
<
0x40
)
{
voltage
->
nr_level
=
entries
;
voltage
->
level
=
kcalloc
(
entries
,
sizeof
(
*
voltage
->
level
),
GFP_KERNEL
);
if
(
!
voltage
->
level
)
return
;
entry
=
volt
+
headerlen
;
for
(
i
=
0
;
i
<
entries
;
i
++
,
entry
+=
recordlen
)
{
voltage
->
level
[
i
].
voltage
=
entry
[
0
]
*
10000
;
voltage
->
level
[
i
].
vid
=
entry
[
1
]
>>
vidshift
;
entry
=
volt
+
headerlen
;
for
(
i
=
0
;
i
<
entries
;
i
++
,
entry
+=
recordlen
)
{
voltage
->
level
[
i
].
voltage
=
entry
[
0
]
*
10000
;
voltage
->
level
[
i
].
vid
=
entry
[
1
]
>>
vidshift
;
}
}
else
{
u32
volt_uv
=
ROM32
(
volt
[
4
]);
s16
step_uv
=
ROM16
(
volt
[
8
]);
u8
vid
;
voltage
->
nr_level
=
voltage
->
vid_mask
+
1
;
voltage
->
level
=
kcalloc
(
voltage
->
nr_level
,
sizeof
(
*
voltage
->
level
),
GFP_KERNEL
);
if
(
!
voltage
->
level
)
return
;
for
(
vid
=
0
;
vid
<=
voltage
->
vid_mask
;
vid
++
)
{
voltage
->
level
[
vid
].
voltage
=
volt_uv
;
voltage
->
level
[
vid
].
vid
=
vid
;
volt_uv
+=
step_uv
;
}
}
voltage
->
nr_level
=
entries
;
voltage
->
supported
=
true
;
}
...
...
This diff is collapsed.
Click to expand it.
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