Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
bc3b0c41
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 4 年多
通知
15
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kernel_linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
bc3b0c41
编写于
5月 13, 2014
作者:
B
Ben Skeggs
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
drm/nouveau/gpio: use base constructor for all implementations
Signed-off-by:
N
Ben Skeggs
<
bskeggs@redhat.com
>
上级
f4277a0e
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
47 addition
and
119 deletion
+47
-119
drivers/gpu/drm/nouveau/core/include/subdev/gpio.h
drivers/gpu/drm/nouveau/core/include/subdev/gpio.h
+0
-5
drivers/gpu/drm/nouveau/core/subdev/gpio/base.c
drivers/gpu/drm/nouveau/core/subdev/gpio/base.c
+5
-2
drivers/gpu/drm/nouveau/core/subdev/gpio/nv10.c
drivers/gpu/drm/nouveau/core/subdev/gpio/nv10.c
+3
-23
drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c
drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c
+8
-29
drivers/gpu/drm/nouveau/core/subdev/gpio/nv92.c
drivers/gpu/drm/nouveau/core/subdev/gpio/nv92.c
+4
-1
drivers/gpu/drm/nouveau/core/subdev/gpio/nvd0.c
drivers/gpu/drm/nouveau/core/subdev/gpio/nvd0.c
+6
-27
drivers/gpu/drm/nouveau/core/subdev/gpio/nve0.c
drivers/gpu/drm/nouveau/core/subdev/gpio/nve0.c
+4
-24
drivers/gpu/drm/nouveau/core/subdev/gpio/priv.h
drivers/gpu/drm/nouveau/core/subdev/gpio/priv.h
+17
-8
未找到文件。
drivers/gpu/drm/nouveau/core/include/subdev/gpio.h
浏览文件 @
bc3b0c41
...
...
@@ -13,12 +13,7 @@ struct nouveau_gpio {
struct
nouveau_event
*
events
;
/* hardware interfaces */
void
(
*
reset
)(
struct
nouveau_gpio
*
,
u8
func
);
int
(
*
drive
)(
struct
nouveau_gpio
*
,
int
line
,
int
dir
,
int
out
);
int
(
*
sense
)(
struct
nouveau_gpio
*
,
int
line
);
/* software interfaces */
int
(
*
find
)(
struct
nouveau_gpio
*
,
int
idx
,
u8
tag
,
u8
line
,
struct
dcb_gpio_func
*
);
int
(
*
set
)(
struct
nouveau_gpio
*
,
int
idx
,
u8
tag
,
u8
line
,
int
state
);
...
...
drivers/gpu/drm/nouveau/core/subdev/gpio/base.c
浏览文件 @
bc3b0c41
...
...
@@ -31,13 +31,15 @@ static int
nouveau_gpio_drive
(
struct
nouveau_gpio
*
gpio
,
int
idx
,
int
line
,
int
dir
,
int
out
)
{
return
gpio
->
drive
?
gpio
->
drive
(
gpio
,
line
,
dir
,
out
)
:
-
ENODEV
;
const
struct
nouveau_gpio_impl
*
impl
=
(
void
*
)
nv_object
(
gpio
)
->
oclass
;
return
impl
->
drive
?
impl
->
drive
(
gpio
,
line
,
dir
,
out
)
:
-
ENODEV
;
}
static
int
nouveau_gpio_sense
(
struct
nouveau_gpio
*
gpio
,
int
idx
,
int
line
)
{
return
gpio
->
sense
?
gpio
->
sense
(
gpio
,
line
)
:
-
ENODEV
;
const
struct
nouveau_gpio_impl
*
impl
=
(
void
*
)
nv_object
(
gpio
)
->
oclass
;
return
impl
->
sense
?
impl
->
sense
(
gpio
,
line
)
:
-
ENODEV
;
}
static
int
...
...
@@ -201,6 +203,7 @@ nouveau_gpio_create_(struct nouveau_object *parent,
gpio
->
find
=
nouveau_gpio_find
;
gpio
->
set
=
nouveau_gpio_set
;
gpio
->
get
=
nouveau_gpio_get
;
gpio
->
reset
=
impl
->
reset
;
ret
=
nouveau_event_create
(
1
,
impl
->
lines
,
&
gpio
->
events
);
if
(
ret
)
...
...
drivers/gpu/drm/nouveau/core/subdev/gpio/nv10.c
浏览文件 @
bc3b0c41
...
...
@@ -26,10 +26,6 @@
#include "priv.h"
struct
nv10_gpio_priv
{
struct
nouveau_gpio
base
;
};
static
int
nv10_gpio_sense
(
struct
nouveau_gpio
*
gpio
,
int
line
)
{
...
...
@@ -103,29 +99,11 @@ nv10_gpio_intr_mask(struct nouveau_gpio *gpio, u32 type, u32 mask, u32 data)
nv_wr32
(
gpio
,
0x001144
,
inte
);
}
static
int
nv10_gpio_ctor
(
struct
nouveau_object
*
parent
,
struct
nouveau_object
*
engine
,
struct
nouveau_oclass
*
oclass
,
void
*
data
,
u32
size
,
struct
nouveau_object
**
pobject
)
{
struct
nv10_gpio_priv
*
priv
;
int
ret
;
ret
=
nouveau_gpio_create
(
parent
,
engine
,
oclass
,
&
priv
);
*
pobject
=
nv_object
(
priv
);
if
(
ret
)
return
ret
;
priv
->
base
.
drive
=
nv10_gpio_drive
;
priv
->
base
.
sense
=
nv10_gpio_sense
;
return
0
;
}
struct
nouveau_oclass
*
nv10_gpio_oclass
=
&
(
struct
nouveau_gpio_impl
)
{
.
base
.
handle
=
NV_SUBDEV
(
GPIO
,
0x10
),
.
base
.
ofuncs
=
&
(
struct
nouveau_ofuncs
)
{
.
ctor
=
nv10
_gpio_ctor
,
.
ctor
=
_nouveau
_gpio_ctor
,
.
dtor
=
_nouveau_gpio_dtor
,
.
init
=
_nouveau_gpio_init
,
.
fini
=
_nouveau_gpio_fini
,
...
...
@@ -133,4 +111,6 @@ nv10_gpio_oclass = &(struct nouveau_gpio_impl) {
.
lines
=
16
,
.
intr_stat
=
nv10_gpio_intr_stat
,
.
intr_mask
=
nv10_gpio_intr_mask
,
.
drive
=
nv10_gpio_drive
,
.
sense
=
nv10_gpio_sense
,
}.
base
;
drivers/gpu/drm/nouveau/core/subdev/gpio/nv50.c
浏览文件 @
bc3b0c41
...
...
@@ -24,15 +24,10 @@
#include "priv.h"
struct
nv50_gpio_priv
{
struct
nouveau_gpio
base
;
};
static
void
void
nv50_gpio_reset
(
struct
nouveau_gpio
*
gpio
,
u8
match
)
{
struct
nouveau_bios
*
bios
=
nouveau_bios
(
gpio
);
struct
nv50_gpio_priv
*
priv
=
(
void
*
)
gpio
;
u8
ver
,
len
;
u16
entry
;
int
ent
=
-
1
;
...
...
@@ -55,7 +50,7 @@ nv50_gpio_reset(struct nouveau_gpio *gpio, u8 match)
gpio
->
set
(
gpio
,
0
,
func
,
line
,
defs
);
nv_mask
(
priv
,
reg
,
0x00010001
<<
lsh
,
val
<<
lsh
);
nv_mask
(
gpio
,
reg
,
0x00010001
<<
lsh
,
val
<<
lsh
);
}
}
...
...
@@ -72,7 +67,7 @@ nv50_gpio_location(int line, u32 *reg, u32 *shift)
return
0
;
}
static
int
int
nv50_gpio_drive
(
struct
nouveau_gpio
*
gpio
,
int
line
,
int
dir
,
int
out
)
{
u32
reg
,
shift
;
...
...
@@ -84,7 +79,7 @@ nv50_gpio_drive(struct nouveau_gpio *gpio, int line, int dir, int out)
return
0
;
}
static
int
int
nv50_gpio_sense
(
struct
nouveau_gpio
*
gpio
,
int
line
)
{
u32
reg
,
shift
;
...
...
@@ -116,30 +111,11 @@ nv50_gpio_intr_mask(struct nouveau_gpio *gpio, u32 type, u32 mask, u32 data)
nv_wr32
(
gpio
,
0x00e050
,
inte
);
}
int
nv50_gpio_ctor
(
struct
nouveau_object
*
parent
,
struct
nouveau_object
*
engine
,
struct
nouveau_oclass
*
oclass
,
void
*
data
,
u32
size
,
struct
nouveau_object
**
pobject
)
{
struct
nv50_gpio_priv
*
priv
;
int
ret
;
ret
=
nouveau_gpio_create
(
parent
,
engine
,
oclass
,
&
priv
);
*
pobject
=
nv_object
(
priv
);
if
(
ret
)
return
ret
;
priv
->
base
.
reset
=
nv50_gpio_reset
;
priv
->
base
.
drive
=
nv50_gpio_drive
;
priv
->
base
.
sense
=
nv50_gpio_sense
;
return
0
;
}
struct
nouveau_oclass
*
nv50_gpio_oclass
=
&
(
struct
nouveau_gpio_impl
)
{
.
base
.
handle
=
NV_SUBDEV
(
GPIO
,
0x50
),
.
base
.
ofuncs
=
&
(
struct
nouveau_ofuncs
)
{
.
ctor
=
nv50
_gpio_ctor
,
.
ctor
=
_nouveau
_gpio_ctor
,
.
dtor
=
_nouveau_gpio_dtor
,
.
init
=
_nouveau_gpio_init
,
.
fini
=
_nouveau_gpio_fini
,
...
...
@@ -147,4 +123,7 @@ nv50_gpio_oclass = &(struct nouveau_gpio_impl) {
.
lines
=
16
,
.
intr_stat
=
nv50_gpio_intr_stat
,
.
intr_mask
=
nv50_gpio_intr_mask
,
.
drive
=
nv50_gpio_drive
,
.
sense
=
nv50_gpio_sense
,
.
reset
=
nv50_gpio_reset
,
}.
base
;
drivers/gpu/drm/nouveau/core/subdev/gpio/nv92.c
浏览文件 @
bc3b0c41
...
...
@@ -60,7 +60,7 @@ struct nouveau_oclass *
nv92_gpio_oclass
=
&
(
struct
nouveau_gpio_impl
)
{
.
base
.
handle
=
NV_SUBDEV
(
GPIO
,
0x92
),
.
base
.
ofuncs
=
&
(
struct
nouveau_ofuncs
)
{
.
ctor
=
nv50
_gpio_ctor
,
.
ctor
=
_nouveau
_gpio_ctor
,
.
dtor
=
_nouveau_gpio_dtor
,
.
init
=
_nouveau_gpio_init
,
.
fini
=
_nouveau_gpio_fini
,
...
...
@@ -68,4 +68,7 @@ nv92_gpio_oclass = &(struct nouveau_gpio_impl) {
.
lines
=
32
,
.
intr_stat
=
nv92_gpio_intr_stat
,
.
intr_mask
=
nv92_gpio_intr_mask
,
.
drive
=
nv50_gpio_drive
,
.
sense
=
nv50_gpio_sense
,
.
reset
=
nv50_gpio_reset
,
}.
base
;
drivers/gpu/drm/nouveau/core/subdev/gpio/nvd0.c
浏览文件 @
bc3b0c41
...
...
@@ -24,15 +24,10 @@
#include "priv.h"
struct
nvd0_gpio_priv
{
struct
nouveau_gpio
base
;
};
void
nvd0_gpio_reset
(
struct
nouveau_gpio
*
gpio
,
u8
match
)
{
struct
nouveau_bios
*
bios
=
nouveau_bios
(
gpio
);
struct
nvd0_gpio_priv
*
priv
=
(
void
*
)
gpio
;
u8
ver
,
len
;
u16
entry
;
int
ent
=
-
1
;
...
...
@@ -51,9 +46,9 @@ nvd0_gpio_reset(struct nouveau_gpio *gpio, u8 match)
gpio
->
set
(
gpio
,
0
,
func
,
line
,
defs
);
nv_mask
(
priv
,
0x00d610
+
(
line
*
4
),
0xff
,
unk0
);
nv_mask
(
gpio
,
0x00d610
+
(
line
*
4
),
0xff
,
unk0
);
if
(
unk1
--
)
nv_mask
(
priv
,
0x00d740
+
(
unk1
*
4
),
0xff
,
line
);
nv_mask
(
gpio
,
0x00d740
+
(
unk1
*
4
),
0xff
,
line
);
}
}
...
...
@@ -72,30 +67,11 @@ nvd0_gpio_sense(struct nouveau_gpio *gpio, int line)
return
!!
(
nv_rd32
(
gpio
,
0x00d610
+
(
line
*
4
))
&
0x00004000
);
}
static
int
nvd0_gpio_ctor
(
struct
nouveau_object
*
parent
,
struct
nouveau_object
*
engine
,
struct
nouveau_oclass
*
oclass
,
void
*
data
,
u32
size
,
struct
nouveau_object
**
pobject
)
{
struct
nvd0_gpio_priv
*
priv
;
int
ret
;
ret
=
nouveau_gpio_create
(
parent
,
engine
,
oclass
,
&
priv
);
*
pobject
=
nv_object
(
priv
);
if
(
ret
)
return
ret
;
priv
->
base
.
reset
=
nvd0_gpio_reset
;
priv
->
base
.
drive
=
nvd0_gpio_drive
;
priv
->
base
.
sense
=
nvd0_gpio_sense
;
return
0
;
}
struct
nouveau_oclass
*
nvd0_gpio_oclass
=
&
(
struct
nouveau_gpio_impl
)
{
.
base
.
handle
=
NV_SUBDEV
(
GPIO
,
0xd0
),
.
base
.
ofuncs
=
&
(
struct
nouveau_ofuncs
)
{
.
ctor
=
nvd0
_gpio_ctor
,
.
ctor
=
_nouveau
_gpio_ctor
,
.
dtor
=
_nouveau_gpio_dtor
,
.
init
=
_nouveau_gpio_init
,
.
fini
=
_nouveau_gpio_fini
,
...
...
@@ -103,4 +79,7 @@ nvd0_gpio_oclass = &(struct nouveau_gpio_impl) {
.
lines
=
32
,
.
intr_stat
=
nv92_gpio_intr_stat
,
.
intr_mask
=
nv92_gpio_intr_mask
,
.
drive
=
nvd0_gpio_drive
,
.
sense
=
nvd0_gpio_sense
,
.
reset
=
nvd0_gpio_reset
,
}.
base
;
drivers/gpu/drm/nouveau/core/subdev/gpio/nve0.c
浏览文件 @
bc3b0c41
...
...
@@ -24,10 +24,6 @@
#include "priv.h"
struct
nve0_gpio_priv
{
struct
nouveau_gpio
base
;
};
static
void
nve0_gpio_intr_stat
(
struct
nouveau_gpio
*
gpio
,
u32
*
hi
,
u32
*
lo
)
{
...
...
@@ -60,30 +56,11 @@ nve0_gpio_intr_mask(struct nouveau_gpio *gpio, u32 type, u32 mask, u32 data)
nv_wr32
(
gpio
,
0x00dc88
,
inte1
);
}
static
int
nve0_gpio_ctor
(
struct
nouveau_object
*
parent
,
struct
nouveau_object
*
engine
,
struct
nouveau_oclass
*
oclass
,
void
*
data
,
u32
size
,
struct
nouveau_object
**
pobject
)
{
struct
nve0_gpio_priv
*
priv
;
int
ret
;
ret
=
nouveau_gpio_create
(
parent
,
engine
,
oclass
,
&
priv
);
*
pobject
=
nv_object
(
priv
);
if
(
ret
)
return
ret
;
priv
->
base
.
reset
=
nvd0_gpio_reset
;
priv
->
base
.
drive
=
nvd0_gpio_drive
;
priv
->
base
.
sense
=
nvd0_gpio_sense
;
return
0
;
}
struct
nouveau_oclass
*
nve0_gpio_oclass
=
&
(
struct
nouveau_gpio_impl
)
{
.
base
.
handle
=
NV_SUBDEV
(
GPIO
,
0xe0
),
.
base
.
ofuncs
=
&
(
struct
nouveau_ofuncs
)
{
.
ctor
=
nve0
_gpio_ctor
,
.
ctor
=
_nouveau
_gpio_ctor
,
.
dtor
=
_nouveau_gpio_dtor
,
.
init
=
_nouveau_gpio_init
,
.
fini
=
_nouveau_gpio_fini
,
...
...
@@ -91,4 +68,7 @@ nve0_gpio_oclass = &(struct nouveau_gpio_impl) {
.
lines
=
32
,
.
intr_stat
=
nve0_gpio_intr_stat
,
.
intr_mask
=
nve0_gpio_intr_mask
,
.
drive
=
nvd0_gpio_drive
,
.
sense
=
nvd0_gpio_sense
,
.
reset
=
nvd0_gpio_reset
,
}.
base
;
drivers/gpu/drm/nouveau/core/subdev/gpio/priv.h
浏览文件 @
bc3b0c41
...
...
@@ -27,14 +27,6 @@ void _nouveau_gpio_dtor(struct nouveau_object *);
int
_nouveau_gpio_init
(
struct
nouveau_object
*
);
int
_nouveau_gpio_fini
(
struct
nouveau_object
*
,
bool
);
int
nv50_gpio_ctor
(
struct
nouveau_object
*
,
struct
nouveau_object
*
,
struct
nouveau_oclass
*
,
void
*
,
u32
,
struct
nouveau_object
**
);
void
nvd0_gpio_reset
(
struct
nouveau_gpio
*
,
u8
);
int
nvd0_gpio_drive
(
struct
nouveau_gpio
*
,
int
,
int
,
int
);
int
nvd0_gpio_sense
(
struct
nouveau_gpio
*
,
int
);
enum
nvkm_gpio_event
{
NVKM_GPIO_HI
=
1
,
NVKM_GPIO_LO
=
2
,
...
...
@@ -55,10 +47,27 @@ struct nouveau_gpio_impl {
* given set of gpio lines
*/
void
(
*
intr_mask
)(
struct
nouveau_gpio
*
,
u32
,
u32
,
u32
);
/* configure gpio direction and output value */
int
(
*
drive
)(
struct
nouveau_gpio
*
,
int
line
,
int
dir
,
int
out
);
/* sense current state of given gpio line */
int
(
*
sense
)(
struct
nouveau_gpio
*
,
int
line
);
/*XXX*/
void
(
*
reset
)(
struct
nouveau_gpio
*
,
u8
);
};
void
nv50_gpio_reset
(
struct
nouveau_gpio
*
,
u8
);
int
nv50_gpio_drive
(
struct
nouveau_gpio
*
,
int
,
int
,
int
);
int
nv50_gpio_sense
(
struct
nouveau_gpio
*
,
int
);
void
nv92_gpio_intr_stat
(
struct
nouveau_gpio
*
,
u32
*
,
u32
*
);
void
nv92_gpio_intr_mask
(
struct
nouveau_gpio
*
,
u32
,
u32
,
u32
);
void
nvd0_gpio_reset
(
struct
nouveau_gpio
*
,
u8
);
int
nvd0_gpio_drive
(
struct
nouveau_gpio
*
,
int
,
int
,
int
);
int
nvd0_gpio_sense
(
struct
nouveau_gpio
*
,
int
);
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录