Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
0186f4f4
Commit
0186f4f4
authored
Feb 07, 2013
by
Takashi Iwai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ALSA: hda - Use generic array for loopback list management
Signed-off-by:
Takashi Iwai
<
tiwai@suse.de
>
parent
46a14481
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
12 deletions
+17
-12
sound/pci/hda/hda_generic.c
sound/pci/hda/hda_generic.c
+11
-7
sound/pci/hda/hda_generic.h
sound/pci/hda/hda_generic.h
+1
-2
sound/pci/hda/patch_via.c
sound/pci/hda/patch_via.c
+5
-3
No files found.
sound/pci/hda/hda_generic.c
View file @
0186f4f4
...
@@ -42,6 +42,7 @@ int snd_hda_gen_spec_init(struct hda_gen_spec *spec)
...
@@ -42,6 +42,7 @@ int snd_hda_gen_spec_init(struct hda_gen_spec *spec)
{
{
snd_array_init
(
&
spec
->
kctls
,
sizeof
(
struct
snd_kcontrol_new
),
32
);
snd_array_init
(
&
spec
->
kctls
,
sizeof
(
struct
snd_kcontrol_new
),
32
);
snd_array_init
(
&
spec
->
paths
,
sizeof
(
struct
nid_path
),
8
);
snd_array_init
(
&
spec
->
paths
,
sizeof
(
struct
nid_path
),
8
);
snd_array_init
(
&
spec
->
loopback_list
,
sizeof
(
struct
hda_amp_list
),
8
);
mutex_init
(
&
spec
->
pcm_mutex
);
mutex_init
(
&
spec
->
pcm_mutex
);
return
0
;
return
0
;
}
}
...
@@ -82,6 +83,7 @@ void snd_hda_gen_spec_free(struct hda_gen_spec *spec)
...
@@ -82,6 +83,7 @@ void snd_hda_gen_spec_free(struct hda_gen_spec *spec)
return
;
return
;
free_kctls
(
spec
);
free_kctls
(
spec
);
snd_array_free
(
&
spec
->
paths
);
snd_array_free
(
&
spec
->
paths
);
snd_array_free
(
&
spec
->
loopback_list
);
}
}
EXPORT_SYMBOL_HDA
(
snd_hda_gen_spec_free
);
EXPORT_SYMBOL_HDA
(
snd_hda_gen_spec_free
);
...
@@ -2484,18 +2486,18 @@ static int create_in_jack_mode(struct hda_codec *codec, hda_nid_t pin)
...
@@ -2484,18 +2486,18 @@ static int create_in_jack_mode(struct hda_codec *codec, hda_nid_t pin)
*/
*/
/* add the powersave loopback-list entry */
/* add the powersave loopback-list entry */
static
void
add_loopback_list
(
struct
hda_gen_spec
*
spec
,
hda_nid_t
mix
,
int
idx
)
static
int
add_loopback_list
(
struct
hda_gen_spec
*
spec
,
hda_nid_t
mix
,
int
idx
)
{
{
struct
hda_amp_list
*
list
;
struct
hda_amp_list
*
list
;
if
(
spec
->
num_loopbacks
>=
ARRAY_SIZE
(
spec
->
loopback_list
)
-
1
)
list
=
snd_array_new
(
&
spec
->
loopback_list
);
return
;
if
(
!
list
)
list
=
spec
->
loopback_list
+
spec
->
num_loopbacks
;
return
-
ENOMEM
;
list
->
nid
=
mix
;
list
->
nid
=
mix
;
list
->
dir
=
HDA_INPUT
;
list
->
dir
=
HDA_INPUT
;
list
->
idx
=
idx
;
list
->
idx
=
idx
;
spec
->
num_loopbacks
++
;
spec
->
loopback
.
amplist
=
spec
->
loopback_list
.
list
;
spec
->
loopback
.
amplist
=
spec
->
loopback_list
;
return
0
;
}
}
/* create input playback/capture controls for the given pin */
/* create input playback/capture controls for the given pin */
...
@@ -2536,7 +2538,9 @@ static int new_analog_input(struct hda_codec *codec, int input_idx,
...
@@ -2536,7 +2538,9 @@ static int new_analog_input(struct hda_codec *codec, int input_idx,
}
}
path
->
active
=
true
;
path
->
active
=
true
;
add_loopback_list
(
spec
,
mix_nid
,
idx
);
err
=
add_loopback_list
(
spec
,
mix_nid
,
idx
);
if
(
err
<
0
)
return
err
;
if
(
spec
->
mixer_nid
!=
spec
->
mixer_merge_nid
&&
if
(
spec
->
mixer_nid
!=
spec
->
mixer_merge_nid
&&
!
spec
->
loopback_merge_path
)
{
!
spec
->
loopback_merge_path
)
{
...
...
sound/pci/hda/hda_generic.h
View file @
0186f4f4
...
@@ -228,8 +228,7 @@ struct hda_gen_spec {
...
@@ -228,8 +228,7 @@ struct hda_gen_spec {
struct
hda_vmaster_mute_hook
vmaster_mute
;
struct
hda_vmaster_mute_hook
vmaster_mute
;
struct
hda_loopback_check
loopback
;
struct
hda_loopback_check
loopback
;
int
num_loopbacks
;
struct
snd_array
loopback_list
;
struct
hda_amp_list
loopback_list
[
8
];
/* multi-io */
/* multi-io */
int
multi_ios
;
int
multi_ios
;
...
...
sound/pci/hda/patch_via.c
View file @
0186f4f4
...
@@ -355,10 +355,12 @@ static bool is_aa_path_mute(struct hda_codec *codec)
...
@@ -355,10 +355,12 @@ static bool is_aa_path_mute(struct hda_codec *codec)
{
{
struct
via_spec
*
spec
=
codec
->
spec
;
struct
via_spec
*
spec
=
codec
->
spec
;
const
struct
hda_amp_list
*
p
;
const
struct
hda_amp_list
*
p
;
int
i
,
ch
,
v
;
int
ch
,
v
;
for
(
i
=
0
;
i
<
spec
->
gen
.
num_loopbacks
;
i
++
)
{
p
=
spec
->
gen
.
loopback
.
amplist
;
p
=
&
spec
->
gen
.
loopback_list
[
i
];
if
(
!
p
)
return
true
;
for
(;
p
->
nid
;
p
++
)
{
for
(
ch
=
0
;
ch
<
2
;
ch
++
)
{
for
(
ch
=
0
;
ch
<
2
;
ch
++
)
{
v
=
snd_hda_codec_amp_read
(
codec
,
p
->
nid
,
ch
,
p
->
dir
,
v
=
snd_hda_codec_amp_read
(
codec
,
p
->
nid
,
ch
,
p
->
dir
,
p
->
idx
);
p
->
idx
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment