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
09461459
Commit
09461459
authored
Aug 02, 2011
by
Ben Skeggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drm/nv50/backlight: express brightness level in percent
Signed-off-by:
Ben Skeggs
<
bskeggs@redhat.com
>
parent
10b461e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
drivers/gpu/drm/nouveau/nouveau_backlight.c
drivers/gpu/drm/nouveau/nouveau_backlight.c
+7
-3
No files found.
drivers/gpu/drm/nouveau/nouveau_backlight.c
View file @
09461459
...
@@ -100,8 +100,11 @@ nv50_get_intensity(struct backlight_device *bd)
...
@@ -100,8 +100,11 @@ nv50_get_intensity(struct backlight_device *bd)
struct
nouveau_encoder
*
nv_encoder
=
bl_get_data
(
bd
);
struct
nouveau_encoder
*
nv_encoder
=
bl_get_data
(
bd
);
struct
drm_device
*
dev
=
nv_encoder
->
base
.
base
.
dev
;
struct
drm_device
*
dev
=
nv_encoder
->
base
.
base
.
dev
;
int
or
=
nv_encoder
->
or
;
int
or
=
nv_encoder
->
or
;
u32
div
=
1025
;
u32
val
;
return
nv_rd32
(
dev
,
NV50_PDISPLAY_SOR_BACKLIGHT
+
(
or
*
0x800
));
val
=
nv_rd32
(
dev
,
NV50_PDISPLAY_SOR_BACKLIGHT
+
(
or
*
0x800
));
return
((
val
*
100
)
+
(
div
/
2
))
/
div
;
}
}
static
int
static
int
...
@@ -109,8 +112,9 @@ nv50_set_intensity(struct backlight_device *bd)
...
@@ -109,8 +112,9 @@ nv50_set_intensity(struct backlight_device *bd)
{
{
struct
nouveau_encoder
*
nv_encoder
=
bl_get_data
(
bd
);
struct
nouveau_encoder
*
nv_encoder
=
bl_get_data
(
bd
);
struct
drm_device
*
dev
=
nv_encoder
->
base
.
base
.
dev
;
struct
drm_device
*
dev
=
nv_encoder
->
base
.
base
.
dev
;
int
val
=
bd
->
props
.
brightness
;
int
or
=
nv_encoder
->
or
;
int
or
=
nv_encoder
->
or
;
u32
div
=
1025
;
u32
val
=
(
bd
->
props
.
brightness
*
div
)
/
100
;
nv_wr32
(
dev
,
NV50_PDISPLAY_SOR_BACKLIGHT
+
(
or
*
0x800
),
nv_wr32
(
dev
,
NV50_PDISPLAY_SOR_BACKLIGHT
+
(
or
*
0x800
),
val
|
NV50_PDISPLAY_SOR_BACKLIGHT_ENABLE
);
val
|
NV50_PDISPLAY_SOR_BACKLIGHT_ENABLE
);
...
@@ -147,7 +151,7 @@ nv50_backlight_init(struct drm_connector *connector)
...
@@ -147,7 +151,7 @@ nv50_backlight_init(struct drm_connector *connector)
memset
(
&
props
,
0
,
sizeof
(
struct
backlight_properties
));
memset
(
&
props
,
0
,
sizeof
(
struct
backlight_properties
));
props
.
type
=
BACKLIGHT_RAW
;
props
.
type
=
BACKLIGHT_RAW
;
props
.
max_brightness
=
10
25
;
props
.
max_brightness
=
10
0
;
bd
=
backlight_device_register
(
"nv_backlight"
,
&
connector
->
kdev
,
bd
=
backlight_device_register
(
"nv_backlight"
,
&
connector
->
kdev
,
nv_encoder
,
&
nv50_bl_ops
,
&
props
);
nv_encoder
,
&
nv50_bl_ops
,
&
props
);
if
(
IS_ERR
(
bd
))
if
(
IS_ERR
(
bd
))
...
...
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