Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
43131a2c
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看板
提交
43131a2c
编写于
6月 19, 2011
作者:
M
Mauro Carvalho Chehab
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[media] em28xx-audio: add support for mute controls
Signed-off-by:
N
Mauro Carvalho Chehab
<
mchehab@redhat.com
>
上级
850d24a5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
73 addition
and
14 deletion
+73
-14
drivers/media/video/em28xx/em28xx-audio.c
drivers/media/video/em28xx/em28xx-audio.c
+73
-14
未找到文件。
drivers/media/video/em28xx/em28xx-audio.c
浏览文件 @
43131a2c
...
...
@@ -448,8 +448,6 @@ static int em28xx_vol_info(struct snd_kcontrol *kcontrol,
return
0
;
}
/* FIXME: should also add mute controls for each */
static
int
em28xx_vol_put
(
struct
snd_kcontrol
*
kcontrol
,
struct
snd_ctl_elem_value
*
value
)
{
...
...
@@ -463,7 +461,7 @@ static int em28xx_vol_put(struct snd_kcontrol *kcontrol,
if
(
rc
<
0
)
goto
err
;
val
|=
rc
&
0x80
80
;
/* Preserve the mute flags
*/
val
|=
rc
&
0x80
00
;
/* Preserve the mute flag
*/
rc
=
em28xx_write_ac97
(
dev
,
kcontrol
->
private_value
,
val
);
...
...
@@ -490,25 +488,87 @@ static int em28xx_vol_get(struct snd_kcontrol *kcontrol,
return
0
;
}
static
int
em28xx_vol_put_mute
(
struct
snd_kcontrol
*
kcontrol
,
struct
snd_ctl_elem_value
*
value
)
{
struct
em28xx
*
dev
=
snd_kcontrol_chip
(
kcontrol
);
u16
val
=
value
->
value
.
integer
.
value
[
0
];
int
rc
;
mutex_lock
(
&
dev
->
lock
);
rc
=
em28xx_read_ac97
(
dev
,
kcontrol
->
private_value
);
if
(
rc
<
0
)
goto
err
;
if
(
val
)
rc
|=
0x8000
;
else
rc
&=
0x7f7f
;
rc
=
em28xx_write_ac97
(
dev
,
kcontrol
->
private_value
,
rc
);
err:
mutex_unlock
(
&
dev
->
lock
);
return
rc
;
}
static
int
em28xx_vol_get_mute
(
struct
snd_kcontrol
*
kcontrol
,
struct
snd_ctl_elem_value
*
value
)
{
struct
em28xx
*
dev
=
snd_kcontrol_chip
(
kcontrol
);
int
val
;
mutex_lock
(
&
dev
->
lock
);
val
=
em28xx_read_ac97
(
dev
,
kcontrol
->
private_value
);
mutex_unlock
(
&
dev
->
lock
);
if
(
val
<
0
)
return
val
;
if
(
val
&
0x8000
)
value
->
value
.
integer
.
value
[
0
]
=
1
;
else
value
->
value
.
integer
.
value
[
0
]
=
0
;
return
0
;
}
static
const
DECLARE_TLV_DB_SCALE
(
em28xx_db_scale
,
-
3450
,
150
,
0
);
static
int
em28xx_cvol_new
(
struct
snd_card
*
card
,
struct
em28xx
*
dev
,
char
*
name
,
int
id
)
{
int
err
;
char
ctl_name
[
44
];
struct
snd_kcontrol
*
kctl
;
struct
snd_kcontrol_new
tmp
=
{
.
iface
=
SNDRV_CTL_ELEM_IFACE_MIXER
,
.
name
=
name
,
.
info
=
em28xx_vol_info
,
.
get
=
em28xx_vol_get
,
.
put
=
em28xx_vol_put
,
.
private_value
=
id
,
.
tlv
.
p
=
em28xx_db_scale
,
};
struct
snd_kcontrol_new
tmp
;
memset
(
&
tmp
,
0
,
sizeof
(
tmp
));
tmp
.
iface
=
SNDRV_CTL_ELEM_IFACE_MIXER
,
tmp
.
private_value
=
id
,
tmp
.
name
=
ctl_name
,
/* Add Mute Control */
sprintf
(
ctl_name
,
"%s Switch"
,
name
);
tmp
.
get
=
em28xx_vol_get_mute
;
tmp
.
put
=
em28xx_vol_put_mute
;
tmp
.
info
=
snd_ctl_boolean_mono_info
;
kctl
=
snd_ctl_new1
(
&
tmp
,
dev
);
err
=
snd_ctl_add
(
card
,
kctl
);
if
(
err
<
0
)
return
err
;
memset
(
&
tmp
,
0
,
sizeof
(
tmp
));
tmp
.
iface
=
SNDRV_CTL_ELEM_IFACE_MIXER
,
tmp
.
private_value
=
id
,
tmp
.
name
=
ctl_name
,
/* Add Volume Control */
sprintf
(
ctl_name
,
"%s Volume"
,
name
);
tmp
.
get
=
em28xx_vol_get
;
tmp
.
put
=
em28xx_vol_put
;
tmp
.
info
=
em28xx_vol_info
;
tmp
.
tlv
.
p
=
em28xx_db_scale
,
kctl
=
snd_ctl_new1
(
&
tmp
,
dev
);
err
=
snd_ctl_add
(
card
,
kctl
);
if
(
err
<
0
)
return
err
;
...
...
@@ -516,7 +576,6 @@ static int em28xx_cvol_new(struct snd_card *card, struct em28xx *dev,
return
0
;
}
/*
* register/unregister code and data
*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录