Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
99218fe4
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
99218fe4
编写于
1月 25, 2007
作者:
M
Mauro Carvalho Chehab
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
V4L/DVB (5148): Convert radio-aztech to use video_ioctl2
Signed-off-by:
N
Mauro Carvalho Chehab
<
mchehab@infradead.org
>
上级
b50e7fe9
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
122 addition
and
118 deletion
+122
-118
drivers/media/radio/radio-aztech.c
drivers/media/radio/radio-aztech.c
+122
-118
未找到文件。
drivers/media/radio/radio-aztech.c
浏览文件 @
99218fe4
...
...
@@ -180,136 +180,129 @@ static int az_setfreq(struct az_device *dev, unsigned long frequency)
return
0
;
}
static
int
az_do_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
void
*
arg
)
static
int
vidioc_querycap
(
struct
file
*
file
,
void
*
priv
,
struct
v4l2_capability
*
v
)
{
strlcpy
(
v
->
driver
,
"radio-aztech"
,
sizeof
(
v
->
driver
));
strlcpy
(
v
->
card
,
"Aztech Radio"
,
sizeof
(
v
->
card
));
sprintf
(
v
->
bus_info
,
"ISA"
);
v
->
version
=
RADIO_VERSION
;
v
->
capabilities
=
V4L2_CAP_TUNER
;
return
0
;
}
static
int
vidioc_g_tuner
(
struct
file
*
file
,
void
*
priv
,
struct
v4l2_tuner
*
v
)
{
struct
video_device
*
dev
=
video_devdata
(
file
);
struct
az_device
*
az
=
dev
->
priv
;
switch
(
cmd
)
{
case
VIDIOC_QUERYCAP
:
{
struct
v4l2_capability
*
v
=
arg
;
memset
(
v
,
0
,
sizeof
(
*
v
));
strlcpy
(
v
->
driver
,
"radio-aztech"
,
sizeof
(
v
->
driver
));
strlcpy
(
v
->
card
,
"Aztech Radio"
,
sizeof
(
v
->
card
));
sprintf
(
v
->
bus_info
,
"ISA"
);
v
->
version
=
RADIO_VERSION
;
v
->
capabilities
=
V4L2_CAP_TUNER
;
if
(
v
->
index
>
0
)
return
-
EINVAL
;
return
0
;
}
case
VIDIOC_G_TUNER
:
{
struct
v4l2_tuner
*
v
=
arg
;
if
(
v
->
index
>
0
)
return
-
EINVAL
;
memset
(
v
,
0
,
sizeof
(
*
v
));
strcpy
(
v
->
name
,
"FM"
);
v
->
type
=
V4L2_TUNER_RADIO
;
v
->
rangelow
=
(
87
*
16000
);
v
->
rangehigh
=
(
108
*
16000
);
v
->
rxsubchans
=
V4L2_TUNER_SUB_MONO
|
V4L2_TUNER_SUB_STEREO
;
v
->
capability
=
V4L2_TUNER_CAP_LOW
;
if
(
az_getstereo
(
az
))
v
->
audmode
=
V4L2_TUNER_MODE_STEREO
;
else
v
->
audmode
=
V4L2_TUNER_MODE_MONO
;
v
->
signal
=
0xFFFF
*
az_getsigstr
(
az
);
strcpy
(
v
->
name
,
"FM"
);
v
->
type
=
V4L2_TUNER_RADIO
;
return
0
;
}
case
VIDIOC_S_TUNER
:
{
struct
v4l2_tuner
*
v
=
arg
;
v
->
rangelow
=
(
87
*
16000
);
v
->
rangehigh
=
(
108
*
16000
);
v
->
rxsubchans
=
V4L2_TUNER_SUB_MONO
|
V4L2_TUNER_SUB_STEREO
;
v
->
capability
=
V4L2_TUNER_CAP_LOW
;
if
(
az_getstereo
(
az
))
v
->
audmode
=
V4L2_TUNER_MODE_STEREO
;
else
v
->
audmode
=
V4L2_TUNER_MODE_MONO
;
v
->
signal
=
0xFFFF
*
az_getsigstr
(
az
);
if
(
v
->
index
>
0
)
return
-
EINVAL
;
return
0
;
}
return
0
;
}
case
VIDIOC_S_FREQUENCY
:
{
struct
v4l2_frequency
*
f
=
arg
;
az
->
curfreq
=
f
->
frequency
;
az_setfreq
(
az
,
az
->
curfreq
);
return
0
;
}
case
VIDIOC_G_FREQUENCY
:
{
struct
v4l2_frequency
*
f
=
arg
;
static
int
vidioc_s_tuner
(
struct
file
*
file
,
void
*
priv
,
struct
v4l2_tuner
*
v
)
{
if
(
v
->
index
>
0
)
return
-
EINVAL
;
f
->
type
=
V4L2_TUNER_RADIO
;
f
->
frequency
=
az
->
curfreq
;
return
0
;
}
return
0
;
}
static
int
vidioc_s_frequency
(
struct
file
*
file
,
void
*
priv
,
struct
v4l2_frequency
*
f
)
{
struct
video_device
*
dev
=
video_devdata
(
file
);
struct
az_device
*
az
=
dev
->
priv
;
case
VIDIOC_QUERYCTRL
:
{
struct
v4l2_queryctrl
*
qc
=
arg
;
int
i
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
radio_qctrl
);
i
++
)
{
if
(
qc
->
id
&&
qc
->
id
==
radio_qctrl
[
i
].
id
)
{
memcpy
(
qc
,
&
(
radio_qctrl
[
i
]),
sizeof
(
*
qc
));
return
(
0
);
}
}
return
-
EINVAL
;
}
case
VIDIOC_G_CTRL
:
{
struct
v4l2_control
*
ctrl
=
arg
;
switch
(
ctrl
->
id
)
{
case
V4L2_CID_AUDIO_MUTE
:
if
(
az
->
curvol
==
0
)
ctrl
->
value
=
1
;
else
ctrl
->
value
=
0
;
return
(
0
);
case
V4L2_CID_AUDIO_VOLUME
:
ctrl
->
value
=
az
->
curvol
*
6554
;
return
(
0
);
}
return
-
EINVAL
;
}
case
VIDIOC_S_CTRL
:
{
struct
v4l2_control
*
ctrl
=
arg
;
switch
(
ctrl
->
id
)
{
case
V4L2_CID_AUDIO_MUTE
:
if
(
ctrl
->
value
)
{
az_setvol
(
az
,
0
);
}
else
{
az_setvol
(
az
,
az
->
curvol
);
}
return
(
0
);
case
V4L2_CID_AUDIO_VOLUME
:
az_setvol
(
az
,
ctrl
->
value
);
return
(
0
);
}
return
-
EINVAL
;
az
->
curfreq
=
f
->
frequency
;
az_setfreq
(
az
,
az
->
curfreq
);
return
0
;
}
static
int
vidioc_g_frequency
(
struct
file
*
file
,
void
*
priv
,
struct
v4l2_frequency
*
f
)
{
struct
video_device
*
dev
=
video_devdata
(
file
);
struct
az_device
*
az
=
dev
->
priv
;
f
->
type
=
V4L2_TUNER_RADIO
;
f
->
frequency
=
az
->
curfreq
;
return
0
;
}
static
int
vidioc_queryctrl
(
struct
file
*
file
,
void
*
priv
,
struct
v4l2_queryctrl
*
qc
)
{
int
i
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
radio_qctrl
);
i
++
)
{
if
(
qc
->
id
&&
qc
->
id
==
radio_qctrl
[
i
].
id
)
{
memcpy
(
qc
,
&
(
radio_qctrl
[
i
]),
sizeof
(
*
qc
));
return
(
0
);
}
}
return
-
EINVAL
;
}
default:
return
v4l_compat_translate_ioctl
(
inode
,
file
,
cmd
,
arg
,
az_do_ioctl
);
static
int
vidioc_g_ctrl
(
struct
file
*
file
,
void
*
priv
,
struct
v4l2_control
*
ctrl
)
{
struct
video_device
*
dev
=
video_devdata
(
file
);
struct
az_device
*
az
=
dev
->
priv
;
switch
(
ctrl
->
id
)
{
case
V4L2_CID_AUDIO_MUTE
:
if
(
az
->
curvol
==
0
)
ctrl
->
value
=
1
;
else
ctrl
->
value
=
0
;
return
(
0
);
case
V4L2_CID_AUDIO_VOLUME
:
ctrl
->
value
=
az
->
curvol
*
6554
;
return
(
0
);
}
return
-
EINVAL
;
}
static
int
az_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
static
int
vidioc_s_ctrl
(
struct
file
*
file
,
void
*
priv
,
struct
v4l2_control
*
ctrl
)
{
return
video_usercopy
(
inode
,
file
,
cmd
,
arg
,
az_do_ioctl
);
struct
video_device
*
dev
=
video_devdata
(
file
);
struct
az_device
*
az
=
dev
->
priv
;
switch
(
ctrl
->
id
)
{
case
V4L2_CID_AUDIO_MUTE
:
if
(
ctrl
->
value
)
{
az_setvol
(
az
,
0
);
}
else
{
az_setvol
(
az
,
az
->
curvol
);
}
return
(
0
);
case
V4L2_CID_AUDIO_VOLUME
:
az_setvol
(
az
,
ctrl
->
value
);
return
(
0
);
}
return
-
EINVAL
;
}
static
struct
az_device
aztech_unit
;
...
...
@@ -318,20 +311,31 @@ static const struct file_operations aztech_fops = {
.
owner
=
THIS_MODULE
,
.
open
=
video_exclusive_open
,
.
release
=
video_exclusive_release
,
.
ioctl
=
az_ioctl
,
.
ioctl
=
video_ioctl2
,
.
compat_ioctl
=
v4l_compat_ioctl32
,
.
llseek
=
no_llseek
,
};
static
struct
video_device
aztech_radio
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"Aztech radio"
,
.
type
=
VID_TYPE_TUNER
,
.
hardware
=
0
,
.
fops
=
&
aztech_fops
,
.
owner
=
THIS_MODULE
,
.
name
=
"Aztech radio"
,
.
type
=
VID_TYPE_TUNER
,
.
hardware
=
0
,
.
fops
=
&
aztech_fops
,
.
vidioc_querycap
=
vidioc_querycap
,
.
vidioc_g_tuner
=
vidioc_g_tuner
,
.
vidioc_s_tuner
=
vidioc_s_tuner
,
.
vidioc_g_frequency
=
vidioc_g_frequency
,
.
vidioc_s_frequency
=
vidioc_s_frequency
,
.
vidioc_queryctrl
=
vidioc_queryctrl
,
.
vidioc_g_ctrl
=
vidioc_g_ctrl
,
.
vidioc_s_ctrl
=
vidioc_s_ctrl
,
};
module_param_named
(
debug
,
aztech_radio
.
debug
,
int
,
0644
);
MODULE_PARM_DESC
(
debug
,
"activates debug info"
);
static
int
__init
aztech_init
(
void
)
{
if
(
io
==-
1
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录