aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2010-02-22 02:34:40 -0500
committerTakashi Iwai <tiwai@suse.de>2010-02-22 02:34:40 -0500
commit9d54f08bc77bf6dfe835b945d03b6e127c9fc5a3 (patch)
tree3c60ab8d720af86f2c18d214b73fb74eb4fd3b2c
parente458b1fadf9239d1fdb165ff4c4ea0d807041bec (diff)
ALSA: hda - Clean up Intel Mac unsol codes
Use the standard unsol_event callback with each setup callback for IntelMac models with Realtek ALC885 codecs. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/patch_realtek.c81
1 files changed, 17 insertions, 64 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index b5a6ba025930..f8fb260a2dd7 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -7879,6 +7879,9 @@ static void alc885_imac24_setup(struct hda_codec *codec)
7879 spec->autocfg.speaker_pins[1] = 0x1a; 7879 spec->autocfg.speaker_pins[1] = 0x1a;
7880} 7880}
7881 7881
7882#define alc885_mb5_setup alc885_imac24_setup
7883#define alc885_macmini3_setup alc885_imac24_setup
7884
7882static void alc885_mbp3_setup(struct hda_codec *codec) 7885static void alc885_mbp3_setup(struct hda_codec *codec)
7883{ 7886{
7884 struct alc_spec *spec = codec->spec; 7887 struct alc_spec *spec = codec->spec;
@@ -7887,66 +7890,13 @@ static void alc885_mbp3_setup(struct hda_codec *codec)
7887 spec->autocfg.speaker_pins[0] = 0x14; 7890 spec->autocfg.speaker_pins[0] = 0x14;
7888} 7891}
7889 7892
7890static void alc885_mb5_automute(struct hda_codec *codec) 7893static void alc885_imac91_setup(struct hda_codec *codec)
7891{
7892 unsigned int present;
7893
7894 present = snd_hda_codec_read(codec, 0x14, 0,
7895 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7896 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
7897 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7898 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7899 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7900
7901}
7902
7903static void alc885_macmini3_automute(struct hda_codec *codec)
7904{
7905 unsigned int present;
7906
7907 present = snd_hda_codec_read(codec, 0x14, 0,
7908 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7909 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
7910 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7911 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7912 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7913}
7914
7915static void alc885_mb5_unsol_event(struct hda_codec *codec,
7916 unsigned int res)
7917{
7918 /* Headphone insertion or removal. */
7919 if ((res >> 26) == ALC880_HP_EVENT)
7920 alc885_mb5_automute(codec);
7921}
7922
7923static void alc885_macmini3_unsol_event(struct hda_codec *codec,
7924 unsigned int res)
7925{
7926 /* Headphone insertion or removal. */
7927 if ((res >> 26) == ALC880_HP_EVENT)
7928 alc885_mb5_automute(codec);
7929}
7930
7931static void alc885_imac91_automute(struct hda_codec *codec)
7932{ 7894{
7933 unsigned int present; 7895 struct alc_spec *spec = codec->spec;
7934
7935 present = snd_hda_codec_read(codec, 0x14, 0,
7936 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7937 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7938 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7939 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7940 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7941
7942}
7943 7896
7944static void alc885_imac91_unsol_event(struct hda_codec *codec, 7897 spec->autocfg.hp_pins[0] = 0x14;
7945 unsigned int res) 7898 spec->autocfg.speaker_pins[0] = 0x15;
7946{ 7899 spec->autocfg.speaker_pins[1] = 0x1a;
7947 /* Headphone insertion or removal. */
7948 if ((res >> 26) == ALC880_HP_EVENT)
7949 alc885_imac91_automute(codec);
7950} 7900}
7951 7901
7952static struct hda_verb alc882_targa_verbs[] = { 7902static struct hda_verb alc882_targa_verbs[] = {
@@ -9357,8 +9307,9 @@ static struct alc_config_preset alc882_presets[] = {
9357 .input_mux = &mb5_capture_source, 9307 .input_mux = &mb5_capture_source,
9358 .dig_out_nid = ALC882_DIGOUT_NID, 9308 .dig_out_nid = ALC882_DIGOUT_NID,
9359 .dig_in_nid = ALC882_DIGIN_NID, 9309 .dig_in_nid = ALC882_DIGIN_NID,
9360 .unsol_event = alc885_mb5_unsol_event, 9310 .unsol_event = alc_automute_amp_unsol_event,
9361 .init_hook = alc885_mb5_automute, 9311 .setup = alc885_mb5_setup,
9312 .init_hook = alc_automute_amp,
9362 }, 9313 },
9363 [ALC885_MACMINI3] = { 9314 [ALC885_MACMINI3] = {
9364 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, 9315 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
@@ -9371,8 +9322,9 @@ static struct alc_config_preset alc882_presets[] = {
9371 .input_mux = &macmini3_capture_source, 9322 .input_mux = &macmini3_capture_source,
9372 .dig_out_nid = ALC882_DIGOUT_NID, 9323 .dig_out_nid = ALC882_DIGOUT_NID,
9373 .dig_in_nid = ALC882_DIGIN_NID, 9324 .dig_in_nid = ALC882_DIGIN_NID,
9374 .unsol_event = alc885_macmini3_unsol_event, 9325 .unsol_event = alc_automute_amp_unsol_event,
9375 .init_hook = alc885_macmini3_automute, 9326 .setup = alc885_macmini3_setup,
9327 .init_hook = alc_automute_amp,
9376 }, 9328 },
9377 [ALC885_MACPRO] = { 9329 [ALC885_MACPRO] = {
9378 .mixers = { alc882_macpro_mixer }, 9330 .mixers = { alc882_macpro_mixer },
@@ -9411,8 +9363,9 @@ static struct alc_config_preset alc882_presets[] = {
9411 .input_mux = &alc882_capture_source, 9363 .input_mux = &alc882_capture_source,
9412 .dig_out_nid = ALC882_DIGOUT_NID, 9364 .dig_out_nid = ALC882_DIGOUT_NID,
9413 .dig_in_nid = ALC882_DIGIN_NID, 9365 .dig_in_nid = ALC882_DIGIN_NID,
9414 .unsol_event = alc885_imac91_unsol_event, 9366 .unsol_event = alc_automute_amp_unsol_event,
9415 .init_hook = alc885_imac91_automute, 9367 .setup = alc885_imac91_setup,
9368 .init_hook = alc_automute_amp,
9416 }, 9369 },
9417 [ALC882_TARGA] = { 9370 [ALC882_TARGA] = {
9418 .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, 9371 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },