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
nexedi
linux
Commits
f339240d
Commit
f339240d
authored
Nov 27, 2011
by
Takashi Iwai
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix/hda' into for-linus
parents
77088cc9
187d333e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
46 deletions
+56
-46
sound/pci/hda/patch_cirrus.c
sound/pci/hda/patch_cirrus.c
+1
-1
sound/pci/hda/patch_realtek.c
sound/pci/hda/patch_realtek.c
+12
-12
sound/pci/hda/patch_via.c
sound/pci/hda/patch_via.c
+43
-33
No files found.
sound/pci/hda/patch_cirrus.c
View file @
f339240d
...
...
@@ -1278,7 +1278,7 @@ static const char * const cs420x_models[CS420X_MODELS] = {
[
CS420X_MBP53
]
=
"mbp53"
,
[
CS420X_MBP55
]
=
"mbp55"
,
[
CS420X_IMAC27
]
=
"imac27"
,
[
CS420X_
IMAC27
]
=
"apple"
,
[
CS420X_
APPLE
]
=
"apple"
,
[
CS420X_AUTO
]
=
"auto"
,
};
...
...
sound/pci/hda/patch_realtek.c
View file @
f339240d
...
...
@@ -277,6 +277,12 @@ static bool alc_dyn_adc_pcm_resetup(struct hda_codec *codec, int cur)
return
false
;
}
static
inline
hda_nid_t
get_capsrc
(
struct
alc_spec
*
spec
,
int
idx
)
{
return
spec
->
capsrc_nids
?
spec
->
capsrc_nids
[
idx
]
:
spec
->
adc_nids
[
idx
];
}
/* select the given imux item; either unmute exclusively or select the route */
static
int
alc_mux_select
(
struct
hda_codec
*
codec
,
unsigned
int
adc_idx
,
unsigned
int
idx
,
bool
force
)
...
...
@@ -303,8 +309,7 @@ static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx,
adc_idx
=
spec
->
dyn_adc_idx
[
idx
];
}
nid
=
spec
->
capsrc_nids
?
spec
->
capsrc_nids
[
adc_idx
]
:
spec
->
adc_nids
[
adc_idx
];
nid
=
get_capsrc
(
spec
,
adc_idx
);
/* no selection? */
num_conns
=
snd_hda_get_conn_list
(
codec
,
nid
,
NULL
);
...
...
@@ -1058,8 +1063,7 @@ static bool alc_rebuild_imux_for_auto_mic(struct hda_codec *codec)
hda_nid_t
pin
=
spec
->
imux_pins
[
i
];
int
c
;
for
(
c
=
0
;
c
<
spec
->
num_adc_nids
;
c
++
)
{
hda_nid_t
cap
=
spec
->
capsrc_nids
?
spec
->
capsrc_nids
[
c
]
:
spec
->
adc_nids
[
c
];
hda_nid_t
cap
=
get_capsrc
(
spec
,
c
);
int
idx
=
get_connection_index
(
codec
,
cap
,
pin
);
if
(
idx
>=
0
)
{
imux
->
items
[
i
].
index
=
idx
;
...
...
@@ -1969,10 +1973,8 @@ static int alc_build_controls(struct hda_codec *codec)
if
(
!
kctl
)
kctl
=
snd_hda_find_mixer_ctl
(
codec
,
"Input Source"
);
for
(
i
=
0
;
kctl
&&
i
<
kctl
->
count
;
i
++
)
{
const
hda_nid_t
*
nids
=
spec
->
capsrc_nids
;
if
(
!
nids
)
nids
=
spec
->
adc_nids
;
err
=
snd_hda_add_nid
(
codec
,
kctl
,
i
,
nids
[
i
]);
err
=
snd_hda_add_nid
(
codec
,
kctl
,
i
,
get_capsrc
(
spec
,
i
));
if
(
err
<
0
)
return
err
;
}
...
...
@@ -2759,8 +2761,7 @@ static int alc_auto_create_input_ctls(struct hda_codec *codec)
}
for
(
c
=
0
;
c
<
num_adcs
;
c
++
)
{
hda_nid_t
cap
=
spec
->
capsrc_nids
?
spec
->
capsrc_nids
[
c
]
:
spec
->
adc_nids
[
c
];
hda_nid_t
cap
=
get_capsrc
(
spec
,
c
);
idx
=
get_connection_index
(
codec
,
cap
,
pin
);
if
(
idx
>=
0
)
{
spec
->
imux_pins
[
imux
->
num_items
]
=
pin
;
...
...
@@ -3706,8 +3707,7 @@ static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin)
if
(
!
pin
)
return
0
;
for
(
i
=
0
;
i
<
spec
->
num_adc_nids
;
i
++
)
{
hda_nid_t
cap
=
spec
->
capsrc_nids
?
spec
->
capsrc_nids
[
i
]
:
spec
->
adc_nids
[
i
];
hda_nid_t
cap
=
get_capsrc
(
spec
,
i
);
int
idx
;
idx
=
get_connection_index
(
codec
,
cap
,
pin
);
...
...
sound/pci/hda/patch_via.c
View file @
f339240d
...
...
@@ -208,6 +208,7 @@ struct via_spec {
/* work to check hp jack state */
struct
hda_codec
*
codec
;
struct
delayed_work
vt1708_hp_work
;
int
hp_work_active
;
int
vt1708_jack_detect
;
int
vt1708_hp_present
;
...
...
@@ -305,27 +306,35 @@ enum {
static
void
analog_low_current_mode
(
struct
hda_codec
*
codec
);
static
bool
is_aa_path_mute
(
struct
hda_codec
*
codec
);
static
void
vt1708_start_hp_work
(
struct
via_spec
*
spec
)
#define hp_detect_with_aa(codec) \
(snd_hda_get_bool_hint(codec, "analog_loopback_hp_detect") == 1 && \
!is_aa_path_mute(codec))
static
void
vt1708_stop_hp_work
(
struct
via_spec
*
spec
)
{
if
(
spec
->
codec_type
!=
VT1708
||
spec
->
autocfg
.
hp_pins
[
0
]
==
0
)
return
;
snd_hda_codec_write
(
spec
->
codec
,
0x1
,
0
,
0xf81
,
!
spec
->
vt1708_jack_detect
);
if
(
!
delayed_work_pending
(
&
spec
->
vt1708_hp_work
))
s
chedule_delayed_work
(
&
spec
->
vt1708_hp_work
,
msecs_to_jiffies
(
100
));
if
(
spec
->
hp_work_active
)
{
snd_hda_codec_write
(
spec
->
codec
,
0x1
,
0
,
0xf81
,
1
);
cancel_delayed_work_sync
(
&
spec
->
vt1708_hp_work
);
s
pec
->
hp_work_active
=
0
;
}
}
static
void
vt1708_
stop
_hp_work
(
struct
via_spec
*
spec
)
static
void
vt1708_
update
_hp_work
(
struct
via_spec
*
spec
)
{
if
(
spec
->
codec_type
!=
VT1708
||
spec
->
autocfg
.
hp_pins
[
0
]
==
0
)
return
;
if
(
snd_hda_get_bool_hint
(
spec
->
codec
,
"analog_loopback_hp_detect"
)
==
1
&&
!
is_aa_path_mute
(
spec
->
codec
))
return
;
snd_hda_codec_write
(
spec
->
codec
,
0x1
,
0
,
0xf81
,
!
spec
->
vt1708_jack_detect
);
cancel_delayed_work_sync
(
&
spec
->
vt1708_hp_work
);
if
(
spec
->
vt1708_jack_detect
&&
(
spec
->
active_streams
||
hp_detect_with_aa
(
spec
->
codec
)))
{
if
(
!
spec
->
hp_work_active
)
{
snd_hda_codec_write
(
spec
->
codec
,
0x1
,
0
,
0xf81
,
0
);
schedule_delayed_work
(
&
spec
->
vt1708_hp_work
,
msecs_to_jiffies
(
100
));
spec
->
hp_work_active
=
1
;
}
}
else
if
(
!
hp_detect_with_aa
(
spec
->
codec
))
vt1708_stop_hp_work
(
spec
);
}
static
void
set_widgets_power_state
(
struct
hda_codec
*
codec
)
...
...
@@ -343,12 +352,7 @@ static int analog_input_switch_put(struct snd_kcontrol *kcontrol,
set_widgets_power_state
(
codec
);
analog_low_current_mode
(
snd_kcontrol_chip
(
kcontrol
));
if
(
snd_hda_get_bool_hint
(
codec
,
"analog_loopback_hp_detect"
)
==
1
)
{
if
(
is_aa_path_mute
(
codec
))
vt1708_start_hp_work
(
codec
->
spec
);
else
vt1708_stop_hp_work
(
codec
->
spec
);
}
vt1708_update_hp_work
(
codec
->
spec
);
return
change
;
}
...
...
@@ -1154,7 +1158,7 @@ static int via_playback_multi_pcm_prepare(struct hda_pcm_stream *hinfo,
spec
->
cur_dac_stream_tag
=
stream_tag
;
spec
->
cur_dac_format
=
format
;
mutex_unlock
(
&
spec
->
config_mutex
);
vt1708_
start
_hp_work
(
spec
);
vt1708_
update
_hp_work
(
spec
);
return
0
;
}
...
...
@@ -1174,7 +1178,7 @@ static int via_playback_hp_pcm_prepare(struct hda_pcm_stream *hinfo,
spec
->
cur_hp_stream_tag
=
stream_tag
;
spec
->
cur_hp_format
=
format
;
mutex_unlock
(
&
spec
->
config_mutex
);
vt1708_
start
_hp_work
(
spec
);
vt1708_
update
_hp_work
(
spec
);
return
0
;
}
...
...
@@ -1188,7 +1192,7 @@ static int via_playback_multi_pcm_cleanup(struct hda_pcm_stream *hinfo,
snd_hda_multi_out_analog_cleanup
(
codec
,
&
spec
->
multiout
);
spec
->
active_streams
&=
~
STREAM_MULTI_OUT
;
mutex_unlock
(
&
spec
->
config_mutex
);
vt1708_
stop
_hp_work
(
spec
);
vt1708_
update
_hp_work
(
spec
);
return
0
;
}
...
...
@@ -1203,7 +1207,7 @@ static int via_playback_hp_pcm_cleanup(struct hda_pcm_stream *hinfo,
snd_hda_codec_setup_stream
(
codec
,
spec
->
hp_dac_nid
,
0
,
0
,
0
);
spec
->
active_streams
&=
~
STREAM_INDEP_HP
;
mutex_unlock
(
&
spec
->
config_mutex
);
vt1708_
stop
_hp_work
(
spec
);
vt1708_
update
_hp_work
(
spec
);
return
0
;
}
...
...
@@ -1645,7 +1649,8 @@ static void via_hp_automute(struct hda_codec *codec)
int
nums
;
struct
via_spec
*
spec
=
codec
->
spec
;
if
(
!
spec
->
hp_independent_mode
&&
spec
->
autocfg
.
hp_pins
[
0
])
if
(
!
spec
->
hp_independent_mode
&&
spec
->
autocfg
.
hp_pins
[
0
]
&&
(
spec
->
codec_type
!=
VT1708
||
spec
->
vt1708_jack_detect
))
present
=
snd_hda_jack_detect
(
codec
,
spec
->
autocfg
.
hp_pins
[
0
]);
if
(
spec
->
smart51_enabled
)
...
...
@@ -2612,8 +2617,6 @@ static int vt1708_jack_detect_get(struct snd_kcontrol *kcontrol,
if
(
spec
->
codec_type
!=
VT1708
)
return
0
;
spec
->
vt1708_jack_detect
=
!
((
snd_hda_codec_read
(
codec
,
0x1
,
0
,
0xf84
,
0
)
>>
8
)
&
0x1
);
ucontrol
->
value
.
integer
.
value
[
0
]
=
spec
->
vt1708_jack_detect
;
return
0
;
}
...
...
@@ -2623,18 +2626,22 @@ static int vt1708_jack_detect_put(struct snd_kcontrol *kcontrol,
{
struct
hda_codec
*
codec
=
snd_kcontrol_chip
(
kcontrol
);
struct
via_spec
*
spec
=
codec
->
spec
;
int
change
;
int
val
;
if
(
spec
->
codec_type
!=
VT1708
)
return
0
;
spec
->
vt1708_jack_detect
=
ucontrol
->
value
.
integer
.
value
[
0
];
change
=
(
0x1
&
(
snd_hda_codec_read
(
codec
,
0x1
,
0
,
0xf84
,
0
)
>>
8
))
==
!
spec
->
vt1708_jack_detect
;
if
(
spec
->
vt1708_jack_detect
)
{
val
=
!!
ucontrol
->
value
.
integer
.
value
[
0
];
if
(
spec
->
vt1708_jack_detect
==
val
)
return
0
;
spec
->
vt1708_jack_detect
=
val
;
if
(
spec
->
vt1708_jack_detect
&&
snd_hda_get_bool_hint
(
codec
,
"analog_loopback_hp_detect"
)
!=
1
)
{
mute_aa_path
(
codec
,
1
);
notify_aa_path_ctls
(
codec
);
}
return
change
;
via_hp_automute
(
codec
);
vt1708_update_hp_work
(
spec
);
return
1
;
}
static
const
struct
snd_kcontrol_new
vt1708_jack_detect_ctl
=
{
...
...
@@ -2771,6 +2778,7 @@ static int via_init(struct hda_codec *codec)
via_auto_init_unsol_event
(
codec
);
via_hp_automute
(
codec
);
vt1708_update_hp_work
(
spec
);
return
0
;
}
...
...
@@ -2787,7 +2795,9 @@ static void vt1708_update_hp_jack_state(struct work_struct *work)
spec
->
vt1708_hp_present
^=
1
;
via_hp_automute
(
spec
->
codec
);
}
vt1708_start_hp_work
(
spec
);
if
(
spec
->
vt1708_jack_detect
)
schedule_delayed_work
(
&
spec
->
vt1708_hp_work
,
msecs_to_jiffies
(
100
));
}
static
int
get_mux_nids
(
struct
hda_codec
*
codec
)
...
...
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