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
4de93a08
Commit
4de93a08
authored
Aug 20, 2015
by
Ben Skeggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drm/nouveau/gpio: switch to device pri macros
Signed-off-by:
Ben Skeggs
<
bskeggs@redhat.com
>
parent
2bdb4995
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
60 additions
and
44 deletions
+60
-44
drivers/gpu/drm/nouveau/nvkm/subdev/gpio/g94.c
drivers/gpu/drm/nouveau/nvkm/subdev/gpio/g94.c
+12
-10
drivers/gpu/drm/nouveau/nvkm/subdev/gpio/gf110.c
drivers/gpu/drm/nouveau/nvkm/subdev/gpio/gf110.c
+9
-6
drivers/gpu/drm/nouveau/nvkm/subdev/gpio/gk104.c
drivers/gpu/drm/nouveau/nvkm/subdev/gpio/gk104.c
+12
-10
drivers/gpu/drm/nouveau/nvkm/subdev/gpio/nv10.c
drivers/gpu/drm/nouveau/nvkm/subdev/gpio/nv10.c
+13
-9
drivers/gpu/drm/nouveau/nvkm/subdev/gpio/nv50.c
drivers/gpu/drm/nouveau/nvkm/subdev/gpio/nv50.c
+14
-9
No files found.
drivers/gpu/drm/nouveau/nvkm/subdev/gpio/g94.c
View file @
4de93a08
...
...
@@ -26,21 +26,23 @@
void
g94_gpio_intr_stat
(
struct
nvkm_gpio
*
gpio
,
u32
*
hi
,
u32
*
lo
)
{
u32
intr0
=
nv_rd32
(
gpio
,
0x00e054
);
u32
intr1
=
nv_rd32
(
gpio
,
0x00e074
);
u32
stat0
=
nv_rd32
(
gpio
,
0x00e050
)
&
intr0
;
u32
stat1
=
nv_rd32
(
gpio
,
0x00e070
)
&
intr1
;
struct
nvkm_device
*
device
=
gpio
->
subdev
.
device
;
u32
intr0
=
nvkm_rd32
(
device
,
0x00e054
);
u32
intr1
=
nvkm_rd32
(
device
,
0x00e074
);
u32
stat0
=
nvkm_rd32
(
device
,
0x00e050
)
&
intr0
;
u32
stat1
=
nvkm_rd32
(
device
,
0x00e070
)
&
intr1
;
*
lo
=
(
stat1
&
0xffff0000
)
|
(
stat0
>>
16
);
*
hi
=
(
stat1
<<
16
)
|
(
stat0
&
0x0000ffff
);
nv
_wr32
(
gpio
,
0x00e054
,
intr0
);
nv
_wr32
(
gpio
,
0x00e074
,
intr1
);
nv
km_wr32
(
device
,
0x00e054
,
intr0
);
nv
km_wr32
(
device
,
0x00e074
,
intr1
);
}
void
g94_gpio_intr_mask
(
struct
nvkm_gpio
*
gpio
,
u32
type
,
u32
mask
,
u32
data
)
{
u32
inte0
=
nv_rd32
(
gpio
,
0x00e050
);
u32
inte1
=
nv_rd32
(
gpio
,
0x00e070
);
struct
nvkm_device
*
device
=
gpio
->
subdev
.
device
;
u32
inte0
=
nvkm_rd32
(
device
,
0x00e050
);
u32
inte1
=
nvkm_rd32
(
device
,
0x00e070
);
if
(
type
&
NVKM_GPIO_LO
)
inte0
=
(
inte0
&
~
(
mask
<<
16
))
|
(
data
<<
16
);
if
(
type
&
NVKM_GPIO_HI
)
...
...
@@ -51,8 +53,8 @@ g94_gpio_intr_mask(struct nvkm_gpio *gpio, u32 type, u32 mask, u32 data)
inte1
=
(
inte1
&
~
(
mask
<<
16
))
|
(
data
<<
16
);
if
(
type
&
NVKM_GPIO_HI
)
inte1
=
(
inte1
&
~
mask
)
|
data
;
nv
_wr32
(
gpio
,
0x00e050
,
inte0
);
nv
_wr32
(
gpio
,
0x00e070
,
inte1
);
nv
km_wr32
(
device
,
0x00e050
,
inte0
);
nv
km_wr32
(
device
,
0x00e070
,
inte1
);
}
struct
nvkm_oclass
*
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/gpio/gf110.c
View file @
4de93a08
...
...
@@ -26,7 +26,8 @@
void
gf110_gpio_reset
(
struct
nvkm_gpio
*
gpio
,
u8
match
)
{
struct
nvkm_bios
*
bios
=
nvkm_bios
(
gpio
);
struct
nvkm_device
*
device
=
gpio
->
subdev
.
device
;
struct
nvkm_bios
*
bios
=
device
->
bios
;
u8
ver
,
len
;
u16
entry
;
int
ent
=
-
1
;
...
...
@@ -45,25 +46,27 @@ gf110_gpio_reset(struct nvkm_gpio *gpio, u8 match)
gpio
->
set
(
gpio
,
0
,
func
,
line
,
defs
);
nv
_mask
(
gpio
,
0x00d610
+
(
line
*
4
),
0xff
,
unk0
);
nv
km_mask
(
device
,
0x00d610
+
(
line
*
4
),
0xff
,
unk0
);
if
(
unk1
--
)
nv
_mask
(
gpio
,
0x00d740
+
(
unk1
*
4
),
0xff
,
line
);
nv
km_mask
(
device
,
0x00d740
+
(
unk1
*
4
),
0xff
,
line
);
}
}
int
gf110_gpio_drive
(
struct
nvkm_gpio
*
gpio
,
int
line
,
int
dir
,
int
out
)
{
struct
nvkm_device
*
device
=
gpio
->
subdev
.
device
;
u32
data
=
((
dir
^
1
)
<<
13
)
|
(
out
<<
12
);
nv
_mask
(
gpio
,
0x00d610
+
(
line
*
4
),
0x00003000
,
data
);
nv
_mask
(
gpio
,
0x00d604
,
0x00000001
,
0x00000001
);
/* update? */
nv
km_mask
(
device
,
0x00d610
+
(
line
*
4
),
0x00003000
,
data
);
nv
km_mask
(
device
,
0x00d604
,
0x00000001
,
0x00000001
);
/* update? */
return
0
;
}
int
gf110_gpio_sense
(
struct
nvkm_gpio
*
gpio
,
int
line
)
{
return
!!
(
nv_rd32
(
gpio
,
0x00d610
+
(
line
*
4
))
&
0x00004000
);
struct
nvkm_device
*
device
=
gpio
->
subdev
.
device
;
return
!!
(
nvkm_rd32
(
device
,
0x00d610
+
(
line
*
4
))
&
0x00004000
);
}
struct
nvkm_oclass
*
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/gpio/gk104.c
View file @
4de93a08
...
...
@@ -26,21 +26,23 @@
static
void
gk104_gpio_intr_stat
(
struct
nvkm_gpio
*
gpio
,
u32
*
hi
,
u32
*
lo
)
{
u32
intr0
=
nv_rd32
(
gpio
,
0x00dc00
);
u32
intr1
=
nv_rd32
(
gpio
,
0x00dc80
);
u32
stat0
=
nv_rd32
(
gpio
,
0x00dc08
)
&
intr0
;
u32
stat1
=
nv_rd32
(
gpio
,
0x00dc88
)
&
intr1
;
struct
nvkm_device
*
device
=
gpio
->
subdev
.
device
;
u32
intr0
=
nvkm_rd32
(
device
,
0x00dc00
);
u32
intr1
=
nvkm_rd32
(
device
,
0x00dc80
);
u32
stat0
=
nvkm_rd32
(
device
,
0x00dc08
)
&
intr0
;
u32
stat1
=
nvkm_rd32
(
device
,
0x00dc88
)
&
intr1
;
*
lo
=
(
stat1
&
0xffff0000
)
|
(
stat0
>>
16
);
*
hi
=
(
stat1
<<
16
)
|
(
stat0
&
0x0000ffff
);
nv
_wr32
(
gpio
,
0x00dc00
,
intr0
);
nv
_wr32
(
gpio
,
0x00dc80
,
intr1
);
nv
km_wr32
(
device
,
0x00dc00
,
intr0
);
nv
km_wr32
(
device
,
0x00dc80
,
intr1
);
}
void
gk104_gpio_intr_mask
(
struct
nvkm_gpio
*
gpio
,
u32
type
,
u32
mask
,
u32
data
)
{
u32
inte0
=
nv_rd32
(
gpio
,
0x00dc08
);
u32
inte1
=
nv_rd32
(
gpio
,
0x00dc88
);
struct
nvkm_device
*
device
=
gpio
->
subdev
.
device
;
u32
inte0
=
nvkm_rd32
(
device
,
0x00dc08
);
u32
inte1
=
nvkm_rd32
(
device
,
0x00dc88
);
if
(
type
&
NVKM_GPIO_LO
)
inte0
=
(
inte0
&
~
(
mask
<<
16
))
|
(
data
<<
16
);
if
(
type
&
NVKM_GPIO_HI
)
...
...
@@ -51,8 +53,8 @@ gk104_gpio_intr_mask(struct nvkm_gpio *gpio, u32 type, u32 mask, u32 data)
inte1
=
(
inte1
&
~
(
mask
<<
16
))
|
(
data
<<
16
);
if
(
type
&
NVKM_GPIO_HI
)
inte1
=
(
inte1
&
~
mask
)
|
data
;
nv
_wr32
(
gpio
,
0x00dc08
,
inte0
);
nv
_wr32
(
gpio
,
0x00dc88
,
inte1
);
nv
km_wr32
(
device
,
0x00dc08
,
inte0
);
nv
km_wr32
(
device
,
0x00dc88
,
inte1
);
}
struct
nvkm_oclass
*
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/gpio/nv10.c
View file @
4de93a08
...
...
@@ -28,19 +28,20 @@
static
int
nv10_gpio_sense
(
struct
nvkm_gpio
*
gpio
,
int
line
)
{
struct
nvkm_device
*
device
=
gpio
->
subdev
.
device
;
if
(
line
<
2
)
{
line
=
line
*
16
;
line
=
nv
_rd32
(
gpio
,
0x600818
)
>>
line
;
line
=
nv
km_rd32
(
device
,
0x600818
)
>>
line
;
return
!!
(
line
&
0x0100
);
}
else
if
(
line
<
10
)
{
line
=
(
line
-
2
)
*
4
;
line
=
nv
_rd32
(
gpio
,
0x60081c
)
>>
line
;
line
=
nv
km_rd32
(
device
,
0x60081c
)
>>
line
;
return
!!
(
line
&
0x04
);
}
else
if
(
line
<
14
)
{
line
=
(
line
-
10
)
*
4
;
line
=
nv
_rd32
(
gpio
,
0x600850
)
>>
line
;
line
=
nv
km_rd32
(
device
,
0x600850
)
>>
line
;
return
!!
(
line
&
0x04
);
}
...
...
@@ -50,6 +51,7 @@ nv10_gpio_sense(struct nvkm_gpio *gpio, int line)
static
int
nv10_gpio_drive
(
struct
nvkm_gpio
*
gpio
,
int
line
,
int
dir
,
int
out
)
{
struct
nvkm_device
*
device
=
gpio
->
subdev
.
device
;
u32
reg
,
mask
,
data
;
if
(
line
<
2
)
{
...
...
@@ -73,29 +75,31 @@ nv10_gpio_drive(struct nvkm_gpio *gpio, int line, int dir, int out)
return
-
EINVAL
;
}
nv
_mask
(
gpio
,
reg
,
mask
<<
line
,
data
<<
line
);
nv
km_mask
(
device
,
reg
,
mask
<<
line
,
data
<<
line
);
return
0
;
}
static
void
nv10_gpio_intr_stat
(
struct
nvkm_gpio
*
gpio
,
u32
*
hi
,
u32
*
lo
)
{
u32
intr
=
nv_rd32
(
gpio
,
0x001104
);
u32
stat
=
nv_rd32
(
gpio
,
0x001144
)
&
intr
;
struct
nvkm_device
*
device
=
gpio
->
subdev
.
device
;
u32
intr
=
nvkm_rd32
(
device
,
0x001104
);
u32
stat
=
nvkm_rd32
(
device
,
0x001144
)
&
intr
;
*
lo
=
(
stat
&
0xffff0000
)
>>
16
;
*
hi
=
(
stat
&
0x0000ffff
);
nv
_wr32
(
gpio
,
0x001104
,
intr
);
nv
km_wr32
(
device
,
0x001104
,
intr
);
}
static
void
nv10_gpio_intr_mask
(
struct
nvkm_gpio
*
gpio
,
u32
type
,
u32
mask
,
u32
data
)
{
u32
inte
=
nv_rd32
(
gpio
,
0x001144
);
struct
nvkm_device
*
device
=
gpio
->
subdev
.
device
;
u32
inte
=
nvkm_rd32
(
device
,
0x001144
);
if
(
type
&
NVKM_GPIO_LO
)
inte
=
(
inte
&
~
(
mask
<<
16
))
|
(
data
<<
16
);
if
(
type
&
NVKM_GPIO_HI
)
inte
=
(
inte
&
~
mask
)
|
data
;
nv
_wr32
(
gpio
,
0x001144
,
inte
);
nv
km_wr32
(
device
,
0x001144
,
inte
);
}
struct
nvkm_oclass
*
...
...
drivers/gpu/drm/nouveau/nvkm/subdev/gpio/nv50.c
View file @
4de93a08
...
...
@@ -26,7 +26,8 @@
void
nv50_gpio_reset
(
struct
nvkm_gpio
*
gpio
,
u8
match
)
{
struct
nvkm_bios
*
bios
=
nvkm_bios
(
gpio
);
struct
nvkm_device
*
device
=
gpio
->
subdev
.
device
;
struct
nvkm_bios
*
bios
=
device
->
bios
;
u8
ver
,
len
;
u16
entry
;
int
ent
=
-
1
;
...
...
@@ -49,7 +50,7 @@ nv50_gpio_reset(struct nvkm_gpio *gpio, u8 match)
gpio
->
set
(
gpio
,
0
,
func
,
line
,
defs
);
nv
_mask
(
gpio
,
reg
,
0x00010001
<<
lsh
,
val
<<
lsh
);
nv
km_mask
(
device
,
reg
,
0x00010001
<<
lsh
,
val
<<
lsh
);
}
}
...
...
@@ -69,45 +70,49 @@ nv50_gpio_location(int line, u32 *reg, u32 *shift)
int
nv50_gpio_drive
(
struct
nvkm_gpio
*
gpio
,
int
line
,
int
dir
,
int
out
)
{
struct
nvkm_device
*
device
=
gpio
->
subdev
.
device
;
u32
reg
,
shift
;
if
(
nv50_gpio_location
(
line
,
&
reg
,
&
shift
))
return
-
EINVAL
;
nv
_mask
(
gpio
,
reg
,
3
<<
shift
,
(((
dir
^
1
)
<<
1
)
|
out
)
<<
shift
);
nv
km_mask
(
device
,
reg
,
3
<<
shift
,
(((
dir
^
1
)
<<
1
)
|
out
)
<<
shift
);
return
0
;
}
int
nv50_gpio_sense
(
struct
nvkm_gpio
*
gpio
,
int
line
)
{
struct
nvkm_device
*
device
=
gpio
->
subdev
.
device
;
u32
reg
,
shift
;
if
(
nv50_gpio_location
(
line
,
&
reg
,
&
shift
))
return
-
EINVAL
;
return
!!
(
nv
_rd32
(
gpio
,
reg
)
&
(
4
<<
shift
));
return
!!
(
nv
km_rd32
(
device
,
reg
)
&
(
4
<<
shift
));
}
static
void
nv50_gpio_intr_stat
(
struct
nvkm_gpio
*
gpio
,
u32
*
hi
,
u32
*
lo
)
{
u32
intr
=
nv_rd32
(
gpio
,
0x00e054
);
u32
stat
=
nv_rd32
(
gpio
,
0x00e050
)
&
intr
;
struct
nvkm_device
*
device
=
gpio
->
subdev
.
device
;
u32
intr
=
nvkm_rd32
(
device
,
0x00e054
);
u32
stat
=
nvkm_rd32
(
device
,
0x00e050
)
&
intr
;
*
lo
=
(
stat
&
0xffff0000
)
>>
16
;
*
hi
=
(
stat
&
0x0000ffff
);
nv
_wr32
(
gpio
,
0x00e054
,
intr
);
nv
km_wr32
(
device
,
0x00e054
,
intr
);
}
static
void
nv50_gpio_intr_mask
(
struct
nvkm_gpio
*
gpio
,
u32
type
,
u32
mask
,
u32
data
)
{
u32
inte
=
nv_rd32
(
gpio
,
0x00e050
);
struct
nvkm_device
*
device
=
gpio
->
subdev
.
device
;
u32
inte
=
nvkm_rd32
(
device
,
0x00e050
);
if
(
type
&
NVKM_GPIO_LO
)
inte
=
(
inte
&
~
(
mask
<<
16
))
|
(
data
<<
16
);
if
(
type
&
NVKM_GPIO_HI
)
inte
=
(
inte
&
~
mask
)
|
data
;
nv
_wr32
(
gpio
,
0x00e050
,
inte
);
nv
km_wr32
(
device
,
0x00e050
,
inte
);
}
struct
nvkm_oclass
*
...
...
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