Skip to content

Commit

Permalink
ALSA: hda - Fix ALC268/ALC269 headphone pin routing
Browse files Browse the repository at this point in the history
Fix the headphone pin routing of ALC268/ALC269 codecs.  Using alc882
routine doesn't work because alc268/alc269 parser assumes the
independent DACs for both HP and speaker outputs.  Need to assign the
DAC depending on the pin.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Takashi Iwai committed Aug 31, 2009
1 parent 96f845d commit e9af4f3
Showing 1 changed file with 41 additions and 5 deletions.
46 changes: 41 additions & 5 deletions sound/pci/hda/patch_realtek.c
Original file line number Diff line number Diff line change
Expand Up @@ -12303,6 +12303,42 @@ static int alc268_auto_create_input_ctls(struct hda_codec *codec,
return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
}

static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
hda_nid_t nid, int pin_type)
{
int idx;

alc_set_pin_output(codec, nid, pin_type);
if (nid == 0x14 || nid == 0x16)
idx = 0;
else
idx = 1;
snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
}

static void alc268_auto_init_multi_out(struct hda_codec *codec)
{
struct alc_spec *spec = codec->spec;
hda_nid_t nid = spec->autocfg.line_out_pins[0];
if (nid) {
int pin_type = get_pin_type(spec->autocfg.line_out_type);
alc268_auto_set_output_and_unmute(codec, nid, pin_type);
}
}

static void alc268_auto_init_hp_out(struct hda_codec *codec)
{
struct alc_spec *spec = codec->spec;
hda_nid_t pin;

pin = spec->autocfg.hp_pins[0];
if (pin)
alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
pin = spec->autocfg.speaker_pins[0];
if (pin)
alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
}

static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
{
struct alc_spec *spec = codec->spec;
Expand All @@ -12311,16 +12347,18 @@ static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
unsigned int dac_vol1, dac_vol2;

if (speaker_nid) {
if (line_nid == 0x1d || speaker_nid == 0x1d) {
snd_hda_codec_write(codec, speaker_nid, 0,
AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
/* mute mixer inputs from 0x1d */
snd_hda_codec_write(codec, 0x0f, 0,
AC_VERB_SET_AMP_GAIN_MUTE,
AMP_IN_UNMUTE(1));
snd_hda_codec_write(codec, 0x10, 0,
AC_VERB_SET_AMP_GAIN_MUTE,
AMP_IN_UNMUTE(1));
} else {
/* unmute mixer inputs from 0x1d */
snd_hda_codec_write(codec, 0x0f, 0,
AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
snd_hda_codec_write(codec, 0x10, 0,
Expand Down Expand Up @@ -12408,8 +12446,6 @@ static int alc268_parse_auto_config(struct hda_codec *codec)
return 1;
}

#define alc268_auto_init_multi_out alc882_auto_init_multi_out
#define alc268_auto_init_hp_out alc882_auto_init_hp_out
#define alc268_auto_init_analog_input alc882_auto_init_analog_input

/* init callback for auto-configuration model -- overriding the default init */
Expand Down Expand Up @@ -13220,8 +13256,8 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
return 1;
}

#define alc269_auto_init_multi_out alc882_auto_init_multi_out
#define alc269_auto_init_hp_out alc882_auto_init_hp_out
#define alc269_auto_init_multi_out alc268_auto_init_multi_out
#define alc269_auto_init_hp_out alc268_auto_init_hp_out
#define alc269_auto_init_analog_input alc882_auto_init_analog_input


Expand Down

0 comments on commit e9af4f3

Please sign in to comment.