Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
0e29998a
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
0e29998a
编写于
8月 20, 2015
作者:
B
Ben Skeggs
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
drm/nouveau/device: convert ctrl class to new-style nvkm_object
Signed-off-by:
N
Ben Skeggs
<
bskeggs@redhat.com
>
上级
2a9f847f
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
73 addition
and
45 deletion
+73
-45
drivers/gpu/drm/nouveau/include/nvkm/core/device.h
drivers/gpu/drm/nouveau/include/nvkm/core/device.h
+6
-0
drivers/gpu/drm/nouveau/nvkm/engine/device/ctrl.c
drivers/gpu/drm/nouveau/nvkm/engine/device/ctrl.c
+43
-31
drivers/gpu/drm/nouveau/nvkm/engine/device/ctrl.h
drivers/gpu/drm/nouveau/nvkm/engine/device/ctrl.h
+12
-0
drivers/gpu/drm/nouveau/nvkm/engine/device/priv.h
drivers/gpu/drm/nouveau/nvkm/engine/device/priv.h
+0
-2
drivers/gpu/drm/nouveau/nvkm/engine/device/user.c
drivers/gpu/drm/nouveau/nvkm/engine/device/user.c
+12
-12
未找到文件。
drivers/gpu/drm/nouveau/include/nvkm/core/device.h
浏览文件 @
0e29998a
...
...
@@ -274,6 +274,12 @@ enum nv_bus_type {
void
nvkm_device_del
(
struct
nvkm_device
**
);
struct
nvkm_device_oclass
{
int
(
*
ctor
)(
struct
nvkm_device
*
,
const
struct
nvkm_oclass
*
,
void
*
data
,
u32
size
,
struct
nvkm_object
**
);
struct
nvkm_sclass
base
;
};
extern
const
struct
nvkm_sclass
nvkm_udevice_sclass
;
/* device logging */
...
...
drivers/gpu/drm/nouveau/nvkm/engine/device/ctrl.c
浏览文件 @
0e29998a
...
...
@@ -21,7 +21,7 @@
*
* Authors: Ben Skeggs <bskeggs@redhat.com>
*/
#include "
priv
.h"
#include "
ctrl
.h"
#include <core/client.h>
#include <subdev/clk.h>
...
...
@@ -31,17 +31,17 @@
#include <nvif/unpack.h>
static
int
nvkm_control_mthd_pstate_info
(
struct
nvkm_
object
*
object
,
void
*
data
,
u32
size
)
nvkm_control_mthd_pstate_info
(
struct
nvkm_
control
*
ctrl
,
void
*
data
,
u32
size
)
{
union
{
struct
nvif_control_pstate_info_v0
v0
;
}
*
args
=
data
;
struct
nvkm_clk
*
clk
=
nvkm_clk
(
object
)
;
struct
nvkm_clk
*
clk
=
ctrl
->
device
->
clk
;
int
ret
;
nvif_ioctl
(
object
,
"control pstate info size %d
\n
"
,
size
);
nvif_ioctl
(
&
ctrl
->
object
,
"control pstate info size %d
\n
"
,
size
);
if
(
nvif_unpack
(
args
->
v0
,
0
,
0
,
false
))
{
nvif_ioctl
(
object
,
"control pstate info vers %d
\n
"
,
nvif_ioctl
(
&
ctrl
->
object
,
"control pstate info vers %d
\n
"
,
args
->
v0
.
version
);
}
else
return
ret
;
...
...
@@ -64,12 +64,12 @@ nvkm_control_mthd_pstate_info(struct nvkm_object *object, void *data, u32 size)
}
static
int
nvkm_control_mthd_pstate_attr
(
struct
nvkm_
object
*
object
,
void
*
data
,
u32
size
)
nvkm_control_mthd_pstate_attr
(
struct
nvkm_
control
*
ctrl
,
void
*
data
,
u32
size
)
{
union
{
struct
nvif_control_pstate_attr_v0
v0
;
}
*
args
=
data
;
struct
nvkm_clk
*
clk
=
nvkm_clk
(
object
)
;
struct
nvkm_clk
*
clk
=
ctrl
->
device
->
clk
;
struct
nvkm_domain
*
domain
;
struct
nvkm_pstate
*
pstate
;
struct
nvkm_cstate
*
cstate
;
...
...
@@ -77,10 +77,10 @@ nvkm_control_mthd_pstate_attr(struct nvkm_object *object, void *data, u32 size)
u32
lo
,
hi
;
int
ret
;
nvif_ioctl
(
object
,
"control pstate attr size %d
\n
"
,
size
);
nvif_ioctl
(
&
ctrl
->
object
,
"control pstate attr size %d
\n
"
,
size
);
if
(
nvif_unpack
(
args
->
v0
,
0
,
0
,
false
))
{
nvif_ioctl
(
object
,
"control pstate attr vers %d state %d "
"
index %d
\n
"
,
nvif_ioctl
(
&
ctrl
->
object
,
"control pstate attr vers %d state %d
index %d
\n
"
,
args
->
v0
.
version
,
args
->
v0
.
state
,
args
->
v0
.
index
);
if
(
!
clk
)
return
-
ENODEV
;
...
...
@@ -137,19 +137,19 @@ nvkm_control_mthd_pstate_attr(struct nvkm_object *object, void *data, u32 size)
}
static
int
nvkm_control_mthd_pstate_user
(
struct
nvkm_
object
*
object
,
void
*
data
,
u32
size
)
nvkm_control_mthd_pstate_user
(
struct
nvkm_
control
*
ctrl
,
void
*
data
,
u32
size
)
{
union
{
struct
nvif_control_pstate_user_v0
v0
;
}
*
args
=
data
;
struct
nvkm_clk
*
clk
=
nvkm_clk
(
object
)
;
struct
nvkm_clk
*
clk
=
ctrl
->
device
->
clk
;
int
ret
;
nvif_ioctl
(
object
,
"control pstate user size %d
\n
"
,
size
);
nvif_ioctl
(
&
ctrl
->
object
,
"control pstate user size %d
\n
"
,
size
);
if
(
nvif_unpack
(
args
->
v0
,
0
,
0
,
false
))
{
nvif_ioctl
(
object
,
"control pstate user vers %d ustate %d "
"pwrsrc %d
\n
"
,
args
->
v0
.
version
,
args
->
v0
.
ustate
,
args
->
v0
.
pwrsrc
);
nvif_ioctl
(
&
ctrl
->
object
,
"control pstate user vers %d ustate %d pwrsrc %d
\n
"
,
args
->
v0
.
version
,
args
->
v0
.
ustate
,
args
->
v0
.
pwrsrc
);
if
(
!
clk
)
return
-
ENODEV
;
}
else
...
...
@@ -168,32 +168,44 @@ nvkm_control_mthd_pstate_user(struct nvkm_object *object, void *data, u32 size)
static
int
nvkm_control_mthd
(
struct
nvkm_object
*
object
,
u32
mthd
,
void
*
data
,
u32
size
)
{
struct
nvkm_control
*
ctrl
=
nvkm_control
(
object
);
switch
(
mthd
)
{
case
NVIF_CONTROL_PSTATE_INFO
:
return
nvkm_control_mthd_pstate_info
(
object
,
data
,
size
);
return
nvkm_control_mthd_pstate_info
(
ctrl
,
data
,
size
);
case
NVIF_CONTROL_PSTATE_ATTR
:
return
nvkm_control_mthd_pstate_attr
(
object
,
data
,
size
);
return
nvkm_control_mthd_pstate_attr
(
ctrl
,
data
,
size
);
case
NVIF_CONTROL_PSTATE_USER
:
return
nvkm_control_mthd_pstate_user
(
object
,
data
,
size
);
return
nvkm_control_mthd_pstate_user
(
ctrl
,
data
,
size
);
default:
break
;
}
return
-
EINVAL
;
}
static
struct
nvkm_ofuncs
nvkm_control_ofuncs
=
{
.
ctor
=
_nvkm_object_ctor
,
.
dtor
=
nvkm_object_destroy
,
.
init
=
_nvkm_object_init
,
.
fini
=
_nvkm_object_fini
,
static
const
struct
nvkm_object_func
nvkm_control
=
{
.
mthd
=
nvkm_control_mthd
,
};
struct
nvkm_oclass
nvkm_control_oclass
[]
=
{
{
.
handle
=
NVIF_IOCTL_NEW_V0_CONTROL
,
.
ofuncs
=
&
nvkm_control_ofuncs
},
{}
static
int
nvkm_control_new
(
struct
nvkm_device
*
device
,
const
struct
nvkm_oclass
*
oclass
,
void
*
data
,
u32
size
,
struct
nvkm_object
**
pobject
)
{
struct
nvkm_control
*
ctrl
;
if
(
!
(
ctrl
=
kzalloc
(
sizeof
(
*
ctrl
),
GFP_KERNEL
)))
return
-
ENOMEM
;
*
pobject
=
&
ctrl
->
object
;
ctrl
->
device
=
device
;
nvkm_object_ctor
(
&
nvkm_control
,
oclass
,
&
ctrl
->
object
);
return
0
;
}
const
struct
nvkm_device_oclass
nvkm_control_oclass
=
{
.
base
.
oclass
=
NVIF_IOCTL_NEW_V0_CONTROL
,
.
base
.
minver
=
-
1
,
.
base
.
maxver
=
-
1
,
.
ctor
=
nvkm_control_new
,
};
drivers/gpu/drm/nouveau/nvkm/engine/device/ctrl.h
0 → 100644
浏览文件 @
0e29998a
#ifndef __NVKM_DEVICE_CTRL_H__
#define __NVKM_DEVICE_CTRL_H__
#define nvkm_control(p) container_of((p), struct nvkm_control, object)
#include <core/device.h>
struct
nvkm_control
{
struct
nvkm_object
object
;
struct
nvkm_device
*
device
;
};
extern
const
struct
nvkm_device_oclass
nvkm_control_oclass
;
#endif
drivers/gpu/drm/nouveau/nvkm/engine/device/priv.h
浏览文件 @
0e29998a
...
...
@@ -47,8 +47,6 @@ int nvkm_device_ctor(const struct nvkm_device_func *,
int
nvkm_device_init
(
struct
nvkm_device
*
);
int
nvkm_device_fini
(
struct
nvkm_device
*
,
bool
suspend
);
extern
struct
nvkm_oclass
nvkm_control_oclass
[];
int
nv04_identify
(
struct
nvkm_device
*
);
int
nv10_identify
(
struct
nvkm_device
*
);
int
nv20_identify
(
struct
nvkm_device
*
);
...
...
drivers/gpu/drm/nouveau/nvkm/engine/device/user.c
浏览文件 @
0e29998a
...
...
@@ -23,6 +23,7 @@
*/
#define nvkm_udevice(p) container_of((p), struct nvkm_udevice, object)
#include "priv.h"
#include "ctrl.h"
#include <core/client.h>
#include <core/parent.h>
...
...
@@ -280,10 +281,8 @@ nvkm_udevice_child_new(const struct nvkm_oclass *oclass,
void
*
data
,
u32
size
,
struct
nvkm_object
**
pobject
)
{
struct
nvkm_udevice
*
udev
=
nvkm_udevice
(
oclass
->
parent
);
const
struct
nvkm_oclass
*
sclass
=
oclass
->
priv
;
return
nvkm_object_old
(
&
udev
->
object
,
NULL
,
(
struct
nvkm_oclass
*
)
sclass
,
data
,
size
,
pobject
);
const
struct
nvkm_device_oclass
*
sclass
=
oclass
->
priv
;
return
sclass
->
ctor
(
udev
->
device
,
oclass
,
data
,
size
,
pobject
);
}
static
int
...
...
@@ -297,6 +296,7 @@ nvkm_udevice_child_get(struct nvkm_object *object, int index,
(
1ULL
<<
NVDEV_ENGINE_FIFO
)
|
(
1ULL
<<
NVDEV_ENGINE_DISP
)
|
(
1ULL
<<
NVDEV_ENGINE_PM
);
const
struct
nvkm_device_oclass
*
sclass
;
int
i
;
for
(;
i
=
__ffs64
(
mask
),
mask
;
mask
&=
~
(
1ULL
<<
i
))
{
...
...
@@ -319,16 +319,16 @@ nvkm_udevice_child_get(struct nvkm_object *object, int index,
}
}
if
(
index
==
0
)
{
oclass
->
ctor
=
nvkm_udevice_child_new
;
oclass
->
base
.
oclass
=
nvkm_control_oclass
[
0
].
handle
;
oclass
->
base
.
minver
=
-
2
;
oclass
->
base
.
maxver
=
-
2
;
oclass
->
priv
=
&
nvkm_control_oclass
[
0
];
return
0
;
switch
(
index
)
{
case
0
:
sclass
=
&
nvkm_control_oclass
;
break
;
default:
return
-
EINVAL
;
}
return
-
EINVAL
;
oclass
->
ctor
=
nvkm_udevice_child_new
;
oclass
->
base
=
sclass
->
base
;
oclass
->
priv
=
sclass
;
return
0
;
}
static
const
struct
nvkm_object_func
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录