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
433e8327
Commit
433e8327
authored
Mar 16, 2011
by
Takashi Iwai
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'topic/hda' into for-linus
parents
27b92d4f
cc90fd72
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
417 additions
and
509 deletions
+417
-509
sound/pci/hda/hda_codec.c
sound/pci/hda/hda_codec.c
+105
-0
sound/pci/hda/hda_codec.h
sound/pci/hda/hda_codec.h
+5
-0
sound/pci/hda/hda_intel.c
sound/pci/hda/hda_intel.c
+5
-2
sound/pci/hda/hda_local.h
sound/pci/hda/hda_local.h
+24
-0
sound/pci/hda/patch_analog.c
sound/pci/hda/patch_analog.c
+10
-107
sound/pci/hda/patch_conexant.c
sound/pci/hda/patch_conexant.c
+14
-110
sound/pci/hda/patch_hdmi.c
sound/pci/hda/patch_hdmi.c
+13
-9
sound/pci/hda/patch_realtek.c
sound/pci/hda/patch_realtek.c
+79
-125
sound/pci/hda/patch_sigmatel.c
sound/pci/hda/patch_sigmatel.c
+162
-156
No files found.
sound/pci/hda/hda_codec.c
View file @
433e8327
...
...
@@ -29,6 +29,7 @@
#include <sound/asoundef.h>
#include <sound/tlv.h>
#include <sound/initval.h>
#include <sound/jack.h>
#include "hda_local.h"
#include "hda_beep.h"
#include <sound/hda_hwdep.h>
...
...
@@ -4959,5 +4960,109 @@ void snd_print_pcm_bits(int pcm, char *buf, int buflen)
}
EXPORT_SYMBOL_HDA
(
snd_print_pcm_bits
);
#ifdef CONFIG_SND_HDA_INPUT_JACK
/*
* Input-jack notification support
*/
struct
hda_jack_item
{
hda_nid_t
nid
;
int
type
;
struct
snd_jack
*
jack
;
};
static
const
char
*
get_jack_default_name
(
struct
hda_codec
*
codec
,
hda_nid_t
nid
,
int
type
)
{
switch
(
type
)
{
case
SND_JACK_HEADPHONE
:
return
"Headphone"
;
case
SND_JACK_MICROPHONE
:
return
"Mic"
;
case
SND_JACK_LINEOUT
:
return
"Line-out"
;
case
SND_JACK_HEADSET
:
return
"Headset"
;
default:
return
"Misc"
;
}
}
static
void
hda_free_jack_priv
(
struct
snd_jack
*
jack
)
{
struct
hda_jack_item
*
jacks
=
jack
->
private_data
;
jacks
->
nid
=
0
;
jacks
->
jack
=
NULL
;
}
int
snd_hda_input_jack_add
(
struct
hda_codec
*
codec
,
hda_nid_t
nid
,
int
type
,
const
char
*
name
)
{
struct
hda_jack_item
*
jack
;
int
err
;
snd_array_init
(
&
codec
->
jacks
,
sizeof
(
*
jack
),
32
);
jack
=
snd_array_new
(
&
codec
->
jacks
);
if
(
!
jack
)
return
-
ENOMEM
;
jack
->
nid
=
nid
;
jack
->
type
=
type
;
if
(
!
name
)
name
=
get_jack_default_name
(
codec
,
nid
,
type
);
err
=
snd_jack_new
(
codec
->
bus
->
card
,
name
,
type
,
&
jack
->
jack
);
if
(
err
<
0
)
{
jack
->
nid
=
0
;
return
err
;
}
jack
->
jack
->
private_data
=
jack
;
jack
->
jack
->
private_free
=
hda_free_jack_priv
;
return
0
;
}
EXPORT_SYMBOL_HDA
(
snd_hda_input_jack_add
);
void
snd_hda_input_jack_report
(
struct
hda_codec
*
codec
,
hda_nid_t
nid
)
{
struct
hda_jack_item
*
jacks
=
codec
->
jacks
.
list
;
int
i
;
if
(
!
jacks
)
return
;
for
(
i
=
0
;
i
<
codec
->
jacks
.
used
;
i
++
,
jacks
++
)
{
unsigned
int
pin_ctl
;
unsigned
int
present
;
int
type
;
if
(
jacks
->
nid
!=
nid
)
continue
;
present
=
snd_hda_jack_detect
(
codec
,
nid
);
type
=
jacks
->
type
;
if
(
type
==
(
SND_JACK_HEADPHONE
|
SND_JACK_LINEOUT
))
{
pin_ctl
=
snd_hda_codec_read
(
codec
,
nid
,
0
,
AC_VERB_GET_PIN_WIDGET_CONTROL
,
0
);
type
=
(
pin_ctl
&
AC_PINCTL_HP_EN
)
?
SND_JACK_HEADPHONE
:
SND_JACK_LINEOUT
;
}
snd_jack_report
(
jacks
->
jack
,
present
?
type
:
0
);
}
}
EXPORT_SYMBOL_HDA
(
snd_hda_input_jack_report
);
/* free jack instances manually when clearing/reconfiguring */
void
snd_hda_input_jack_free
(
struct
hda_codec
*
codec
)
{
if
(
!
codec
->
bus
->
shutdown
&&
codec
->
jacks
.
list
)
{
struct
hda_jack_item
*
jacks
=
codec
->
jacks
.
list
;
int
i
;
for
(
i
=
0
;
i
<
codec
->
jacks
.
used
;
i
++
,
jacks
++
)
{
if
(
jacks
->
jack
)
snd_device_free
(
codec
->
bus
->
card
,
jacks
->
jack
);
}
}
snd_array_free
(
&
codec
->
jacks
);
}
EXPORT_SYMBOL_HDA
(
snd_hda_input_jack_free
);
#endif
/* CONFIG_SND_HDA_INPUT_JACK */
MODULE_DESCRIPTION
(
"HDA codec core"
);
MODULE_LICENSE
(
"GPL"
);
sound/pci/hda/hda_codec.h
View file @
433e8327
...
...
@@ -866,6 +866,11 @@ struct hda_codec {
/* codec-specific additional proc output */
void
(
*
proc_widget_hook
)(
struct
snd_info_buffer
*
buffer
,
struct
hda_codec
*
codec
,
hda_nid_t
nid
);
#ifdef CONFIG_SND_HDA_INPUT_JACK
/* jack detection */
struct
snd_array
jacks
;
#endif
};
/* direction */
...
...
sound/pci/hda/hda_intel.c
View file @
433e8327
...
...
@@ -1052,9 +1052,12 @@ static void azx_init_pci(struct azx *chip)
/* Clear bits 0-2 of PCI register TCSEL (at offset 0x44)
* TCSEL == Traffic Class Select Register, which sets PCI express QOS
* Ensuring these bits are 0 clears playback static on some HD Audio
* codecs
* codecs.
* The PCI register TCSEL is defined in the Intel manuals.
*/
update_pci_byte
(
chip
->
pci
,
ICH6_PCIREG_TCSEL
,
0x07
,
0
);
if
(
chip
->
driver_type
!=
AZX_DRIVER_ATI
&&
chip
->
driver_type
!=
AZX_DRIVER_ATIHDMI
)
update_pci_byte
(
chip
->
pci
,
ICH6_PCIREG_TCSEL
,
0x07
,
0
);
switch
(
chip
->
driver_type
)
{
case
AZX_DRIVER_ATI
:
...
...
sound/pci/hda/hda_local.h
View file @
433e8327
...
...
@@ -656,4 +656,28 @@ static inline void snd_hda_eld_proc_free(struct hda_codec *codec,
#define SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE 80
void
snd_print_channel_allocation
(
int
spk_alloc
,
char
*
buf
,
int
buflen
);
/*
* Input-jack notification support
*/
#ifdef CONFIG_SND_HDA_INPUT_JACK
int
snd_hda_input_jack_add
(
struct
hda_codec
*
codec
,
hda_nid_t
nid
,
int
type
,
const
char
*
name
);
void
snd_hda_input_jack_report
(
struct
hda_codec
*
codec
,
hda_nid_t
nid
);
void
snd_hda_input_jack_free
(
struct
hda_codec
*
codec
);
#else
/* CONFIG_SND_HDA_INPUT_JACK */
static
inline
int
snd_hda_input_jack_add
(
struct
hda_codec
*
codec
,
hda_nid_t
nid
,
int
type
,
const
char
*
name
)
{
return
0
;
}
static
inline
void
snd_hda_input_jack_report
(
struct
hda_codec
*
codec
,
hda_nid_t
nid
)
{
}
static
inline
void
snd_hda_input_jack_free
(
struct
hda_codec
*
codec
)
{
}
#endif
/* CONFIG_SND_HDA_INPUT_JACK */
#endif
/* __SOUND_HDA_LOCAL_H */
sound/pci/hda/patch_analog.c
View file @
433e8327
...
...
@@ -30,10 +30,10 @@
#include "hda_beep.h"
struct
ad198x_spec
{
struct
snd_kcontrol_new
*
mixers
[
5
];
struct
snd_kcontrol_new
*
mixers
[
6
];
int
num_mixers
;
unsigned
int
beep_amp
;
/* beep amp value, set via set_beep_amp() */
const
struct
hda_verb
*
init_verbs
[
5
];
/* initialization verbs
const
struct
hda_verb
*
init_verbs
[
6
];
/* initialization verbs
* don't forget NULL termination!
*/
unsigned
int
num_init_verbs
;
...
...
@@ -331,36 +331,11 @@ static int ad198x_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
return
snd_hda_multi_out_analog_cleanup
(
codec
,
&
spec
->
multiout
);
}
static
int
ad198x_alt_playback_pcm_prepare
(
struct
hda_pcm_stream
*
hinfo
,
struct
hda_codec
*
codec
,
unsigned
int
stream_tag
,
unsigned
int
format
,
struct
snd_pcm_substream
*
substream
)
{
struct
ad198x_spec
*
spec
=
codec
->
spec
;
snd_hda_codec_setup_stream
(
codec
,
spec
->
alt_dac_nid
[
0
],
stream_tag
,
0
,
format
);
return
0
;
}
static
int
ad198x_alt_playback_pcm_cleanup
(
struct
hda_pcm_stream
*
hinfo
,
struct
hda_codec
*
codec
,
struct
snd_pcm_substream
*
substream
)
{
struct
ad198x_spec
*
spec
=
codec
->
spec
;
snd_hda_codec_cleanup_stream
(
codec
,
spec
->
alt_dac_nid
[
0
]);
return
0
;
}
static
struct
hda_pcm_stream
ad198x_pcm_analog_alt_playback
=
{
.
substreams
=
1
,
.
channels_min
=
2
,
.
channels_max
=
2
,
/* NID is set in ad198x_build_pcms */
.
ops
=
{
.
prepare
=
ad198x_alt_playback_pcm_prepare
,
.
cleanup
=
ad198x_alt_playback_pcm_cleanup
},
};
/*
...
...
@@ -2239,29 +2214,6 @@ static struct snd_kcontrol_new ad1988_6stack_mixers2[] = {
static
struct
snd_kcontrol_new
ad1988_6stack_fp_mixers
[]
=
{
HDA_CODEC_VOLUME
(
"Headphone Playback Volume"
,
0x03
,
0x0
,
HDA_OUTPUT
),
HDA_BIND_MUTE
(
"Front Playback Switch"
,
0x29
,
2
,
HDA_INPUT
),
HDA_BIND_MUTE
(
"Surround Playback Switch"
,
0x2a
,
2
,
HDA_INPUT
),
HDA_BIND_MUTE_MONO
(
"Center Playback Switch"
,
0x27
,
1
,
2
,
HDA_INPUT
),
HDA_BIND_MUTE_MONO
(
"LFE Playback Switch"
,
0x27
,
2
,
2
,
HDA_INPUT
),
HDA_BIND_MUTE
(
"Side Playback Switch"
,
0x28
,
2
,
HDA_INPUT
),
HDA_BIND_MUTE
(
"Headphone Playback Switch"
,
0x22
,
2
,
HDA_INPUT
),
HDA_BIND_MUTE
(
"Mono Playback Switch"
,
0x1e
,
2
,
HDA_INPUT
),
HDA_CODEC_VOLUME
(
"CD Playback Volume"
,
0x20
,
0x6
,
HDA_INPUT
),
HDA_CODEC_MUTE
(
"CD Playback Switch"
,
0x20
,
0x6
,
HDA_INPUT
),
HDA_CODEC_VOLUME
(
"Front Mic Playback Volume"
,
0x20
,
0x0
,
HDA_INPUT
),
HDA_CODEC_MUTE
(
"Front Mic Playback Switch"
,
0x20
,
0x0
,
HDA_INPUT
),
HDA_CODEC_VOLUME
(
"Line Playback Volume"
,
0x20
,
0x1
,
HDA_INPUT
),
HDA_CODEC_MUTE
(
"Line Playback Switch"
,
0x20
,
0x1
,
HDA_INPUT
),
HDA_CODEC_VOLUME
(
"Mic Playback Volume"
,
0x20
,
0x4
,
HDA_INPUT
),
HDA_CODEC_MUTE
(
"Mic Playback Switch"
,
0x20
,
0x4
,
HDA_INPUT
),
HDA_CODEC_VOLUME
(
"Analog Mix Playback Volume"
,
0x21
,
0x0
,
HDA_OUTPUT
),
HDA_CODEC_MUTE
(
"Analog Mix Playback Switch"
,
0x21
,
0x0
,
HDA_OUTPUT
),
HDA_CODEC_VOLUME
(
"Front Mic Boost Volume"
,
0x39
,
0x0
,
HDA_OUTPUT
),
HDA_CODEC_VOLUME
(
"Mic Boost Volume"
,
0x3c
,
0x0
,
HDA_OUTPUT
),
{
}
/* end */
};
...
...
@@ -2545,11 +2497,6 @@ static struct hda_verb ad1988_6stack_init_verbs[] = {
};
static
struct
hda_verb
ad1988_6stack_fp_init_verbs
[]
=
{
/* Front, Surround, CLFE, side DAC; unmute as default */
{
0x04
,
AC_VERB_SET_AMP_GAIN_MUTE
,
AMP_OUT_UNMUTE
},
{
0x06
,
AC_VERB_SET_AMP_GAIN_MUTE
,
AMP_OUT_UNMUTE
},
{
0x05
,
AC_VERB_SET_AMP_GAIN_MUTE
,
AMP_OUT_UNMUTE
},
{
0x0a
,
AC_VERB_SET_AMP_GAIN_MUTE
,
AMP_OUT_UNMUTE
},
/* Headphone; unmute as default */
{
0x03
,
AC_VERB_SET_AMP_GAIN_MUTE
,
AMP_OUT_UNMUTE
},
/* Port-A front headphon path */
...
...
@@ -2558,50 +2505,6 @@ static struct hda_verb ad1988_6stack_fp_init_verbs[] = {
{
0x22
,
AC_VERB_SET_AMP_GAIN_MUTE
,
AMP_IN_MUTE
(
1
)},
{
0x11
,
AC_VERB_SET_AMP_GAIN_MUTE
,
AMP_OUT_UNMUTE
},
{
0x11
,
AC_VERB_SET_PIN_WIDGET_CONTROL
,
PIN_HP
},
/* Port-D line-out path */
{
0x29
,
AC_VERB_SET_AMP_GAIN_MUTE
,
AMP_IN_MUTE
(
0
)},
{
0x29
,
AC_VERB_SET_AMP_GAIN_MUTE
,
AMP_IN_MUTE
(
1
)},
{
0x12
,
AC_VERB_SET_AMP_GAIN_MUTE
,
AMP_OUT_UNMUTE
},
{
0x12
,
AC_VERB_SET_PIN_WIDGET_CONTROL
,
PIN_OUT
},
/* Port-F surround path */
{
0x2a
,
AC_VERB_SET_AMP_GAIN_MUTE
,
AMP_IN_MUTE
(
0
)},
{
0x2a
,
AC_VERB_SET_AMP_GAIN_MUTE
,
AMP_IN_MUTE
(
1
)},
{
0x16
,
AC_VERB_SET_AMP_GAIN_MUTE
,
AMP_OUT_UNMUTE
},
{
0x16
,
AC_VERB_SET_PIN_WIDGET_CONTROL
,
PIN_OUT
},
/* Port-G CLFE path */
{
0x27
,
AC_VERB_SET_AMP_GAIN_MUTE
,
AMP_IN_MUTE
(
0
)},
{
0x27
,
AC_VERB_SET_AMP_GAIN_MUTE
,
AMP_IN_MUTE
(
1
)},
{
0x24
,
AC_VERB_SET_AMP_GAIN_MUTE
,
AMP_OUT_UNMUTE
},
{
0x24
,
AC_VERB_SET_PIN_WIDGET_CONTROL
,
PIN_OUT
},
/* Port-H side path */
{
0x28
,
AC_VERB_SET_AMP_GAIN_MUTE
,
AMP_IN_MUTE
(
0
)},
{
0x28
,
AC_VERB_SET_AMP_GAIN_MUTE
,
AMP_IN_MUTE
(
1
)},
{
0x25
,
AC_VERB_SET_AMP_GAIN_MUTE
,
AMP_OUT_UNMUTE
},
{
0x25
,
AC_VERB_SET_PIN_WIDGET_CONTROL
,
PIN_OUT
},
/* Mono out path */
{
0x36
,
AC_VERB_SET_CONNECT_SEL
,
0x1
},
/* DAC1:04h */
{
0x1e
,
AC_VERB_SET_AMP_GAIN_MUTE
,
AMP_IN_MUTE
(
0
)},
{
0x1e
,
AC_VERB_SET_AMP_GAIN_MUTE
,
AMP_IN_MUTE
(
1
)},
{
0x13
,
AC_VERB_SET_PIN_WIDGET_CONTROL
,
PIN_OUT
},
{
0x13
,
AC_VERB_SET_AMP_GAIN_MUTE
,
0xb01f
},
/* unmute, 0dB */
/* Port-B front mic-in path */
{
0x14
,
AC_VERB_SET_AMP_GAIN_MUTE
,
AMP_OUT_MUTE
},
{
0x14
,
AC_VERB_SET_PIN_WIDGET_CONTROL
,
PIN_VREF80
},
{
0x39
,
AC_VERB_SET_AMP_GAIN_MUTE
,
AMP_OUT_ZERO
},
/* Port-C line-in path */
{
0x15
,
AC_VERB_SET_AMP_GAIN_MUTE
,
AMP_OUT_MUTE
},
{
0x15
,
AC_VERB_SET_PIN_WIDGET_CONTROL
,
PIN_IN
},
{
0x3a
,
AC_VERB_SET_AMP_GAIN_MUTE
,
AMP_OUT_ZERO
},
{
0x33
,
AC_VERB_SET_CONNECT_SEL
,
0x0
},
/* Port-E mic-in path */
{
0x17
,
AC_VERB_SET_AMP_GAIN_MUTE
,
AMP_OUT_MUTE
},
{
0x17
,
AC_VERB_SET_PIN_WIDGET_CONTROL
,
PIN_VREF80
},
{
0x3c
,
AC_VERB_SET_AMP_GAIN_MUTE
,
AMP_OUT_ZERO
},
{
0x34
,
AC_VERB_SET_CONNECT_SEL
,
0x0
},
/* Analog CD Input */
{
0x18
,
AC_VERB_SET_PIN_WIDGET_CONTROL
,
PIN_IN
},
/* Analog Mix output amp */
{
0x21
,
AC_VERB_SET_AMP_GAIN_MUTE
,
AMP_OUT_UNMUTE
|
0x1f
},
/* 0dB */
{
}
};
...
...
@@ -3316,20 +3219,20 @@ static int patch_ad1988(struct hda_codec *codec)
spec
->
mixers
[
0
]
=
ad1988_6stack_mixers1_rev2
;
else
spec
->
mixers
[
0
]
=
ad1988_6stack_mixers1
;
spec
->
mixers
[
1
]
=
ad1988_6stack_mixers2
;
spec
->
num_init_verbs
=
1
;
spec
->
init_verbs
[
0
]
=
ad1988_6stack_init_verbs
;
if
(
board_config
==
AD1988_6STACK_DIG_FP
)
{
spec
->
mixers
[
1
]
=
ad1988_6stack_fp_mixers
;
spec
->
num_mixers
++
;
spec
->
mixers
[
2
]
=
ad1988_6stack_fp_mixers
;
spec
->
num_init_verbs
++
;
spec
->
init_verbs
[
1
]
=
ad1988_6stack_fp_init_verbs
;
spec
->
slave_vols
=
ad1988_6stack_fp_slave_vols
;
spec
->
slave_sws
=
ad1988_6stack_fp_slave_sws
;
spec
->
alt_dac_nid
=
ad1988_alt_dac_nid
;
spec
->
stream_analog_alt_playback
=
&
ad198x_pcm_analog_alt_playback
;
}
else
spec
->
mixers
[
1
]
=
ad1988_6stack_mixers2
;
spec
->
num_init_verbs
=
1
;
if
(
board_config
==
AD1988_6STACK_DIG_FP
)
spec
->
init_verbs
[
0
]
=
ad1988_6stack_fp_init_verbs
;
else
spec
->
init_verbs
[
0
]
=
ad1988_6stack_init_verbs
;
}
if
((
board_config
==
AD1988_6STACK_DIG
)
||
(
board_config
==
AD1988_6STACK_DIG_FP
))
{
spec
->
multiout
.
dig_out_nid
=
AD1988_SPDIF_OUT
;
...
...
sound/pci/hda/patch_conexant.c
View file @
433e8327
...
...
@@ -49,14 +49,6 @@
#define AUTO_MIC_PORTB (1 << 1)
#define AUTO_MIC_PORTC (1 << 2)
struct
conexant_jack
{
hda_nid_t
nid
;
int
type
;
struct
snd_jack
*
jack
;
};
struct
pin_dac_pair
{
hda_nid_t
pin
;
hda_nid_t
dac
;
...
...
@@ -111,9 +103,6 @@ struct conexant_spec {
unsigned
int
spdif_route
;
/* jack detection */
struct
snd_array
jacks
;
/* dynamic controls, init_verbs and input_mux */
struct
auto_pin_cfg
autocfg
;
struct
hda_input_mux
private_imux
;
...
...
@@ -393,71 +382,9 @@ static int conexant_mux_enum_put(struct snd_kcontrol *kcontrol,
&
spec
->
cur_mux
[
adc_idx
]);
}
#ifdef CONFIG_SND_HDA_INPUT_JACK
static
void
conexant_free_jack_priv
(
struct
snd_jack
*
jack
)
{
struct
conexant_jack
*
jacks
=
jack
->
private_data
;
jacks
->
nid
=
0
;
jacks
->
jack
=
NULL
;
}
static
int
conexant_add_jack
(
struct
hda_codec
*
codec
,
hda_nid_t
nid
,
int
type
)
{
struct
conexant_spec
*
spec
;
struct
conexant_jack
*
jack
;
const
char
*
name
;
int
i
,
err
;
spec
=
codec
->
spec
;
snd_array_init
(
&
spec
->
jacks
,
sizeof
(
*
jack
),
32
);
jack
=
spec
->
jacks
.
list
;
for
(
i
=
0
;
i
<
spec
->
jacks
.
used
;
i
++
,
jack
++
)
if
(
jack
->
nid
==
nid
)
return
0
;
/* already present */
jack
=
snd_array_new
(
&
spec
->
jacks
);
name
=
(
type
==
SND_JACK_HEADPHONE
)
?
"Headphone"
:
"Mic"
;
if
(
!
jack
)
return
-
ENOMEM
;
jack
->
nid
=
nid
;
jack
->
type
=
type
;
err
=
snd_jack_new
(
codec
->
bus
->
card
,
name
,
type
,
&
jack
->
jack
);
if
(
err
<
0
)
return
err
;
jack
->
jack
->
private_data
=
jack
;
jack
->
jack
->
private_free
=
conexant_free_jack_priv
;
return
0
;
}
static
void
conexant_report_jack
(
struct
hda_codec
*
codec
,
hda_nid_t
nid
)
{
struct
conexant_spec
*
spec
=
codec
->
spec
;
struct
conexant_jack
*
jacks
=
spec
->
jacks
.
list
;
if
(
jacks
)
{
int
i
;
for
(
i
=
0
;
i
<
spec
->
jacks
.
used
;
i
++
)
{
if
(
jacks
->
nid
==
nid
)
{
unsigned
int
present
;
present
=
snd_hda_jack_detect
(
codec
,
nid
);
present
=
(
present
)
?
jacks
->
type
:
0
;
snd_jack_report
(
jacks
->
jack
,
present
);
}
jacks
++
;
}
}
}
static
int
conexant_init_jacks
(
struct
hda_codec
*
codec
)
{
#ifdef CONFIG_SND_HDA_INPUT_JACK
struct
conexant_spec
*
spec
=
codec
->
spec
;
int
i
;
...
...
@@ -469,15 +396,15 @@ static int conexant_init_jacks(struct hda_codec *codec)
int
err
=
0
;
switch
(
hv
->
param
^
AC_USRSP_EN
)
{
case
CONEXANT_HP_EVENT
:
err
=
conexant_add_jack
(
codec
,
hv
->
nid
,
SND_JACK_HEADPHONE
);
conexant_report_jack
(
codec
,
hv
->
nid
);
err
=
snd_hda_input_jack_add
(
codec
,
hv
->
nid
,
SND_JACK_HEADPHONE
,
NULL
);
snd_hda_input_jack_report
(
codec
,
hv
->
nid
);
break
;
case
CXT5051_PORTC_EVENT
:
case
CONEXANT_MIC_EVENT
:
err
=
conexant_add_jack
(
codec
,
hv
->
nid
,
SND_JACK_MICROPHONE
);
conexant_report_jack
(
codec
,
hv
->
nid
);
err
=
snd_hda_input_jack_add
(
codec
,
hv
->
nid
,
SND_JACK_MICROPHONE
,
NULL
);
snd_hda_input_jack_report
(
codec
,
hv
->
nid
);
break
;
}
if
(
err
<
0
)
...
...
@@ -485,19 +412,9 @@ static int conexant_init_jacks(struct hda_codec *codec)
++
hv
;
}
}
return
0
;
}
#else
static
inline
void
conexant_report_jack
(
struct
hda_codec
*
codec
,
hda_nid_t
nid
)
{
}
static
inline
int
conexant_init_jacks
(
struct
hda_codec
*
codec
)
{
#endif
/* CONFIG_SND_HDA_INPUT_JACK */
return
0
;
}
#endif
static
int
conexant_init
(
struct
hda_codec
*
codec
)
{
...
...
@@ -511,18 +428,7 @@ static int conexant_init(struct hda_codec *codec)
static
void
conexant_free
(
struct
hda_codec
*
codec
)
{
#ifdef CONFIG_SND_HDA_INPUT_JACK
struct
conexant_spec
*
spec
=
codec
->
spec
;
if
(
spec
->
jacks
.
list
)
{
struct
conexant_jack
*
jacks
=
spec
->
jacks
.
list
;
int
i
;
for
(
i
=
0
;
i
<
spec
->
jacks
.
used
;
i
++
,
jacks
++
)
{
if
(
jacks
->
jack
)
snd_device_free
(
codec
->
bus
->
card
,
jacks
->
jack
);
}
snd_array_free
(
&
spec
->
jacks
);
}
#endif
snd_hda_input_jack_free
(
codec
);
snd_hda_detach_beep_device
(
codec
);
kfree
(
codec
->
spec
);
}
...
...
@@ -1787,7 +1693,7 @@ static void cxt5051_hp_unsol_event(struct hda_codec *codec,
cxt5051_portc_automic
(
codec
);
break
;
}
conexant_report_jack
(
codec
,
nid
);
snd_hda_input_jack_report
(
codec
,
nid
);
}
static
struct
snd_kcontrol_new
cxt5051_playback_mixers
[]
=
{
...
...
@@ -1959,10 +1865,8 @@ static void cxt5051_init_mic_port(struct hda_codec *codec, hda_nid_t nid,
snd_hda_codec_write
(
codec
,
nid
,
0
,
AC_VERB_SET_UNSOLICITED_ENABLE
,
AC_USRSP_EN
|
event
);
#ifdef CONFIG_SND_HDA_INPUT_JACK
conexant_add_jack
(
codec
,
nid
,
SND_JACK_MICROPHONE
);
conexant_report_jack
(
codec
,
nid
);
#endif
snd_hda_input_jack_add
(
codec
,
nid
,
SND_JACK_MICROPHONE
,
NULL
);
snd_hda_input_jack_report
(
codec
,
nid
);
}
static
struct
hda_verb
cxt5051_ideapad_init_verbs
[]
=
{
...
...
@@ -3477,11 +3381,11 @@ static void cx_auto_unsol_event(struct hda_codec *codec, unsigned int res)
switch
(
res
>>
26
)
{
case
CONEXANT_HP_EVENT
:
cx_auto_hp_automute
(
codec
);
conexant_report_jack
(
codec
,
nid
);
snd_hda_input_jack_report
(
codec
,
nid
);
break
;
case
CONEXANT_MIC_EVENT
:
cx_auto_automic
(
codec
);
conexant_report_jack
(
codec
,
nid
);
snd_hda_input_jack_report
(
codec
,
nid
);
break
;
}
}
...
...
sound/pci/hda/patch_hdmi.c
View file @
433e8327
...
...
@@ -110,6 +110,12 @@ struct dp_audio_infoframe {
u8
LFEPBL01_LSV36_DM_INH7
;
};
union
audio_infoframe
{
struct
hdmi_audio_infoframe
hdmi
;
struct
dp_audio_infoframe
dp
;
u8
bytes
[
0
];
};
/*
* CEA speaker placement:
*
...
...
@@ -620,8 +626,7 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, hda_nid_t nid,
int
channels
=
substream
->
runtime
->
channels
;
int
ca
;
int
i
;
u8
ai
[
max
(
sizeof
(
struct
hdmi_audio_infoframe
),
sizeof
(
struct
dp_audio_infoframe
))];
union
audio_infoframe
ai
;
ca
=
hdmi_channel_allocation
(
codec
,
nid
,
channels
);
...
...
@@ -633,11 +638,10 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, hda_nid_t nid,
pin_nid
=
spec
->
pin
[
i
];
memset
(
ai
,
0
,
sizeof
(
ai
));
memset
(
&
ai
,
0
,
sizeof
(
ai
));
if
(
spec
->
sink_eld
[
i
].
conn_type
==
0
)
{
/* HDMI */
struct
hdmi_audio_infoframe
*
hdmi_ai
;
struct
hdmi_audio_infoframe
*
hdmi_ai
=
&
ai
.
hdmi
;
hdmi_ai
=
(
struct
hdmi_audio_infoframe
*
)
ai
;
hdmi_ai
->
type
=
0x84
;
hdmi_ai
->
ver
=
0x01
;
hdmi_ai
->
len
=
0x0a
;
...
...
@@ -645,9 +649,8 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, hda_nid_t nid,
hdmi_ai
->
CA
=
ca
;
hdmi_checksum_audio_infoframe
(
hdmi_ai
);
}
else
if
(
spec
->
sink_eld
[
i
].
conn_type
==
1
)
{
/* DisplayPort */
struct
dp_audio_infoframe
*
dp_ai
;
struct
dp_audio_infoframe
*
dp_ai
=
&
ai
.
dp
;
dp_ai
=
(
struct
dp_audio_infoframe
*
)
ai
;
dp_ai
->
type
=
0x84
;
dp_ai
->
len
=
0x1b
;
dp_ai
->
ver
=
0x11
<<
2
;
...
...
@@ -664,7 +667,8 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, hda_nid_t nid,
* sizeof(*dp_ai) to avoid partial match/update problems when
* the user switches between HDMI/DP monitors.
*/
if
(
!
hdmi_infoframe_uptodate
(
codec
,
pin_nid
,
ai
,
sizeof
(
ai
)))
{
if
(
!
hdmi_infoframe_uptodate
(
codec
,
pin_nid
,
ai
.
bytes
,
sizeof
(
ai
)))
{
snd_printdd
(
"hdmi_setup_audio_infoframe: "
"cvt=%d pin=%d channels=%d
\n
"
,
nid
,
pin_nid
,
...
...
@@ -672,7 +676,7 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, hda_nid_t nid,
hdmi_setup_channel_mapping
(
codec
,
pin_nid
,
ca
);
hdmi_stop_infoframe_trans
(
codec
,
pin_nid
);
hdmi_fill_audio_infoframe
(
codec
,
pin_nid
,
ai
,
sizeof
(
ai
));
ai
.
bytes
,
sizeof
(
ai
));
hdmi_start_infoframe_trans
(
codec
,
pin_nid
);
}
}
...
...
sound/pci/hda/patch_realtek.c
View file @
433e8327
This diff is collapsed.
Click to expand it.
sound/pci/hda/patch_sigmatel.c
View file @
433e8327
This diff is collapsed.
Click to expand it.
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