Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 120419
b: refs/heads/master
c: 163d4c5
h: refs/heads/master
i:
  120417: a6498ce
  120415: 4b9e358
v: v3
  • Loading branch information
Takashi Iwai committed Oct 28, 2008
1 parent fd21d22 commit 539352b
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 34c25350acfc792747e861d1e36874abf7e73255
refs/heads/master: 163d4c53e3efb457eee96f7487ba3baef2be7796
77 changes: 77 additions & 0 deletions trunk/sound/pci/hda/patch_realtek.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,13 @@ struct alc_spec {
/* for PLL fix */
hda_nid_t pll_nid;
unsigned int pll_coef_idx, pll_coef_bit;

#ifdef SND_HDA_NEEDS_RESUME
#define ALC_MAX_PINS 16
unsigned int num_pins;
hda_nid_t pin_nids[ALC_MAX_PINS];
unsigned int pin_cfgs[ALC_MAX_PINS];
#endif
};

/*
Expand Down Expand Up @@ -2789,6 +2796,64 @@ static void alc_free(struct hda_codec *codec)
codec->spec = NULL; /* to be sure */
}

#ifdef SND_HDA_NEEDS_RESUME
static void store_pin_configs(struct hda_codec *codec)
{
struct alc_spec *spec = codec->spec;
hda_nid_t nid, end_nid;

end_nid = codec->start_nid + codec->num_nodes;
for (nid = codec->start_nid; nid < end_nid; nid++) {
unsigned int wid_caps = get_wcaps(codec, nid);
unsigned int wid_type =
(wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
if (wid_type != AC_WID_PIN)
continue;
if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids))
break;
spec->pin_nids[spec->num_pins] = nid;
spec->pin_cfgs[spec->num_pins] =
snd_hda_codec_read(codec, nid, 0,
AC_VERB_GET_CONFIG_DEFAULT, 0);
spec->num_pins++;
}
}

static void resume_pin_configs(struct hda_codec *codec)
{
struct alc_spec *spec = codec->spec;
int i;

for (i = 0; i < spec->num_pins; i++) {
hda_nid_t pin_nid = spec->pin_nids[i];
unsigned int pin_config = spec->pin_cfgs[i];
snd_hda_codec_write(codec, pin_nid, 0,
AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
pin_config & 0x000000ff);
snd_hda_codec_write(codec, pin_nid, 0,
AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
(pin_config & 0x0000ff00) >> 8);
snd_hda_codec_write(codec, pin_nid, 0,
AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
(pin_config & 0x00ff0000) >> 16);
snd_hda_codec_write(codec, pin_nid, 0,
AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
pin_config >> 24);
}
}

static int alc_resume(struct hda_codec *codec)
{
resume_pin_configs(codec);
codec->patch_ops.init(codec);
snd_hda_codec_resume_amp(codec);
snd_hda_codec_resume_cache(codec);
return 0;
}
#else
#define store_pin_configs(codec)
#endif

/*
*/
static struct hda_codec_ops alc_patch_ops = {
Expand All @@ -2797,6 +2862,9 @@ static struct hda_codec_ops alc_patch_ops = {
.init = alc_init,
.free = alc_free,
.unsol_event = alc_unsol_event,
#ifdef SND_HDA_NEEDS_RESUME
.resume = alc_resume,
#endif
#ifdef CONFIG_SND_HDA_POWER_SAVE
.check_power_status = alc_check_power_status,
#endif
Expand Down Expand Up @@ -3826,6 +3894,7 @@ static int alc880_parse_auto_config(struct hda_codec *codec)
spec->num_mux_defs = 1;
spec->input_mux = &spec->private_imux;

store_pin_configs(codec);
return 1;
}

Expand Down Expand Up @@ -5244,6 +5313,7 @@ static int alc260_parse_auto_config(struct hda_codec *codec)
}
spec->num_mixers++;

store_pin_configs(codec);
return 1;
}

Expand Down Expand Up @@ -10307,6 +10377,7 @@ static int alc262_parse_auto_config(struct hda_codec *codec)
if (err < 0)
return err;

store_pin_configs(codec);
return 1;
}

Expand Down Expand Up @@ -11441,6 +11512,7 @@ static int alc268_parse_auto_config(struct hda_codec *codec)
if (err < 0)
return err;

store_pin_configs(codec);
return 1;
}

Expand Down Expand Up @@ -12224,6 +12296,7 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
spec->mixers[spec->num_mixers] = alc269_capture_mixer;
spec->num_mixers++;

store_pin_configs(codec);
return 1;
}

Expand Down Expand Up @@ -13310,6 +13383,7 @@ static int alc861_parse_auto_config(struct hda_codec *codec)
spec->mixers[spec->num_mixers] = alc861_capture_mixer;
spec->num_mixers++;

store_pin_configs(codec);
return 1;
}

Expand Down Expand Up @@ -14421,6 +14495,7 @@ static int alc861vd_parse_auto_config(struct hda_codec *codec)
if (err < 0)
return err;

store_pin_configs(codec);
return 1;
}

Expand Down Expand Up @@ -16252,6 +16327,8 @@ static int alc662_parse_auto_config(struct hda_codec *codec)

spec->mixers[spec->num_mixers] = alc662_capture_mixer;
spec->num_mixers++;

store_pin_configs(codec);
return 1;
}

Expand Down

0 comments on commit 539352b

Please sign in to comment.