diff options
author | Kailang Yang <kailang@realtek.com> | 2010-03-19 06:33:06 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2010-03-19 06:40:53 -0400 |
commit | c027ddcd01c852dfa5880862e47f022d7d9402f5 (patch) | |
tree | 1088a8ad23f5d1d975a632fef4783e5bb72211b6 /sound/pci/hda | |
parent | da00c24493bf6ae3772dfe7343dca033ebc75955 (diff) |
ALSA: hda - Add alc_codec_rename() helper
Added alc_codec_rename() helper for renaming codec->chip_name.
Added Acer-specific codec naming for ALC269/662.
[Clean-up and refactoring by tiwai]
Signed-off-by: Kailang Yang <kailang@realtek.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 245e1afa5896..3d37e2161a57 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -3848,6 +3848,18 @@ static struct hda_codec_ops alc_patch_ops = { | |||
3848 | .reboot_notify = alc_shutup, | 3848 | .reboot_notify = alc_shutup, |
3849 | }; | 3849 | }; |
3850 | 3850 | ||
3851 | /* replace the codec chip_name with the given string */ | ||
3852 | static int alc_codec_rename(struct hda_codec *codec, const char *name) | ||
3853 | { | ||
3854 | kfree(codec->chip_name); | ||
3855 | codec->chip_name = kstrdup(name, GFP_KERNEL); | ||
3856 | if (!codec->chip_name) { | ||
3857 | alc_free(codec); | ||
3858 | return -ENOMEM; | ||
3859 | } | ||
3860 | return 0; | ||
3861 | } | ||
3862 | |||
3851 | /* | 3863 | /* |
3852 | * Test configuration for debugging | 3864 | * Test configuration for debugging |
3853 | * | 3865 | * |
@@ -14169,17 +14181,15 @@ static int patch_alc269(struct hda_codec *codec) | |||
14169 | 14181 | ||
14170 | alc_auto_parse_customize_define(codec); | 14182 | alc_auto_parse_customize_define(codec); |
14171 | 14183 | ||
14172 | alc_fix_pll_init(codec, 0x20, 0x04, 15); | ||
14173 | |||
14174 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){ | 14184 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){ |
14175 | kfree(codec->chip_name); | 14185 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
14176 | codec->chip_name = kstrdup("ALC259", GFP_KERNEL); | 14186 | spec->cdefine.platform_type == 1) |
14177 | if (!codec->chip_name) { | 14187 | alc_codec_rename(codec, "ALC271X"); |
14178 | alc_free(codec); | 14188 | else |
14179 | return -ENOMEM; | 14189 | alc_codec_rename(codec, "ALC259"); |
14180 | } | ||
14181 | is_alc269vb = 1; | 14190 | is_alc269vb = 1; |
14182 | } | 14191 | } else |
14192 | alc_fix_pll_init(codec, 0x20, 0x04, 15); | ||
14183 | 14193 | ||
14184 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, | 14194 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
14185 | alc269_models, | 14195 | alc269_models, |
@@ -18394,14 +18404,12 @@ static int patch_alc662(struct hda_codec *codec) | |||
18394 | 18404 | ||
18395 | alc_fix_pll_init(codec, 0x20, 0x04, 15); | 18405 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
18396 | 18406 | ||
18397 | if (alc_read_coef_idx(codec, 0)==0x8020){ | 18407 | if (alc_read_coef_idx(codec, 0) == 0x8020) |
18398 | kfree(codec->chip_name); | 18408 | alc_codec_rename(codec, "ALC661"); |
18399 | codec->chip_name = kstrdup("ALC661", GFP_KERNEL); | 18409 | else if ((alc_read_coef_idx(codec, 0) & (1 << 14)) && |
18400 | if (!codec->chip_name) { | 18410 | codec->bus->pci->subsystem_vendor == 0x1025 && |
18401 | alc_free(codec); | 18411 | spec->cdefine.platform_type == 1) |
18402 | return -ENOMEM; | 18412 | alc_codec_rename(codec, "ALC272X"); |
18403 | } | ||
18404 | } | ||
18405 | 18413 | ||
18406 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, | 18414 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
18407 | alc662_models, | 18415 | alc662_models, |