Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 99077
b: refs/heads/master
c: 2c3bf9a
h: refs/heads/master
i:
  99075: 054384c
v: v3
  • Loading branch information
Takashi Iwai committed Jun 6, 2008
1 parent dc9d523 commit 8bfd363
Show file tree
Hide file tree
Showing 2 changed files with 47 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: 17bba1b72d190742c99a140154f0abac9c1996c3
refs/heads/master: 2c3bf9abb11dd8050cd2d153917d1746c8d5af05
46 changes: 46 additions & 0 deletions trunk/sound/pci/hda/patch_realtek.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,10 @@ struct alc_spec {
#ifdef CONFIG_SND_HDA_POWER_SAVE
struct hda_loopback_check loopback;
#endif

/* for PLL fix */
hda_nid_t pll_nid;
unsigned int pll_coef_idx, pll_coef_bit;
};

/*
Expand Down Expand Up @@ -752,6 +756,38 @@ static struct hda_verb alc_gpio3_init_verbs[] = {
{ }
};

/*
* Fix hardware PLL issue
* On some codecs, the analog PLL gating control must be off while
* the default value is 1.
*/
static void alc_fix_pll(struct hda_codec *codec)
{
struct alc_spec *spec = codec->spec;
unsigned int val;

if (!spec->pll_nid)
return;
snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
spec->pll_coef_idx);
val = snd_hda_codec_read(codec, spec->pll_nid, 0,
AC_VERB_GET_PROC_COEF, 0);
snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
spec->pll_coef_idx);
snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
val & ~(1 << spec->pll_coef_bit));
}

static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
unsigned int coef_idx, unsigned int coef_bit)
{
struct alc_spec *spec = codec->spec;
spec->pll_nid = nid;
spec->pll_coef_idx = coef_idx;
spec->pll_coef_bit = coef_bit;
alc_fix_pll(codec);
}

static void alc_sku_automute(struct hda_codec *codec)
{
struct alc_spec *spec = codec->spec;
Expand Down Expand Up @@ -2400,6 +2436,8 @@ static int alc_init(struct hda_codec *codec)
struct alc_spec *spec = codec->spec;
unsigned int i;

alc_fix_pll(codec);

for (i = 0; i < spec->num_init_verbs; i++)
snd_hda_sequence_write(codec, spec->init_verbs[i]);

Expand Down Expand Up @@ -8286,6 +8324,8 @@ static int patch_alc883(struct hda_codec *codec)

codec->spec = spec;

alc_fix_pll_init(codec, 0x20, 0x0a, 10);

board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
alc883_models,
alc883_cfg_tbl);
Expand Down Expand Up @@ -9886,6 +9926,8 @@ static int patch_alc262(struct hda_codec *codec)
}
#endif

alc_fix_pll_init(codec, 0x20, 0x0a, 10);

board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
alc262_models,
alc262_cfg_tbl);
Expand Down Expand Up @@ -11196,6 +11238,8 @@ static int patch_alc269(struct hda_codec *codec)

codec->spec = spec;

alc_fix_pll_init(codec, 0x20, 0x04, 15);

board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
alc269_models,
alc269_cfg_tbl);
Expand Down Expand Up @@ -14531,6 +14575,8 @@ static int patch_alc662(struct hda_codec *codec)

codec->spec = spec;

alc_fix_pll_init(codec, 0x20, 0x04, 15);

board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
alc662_models,
alc662_cfg_tbl);
Expand Down

0 comments on commit 8bfd363

Please sign in to comment.