aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2011-11-15 08:26:54 -0500
committerTakashi Iwai <tiwai@suse.de>2011-11-15 08:26:54 -0500
commitee3b29693cb56b36fa4913b9a573d6c233bb8f03 (patch)
tree6a790d72e039081358d846a90787c41dec8346d8 /sound
parent5671087ffa80ea7fcc254c08de9697551fecedcf (diff)
ALSA: hda/realtek - Move ALC880 model=medion-rim to auto-parser
Translate ALC880 medion-rim static configs to the auto-parser with the additional GPIO2 verb and COEF setup. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/alc880_quirks.c90
-rw-r--r--sound/pci/hda/patch_realtek.c38
2 files changed, 38 insertions, 90 deletions
diff --git a/sound/pci/hda/alc880_quirks.c b/sound/pci/hda/alc880_quirks.c
index bea22edcfd8c..dffa7a91ba6d 100644
--- a/sound/pci/hda/alc880_quirks.c
+++ b/sound/pci/hda/alc880_quirks.c
@@ -27,7 +27,6 @@ enum {
27 ALC880_TCL_S700, 27 ALC880_TCL_S700,
28 ALC880_LG, 28 ALC880_LG,
29 ALC880_LG_LW, 29 ALC880_LG_LW,
30 ALC880_MEDION_RIM,
31#ifdef CONFIG_SND_DEBUG 30#ifdef CONFIG_SND_DEBUG
32 ALC880_TEST, 31 ALC880_TEST,
33#endif 32#endif
@@ -1137,78 +1136,6 @@ static void alc880_lg_lw_setup(struct hda_codec *codec)
1137 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); 1136 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
1138} 1137}
1139 1138
1140static const struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
1141 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1142 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
1143 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1144 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1145 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1146 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
1147 { } /* end */
1148};
1149
1150static const struct hda_input_mux alc880_medion_rim_capture_source = {
1151 .num_items = 2,
1152 .items = {
1153 { "Mic", 0x0 },
1154 { "Internal Mic", 0x1 },
1155 },
1156};
1157
1158static const struct hda_verb alc880_medion_rim_init_verbs[] = {
1159 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1160
1161 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1162 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1163
1164 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1165 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1166 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1167 /* Mic2 (as headphone out) for HP output */
1168 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1169 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1170 /* Internal Speaker */
1171 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1172 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1173
1174 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
1175 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
1176
1177 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
1178 { }
1179};
1180
1181/* toggle speaker-output according to the hp-jack state */
1182static void alc880_medion_rim_automute(struct hda_codec *codec)
1183{
1184 struct alc_spec *spec = codec->spec;
1185 alc_hp_automute(codec);
1186 /* toggle EAPD */
1187 if (spec->hp_jack_present)
1188 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
1189 else
1190 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
1191}
1192
1193static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
1194 unsigned int res)
1195{
1196 /* Looks like the unsol event is incompatible with the standard
1197 * definition. 4bit tag is placed at 28 bit!
1198 */
1199 if ((res >> 28) == ALC_HP_EVENT)
1200 alc880_medion_rim_automute(codec);
1201}
1202
1203static void alc880_medion_rim_setup(struct hda_codec *codec)
1204{
1205 struct alc_spec *spec = codec->spec;
1206
1207 spec->autocfg.hp_pins[0] = 0x14;
1208 spec->autocfg.speaker_pins[0] = 0x1b;
1209 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
1210}
1211
1212#ifdef CONFIG_SND_HDA_POWER_SAVE 1139#ifdef CONFIG_SND_HDA_POWER_SAVE
1213static const struct hda_amp_list alc880_lg_loopbacks[] = { 1140static const struct hda_amp_list alc880_lg_loopbacks[] = {
1214 { 0x0b, HDA_INPUT, 1 }, 1141 { 0x0b, HDA_INPUT, 1 },
@@ -1506,7 +1433,6 @@ static const char * const alc880_models[ALC880_MODEL_LAST] = {
1506 [ALC880_F1734] = "F1734", 1433 [ALC880_F1734] = "F1734",
1507 [ALC880_LG] = "lg", 1434 [ALC880_LG] = "lg",
1508 [ALC880_LG_LW] = "lg-lw", 1435 [ALC880_LG_LW] = "lg-lw",
1509 [ALC880_MEDION_RIM] = "medion",
1510#ifdef CONFIG_SND_DEBUG 1436#ifdef CONFIG_SND_DEBUG
1511 [ALC880_TEST] = "test", 1437 [ALC880_TEST] = "test",
1512#endif 1438#endif
@@ -1557,7 +1483,6 @@ static const struct snd_pci_quirk alc880_cfg_tbl[] = {
1557 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), 1483 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
1558 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), 1484 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
1559 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), 1485 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
1560 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
1561 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), 1486 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
1562 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), 1487 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
1563 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), 1488 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
@@ -1862,21 +1787,6 @@ static const struct alc_config_preset alc880_presets[] = {
1862 .setup = alc880_lg_lw_setup, 1787 .setup = alc880_lg_lw_setup,
1863 .init_hook = alc_hp_automute, 1788 .init_hook = alc_hp_automute,
1864 }, 1789 },
1865 [ALC880_MEDION_RIM] = {
1866 .mixers = { alc880_medion_rim_mixer },
1867 .init_verbs = { alc880_volume_init_verbs,
1868 alc880_medion_rim_init_verbs,
1869 alc_gpio2_init_verbs },
1870 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
1871 .dac_nids = alc880_dac_nids,
1872 .dig_out_nid = ALC880_DIGOUT_NID,
1873 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
1874 .channel_mode = alc880_2_jack_modes,
1875 .input_mux = &alc880_medion_rim_capture_source,
1876 .unsol_event = alc880_medion_rim_unsol_event,
1877 .setup = alc880_medion_rim_setup,
1878 .init_hook = alc880_medion_rim_automute,
1879 },
1880#ifdef CONFIG_SND_DEBUG 1790#ifdef CONFIG_SND_DEBUG
1881 [ALC880_TEST] = { 1791 [ALC880_TEST] = {
1882 .mixers = { alc880_test_mixer }, 1792 .mixers = { alc880_test_mixer },
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index fb480858ec65..8d1b27b2f78c 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4035,6 +4035,37 @@ static const struct hda_amp_list alc880_loopbacks[] = {
4035#endif 4035#endif
4036 4036
4037/* 4037/*
4038 * ALC880 fix-ups
4039 */
4040enum {
4041 ALC880_FIXUP_GPIO2,
4042 ALC880_FIXUP_MEDION_RIM,
4043};
4044
4045static const struct alc_fixup alc880_fixups[] = {
4046 [ALC880_FIXUP_GPIO2] = {
4047 .type = ALC_FIXUP_VERBS,
4048 .v.verbs = alc_gpio2_init_verbs,
4049 },
4050 [ALC880_FIXUP_MEDION_RIM] = {
4051 .type = ALC_FIXUP_VERBS,
4052 .v.verbs = (const struct hda_verb[]) {
4053 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
4054 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
4055 { }
4056 },
4057 .chained = true,
4058 .chain_id = ALC880_FIXUP_GPIO2,
4059 },
4060};
4061
4062static const struct snd_pci_quirk alc880_fixup_tbl[] = {
4063 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
4064 {}
4065};
4066
4067
4068/*
4038 * board setups 4069 * board setups
4039 */ 4070 */
4040#ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS 4071#ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS
@@ -4080,6 +4111,11 @@ static int patch_alc880(struct hda_codec *codec)
4080 } 4111 }
4081 4112
4082 if (board_config == ALC_MODEL_AUTO) { 4113 if (board_config == ALC_MODEL_AUTO) {
4114 alc_pick_fixup(codec, NULL, alc880_fixup_tbl, alc880_fixups);
4115 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
4116 }
4117
4118 if (board_config == ALC_MODEL_AUTO) {
4083 /* automatic parse from the BIOS config */ 4119 /* automatic parse from the BIOS config */
4084 err = alc880_parse_auto_config(codec); 4120 err = alc880_parse_auto_config(codec);
4085 if (err < 0) 4121 if (err < 0)
@@ -4113,6 +4149,8 @@ static int patch_alc880(struct hda_codec *codec)
4113 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); 4149 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4114 } 4150 }
4115 4151
4152 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
4153
4116 spec->vmaster_nid = 0x0c; 4154 spec->vmaster_nid = 0x0c;
4117 4155
4118 codec->patch_ops = alc_patch_ops; 4156 codec->patch_ops = alc_patch_ops;