Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
5eba3571
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 3 年多
通知
13
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看板
提交
5eba3571
编写于
8月 25, 2006
作者:
M
Mauro Carvalho Chehab
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
V4L/DVB (6420): V4L2 conversion for tda9875 from V4L1 API
Signed-off-by:
N
Mauro Carvalho Chehab
<
mchehab@infradead.org
>
上级
7a00d45c
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
112 addition
and
55 deletion
+112
-55
drivers/media/video/tda9875.c
drivers/media/video/tda9875.c
+112
-55
未找到文件。
drivers/media/video/tda9875.c
浏览文件 @
5eba3571
...
...
@@ -7,6 +7,7 @@
*
* Copyright (c) 2000 Guillaume Delvit based on Gerd Knorr source and
* Eric Sandeen
* Copyright (c) 2006 Mauro Carvalho Chehab <mchehab@infradead.org>
* This code is placed under the terms of the GNU General Public License
* Based on tda9855.c by Steve VanDeBogart (vandebo@uclink.berkeley.edu)
* Which was based on tda8425.c by Greg Alexander (c) 1998
...
...
@@ -268,53 +269,95 @@ static int tda9875_detach(struct i2c_client *client)
return
0
;
}
static
int
tda9875_
command
(
struct
i2c_client
*
client
,
unsigned
int
cmd
,
void
*
arg
)
static
int
tda9875_
get_ctrl
(
struct
i2c_client
*
client
,
struct
v4l2_control
*
ctrl
)
{
struct
tda9875
*
t
=
i2c_get_clientdata
(
client
);
dprintk
(
"In tda9875_command...
\n
"
);
switch
(
ctrl
->
id
)
{
case
V4L2_CID_AUDIO_VOLUME
:
{
int
left
=
(
t
->
lvol
+
84
)
*
606
;
int
right
=
(
t
->
rvol
+
84
)
*
606
;
switch
(
cmd
)
{
/* --- v4l ioctls --- */
/* take care: bttv does userspace copying, we'll get a
kernel pointer here... */
case
VIDIOCGAUDIO
:
ctrl
->
value
=
max
(
left
,
right
);
return
0
;
}
case
V4L2_CID_AUDIO_BALANCE
:
{
struct
video_audio
*
va
=
arg
;
int
left
,
right
;
int
left
=
(
t
->
lvol
+
84
)
*
606
;
int
right
=
(
t
->
rvol
+
84
)
*
606
;
int
volume
=
max
(
left
,
right
);
int
balance
=
(
32768
*
min
(
left
,
right
))
/
(
volume
?
volume
:
1
);
ctrl
->
value
=
(
left
<
right
)
?
(
65535
-
balance
)
:
balance
;
return
0
;
}
case
V4L2_CID_AUDIO_BASS
:
ctrl
->
value
=
(
t
->
bass
+
12
)
*
2427
;
/* min -12 max +15 */
return
0
;
case
V4L2_CID_AUDIO_TREBLE
:
ctrl
->
value
=
(
t
->
treble
+
12
)
*
2730
;
/* min -12 max +12 */
return
0
;
}
return
-
EINVAL
;
}
static
int
tda9875_set_ctrl
(
struct
i2c_client
*
client
,
struct
v4l2_control
*
ctrl
)
{
struct
tda9875
*
t
=
i2c_get_clientdata
(
client
);
int
chvol
=
0
,
volume
,
balance
,
left
,
right
;
switch
(
ctrl
->
id
)
{
case
V4L2_CID_AUDIO_VOLUME
:
left
=
(
t
->
lvol
+
84
)
*
606
;
right
=
(
t
->
rvol
+
84
)
*
606
;
dprintk
(
"VIDIOCGAUDIO
\n
"
);
volume
=
max
(
left
,
right
);
balance
=
(
32768
*
min
(
left
,
right
))
/
(
volume
?
volume
:
1
);
balance
=
(
left
<
right
)
?
(
65535
-
balance
)
:
balance
;
va
->
flags
|=
VIDEO_AUDIO_VOLUME
|
VIDEO_AUDIO_BASS
|
VIDEO_AUDIO_TREBLE
;
volume
=
ctrl
->
value
;
/* min is -84 max is 24 */
chvol
=
1
;
break
;
case
V4L2_CID_AUDIO_BALANCE
:
left
=
(
t
->
lvol
+
84
)
*
606
;
right
=
(
t
->
rvol
+
84
)
*
606
;
va
->
volume
=
max
(
left
,
right
);
va
->
balance
=
(
32768
*
min
(
left
,
right
))
/
(
va
->
volume
?
va
->
volume
:
1
);
va
->
balance
=
(
left
<
right
)
?
(
65535
-
va
->
balance
)
:
va
->
balance
;
va
->
bass
=
(
t
->
bass
+
12
)
*
2427
;
/* min -12 max +15 */
va
->
treble
=
(
t
->
treble
+
12
)
*
2730
;
/* min -12 max +12 */
va
->
mode
|=
VIDEO_SOUND_MONO
;
break
;
/* VIDIOCGAUDIO case */
volume
=
max
(
left
,
right
);
balance
=
ctrl
->
value
;
chvol
=
1
;
break
;
case
V4L2_CID_AUDIO_BASS
:
t
->
bass
=
((
ctrl
->
value
/
2400
)
-
12
)
&
0xff
;
if
(
t
->
bass
>
15
)
t
->
bass
=
15
;
if
(
t
->
bass
<
-
12
)
t
->
bass
=
-
12
&
0xff
;
break
;
case
V4L2_CID_AUDIO_TREBLE
:
t
->
treble
=
((
ctrl
->
value
/
2700
)
-
12
)
&
0xff
;
if
(
t
->
treble
>
12
)
t
->
treble
=
12
;
if
(
t
->
treble
<
-
12
)
t
->
treble
=
-
12
&
0xff
;
break
;
default:
return
-
EINVAL
;
}
case
VIDIOCSAUDIO
:
{
struct
video_audio
*
va
=
arg
;
int
left
,
right
;
dprintk
(
"VIDEOCSAUDIO...
\n
"
);
left
=
(
min
(
65536
-
va
->
balance
,
32768
)
*
va
->
volume
)
/
32768
;
right
=
(
min
(
va
->
balance
,(
__u16
)
32768
)
*
va
->
volume
)
/
32768
;
if
(
chvol
)
{
left
=
(
min
(
65536
-
balance
,
32768
)
*
volume
)
/
32768
;
right
=
(
min
(
balance
,
32768
)
*
volume
)
/
32768
;
t
->
lvol
=
((
left
/
606
)
-
84
)
&
0xff
;
if
(
t
->
lvol
>
24
)
t
->
lvol
=
24
;
...
...
@@ -326,29 +369,43 @@ static int tda9875_command(struct i2c_client *client,
t
->
rvol
=
24
;
if
(
t
->
rvol
<
-
84
)
t
->
rvol
=
-
84
&
0xff
;
}
t
->
bass
=
((
va
->
bass
/
2400
)
-
12
)
&
0xff
;
if
(
t
->
bass
>
15
)
t
->
bass
=
15
;
if
(
t
->
bass
<
-
12
)
t
->
bass
=
-
12
&
0xff
;
t
->
treble
=
((
va
->
treble
/
2700
)
-
12
)
&
0xff
;
if
(
t
->
treble
>
12
)
t
->
treble
=
12
;
if
(
t
->
treble
<
-
12
)
t
->
treble
=
-
12
&
0xff
;
//printk("tda9875 bal:%04x vol:%04x bass:%04x treble:%04x\n",va->balance,va->volume,va->bass,va->treble);
tda9875_set
(
client
);
//printk("tda9875 bal:%04x vol:%04x bass:%04x treble:%04x\n",va->balance,va->volume,va->bass,va->treble);
return
0
;
}
tda9875_set
(
client
);
static
int
tda9875_command
(
struct
i2c_client
*
client
,
unsigned
int
cmd
,
void
*
arg
)
{
dprintk
(
"In tda9875_command...
\n
"
);
break
;
switch
(
cmd
)
{
/* --- v4l ioctls --- */
/* take care: bttv does userspace copying, we'll get a
kernel pointer here... */
case
VIDIOC_QUERYCTRL
:
{
struct
v4l2_queryctrl
*
qc
=
arg
;
switch
(
qc
->
id
)
{
case
V4L2_CID_AUDIO_VOLUME
:
case
V4L2_CID_AUDIO_BASS
:
case
V4L2_CID_AUDIO_TREBLE
:
default:
return
-
EINVAL
;
}
return
v4l2_ctrl_query_fill_std
(
qc
);
}
case
VIDIOC_S_CTRL
:
return
tda9875_set_ctrl
(
client
,
arg
);
}
/* end of VIDEOCSAUDIO case */
case
VIDIOC_G_CTRL
:
return
tda9875_get_ctrl
(
client
,
arg
);
default:
/* Not VIDEOCGAUDIO or VIDEOCSAUDIO */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录