Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
7b315bb4
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看板
提交
7b315bb4
编写于
8月 30, 2010
作者:
T
Takashi Iwai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ALSA: hda - Use new inputs[] field to parse input-pins for VIA codecs
Signed-off-by:
N
Takashi Iwai
<
tiwai@suse.de
>
上级
eea7dc93
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
73 addition
and
71 deletion
+73
-71
sound/pci/hda/patch_via.c
sound/pci/hda/patch_via.c
+73
-71
未找到文件。
sound/pci/hda/patch_via.c
浏览文件 @
7b315bb4
...
...
@@ -444,8 +444,8 @@ static hda_nid_t vt1812_adc_nids[2] = {
/* add dynamic controls */
static
int
via_add_control
(
struct
via_spec
*
spec
,
int
type
,
const
char
*
name
,
unsigned
long
val
)
static
int
__
via_add_control
(
struct
via_spec
*
spec
,
int
type
,
const
char
*
name
,
int
idx
,
unsigned
long
val
)
{
struct
snd_kcontrol_new
*
knew
;
...
...
@@ -463,6 +463,9 @@ static int via_add_control(struct via_spec *spec, int type, const char *name,
return
0
;
}
#define via_add_control(spec, type, name, val) \
__via_add_control(spec, type, name, 0, val)
static
struct
snd_kcontrol_new
*
via_clone_control
(
struct
via_spec
*
spec
,
struct
snd_kcontrol_new
*
tmpl
)
{
...
...
@@ -494,18 +497,18 @@ static void via_free_kctls(struct hda_codec *codec)
/* create input playback/capture controls for the given pin */
static
int
via_new_analog_input
(
struct
via_spec
*
spec
,
const
char
*
ctlname
,
int
idx
,
int
mix_nid
)
int
type_idx
,
int
idx
,
int
mix_nid
)
{
char
name
[
32
];
int
err
;
sprintf
(
name
,
"%s Playback Volume"
,
ctlname
);
err
=
via_add_control
(
spec
,
VIA_CTL_WIDGET_VOL
,
name
,
err
=
__via_add_control
(
spec
,
VIA_CTL_WIDGET_VOL
,
name
,
type_idx
,
HDA_COMPOSE_AMP_VAL
(
mix_nid
,
3
,
idx
,
HDA_INPUT
));
if
(
err
<
0
)
return
err
;
sprintf
(
name
,
"%s Playback Switch"
,
ctlname
);
err
=
via_add_control
(
spec
,
VIA_CTL_WIDGET_ANALOG_MUTE
,
name
,
err
=
__via_add_control
(
spec
,
VIA_CTL_WIDGET_ANALOG_MUTE
,
name
,
type_idx
,
HDA_COMPOSE_AMP_VAL
(
mix_nid
,
3
,
idx
,
HDA_INPUT
));
if
(
err
<
0
)
return
err
;
...
...
@@ -557,14 +560,12 @@ static int is_smart51_pins(struct via_spec *spec, hda_nid_t pin);
static
void
via_auto_init_analog_input
(
struct
hda_codec
*
codec
)
{
struct
via_spec
*
spec
=
codec
->
spec
;
const
struct
auto_pin_cfg
*
cfg
=
&
spec
->
autocfg
;
unsigned
int
ctl
;
int
i
;
for
(
i
=
0
;
i
<
AUTO_PIN_LAST
;
i
++
)
{
hda_nid_t
nid
=
spec
->
autocfg
.
input_pins
[
i
];
if
(
!
nid
)
continue
;
for
(
i
=
0
;
i
<
cfg
->
num_inputs
;
i
++
)
{
hda_nid_t
nid
=
cfg
->
inputs
[
i
].
pin
;
if
(
spec
->
smart51_enabled
&&
is_smart51_pins
(
spec
,
nid
))
ctl
=
PIN_OUT
;
else
if
(
i
<=
AUTO_PIN_FRONT_MIC
)
...
...
@@ -1322,15 +1323,14 @@ static void mute_aa_path(struct hda_codec *codec, int mute)
}
static
int
is_smart51_pins
(
struct
via_spec
*
spec
,
hda_nid_t
pin
)
{
int
res
=
0
;
int
index
;
for
(
index
=
AUTO_PIN_MIC
;
index
<
AUTO_PIN_FRONT_LINE
;
index
++
)
{
if
(
pin
==
spec
->
autocfg
.
input_pins
[
index
])
{
res
=
1
;
break
;
}
const
struct
auto_pin_cfg
*
cfg
=
&
spec
->
autocfg
;
int
i
;
for
(
i
=
0
;
i
<
cfg
->
num_inputs
;
i
++
)
{
if
(
pin
==
cfg
->
inputs
[
i
].
pin
)
return
cfg
->
inputs
[
i
].
type
<
AUTO_PIN_FRONT_LINE
;
}
return
res
;
return
0
;
}
static
int
via_smart51_info
(
struct
snd_kcontrol
*
kcontrol
,
...
...
@@ -1348,25 +1348,21 @@ static int via_smart51_get(struct snd_kcontrol *kcontrol,
{
struct
hda_codec
*
codec
=
snd_kcontrol_chip
(
kcontrol
);
struct
via_spec
*
spec
=
codec
->
spec
;
int
index
[]
=
{
AUTO_PIN_MIC
,
AUTO_PIN_FRONT_MIC
,
AUTO_PIN_LINE
}
;
const
struct
auto_pin_cfg
*
cfg
=
&
spec
->
autocfg
;
int
on
=
1
;
int
i
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
index
);
i
++
)
{
hda_nid_t
nid
=
spec
->
autocfg
.
input_pins
[
index
[
i
]];
if
(
nid
)
{
int
ctl
=
snd_hda_codec_read
(
codec
,
nid
,
0
,
AC_VERB_GET_PIN_WIDGET_CONTROL
,
0
);
if
(
i
==
AUTO_PIN_FRONT_MIC
&&
spec
->
hp_independent_mode
&&
spec
->
codec_type
!=
VT1718S
)
continue
;
/* ignore FMic for independent HP */
if
(
ctl
&
AC_PINCTL_IN_EN
&&
!
(
ctl
&
AC_PINCTL_OUT_EN
))
on
=
0
;
}
for
(
i
=
0
;
i
<
cfg
->
num_inputs
;
i
++
)
{
hda_nid_t
nid
=
cfg
->
inputs
[
i
].
pin
;
int
ctl
=
snd_hda_codec_read
(
codec
,
nid
,
0
,
AC_VERB_GET_PIN_WIDGET_CONTROL
,
0
);
if
(
cfg
->
inputs
[
i
].
type
>=
AUTO_PIN_FRONT_LINE
)
continue
;
if
(
cfg
->
inputs
[
i
].
type
==
AUTO_PIN_FRONT_MIC
&&
spec
->
hp_independent_mode
&&
spec
->
codec_type
!=
VT1718S
)
continue
;
/* ignore FMic for independent HP */
if
((
ctl
&
AC_PINCTL_IN_EN
)
&&
!
(
ctl
&
AC_PINCTL_OUT_EN
))
on
=
0
;
}
*
ucontrol
->
value
.
integer
.
value
=
on
;
return
0
;
...
...
@@ -1377,36 +1373,38 @@ static int via_smart51_put(struct snd_kcontrol *kcontrol,
{
struct
hda_codec
*
codec
=
snd_kcontrol_chip
(
kcontrol
);
struct
via_spec
*
spec
=
codec
->
spec
;
const
struct
auto_pin_cfg
*
cfg
=
&
spec
->
autocfg
;
int
out_in
=
*
ucontrol
->
value
.
integer
.
value
?
AC_PINCTL_OUT_EN
:
AC_PINCTL_IN_EN
;
int
index
[]
=
{
AUTO_PIN_MIC
,
AUTO_PIN_FRONT_MIC
,
AUTO_PIN_LINE
};
int
i
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
index
);
i
++
)
{
hda_nid_t
nid
=
spec
->
autocfg
.
input_pins
[
index
[
i
]];
if
(
i
==
AUTO_PIN_FRONT_MIC
&&
spec
->
hp_independent_mode
&&
spec
->
codec_type
!=
VT1718S
)
for
(
i
=
0
;
i
<
cfg
->
num_inputs
;
i
++
)
{
hda_nid_t
nid
=
cfg
->
inputs
[
i
].
pin
;
unsigned
int
parm
;
if
(
cfg
->
inputs
[
i
].
type
>=
AUTO_PIN_FRONT_LINE
)
continue
;
if
(
cfg
->
inputs
[
i
].
type
==
AUTO_PIN_FRONT_MIC
&&
spec
->
hp_independent_mode
&&
spec
->
codec_type
!=
VT1718S
)
continue
;
/* don't retask FMic for independent HP */
if
(
nid
)
{
unsigned
int
parm
=
snd_hda_codec_read
(
codec
,
nid
,
0
,
AC_VERB_GET_PIN_WIDGET_CONTROL
,
0
);
parm
&=
~
(
AC_PINCTL_IN_EN
|
AC_PINCTL_OUT_EN
);
parm
|=
out_in
;
snd_hda_codec_write
(
codec
,
nid
,
0
,
AC_VERB_SET_PIN_WIDGET_CONTROL
,
parm
);
if
(
out_in
==
AC_PINCTL_OUT_EN
)
{
mute_aa_path
(
codec
,
1
);
notify_aa_path_ctls
(
codec
);
}
if
(
spec
->
codec_type
==
VT1718S
)
snd_hda_codec_amp_stereo
(
parm
=
snd_hda_codec_read
(
codec
,
nid
,
0
,
AC_VERB_GET_PIN_WIDGET_CONTROL
,
0
);
parm
&=
~
(
AC_PINCTL_IN_EN
|
AC_PINCTL_OUT_EN
);
parm
|=
out_in
;
snd_hda_codec_write
(
codec
,
nid
,
0
,
AC_VERB_SET_PIN_WIDGET_CONTROL
,
parm
);
if
(
out_in
==
AC_PINCTL_OUT_EN
)
{
mute_aa_path
(
codec
,
1
);
notify_aa_path_ctls
(
codec
);
}
if
(
spec
->
codec_type
==
VT1718S
)
{
snd_hda_codec_amp_stereo
(
codec
,
nid
,
HDA_OUTPUT
,
0
,
HDA_AMP_MUTE
,
HDA_AMP_UNMUTE
);
}
if
(
i
==
AUTO_PIN_FRONT_MIC
)
{
if
(
cfg
->
inputs
[
i
].
type
==
AUTO_PIN_FRONT_MIC
)
{
if
(
spec
->
codec_type
==
VT1708S
||
spec
->
codec_type
==
VT1716S
)
{
/* input = index 1 (AOW3) */
...
...
@@ -1442,7 +1440,7 @@ static struct snd_kcontrol_new via_smart51_mixer[2] = {
static
int
via_smart51_build
(
struct
via_spec
*
spec
)
{
struct
snd_kcontrol_new
*
knew
;
int
index
[]
=
{
AUTO_PIN_MIC
,
AUTO_PIN_FRONT_MIC
,
AUTO_PIN_LINE
}
;
const
struct
auto_pin_cfg
*
cfg
=
&
spec
->
autocfg
;
hda_nid_t
nid
;
int
i
;
...
...
@@ -1450,13 +1448,14 @@ static int via_smart51_build(struct via_spec *spec)
if
(
knew
==
NULL
)
return
-
ENOMEM
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
index
)
;
i
++
)
{
nid
=
spec
->
autocfg
.
input_pins
[
index
[
i
]]
;
if
(
nid
)
{
for
(
i
=
0
;
i
<
cfg
->
num_inputs
;
i
++
)
{
nid
=
cfg
->
inputs
[
i
].
pin
;
if
(
cfg
->
inputs
[
i
].
type
<
AUTO_PIN_FRONT_LINE
)
{
knew
=
via_clone_control
(
spec
,
&
via_smart51_mixer
[
1
]);
if
(
knew
==
NULL
)
return
-
ENOMEM
;
knew
->
subdevice
=
nid
;
break
;
}
}
...
...
@@ -2419,7 +2418,7 @@ static int vt_auto_create_analog_input_ctls(struct via_spec *spec,
hda_nid_t
pin_idxs
[],
int
num_idxs
)
{
struct
hda_input_mux
*
imux
=
&
spec
->
private_imux
[
0
];
int
i
,
err
,
idx
;
int
i
,
err
,
idx
,
type
,
type_idx
=
0
;
/* for internal loopback recording select */
for
(
idx
=
0
;
idx
<
num_idxs
;
idx
++
)
{
...
...
@@ -2431,20 +2430,23 @@ static int vt_auto_create_analog_input_ctls(struct via_spec *spec,
}
}
for
(
i
=
0
;
i
<
AUTO_PIN_LAST
;
i
++
)
{
if
(
!
cfg
->
input_pins
[
i
])
continue
;
for
(
i
=
0
;
i
<
cfg
->
num_inputs
;
i
++
)
{
type
=
cfg
->
inputs
[
i
].
type
;
for
(
idx
=
0
;
idx
<
num_idxs
;
idx
++
)
if
(
pin_idxs
[
idx
]
==
cfg
->
input
_pins
[
i
]
)
if
(
pin_idxs
[
idx
]
==
cfg
->
input
s
[
i
].
pin
)
break
;
if
(
idx
>=
num_idxs
)
continue
;
err
=
via_new_analog_input
(
spec
,
auto_pin_cfg_labels
[
i
],
idx
,
cap_nid
);
if
(
i
>
0
&&
type
==
cfg
->
inputs
[
i
-
1
].
type
)
type_idx
++
;
else
type_idx
=
0
;
err
=
via_new_analog_input
(
spec
,
auto_pin_cfg_labels
[
type
],
type_idx
,
idx
,
cap_nid
);
if
(
err
<
0
)
return
err
;
imux
->
items
[
imux
->
num_items
].
label
=
auto_pin_cfg_labels
[
i
];
imux
->
items
[
imux
->
num_items
].
label
=
snd_hda_get_input_pin_label
(
cfg
,
i
);
imux
->
items
[
imux
->
num_items
].
index
=
idx
;
imux
->
num_items
++
;
}
...
...
@@ -5513,7 +5515,7 @@ static int vt2002P_auto_create_analog_input_ctls(struct via_spec *spec,
if
(
err
<
0
)
return
err
;
/* build volume/mute control of loopback */
err
=
via_new_analog_input
(
spec
,
"Stereo Mixer"
,
3
,
0x21
);
err
=
via_new_analog_input
(
spec
,
"Stereo Mixer"
,
0
,
3
,
0x21
);
if
(
err
<
0
)
return
err
;
...
...
@@ -5836,7 +5838,7 @@ static int vt1812_auto_create_analog_input_ctls(struct via_spec *spec,
return
err
;
/* build volume/mute control of loopback */
err
=
via_new_analog_input
(
spec
,
"Stereo Mixer"
,
5
,
0x21
);
err
=
via_new_analog_input
(
spec
,
"Stereo Mixer"
,
0
,
5
,
0x21
);
if
(
err
<
0
)
return
err
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录